diff --git a/users/profiles/nvim/default.nix b/users/profiles/nvim/default.nix index ac39a11a..389d1344 100644 --- a/users/profiles/nvim/default.nix +++ b/users/profiles/nvim/default.nix @@ -337,6 +337,9 @@ in -- autopairs require('nvim-autopairs').setup{} + -- marks + require('marks').setup{} + -- Setup nvim-cmp. local has_words_before = function() local line, col = unpack(vim.api.nvim_win_get_cursor(0)) @@ -355,21 +358,32 @@ in end cmp.setup { formatting = { - format = function(entry, vim_item) - -- fancy icons and a name of kind - vim_item.kind = require("lspkind").presets.default[vim_item.kind] .. - " " .. vim_item.kind - -- set a name for each source - vim_item.menu = ({ - buffer = "[Buffer]", - nvim_lsp = "[LSP]", - look = "[Look]", - path = "[Path]", - spell = "[Spell]", - calc = "[Calc]", - })[entry.source.name] - return vim_item + format = lspkind.cmp_format({ + mode = 'symbol_text', -- show only symbol annotations + maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) + + -- The function below will be called before any actual modifications from lspkind + -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) + before = function (entry, vim_item) + ... + return vim_item end + -- old format + -- format = function(entry, vim_item) + -- -- fancy icons and a name of kind + -- vim_item.kind = require("lspkind").presets.default[vim_item.kind] .. + -- " " .. vim_item.kind + -- -- set a name for each source + -- vim_item.menu = ({ + -- buffer = "[Buffer]", + -- nvim_lsp = "[LSP]", + -- look = "[Look]", + -- path = "[Path]", + -- spell = "[Spell]", + -- calc = "[Calc]", + -- })[entry.source.name] + -- return vim_item + -- end }, mapping = { [''] = cmp.mapping.select_prev_item(), @@ -403,15 +417,21 @@ in end end, { "i", "s" }), }, + snippet = { + expand = function(args) + require'luasnip'.lsp_expand(args.body) + end + }, sources = { {name = 'buffer'}, {name = 'nvim_lsp'}, {name = "look"}, {name = "path"}, {name = "calc"}, {name = "spell"}, - {name = 'cmp-conjure'} + {name = 'cmp-conjure'}, {name = "luasnip"} }, completion = {completeopt = 'menu,menuone,noinsert'} } cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = ' ' } })) + require("luasnip.loaders.from_vscode").lazy_load() -- null-ls local null_ls = require "null-ls" @@ -511,6 +531,13 @@ in -- if line.is_empty() -- line = os.time() -- return + + -- auto session + require('auto-session').setup { + log_level = 'info', + auto_session_suppress_dirs = {'~/', '~/kitaab/vimwiki'} + } + vim.o.sessionoptions="blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal" EOF ''; @@ -535,22 +562,16 @@ in nodePackages.typescript-language-server ]; plugins = with pkgs.vimPlugins // customPlugins; [ - # you can use plugins from the pkgs + # ui vim-which-key - # general - vim-nix fzf-vim - vim-elixir - emmet-vim nerdtree neovim-ayu goyo-vim - csv-vim rainbow_parentheses-vim vim-surround vim-devicons nvim-web-devicons - direnv-vim vim-peekaboo undotree telescope-nvim @@ -562,6 +583,17 @@ in dashboard-nvim FTerm-nvim barbar-nvim + auto-session + marks-nvim + lightspeed-nvim + + # language + vim-nix + vim-elixir + python-syntax + emmet-vim + csv-vim + direnv-vim # kitaab stuff vimwiki @@ -578,13 +610,14 @@ in nvim-lsp-ts-utils cmp-conjure cmp-buffer - lspkind-nvim cmp-path cmp-spell nvim-autopairs cmp_luasnip luasnip lsp-format + friendly-snippets + lspkind-nvim # git stuff vim-fugitive