diff --git a/dotfiles/neovim/lua/my/helpers.lua b/dotfiles/neovim/lua/my/helpers.lua new file mode 100644 index 0000000..e127a43 --- /dev/null +++ b/dotfiles/neovim/lua/my/helpers.lua @@ -0,0 +1,7 @@ +local M = {} + +function M.global(name, value) + vim.g[name] = value +end + +return M diff --git a/dotfiles/neovim/lua/my/plugins/cmp.lua b/dotfiles/neovim/lua/my/plugins/cmp.lua new file mode 100644 index 0000000..985d0dc --- /dev/null +++ b/dotfiles/neovim/lua/my/plugins/cmp.lua @@ -0,0 +1,25 @@ +local M = {} + +function M.setup() + local cmp = require("cmp") + + cmp.setup({ + mapping = { + [''] = cmp.mapping(cmp.mapping.scroll_docs(-4), {'i', 'c'}), + [''] = cmp.mapping(cmp.mapping.scroll_docs(4), {'i', 'c'}), + [''] = cmp.mapping(cmp.mapping.complete(), {'i', 'c'}), + [''] = cmp.config.disable, + [''] = cmp.mapping({i = cmp.mapping.abort(), c = cmp.mapping.close()}), + [''] = cmp.mapping.confirm({select = true}) + }, + sources = cmp.config.sources({}, {{name = 'buffer'}}) + }) + + -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline('/', {sources = {{name = 'buffer'}}}) + + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline(':', {sources = cmp.config.sources({{name = 'path'}}, {{name = 'cmdline'}})}) +end + +return M diff --git a/dotfiles/neovim/lua/my/plugins/init.lua b/dotfiles/neovim/lua/my/plugins/init.lua index f2db290..94f06b8 100644 --- a/dotfiles/neovim/lua/my/plugins/init.lua +++ b/dotfiles/neovim/lua/my/plugins/init.lua @@ -1,6 +1,7 @@ local M = {} function M.setup() + require("my.plugins.cmp").setup() require("my.plugins.lspconfig").setup() -- require("my.plugins.fzf-lua").setup() require("my.plugins.telescope").setup() @@ -8,6 +9,7 @@ function M.setup() require("my.plugins.comment").setup() -- require("my.plugins.nerdtree").setup() require("my.plugins.nvim-tree").setup() + require("my.plugins.vimtex").setup() -- Other unconfigured plugins require('nvim-autopairs').setup() diff --git a/dotfiles/neovim/lua/my/plugins/lspconfig.lua b/dotfiles/neovim/lua/my/plugins/lspconfig.lua index bf8e8c9..5b387e7 100644 --- a/dotfiles/neovim/lua/my/plugins/lspconfig.lua +++ b/dotfiles/neovim/lua/my/plugins/lspconfig.lua @@ -74,6 +74,8 @@ local servers = { } function M.setup() + local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) + -- Setup basic language servers for lsp, details in pairs(servers) do if details.on_attach == nil then @@ -87,13 +89,12 @@ function M.setup() flags = { debounce_text_changes = 150 -- This will be the default in neovim 0.7+ }, - cmd = details.cmd + cmd = details.cmd, + capabilities = capabilities } end - local efmLanguages = { - lua = {{formatCommand = formatLua, formatStdin = true}} - } + local efmLanguages = {lua = {{formatCommand = formatLua, formatStdin = true}}} -- Setup auto-formatting require"lspconfig".efm.setup { diff --git a/dotfiles/neovim/lua/my/plugins/telescope.lua b/dotfiles/neovim/lua/my/plugins/telescope.lua index 3c23125..f60377e 100644 --- a/dotfiles/neovim/lua/my/plugins/telescope.lua +++ b/dotfiles/neovim/lua/my/plugins/telescope.lua @@ -10,7 +10,7 @@ local bindings = { live_grep = "", -- See diagnostics with space + d - diagnotics = "d", + diagnostics = "d", -- Open a list with all the pickers builtin = "t", diff --git a/dotfiles/neovim/lua/my/plugins/vimtex.lua b/dotfiles/neovim/lua/my/plugins/vimtex.lua new file mode 100644 index 0000000..7dac9db --- /dev/null +++ b/dotfiles/neovim/lua/my/plugins/vimtex.lua @@ -0,0 +1,10 @@ +local global = require("my.helpers").global + +local M = {} + +function M.setup() + -- Viewer method + global("vimtex_view_method", "zathura") +end + +return M diff --git a/modules/applications/misc.nix b/modules/applications/misc.nix index 6be1a8e..46b3377 100644 --- a/modules/applications/misc.nix +++ b/modules/applications/misc.nix @@ -63,6 +63,7 @@ # blueman # bluetooth manager # freesweep # minesweeper I can play w the keyboard. # multimc + sloc # line of code counter # Nes emulators and stuff # zsnes diff --git a/modules/applications/neovim.nix b/modules/applications/neovim.nix index df18349..10bf7da 100644 --- a/modules/applications/neovim.nix +++ b/modules/applications/neovim.nix @@ -31,6 +31,7 @@ in fd # file finder ripgrep # grep rewrite (I think?) nodePackages.typescript # typescript language + texlive.combined.scheme-full # latex stuff ]; plugins = with pkgs.vimPlugins; @@ -49,6 +50,14 @@ in plenary-nvim # async utility lib it seems? lualine-nvim # customizable status line nvim-tree-lua # file tree + vimtex # latex plugin + + # Cmp related stuff. See https://github.com/hrsh7th/nvim-cmp + cmp-nvim-lsp + cmp-buffer + cmp-path + cmd-cmdline + nvim-cmp ]; }; }