1
Fork 0

feat: no more using nix to install nvim plugins

This commit is contained in:
Matei Adriel 2022-05-15 21:56:19 +03:00
parent 400794b28c
commit 92caa088aa
16 changed files with 182 additions and 135 deletions

View file

@ -0,0 +1,13 @@
local M = {}
function M.setup()
-- Import my other files
require("my.paq").setup()
require("my.theme").setup()
require("my.options").setup()
require('my.keymaps').setup()
require('my.plugins').setup()
require("telescope.extensions.unicode").setupAbbreviations()
end
return M

View file

@ -10,7 +10,6 @@ function M.setup()
"setf " .. syntax)
end
end)
end
return M

View file

@ -0,0 +1,49 @@
local M = {}
function M.setup()
local paq = require("paq")
local themePackages = require("my.theme").deps
local base = {
"neovim/nvim-lspconfig", -- configures lsps for me
"windwp/nvim-autopairs", -- closes pairs for me (should look for a better one)
"nvim-lua/plenary.nvim", -- async utility lib it seems?
"nvim-telescope/telescope.nvim", -- fuzzy search for say opening files
"purescript-contrib/purescript-vim", -- purescript support
"terrortylor/nvim-comment", -- allows toggling line comments
{"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"}, -- use treesitter for syntax highlighting
{"nvim-treesitter/nvim-treesitter-textobjects", run = ":TSUpdate"}, -- the lean plugin wants me to install this, lol
"startup-nvim/startup.nvim", -- splash screen
"kyazdani42/nvim-web-devicons", -- nice looking icons
"nvim-lualine/lualine.nvim", -- customizable status line
"kyazdani42/nvim-tree.lua", -- file tree
"lervag/vimtex", -- latex support
"jose-elias-alvarez/null-ls.nvim", -- generic language server
"nvim-telescope/telescope-file-browser.nvim", -- file creation/deletion menu
"onsails/lspkind.nvim", -- show icons in lsp completion menus
"preservim/vimux", -- interact with tmux from within vim
"christoomey/vim-tmux-navigator", -- easly switch between tmux and vim panes
"kana/vim-arpeggio", -- chord support, let"s fucking goooo
{"andweeb/presence.nvim", run = ":DownloadUnicode"}, -- discord rich presence
"Julian/lean.nvim", -- lean support
"kmonad/kmonad-vim", -- kmonad config support
"LucHermitte/lh-vim-lib", -- dependency for lh-brackets
"LucHermitte/lh-brackets", -- kinda useless bruh
-- Cmp related stuff
"hrsh7th/cmp-nvim-lsp", -- lsp completion
"hrsh7th/cmp-buffer", -- idr what this is
"hrsh7th/cmp-path", -- path completion ig?
"hrsh7th/cmp-cmdline", -- cmdline completion perhaps?
"hrsh7th/nvim-cmp", -- completion engine
"L3MON4D3/LuaSnip", -- snippeting engine
"saadparwaiz1/cmp_luasnip" -- snippet support for cmp
}
for _, v in ipairs(themePackages) do
-- append package in the base list
table.insert(base, v)
end
paq(base)
end
return M

View file

@ -3,6 +3,7 @@ local A = require("my.plugins.arpeggio")
local M = {}
local function map(buf, mode, lhs, rhs, opts)
local options = {noremap = true, silent = true}
if opts then options = vim.tbl_extend('force', options, opts) end
vim.api.nvim_buf_set_keymap(buf, mode, lhs, rhs, options)
@ -12,7 +13,8 @@ function M.on_attach(client, bufnr)
-- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
if client.resolved_capabilities.document_formatting then
if client.server_capabilities.documentFormattingProvider then
print("Initializing formatter...")
vim.cmd([[
augroup LspFormatting
autocmd! * <buffer>
@ -21,36 +23,39 @@ function M.on_attach(client, bufnr)
]])
end
print("Setting up keybinds...")
-- Go to declaration / definition / implementation
map(bufnr, "n", 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>')
map(bufnr, "n", 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>')
map(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>')
-- Hover
map(bufnr, 'n', 'J',
"<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>")
map(bufnr, 'n', 'J', "<cmd>lua vim.diagnostic.open_float()<CR>")
map(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>')
map(bufnr, 'n', 'L', '<cmd>lua vim.lsp.buf.signature_help()<CR>')
-- Workspace stuff
map(bufnr, 'n', '<leader>wa',
'<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>')
map(bufnr, 'n', '<leader>wr',
'<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>')
map(bufnr, 'n', '<leader>wl',
'<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>')
-- map(bufnr, 'n', '<leader>wa',
-- '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>')
-- map(bufnr, 'n', '<leader>wr',
-- '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>')
-- map(bufnr, 'n', '<leader>wl',
-- '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>')
-- Code actions
map(bufnr, 'n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>')
map(bufnr, 'n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>')
-- map(bufnr, 'n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>')
map(bufnr, 'n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>')
map(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>')
map(bufnr, 'n', '<leader>f', '<cmd>lua vim.lsp.buf.formatting()<CR>')
map(bufnr, 'n', '<leader>f',
'<cmd>lua vim.lsp.buf.format({async = true})<CR>')
print("Initialized language server!")
end
local function on_attach_typescript(client, bufnr)
client.resolved_capabilities.document_formatting = false
client.resolved_capabilities.document_range_formatting = false
-- We handle formatting using null-ls and prettierd
client.server_capabilities.documentFormattingProvider = false
M.on_attach(client, bufnr)
end

View file

@ -12,9 +12,7 @@ local bindings = {
live_grep = "<c-F>",
-- See diagnostics with space + d
lsp_document_diagnostics = "<Leader>d",
lsp_workspace_diagnostics = "<Leader>wd",
lsp_code_actions = "<Leader>ca",
diagnostics = "<Leader>d",
-- Open a list with all the pickers
builtin = "<Leader>t",

View file

@ -2,10 +2,16 @@ local M = {}
function M.setup()
require'nvim-treesitter.configs'.setup {
ensure_installed = "maintained",
ensure_installed = {
"bash", "javascript", "typescript", "c", "cpp", "css", "dockerfile",
"elixir", "fish", "html", "json", "latex", "python", "rust", "scss",
"toml", "tsx", "vim", "yaml", "nix"
},
sync_install = false,
indent = {enable = true},
highlight = {
enable = true,
disable = {"lua"}, -- WHY TF DOES THIS NOT WORK
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).