diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index 425d5be..d162e46 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -22,10 +22,17 @@ with final.pkgs.lib; let # ... # } all-plugins = with pkgs.vimPlugins; [ + nvim-dap # Debuggerhttps://github.com/mfussenegger/nvim-dap + nvim-dap-ui # Debugger UI https://github.com/rcarriga/nvim-dap-ui/ + + # Themes + tokyonight-nvim # https://github.com/folke/tokyonight.nvim + # plugins from nixpkgs go in here. # https://search.nixos.org/packages?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=vimPlugins nvim-treesitter.withAllGrammars luasnip # snippets | https://github.com/l3mon4d3/luasnip/ + # nvim-cmp (autocompletion) and extensions nvim-cmp # https://github.com/hrsh7th/nvim-cmp cmp_luasnip # snippets autocompletion extension for nvim-cmp | https://github.com/saadparwaiz1/cmp_luasnip/ @@ -37,26 +44,33 @@ with final.pkgs.lib; let cmp-nvim-lua # neovim lua API as completion source | https://github.com/hrsh7th/cmp-nvim-lua/ cmp-cmdline # cmp command line suggestions cmp-cmdline-history # cmp command line history suggestions + copilot-lua # Github Copilot https://github.com/zbirenbaum/copilot.lua/ + copilot-cmp # Add Copilot as a cmp source # https://github.com/zbirenbaum/copilot-cmp/ # ^ nvim-cmp extensions + # git integration plugins diffview-nvim # https://github.com/sindrets/diffview.nvim/ neogit # https://github.com/TimUntersberger/neogit/ gitsigns-nvim # https://github.com/lewis6991/gitsigns.nvim/ vim-fugitive # https://github.com/tpope/vim-fugitive/ # ^ git integration plugins + # telescope and extensions telescope-nvim # https://github.com/nvim-telescope/telescope.nvim/ telescope-fzy-native-nvim # https://github.com/nvim-telescope/telescope-fzy-native.nvim # telescope-smart-history-nvim # https://github.com/nvim-telescope/telescope-smart-history.nvim # ^ telescope and extensions + # UI lualine-nvim # Status line | https://github.com/nvim-lualine/lualine.nvim/ nvim-navic # Add LSP location to lualine | https://github.com/SmiteshP/nvim-navic statuscol-nvim # Status column | https://github.com/luukvbaal/statuscol.nvim/ nvim-treesitter-context # nvim-treesitter-context # ^ UI + # language support # ^ language support + # navigation/editing enhancement plugins vim-unimpaired # predefined ] and [ navigation keymaps | https://github.com/tpope/vim-unimpaired/ eyeliner-nvim # Highlights unique characters for f/F and t/T motions | https://github.com/jinh0/eyeliner.nvim @@ -64,15 +78,18 @@ with final.pkgs.lib; let nvim-treesitter-textobjects # https://github.com/nvim-treesitter/nvim-treesitter-textobjects/ nvim-ts-context-commentstring # https://github.com/joosepalviste/nvim-ts-context-commentstring/ # ^ navigation/editing enhancement plugins + # Useful utilities nvim-unception # Prevent nested neovim sessions | nvim-unception # ^ Useful utilities + # libraries that other plugins depend on sqlite-lua plenary-nvim nvim-web-devicons vim-repeat # ^ libraries that other plugins depend on + # bleeding-edge plugins from flake inputs # (mkNvimPlugin inputs.wf-nvim "wf.nvim") # (example) keymap hints | https://github.com/Cassin01/wf.nvim # ^ bleeding-edge plugins from flake inputs @@ -81,8 +98,10 @@ with final.pkgs.lib; let extraPackages = with pkgs; [ # language servers, etc. + clang-tools lua-language-server nil # nix LSP + nodejs_20 ]; in { # This is the neovim derivation diff --git a/nvim/ftplugin/c.lua b/nvim/ftplugin/c.lua new file mode 100644 index 0000000..bee7ef7 --- /dev/null +++ b/nvim/ftplugin/c.lua @@ -0,0 +1,18 @@ +-- Exit if the language server isn't available +if vim.fn.executable('clangd') ~= 1 then + return +end + +local root_files = { + 'compile_commands.json', + '.vscode', + '.git', +} + +vim.lsp.start { + name = 'clangd', + cmd = { 'clangd' }, + root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]), + capabilities = require('user.lsp').make_client_capabilities(), + -- capabilities = { offsetEncoding = "utf-8" }, +} diff --git a/nvim/init.lua b/nvim/init.lua index af08696..b2ebe26 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -99,6 +99,7 @@ vim.diagnostic.config { g.editorconfig = true +cmd[[colorscheme tokyonight]] vim.opt.colorcolumn = '100' -- Native plugins diff --git a/nvim/plugin/autocommands.lua b/nvim/plugin/autocommands.lua index 7308aeb..754cf9a 100644 --- a/nvim/plugin/autocommands.lua +++ b/nvim/plugin/autocommands.lua @@ -63,7 +63,7 @@ vim.api.nvim_create_autocmd('LspAttach', { local client = vim.lsp.get_client_by_id(ev.data.client_id) -- Attach plugins - require('nvim-navic').attach(client, bufnr) + -- require('nvim-navic').attach(client, bufnr) vim.cmd.setlocal('signcolumn=yes') vim.bo[bufnr].bufhidden = 'hide' diff --git a/nvim/plugin/completion.lua b/nvim/plugin/completion.lua index 086b589..35abc58 100644 --- a/nvim/plugin/completion.lua +++ b/nvim/plugin/completion.lua @@ -67,7 +67,7 @@ cmp.setup { complete_with_source('path') end end, { 'i', 'c', 's' }), - [''] = cmp.mapping(function(fallback) + [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() -- expand_or_jumpable(): Jump outside the snippet region @@ -80,7 +80,7 @@ cmp.setup { fallback() end end, { 'i', 'c', 's' }), - [''] = cmp.mapping(function(fallback) + [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() elseif luasnip.jumpable(-1) then @@ -103,6 +103,7 @@ cmp.setup { }, sources = cmp.config.sources { -- The insertion order influences the priority of the sources + { name = "copilot", group_index = 2 }, { name = 'nvim_lsp', keyword_length = 3 }, { name = 'nvim_lsp_signature_help', keyword_length = 3 }, { name = 'buffer' }, diff --git a/nvim/plugin/copilot.lua b/nvim/plugin/copilot.lua new file mode 100644 index 0000000..75c3627 --- /dev/null +++ b/nvim/plugin/copilot.lua @@ -0,0 +1,15 @@ +if vim.g.did_load_copilot_plugin then + return +end +vim.g.did_load_copilot_plugin = true + +-- local configs = require('copilot') +-- many plugins annoyingly require a call to a 'setup' function to be loaded, +-- even with default configs + +require("copilot").setup({ + suggestion = { enabled = false }, + panel = { enabled = false }, +}) + + diff --git a/nvim/plugin/lualine.lua b/nvim/plugin/lualine.lua index b5fbe02..88aec14 100644 --- a/nvim/plugin/lualine.lua +++ b/nvim/plugin/lualine.lua @@ -3,8 +3,8 @@ if vim.g.did_load_lualine_plugin then end vim.g.did_load_lualine_plugin = true -local navic = require('nvim-navic') -navic.setup {} +-- local navic = require('nvim-navic') +-- avic.setup {} ---Indicators for special modes, ---@return string status @@ -32,7 +32,7 @@ require('lualine').setup { sections = { lualine_c = { -- nvim-navic - { navic.get_location, cond = navic.is_available }, + -- { navic.get_location, cond = navic.is_available }, }, lualine_z = { -- (see above) diff --git a/nvim/plugin/plugins.lua b/nvim/plugin/plugins.lua index 69f39e3..3429409 100644 --- a/nvim/plugin/plugins.lua +++ b/nvim/plugin/plugins.lua @@ -6,5 +6,6 @@ vim.g.did_load_plugins_plugin = true -- many plugins annoyingly require a call to a 'setup' function to be loaded, -- even with default configs +require("copilot_cmp").setup() require('nvim-surround').setup() require('which-key').setup()