diff options
Diffstat (limited to 'files/nvim')
| -rw-r--r-- | files/nvim/init.vim | 35 | ||||
| -rw-r--r-- | files/nvim/mini_completion_no_title.diff | 0 | ||||
| -rw-r--r-- | files/nvim/mini_sessions_view.diff | 13 | ||||
| -rw-r--r-- | files/nvim/mini_starter_picture.diff | 41 |
4 files changed, 41 insertions, 48 deletions
diff --git a/files/nvim/init.vim b/files/nvim/init.vim index d52edcc..b05acbd 100644 --- a/files/nvim/init.vim +++ b/files/nvim/init.vim @@ -5,8 +5,6 @@ set signcolumn=yes set updatetime=250 set scrolloff=5 -" https://github.com/SmiteshP/nvim-navic - " Change directory based on current file. if !empty($NIX_SHELL) " Attempt to conflict less with plugins. @@ -205,6 +203,13 @@ function! SyntaxGroup() echo synIDattr(l:s, 'name') . ' -> ' . synIDattr(synIDtrans(l:s), 'name') endfun +" https://vi.stackexchange.com/a/456 +function! TrimWhitespace() + let l:save = winsaveview() + keeppatterns %s/\s\+$//e + call winrestview(l:save) +endfun + " https://github.com/junegunn/fzf.vim?tab=readme-ov-file#example-git-grep-wrapper command! -bang -nargs=* GGrep \ call fzf#vim#grep( @@ -236,7 +241,7 @@ function get_lsp_name() end buf_is_big = function(bufnr) - local max_filesize = 100 * 1024 -- 100 KB + local max_filesize = 100 * 1024 -- 100KB local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(bufnr)) if ok and stats and stats.size > max_filesize then return true @@ -247,6 +252,7 @@ end -- LSP configs. if os.getenv('NIX_SHELL') ~= nil then + vim.diagnostic.config({ virtual_text = true }) local lsp = require('lspconfig') lsp.clangd.setup({ cmd = { @@ -259,15 +265,21 @@ if os.getenv('NIX_SHELL') ~= nil then '--completion-style=bundled', '--pch-storage=memory', '--header-insertion=never', - '--header-insertion-decorators=0' + '--header-insertion-decorators=0', + '--query-driver=gcc' }, capabilities = { textDocument = { semanticHighlightingCapabilities = { semanticHighlighting = true + }, + completion = { + completionItem = { + snippetSupport = false + } } } - } + }, }) lsp.ruff.setup({}) -- https://github.com/neovim/nvim-lspconfig/issues/2626#issuecomment-2117022664 @@ -275,10 +287,10 @@ if os.getenv('NIX_SHELL') ~= nil then vim.api.nvim_create_autocmd('BufReadPre', { callback = function(t) if buf_is_big(t.buf) then - vim.o.eventignore = "FileType" + vim.o.eventignore = 'FileType' vim.schedule(function() - vim.o.eventignore = "" - print("Dropped FileType events because the buffer is too big") + vim.o.eventignore = '' + print('Dropped FileType events because the buffer is too big') end) end end @@ -297,7 +309,12 @@ require('mini.sessions').setup({ }) -- Completion. -require('mini.completion').setup({}) +require('mini.completion').setup({ + window = { + info = { border = 'none' }, + signature = { border = 'none' } + } +}) -- Don't use tabs in Neogit. require('neogit').setup({ diff --git a/files/nvim/mini_completion_no_title.diff b/files/nvim/mini_completion_no_title.diff new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/files/nvim/mini_completion_no_title.diff diff --git a/files/nvim/mini_sessions_view.diff b/files/nvim/mini_sessions_view.diff deleted file mode 100644 index 7fa8500..0000000 --- a/files/nvim/mini_sessions_view.diff +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/lua/mini/sessions.lua b/lua/mini/sessions.lua -index 67d0239..bb20292 100644 ---- a/lua/mini/sessions.lua -+++ b/lua/mini/sessions.lua -@@ -248,7 +248,7 @@ MiniSessions.write = function(session_name, opts) - H.possibly_execute(opts.hooks.pre, data) - - -- Make session file -- local command = string.format('mksession%s %s', opts.force and '!' or '', vim.fn.fnameescape(session_path)) -+ local command = string.format('mkview%s %s', opts.force and '!' or '', vim.fn.fnameescape(session_path)) - vim.cmd(command) - data.modify_time = vim.fn.getftime(session_path) - diff --git a/files/nvim/mini_starter_picture.diff b/files/nvim/mini_starter_picture.diff index 7831ca1..1066573 100644 --- a/files/nvim/mini_starter_picture.diff +++ b/files/nvim/mini_starter_picture.diff @@ -1,5 +1,5 @@ diff --git a/lua/mini/starter.lua b/lua/mini/starter.lua -index 8520569e..939e16de 100644 +index 3e0570f3..3f003ba8 100644 --- a/lua/mini/starter.lua +++ b/lua/mini/starter.lua @@ -138,7 +138,7 @@ @@ -34,7 +34,7 @@ index 8520569e..939e16de 100644 -- Array of functions to be applied consecutively to initial content. -- Each function should take and return content for Starter buffer (see -- |mini.starter| and |MiniStarter.get_content()| for more details). -@@ -372,7 +381,7 @@ MiniStarter.refresh = function(buf_id) +@@ -373,7 +382,7 @@ MiniStarter.refresh = function(buf_id) data.footer = H.normalize_header_footer(config.footer or H.default_footer) -- Evaluate content @@ -43,7 +43,7 @@ index 8520569e..939e16de 100644 local hooks = config.content_hooks or H.default_content_hooks for _, f in ipairs(hooks) do content = f(content, buf_id) -@@ -399,6 +408,12 @@ MiniStarter.refresh = function(buf_id) +@@ -400,6 +409,12 @@ MiniStarter.refresh = function(buf_id) -- Apply current query (clear command line afterwards) H.make_query(buf_id) @@ -56,7 +56,7 @@ index 8520569e..939e16de 100644 end --- Close Starter buffer -@@ -730,18 +745,45 @@ MiniStarter.gen_hook.aligning = function(horizontal, vertical) +@@ -731,18 +746,45 @@ MiniStarter.gen_hook.aligning = function(horizontal, vertical) local win_id = vim.fn.bufwinid(buf_id) if win_id < 0 then return end @@ -104,7 +104,7 @@ index 8520569e..939e16de 100644 return MiniStarter.gen_hook.padding(left_pad, top_pad)(content) end end -@@ -1004,7 +1046,7 @@ H.default_footer = [[ +@@ -1005,7 +1047,7 @@ H.default_footer = [[ Type query to filter items <BS> deletes latest character from query <Esc> resets current query @@ -113,7 +113,7 @@ index 8520569e..939e16de 100644 <CR> executes action of current item <C-c> closes this buffer]] -@@ -1048,8 +1090,54 @@ end +@@ -1046,8 +1088,54 @@ end H.apply_config = function(config) MiniStarter.config = config end @@ -169,7 +169,7 @@ index 8520569e..939e16de 100644 if config.autoopen then local on_vimenter = function() -@@ -1061,7 +1149,7 @@ H.create_autocommands = function(config) +@@ -1059,7 +1147,7 @@ H.create_autocommands = function(config) vim.cmd('noautocmd lua MiniStarter.open()') end @@ -178,7 +178,7 @@ index 8520569e..939e16de 100644 vim.api.nvim_create_autocmd('VimEnter', au_opts) end -@@ -1107,9 +1195,11 @@ H.normalize_header_footer = function(x) +@@ -1105,9 +1193,11 @@ H.normalize_header_footer = function(x) end -- Work with buffer content --------------------------------------------------- @@ -191,7 +191,7 @@ index 8520569e..939e16de 100644 -- Add header lines for _, l in ipairs(header) do H.content_add_line(content, { H.content_unit(l, 'header', 'MiniStarterHeader') }) -@@ -1120,7 +1210,7 @@ H.make_initial_content = function(header, items, footer) +@@ -1118,7 +1208,7 @@ H.make_initial_content = function(header, items, footer) H.content_add_items(content, items) -- Add footer lines @@ -200,7 +200,7 @@ index 8520569e..939e16de 100644 for _, l in ipairs(footer) do H.content_add_line(content, { H.content_unit(l, 'footer', 'MiniStarterFooter') }) end -@@ -1323,11 +1413,22 @@ H.make_buffer_autocmd = function(buf_id) +@@ -1321,11 +1411,22 @@ H.make_buffer_autocmd = function(buf_id) au('VimResized', function() MiniStarter.refresh(buf_id) end, 'Refresh') au('CursorMoved', function() H.position_cursor_on_current_item(buf_id) end, 'Position cursor') @@ -223,19 +223,8 @@ index 8520569e..939e16de 100644 end H.apply_buffer_options = function(buf_id) -@@ -1341,17 +1442,11 @@ H.apply_buffer_options = function(buf_id) - - -- Set unique buffer name. Prefer "Starter" prefix as more user friendly. - H.buffer_number = H.buffer_number + 1 -- local name = H.buffer_number <= 1 and 'Starter' or ('Starter_' .. H.buffer_number) -- for _, buf in ipairs(vim.api.nvim_list_bufs()) do -- if vim.fn.fnamemodify(vim.api.nvim_buf_get_name(buf), ':t') == name then -- name = 'ministarter://' .. H.buffer_number -- break -- end -- end -+ local name = H.buffer_number <= 1 and '*dashboard*' or ('dashboard://' .. H.buffer_number) - vim.api.nvim_buf_set_name(buf_id, name) +@@ -1338,7 +1439,7 @@ H.apply_buffer_options = function(buf_id) + vim.api.nvim_feedkeys('\28\14', 'nx', false) -- Having `noautocmd` is crucial for performance: ~9ms without it, ~1.6ms with it - vim.cmd('noautocmd silent! set filetype=ministarter') @@ -243,7 +232,7 @@ index 8520569e..939e16de 100644 local options = { -- Taken from 'vim-startify' -@@ -1398,12 +1493,8 @@ H.apply_buffer_mappings = function(buf_id) +@@ -1385,12 +1486,8 @@ H.apply_buffer_mappings = function(buf_id) buf_keymap('<CR>', 'MiniStarter.eval_current_item()') @@ -258,7 +247,7 @@ index 8520569e..939e16de 100644 -- Make all special symbols to update query for _, key in ipairs(vim.split(H.get_config().query_updaters, '')) do -@@ -1491,7 +1582,7 @@ H.echo = function(msg, is_important) +@@ -1480,7 +1577,7 @@ H.echo = function(msg, is_important) -- Construct message chunks msg = type(msg) == 'string' and { { msg } } or msg @@ -267,7 +256,7 @@ index 8520569e..939e16de 100644 -- Avoid hit-enter-prompt local max_width = vim.o.columns * math.max(vim.o.cmdheight - 1, 0) + vim.v.echospace -@@ -1540,7 +1631,7 @@ H.eval_fun_or_string = function(x, string_as_cmd) +@@ -1529,7 +1626,7 @@ H.eval_fun_or_string = function(x, string_as_cmd) if type(x) == 'function' then return x() end if type(x) == 'string' then if string_as_cmd then |