From 48c76e67a506f64d86405a260111fea0a874fe7f Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Tue, 7 Dec 2021 11:41:05 -0500 Subject: [PATCH 01/48] Disable temporary wikis outside the list --- init.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/init.vim b/init.vim index a6ee690..798dbc0 100644 --- a/init.vim +++ b/init.vim @@ -122,6 +122,7 @@ inoremap :call AdjustFontSize(-1)a " override the default location of vimwiki and change to markdown let g:vimwiki_list = [{'path': '~/Documents/Wiki', 'syntax': 'markdown', 'ext': '.md'}] let g:vimwiki_dir_link = 'index' +let g:vimwiki_global_ext = 0 let g:LanguageClient_serverCommands = { \ 'rust': ['rust-analyzer'], From 2f9df47bce6f950b55d429c14fc8d3fc8dc0d480 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Fri, 10 Dec 2021 09:36:23 -0500 Subject: [PATCH 02/48] Try zoxide plugin --- plug.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plug.vim b/plug.vim index 5e505fb..f81f7f8 100644 --- a/plug.vim +++ b/plug.vim @@ -46,7 +46,7 @@ Plug 'hrsh7th/cmp-nvim-lsp' " Snippet completion source for nvim-cmp Plug 'hrsh7th/cmp-vsnip' -" Other usefull completion sources +" Other useful completion sources Plug 'hrsh7th/cmp-path' Plug 'hrsh7th/cmp-buffer' @@ -75,6 +75,8 @@ Plug 'vimwiki/vimwiki', { 'branch': 'dev' } Plug 'tools-life/taskwiki' " Preferred color scheme Plug 'fneu/breezy' +" Support for the cd replacement, zoxide +Plug 'nanotee/zoxide.vim' " All of your Plugins must be added before the following line call plug#end() " required From add867aa9db87afca820429b09adbacb27fc71f3 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Tue, 28 Dec 2021 16:07:11 -0500 Subject: [PATCH 03/48] Add TypeScript support --- init.vim | 3 +++ plug.vim | 3 +++ 2 files changed, 6 insertions(+) diff --git a/init.vim b/init.vim index 798dbc0..b90c69a 100644 --- a/init.vim +++ b/init.vim @@ -128,3 +128,6 @@ let g:LanguageClient_serverCommands = { \ 'rust': ['rust-analyzer'], \ } +lua< Date: Tue, 28 Dec 2021 16:20:46 -0500 Subject: [PATCH 04/48] Add more config for TS --- ftplugin/typescript.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ftplugin/typescript.vim b/ftplugin/typescript.vim index b7bbae5..c7db738 100644 --- a/ftplugin/typescript.vim +++ b/ftplugin/typescript.vim @@ -1 +1,5 @@ au BufWrite * :Autoformat +setlocal sw=2 ts=2 +setlocal fdm=indent +setlocal smartindent +setlocal list From 1aa5379036e607ea98965d34496f020b1e7741a9 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Wed, 29 Dec 2021 15:52:08 -0500 Subject: [PATCH 05/48] Clean, add more TS support --- init.vim | 17 ++------ rust.vim => lsp.vim | 8 ++++ plug.vim | 96 +++++++++++++++++++++++++++------------------ prettier.vim | 55 ++++++++++++++++++++++++++ wiki.vim | 4 ++ 5 files changed, 128 insertions(+), 52 deletions(-) rename rust.vim => lsp.vim (95%) create mode 100644 prettier.vim create mode 100644 wiki.vim diff --git a/init.vim b/init.vim index b90c69a..5eb2d47 100644 --- a/init.vim +++ b/init.vim @@ -12,10 +12,12 @@ source plug.vim source airline.vim source syntastic.vim source fzf.vim -source rust.vim +source lsp.vim source mapping.vim source jsonnet.vim source nerdtree.vim +source wiki.vim +source prettier.vim exec "cd " . oldwd " set up a line number on the current line but relative above and below to help @@ -118,16 +120,3 @@ noremap :call AdjustFontSize(1) noremap :call AdjustFontSize(-1) inoremap :call AdjustFontSize(1)a inoremap :call AdjustFontSize(-1)a - -" override the default location of vimwiki and change to markdown -let g:vimwiki_list = [{'path': '~/Documents/Wiki', 'syntax': 'markdown', 'ext': '.md'}] -let g:vimwiki_dir_link = 'index' -let g:vimwiki_global_ext = 0 - -let g:LanguageClient_serverCommands = { -\ 'rust': ['rust-analyzer'], -\ } - -lua< f :lua vim.lsp.buf.formatting()") + -- format on save + vim.cmd("autocmd BufWritePost lua vim.lsp.buf.formatting()") + end + + if client.resolved_capabilities.document_range_formatting then + vim.cmd("xnoremap f :lua vim.lsp.buf.range_formatting({})") + end + end, +}) + +prettier.setup({ + bin = 'prettier', -- or `prettierd` + filetypes = { + "css", + "graphql", + "html", + "javascript", + "javascriptreact", + "json", + "less", + "markdown", + "scss", + "typescript", + "typescriptreact", + "yaml", + }, + + -- prettier format options (you can use config files too. ex: `.prettierrc`) + arrow_parens = "always", + bracket_spacing = true, + embedded_language_formatting = "auto", + end_of_line = "lf", + html_whitespace_sensitivity = "css", + jsx_bracket_same_line = false, + jsx_single_quote = false, + print_width = 80, + prose_wrap = "preserve", + quote_props = "as-needed", + semi = true, + single_quote = false, + tab_width = 2, + trailing_comma = "es5", + use_tabs = false, + vue_indent_script_and_style = false, +}) +EOF diff --git a/wiki.vim b/wiki.vim new file mode 100644 index 0000000..cbad8a3 --- /dev/null +++ b/wiki.vim @@ -0,0 +1,4 @@ +" override the default location of vimwiki and change to markdown +let g:vimwiki_list = [{'path': '~/Documents/Wiki', 'syntax': 'markdown', 'ext': '.md'}] +let g:vimwiki_dir_link = 'index' +let g:vimwiki_global_ext = 0 From 8180e3adf6afc518a62cd6031251fe16524c2128 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Tue, 4 Jan 2022 15:27:36 -0500 Subject: [PATCH 06/48] Migrate deprecated call --- lsp.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lsp.vim b/lsp.vim index 985f4e8..e363309 100644 --- a/lsp.vim +++ b/lsp.vim @@ -76,7 +76,7 @@ EOF " 300ms of no cursor movement to trigger CursorHold set updatetime=750 " Show diagnostic popup on cursor hold -autocmd CursorHold * lua vim.lsp.diagnostic.show_line_diagnostics() +autocmd CursorHold * lua vim.diagnostic.open_float() " have a fixed column for the diagnostics to appear in " this removes the jitter when warnings/errors flow in set signcolumn=yes From 2503edbce78482b176954f7584d2ca6fef81142e Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Mon, 10 Jan 2022 16:37:02 -0500 Subject: [PATCH 07/48] Disable for yaml, markdown --- prettier.vim | 2 -- 1 file changed, 2 deletions(-) diff --git a/prettier.vim b/prettier.vim index feb688b..9565665 100644 --- a/prettier.vim +++ b/prettier.vim @@ -27,11 +27,9 @@ prettier.setup({ "javascriptreact", "json", "less", - "markdown", "scss", "typescript", "typescriptreact", - "yaml", }, -- prettier format options (you can use config files too. ex: `.prettierrc`) From f57649029caf782500247d41a2be66d985747e95 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Wed, 12 Jan 2022 11:35:15 -0500 Subject: [PATCH 08/48] Explicitly set shift width --- ftplugin/markdown.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/ftplugin/markdown.vim b/ftplugin/markdown.vim index ee3bfe1..352e743 100644 --- a/ftplugin/markdown.vim +++ b/ftplugin/markdown.vim @@ -1,5 +1,6 @@ " set a smaller indent setlocal ts=2 +setlocal sw=2 " and set up the buffer just like a text file let oldwd = getcwd() From bf3a4e2a8652ad52ff2974b12c89802eb6e3e054 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Wed, 23 Feb 2022 08:19:55 -0500 Subject: [PATCH 09/48] Enable mouse --- init.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.vim b/init.vim index 5eb2d47..5610834 100644 --- a/init.vim +++ b/init.vim @@ -108,6 +108,8 @@ set guioptions-=b set guioptions-=T set guioptions-=m +set mouse=nv + set gfn=DejaVu\ Sans\ Mono\ for\ Powerline:h13 " from https://stackoverflow.com/a/51424640 let s:fontsize = 13 From dcae5849917cde3da6c40ce78ba7eeb2c08d9358 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Sun, 17 Apr 2022 16:54:36 +0000 Subject: [PATCH 10/48] Update from deprecated commands --- mapping.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mapping.vim b/mapping.vim index 426f41b..72ae8fc 100644 --- a/mapping.vim +++ b/mapping.vim @@ -27,5 +27,5 @@ nnoremap ga lua vim.lsp.buf.code_action() nnoremap rn lua vim.lsp.buf.rename() " Goto previous/next diagnostic warning/error -nnoremap g[ lua vim.lsp.diagnostic.goto_prev() -nnoremap g] lua vim.lsp.diagnostic.goto_next() +nnoremap g[ lua vim.diagnostic.goto_prev() +nnoremap g] lua vim.diagnostic.goto_next() From b2082f6aa1e9a4d4baaae7b7bb07bcf48ca498fd Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Wed, 20 Apr 2022 16:40:41 -0400 Subject: [PATCH 11/48] Add map for lsp in loclist --- mapping.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/mapping.vim b/mapping.vim index 72ae8fc..593ee78 100644 --- a/mapping.vim +++ b/mapping.vim @@ -29,3 +29,4 @@ nnoremap rn lua vim.lsp.buf.rename() " Goto previous/next diagnostic warning/error nnoremap g[ lua vim.diagnostic.goto_prev() nnoremap g] lua vim.diagnostic.goto_next() +nnoremap gE lua vim.diagnostic.setloclist() From 1441dd27a2aa3ed87b6f46503a5a4d9f84887f3c Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Wed, 1 Jun 2022 07:46:18 -0400 Subject: [PATCH 12/48] Increase base font --- init.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.vim b/init.vim index 5610834..e09a1c2 100644 --- a/init.vim +++ b/init.vim @@ -112,7 +112,7 @@ set mouse=nv set gfn=DejaVu\ Sans\ Mono\ for\ Powerline:h13 " from https://stackoverflow.com/a/51424640 -let s:fontsize = 13 +let s:fontsize = 14 function! AdjustFontSize(amount) let s:fontsize = s:fontsize+a:amount :execute "set gfn=DejaVu\\ Sans\\ Mono\\ for\\ Powerline:h" . s:fontsize From 671dbd3bf9f4dcdcb8f518470b081912fae1da21 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Wed, 1 Jun 2022 07:46:39 -0400 Subject: [PATCH 13/48] Add Trouble for LSP diagnostics display --- init.vim | 8 ++++++++ mapping.vim | 7 +++++++ plug.vim | 2 ++ 3 files changed, 17 insertions(+) diff --git a/init.vim b/init.vim index e09a1c2..72676e0 100644 --- a/init.vim +++ b/init.vim @@ -122,3 +122,11 @@ noremap :call AdjustFontSize(1) noremap :call AdjustFontSize(-1) inoremap :call AdjustFontSize(1)a inoremap :call AdjustFontSize(-1)a + +lua << EOF + require("trouble").setup { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + } +EOF diff --git a/mapping.vim b/mapping.vim index 593ee78..fabc268 100644 --- a/mapping.vim +++ b/mapping.vim @@ -30,3 +30,10 @@ nnoremap rn lua vim.lsp.buf.rename() nnoremap g[ lua vim.diagnostic.goto_prev() nnoremap g] lua vim.diagnostic.goto_next() nnoremap gE lua vim.diagnostic.setloclist() + +" work with Trouble to view lists of diagnostic warnings/ennoremap xx TroubleToggle +nnoremap xw TroubleToggle workspace_diagnostics +nnoremap xd TroubleToggle document_diagnostics +nnoremap xq TroubleToggle quickfix +nnoremap xl TroubleToggle loclist +nnoremap gR TroubleToggle lsp_referencesrrors diff --git a/plug.vim b/plug.vim index 764065c..da319cf 100644 --- a/plug.vim +++ b/plug.vim @@ -13,6 +13,8 @@ Plug 'vim-airline/vim-airline-themes' Plug 'mbbill/undotree' " Preferred color scheme Plug 'fneu/breezy' +" diagnostics display +Plug 'folke/trouble.nvim' " files, folders, projects, etc. From 151a65cf233404e481043c9941c8ffc13e087d35 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Tue, 26 Jul 2022 13:52:56 -0400 Subject: [PATCH 14/48] Replace autoformat and prettier with neoformat --- ftplugin/typescript.vim | 3 ++- init.vim | 1 - plug.vim | 5 +--- prettier.vim | 53 ----------------------------------------- 4 files changed, 3 insertions(+), 59 deletions(-) delete mode 100644 prettier.vim diff --git a/ftplugin/typescript.vim b/ftplugin/typescript.vim index c7db738..1371888 100644 --- a/ftplugin/typescript.vim +++ b/ftplugin/typescript.vim @@ -1,4 +1,5 @@ -au BufWrite * :Autoformat +autocmd BufWritePre *.ts Neoformat +let g:neoformat_try_node_exe = 1 setlocal sw=2 ts=2 setlocal fdm=indent setlocal smartindent diff --git a/init.vim b/init.vim index 72676e0..3f8e184 100644 --- a/init.vim +++ b/init.vim @@ -17,7 +17,6 @@ source mapping.vim source jsonnet.vim source nerdtree.vim source wiki.vim -source prettier.vim exec "cd " . oldwd " set up a line number on the current line but relative above and below to help diff --git a/plug.vim b/plug.vim index da319cf..4e182f9 100644 --- a/plug.vim +++ b/plug.vim @@ -56,8 +56,7 @@ Plug 'editorconfig/editorconfig-vim' " syntax checking on steroids Plug 'scrooloose/syntastic' " auto format all the things -" https://github.com/Chiel92/vim-autoformat -Plug 'Chiel92/vim-autoformat' +Plug 'sbdchd/neoformat' " Collection of common configurations for the Nvim LSP client Plug 'neovim/nvim-lspconfig' @@ -99,8 +98,6 @@ Plug 'vim-scripts/groovyindent-unix' " nvm to make JS/TS/Node easier to work with Plug 'marene/nvm.vim' -" automating format JS/TS sources -Plug 'MunifTanjim/prettier.nvim' " All of your Plugins must be added before the following line diff --git a/prettier.vim b/prettier.vim deleted file mode 100644 index 9565665..0000000 --- a/prettier.vim +++ /dev/null @@ -1,53 +0,0 @@ -" https://github.com/MunifTanjim/prettier.nvim#setup -lua < f :lua vim.lsp.buf.formatting()") - -- format on save - vim.cmd("autocmd BufWritePost lua vim.lsp.buf.formatting()") - end - - if client.resolved_capabilities.document_range_formatting then - vim.cmd("xnoremap f :lua vim.lsp.buf.range_formatting({})") - end - end, -}) - -prettier.setup({ - bin = 'prettier', -- or `prettierd` - filetypes = { - "css", - "graphql", - "html", - "javascript", - "javascriptreact", - "json", - "less", - "scss", - "typescript", - "typescriptreact", - }, - - -- prettier format options (you can use config files too. ex: `.prettierrc`) - arrow_parens = "always", - bracket_spacing = true, - embedded_language_formatting = "auto", - end_of_line = "lf", - html_whitespace_sensitivity = "css", - jsx_bracket_same_line = false, - jsx_single_quote = false, - print_width = 80, - prose_wrap = "preserve", - quote_props = "as-needed", - semi = true, - single_quote = false, - tab_width = 2, - trailing_comma = "es5", - use_tabs = false, - vue_indent_script_and_style = false, -}) -EOF From c8d7834f22e17178d21917e8771795d63fa70aa7 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Wed, 27 Jul 2022 12:59:17 -0400 Subject: [PATCH 15/48] Fix trouble configs --- mapping.vim | 5 +++-- plug.vim | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mapping.vim b/mapping.vim index fabc268..8f82e58 100644 --- a/mapping.vim +++ b/mapping.vim @@ -31,9 +31,10 @@ nnoremap g[ lua vim.diagnostic.goto_prev() nnoremap g] lua vim.diagnostic.goto_next() nnoremap gE lua vim.diagnostic.setloclist() -" work with Trouble to view lists of diagnostic warnings/ennoremap xx TroubleToggle +" work with Trouble to view lists of diagnostic warnings/errors +nnoremap xx TroubleToggle nnoremap xw TroubleToggle workspace_diagnostics nnoremap xd TroubleToggle document_diagnostics nnoremap xq TroubleToggle quickfix nnoremap xl TroubleToggle loclist -nnoremap gR TroubleToggle lsp_referencesrrors +nnoremap gR TroubleToggle lsp_references diff --git a/plug.vim b/plug.vim index 4e182f9..cb4f95c 100644 --- a/plug.vim +++ b/plug.vim @@ -15,6 +15,8 @@ Plug 'mbbill/undotree' Plug 'fneu/breezy' " diagnostics display Plug 'folke/trouble.nvim' +" icons for Trouble +Plug 'kyazdani42/nvim-web-devicons' " files, folders, projects, etc. From b5b41624af38ec83a52a8349c87ca3b297790cef Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Sat, 30 Jul 2022 15:28:00 -0400 Subject: [PATCH 16/48] Allow project specifics --- init.vim | 2 ++ plug.vim | 2 ++ 2 files changed, 4 insertions(+) diff --git a/init.vim b/init.vim index 3f8e184..1f7b0c8 100644 --- a/init.vim +++ b/init.vim @@ -122,7 +122,9 @@ noremap :call AdjustFontSize(-1) inoremap :call AdjustFontSize(1)a inoremap :call AdjustFontSize(-1)a + lua << EOF + require('nvim-projectconfig').setup({autocmd=true}) require("trouble").setup { -- your configuration comes here -- or leave it empty to use the default settings diff --git a/plug.vim b/plug.vim index cb4f95c..fa49694 100644 --- a/plug.vim +++ b/plug.vim @@ -59,6 +59,8 @@ Plug 'editorconfig/editorconfig-vim' Plug 'scrooloose/syntastic' " auto format all the things Plug 'sbdchd/neoformat' +" load config from $CWD/.config/init.vim +Plug 'windwp/nvim-projectconfig' " Collection of common configurations for the Nvim LSP client Plug 'neovim/nvim-lspconfig' From 94d44b3134b6e8e3a73028a443e6cad29665ea2b Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Sun, 31 Jul 2022 18:10:10 -0400 Subject: [PATCH 17/48] Remove auto command for now --- ftplugin/typescript.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/ftplugin/typescript.vim b/ftplugin/typescript.vim index 1371888..4cf0323 100644 --- a/ftplugin/typescript.vim +++ b/ftplugin/typescript.vim @@ -1,4 +1,3 @@ -autocmd BufWritePre *.ts Neoformat let g:neoformat_try_node_exe = 1 setlocal sw=2 ts=2 setlocal fdm=indent From d2af6e0d9ea2564979b78c92e9e2f743c23661ae Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Sun, 14 Aug 2022 09:46:16 -0400 Subject: [PATCH 18/48] Update rust-tools init --- lsp.vim | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/lsp.vim b/lsp.vim index e363309..726786e 100644 --- a/lsp.vim +++ b/lsp.vim @@ -13,26 +13,19 @@ set shortmess+=c " rust-tools will configure and enable certain LSP features for us. " See https://github.com/simrat39/rust-tools.nvim#configuration lua <", rt.hover_actions.hover_actions, { buffer = bufnr}) + -- Code action groups + vim.keymap.set("n", "a>", rt.code_action_group.code_action_group, { buffer = bufnr}) + end }, - - -- all the opts to send to nvim-lspconfig - -- these override the defaults set by rust-tools.nvim - -- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer - server = {}, -- rust-analyer options -} - -require('rust-tools').setup(opts) + }, -- rust-analyer options +}) EOF " Setup Completion From da7fbd68c7b06969dc5a4c3e395247266d4fa3cc Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Tue, 16 Aug 2022 20:48:19 -0400 Subject: [PATCH 19/48] Remove old mapping --- mapping.vim | 3 --- 1 file changed, 3 deletions(-) diff --git a/mapping.vim b/mapping.vim index 8f82e58..56ba164 100644 --- a/mapping.vim +++ b/mapping.vim @@ -2,9 +2,6 @@ nmap :SyntasticReset " toggle gundo's display nmap :UndotreeToggle -" quickly toggle a right, vsplit for viewing, navigating whatever structure easy -" tags/tagbar can figure out for the current buffer -nmap :TagbarToggle " quickly toggle a left, vsplit for an insanely powerful file explorer nmap :NERDTreeToggle " open tree to current buffer From d561d1964e9379ddbf501547984da438a3251fd8 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Sun, 18 Sep 2022 10:25:46 -0400 Subject: [PATCH 20/48] Switch to same nerd font as alacritty --- init.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.vim b/init.vim index 1f7b0c8..3c26931 100644 --- a/init.vim +++ b/init.vim @@ -109,12 +109,12 @@ set guioptions-=m set mouse=nv -set gfn=DejaVu\ Sans\ Mono\ for\ Powerline:h13 +set gfn=FiraCode\ Nerd\ Font\ Mono:h12 " from https://stackoverflow.com/a/51424640 let s:fontsize = 14 function! AdjustFontSize(amount) let s:fontsize = s:fontsize+a:amount - :execute "set gfn=DejaVu\\ Sans\\ Mono\\ for\\ Powerline:h" . s:fontsize + :execute "set gfn=FiraCode\\ Nerd\\ Font\\ Mono:h" . s:fontsize endfunction noremap :call AdjustFontSize(1) From 1bcdea7a37c8f8af2e079d43d0678e822049312c Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Sun, 30 Oct 2022 13:27:18 -0400 Subject: [PATCH 21/48] Start converting to Lua --- init.lua | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 init.lua diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..b698e78 --- /dev/null +++ b/init.lua @@ -0,0 +1,132 @@ +local vimrc_git = os.getenv("HOME") .. "/src/vimrc" + +vim.cmd("source " .. vimrc_git .. "/plug.vim") +vim.cmd("source " .. vimrc_git .. "/airline.vim") +vim.cmd("source " .. vimrc_git .. "/syntastic.vim") +vim.cmd("source " .. vimrc_git .. "/fzf.vim") +vim.cmd("source " .. vimrc_git .. "/lsp.vim") +vim.cmd("source " .. vimrc_git .. "/mapping.vim") +vim.cmd("source " .. vimrc_git .. "/jsonnet.vim") +vim.cmd("source " .. vimrc_git .. "/nerdtree.vim") +vim.cmd("source " .. vimrc_git .. "/wiki.vim") + +-- set up a line number on the current line but relative above and below to +-- help with motion commands +vim.opt.number = true +vim.opt.relativenumber = true + +-- even with the nice space/tab autodetect, prefer 4 for tab stops but let file +-- type specifics override (for instance a setting of 2 for markdown +vim.opt.tabstop = 4 +-- default to folding on syntax +vim.opt.foldmethod = "syntax" +-- disable automatic line breaks, rely on visual wrapping instead +vim.opt.textwidth = 0 +-- make white space visible, where that matters +vim.opt.list = true + +local function nolist() + vim.opt.list = false +end + +-- make white space invisible only in help text +vim.api.nvim_create_autocmd("FileType", { + pattern = "help", + callback = nolist, +}) +-- set up folding preferences +vim.opt.fde = "1" +-- vim's spelling is smart enough for code, to only check comments +vim.opt.spell = true +-- add a hint for long lines +vim.opt.colorcolumn = "120" +-- default to expanding tabs, I'm not insane +vim.opt.expandtab = true + +-- change buffer behaviors to no longer require changes when hiding a buffer +vim.opt.hidden = true + +-- look for vimrc in the current director as well as $MYVIMRC +vim.opt.exrc = true +-- make looking for local changes secure +vim.opt.secure = true +-- more secure +vim.opt.modelines = 0 +-- preserve some context +vim.opt.scrolloff = 3 +-- make the cursor a bit easier to follows +vim.opt.cursorline = true +-- make search work a bit more like tab completion in bash +vim.opt.incsearch = true +vim.opt.wildmode = "longest:full" +vim.opt. wildmenu = true +-- line break handling +vim.opt.linebreak = true +vim.opt.showbreak = "+" +-- always on status line +vim.opt.laststatus = 2 + +-- let backspace work more naturally +vim.opt.backspace = "start,indent,eol" +-- favor modern encoding +vim.opt.enc = "utf-8" +-- more readable config for list mode +vim.opt.listchars = {nbsp = '¬', tab = '»·', trail = '·'} +-- smarter handling of case during search +vim.opt.ignorecase = true +vim.opt.smartcase = true +-- centralize swap to have backup without clutter +vim.opt.directory = os.getenv("HOME") .. "/.var/nvim/swp//" +-- and undo +vim.opt.undofile = true +vim.opt.undodir = os.getenv("HOME") .. "/.nvim/undodir" +-- make pastemode more accessible +vim.opt.pastetoggle = "" + +-- save when moving away +--au FocusLost * :wa + +-- make sure to set TERM to xterm-256color in terminal program or app +vim.cmd("colorscheme breezy") +vim.opt.background = "light" +vim.opt.termguicolors = true + +-- ensure autoread works, to detect file changes outside the editor +vim.opt.autoread = true +-- au CursorHold * checktime + +-- for gui, make it easier to tell different instances apart +vim.opt.title = true + +-- keep nvim from resetting font back to default from terminal config +vim.opt.guicursor = nil + +local guiopts = vim.opt.guioptions +guiopts = guiopts:gsub("r", "") +guiopts = guiopts:gsub("b", "") +guiopts = guiopts:gsub("T", "") +guiopts = guiopts:gsub("m", "") + +vim.opt.guioptions = guiopts + +vim.opt.mouse = "nv" + +vim.opt.gfn = "FiraCode Nerd Font Mono:h12" +-- from https://stackoverflow.com/a/51424640 +-- let s:fontsize = 14 +-- function! AdjustFontSize(amount) +-- let s:fontsize = s:fontsize+a:amount +-- :execute --set gfn=FiraCode\\ Nerd\\ Font\\ Mono:h" . s:fontsize +-- endfunction +-- +-- noremap :call AdjustFontSize(1) +-- noremap :call AdjustFontSize(-1) +-- inoremap :call AdjustFontSize(1)a +-- inoremap :call AdjustFontSize(-1)a + +require('nvim-projectconfig').setup({autocmd=true}) +require("trouble").setup { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below +} From 79737fc15ec67b0424a3273b3e682a9f71c22fac Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Mon, 31 Oct 2022 10:59:04 -0400 Subject: [PATCH 22/48] Finish port of main config --- init.lua | 30 +++++++++++++++--------------- plug.vim | 2 ++ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/init.lua b/init.lua index b698e78..33cf2c3 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,9 @@ local vimrc_git = os.getenv("HOME") .. "/src/vimrc" +-- it is a big fat key, after all +-- N.B. should come before plugins and plugin specific settings +vim.g.mapleader = ' ' + vim.cmd("source " .. vimrc_git .. "/plug.vim") vim.cmd("source " .. vimrc_git .. "/airline.vim") vim.cmd("source " .. vimrc_git .. "/syntastic.vim") @@ -10,6 +14,10 @@ vim.cmd("source " .. vimrc_git .. "/jsonnet.vim") vim.cmd("source " .. vimrc_git .. "/nerdtree.vim") vim.cmd("source " .. vimrc_git .. "/wiki.vim") +if vim.g.neovide then + require("size-matters") +end + -- set up a line number on the current line but relative above and below to -- help with motion commands vim.opt.number = true @@ -84,7 +92,7 @@ vim.opt.undodir = os.getenv("HOME") .. "/.nvim/undodir" vim.opt.pastetoggle = "" -- save when moving away ---au FocusLost * :wa +vim.api.nvim_create_autocmd("FocusLost", {pattern = "*", command = "wa"}) -- make sure to set TERM to xterm-256color in terminal program or app vim.cmd("colorscheme breezy") @@ -93,7 +101,7 @@ vim.opt.termguicolors = true -- ensure autoread works, to detect file changes outside the editor vim.opt.autoread = true --- au CursorHold * checktime +vim.api.nvim_create_autocmd("CursorHold", {pattern = "*", command = "checktime"}) -- for gui, make it easier to tell different instances apart vim.opt.title = true @@ -101,28 +109,20 @@ vim.opt.title = true -- keep nvim from resetting font back to default from terminal config vim.opt.guicursor = nil -local guiopts = vim.opt.guioptions +local guiopts = vim.g.guioptions +if guiopts == nil then + guiopts = "" +end guiopts = guiopts:gsub("r", "") guiopts = guiopts:gsub("b", "") guiopts = guiopts:gsub("T", "") guiopts = guiopts:gsub("m", "") -vim.opt.guioptions = guiopts +vim.g.guioptions = guiopts vim.opt.mouse = "nv" vim.opt.gfn = "FiraCode Nerd Font Mono:h12" --- from https://stackoverflow.com/a/51424640 --- let s:fontsize = 14 --- function! AdjustFontSize(amount) --- let s:fontsize = s:fontsize+a:amount --- :execute --set gfn=FiraCode\\ Nerd\\ Font\\ Mono:h" . s:fontsize --- endfunction --- --- noremap :call AdjustFontSize(1) --- noremap :call AdjustFontSize(-1) --- inoremap :call AdjustFontSize(1)a --- inoremap :call AdjustFontSize(-1)a require('nvim-projectconfig').setup({autocmd=true}) require("trouble").setup { diff --git a/plug.vim b/plug.vim index fa49694..b3ba129 100644 --- a/plug.vim +++ b/plug.vim @@ -3,6 +3,8 @@ call plug#begin("~/.config/nvim/plugged") " adds to my existing set up. I try to capture the value, at least to me, each " plugin adds. I've tried to logically group them, as well, to spot overlap " and redundancy. +" +Plug 'tenxsoydev/size-matters.nvim' " informational From c14bba24480696c3d67292b4f4fc3b74f331600c Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Mon, 28 Nov 2022 17:23:06 -0500 Subject: [PATCH 23/48] Remove broken plugin --- plug.vim | 3 --- 1 file changed, 3 deletions(-) diff --git a/plug.vim b/plug.vim index b3ba129..d98cc52 100644 --- a/plug.vim +++ b/plug.vim @@ -33,9 +33,6 @@ Plug 'nanotee/zoxide.vim' Plug 'xarthurx/taskwarrior.vim' " Wiki support - my life is in vimwiki Plug 'vimwiki/vimwiki', { 'branch': 'dev' } -" integrating taskwarrior and vimwiki - why did it take me so long to adopt -" this? -Plug 'tools-life/taskwiki' " git integration From 535c4396c8bcdbc61658f0a8a12c6a6beaa0b9af Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Thu, 16 Feb 2023 11:41:01 -0500 Subject: [PATCH 24/48] Add deno support --- lsp.vim | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lsp.vim b/lsp.vim index 726786e..2bf97c2 100644 --- a/lsp.vim +++ b/lsp.vim @@ -79,5 +79,24 @@ let g:LanguageClient_serverCommands = { \ } lua< Date: Sat, 11 Mar 2023 10:24:23 -0500 Subject: [PATCH 25/48] Set colorscheme for text and markdown --- ftplugin/text.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ftplugin/text.vim b/ftplugin/text.vim index cc8cab2..320f546 100644 --- a/ftplugin/text.vim +++ b/ftplugin/text.vim @@ -8,3 +8,5 @@ setlocal nolist setlocal formatoptions-=t " turn off line width hint setlocal colorcolumn=0 +" set an alternate colorscheme from coding +colorscheme quiet From f4d92ed3d80d25efc5a105cea29fe9eba66b1137 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Sun, 7 May 2023 15:44:11 -0400 Subject: [PATCH 26/48] Adjust rust config --- lsp.vim | 4 ++++ plug.vim | 2 ++ 2 files changed, 6 insertions(+) diff --git a/lsp.vim b/lsp.vim index 2bf97c2..b9d1df1 100644 --- a/lsp.vim +++ b/lsp.vim @@ -9,6 +9,9 @@ set completeopt=menuone,noinsert,noselect " Avoid showing extra messages when using completion set shortmess+=c +" Recognize slint files +autocmd BufEnter *.slint :setlocal filetype=slint + " Configure LSP through rust-tools.nvim plugin. " rust-tools will configure and enable certain LSP features for us. " See https://github.com/simrat39/rust-tools.nvim#configuration @@ -82,6 +85,7 @@ lua< Date: Tue, 9 May 2023 10:52:10 -0400 Subject: [PATCH 27/48] Try to restore scheme, add vimwiki filetype --- ftplugin/javascript.vim | 2 ++ ftplugin/typescript.vim | 2 ++ ftplugin/vimwiki.vim | 5 +++++ 3 files changed, 9 insertions(+) create mode 100644 ftplugin/vimwiki.vim diff --git a/ftplugin/javascript.vim b/ftplugin/javascript.vim index 5983860..740b094 100644 --- a/ftplugin/javascript.vim +++ b/ftplugin/javascript.vim @@ -1,3 +1,5 @@ setlocal fdm=indent setlocal smartindent setlocal list +" set an alternate colorscheme from coding +colorscheme breezy diff --git a/ftplugin/typescript.vim b/ftplugin/typescript.vim index 4cf0323..aaaae00 100644 --- a/ftplugin/typescript.vim +++ b/ftplugin/typescript.vim @@ -3,3 +3,5 @@ setlocal sw=2 ts=2 setlocal fdm=indent setlocal smartindent setlocal list +" set an alternate colorscheme from coding +colorscheme breezy diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim new file mode 100644 index 0000000..b8f49c5 --- /dev/null +++ b/ftplugin/vimwiki.vim @@ -0,0 +1,5 @@ +" and set up the buffer just like a markdown file +let oldwd = getcwd() +exec "cd ~/.config/nvim/ftplugin" +source markdown.vim +exec "cd " . oldwd From 9fee066f65ac83ae8e9a0cdf92b5f36ed2fae2fc Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Tue, 9 May 2023 11:31:20 -0400 Subject: [PATCH 28/48] Convert to lua - prune unused - drop scripting, use symlink for identical options --- ftplugin/java.vim | 16 ---------------- ftplugin/javascript.lua | 5 +++++ ftplugin/javascript.vim | 5 ----- ftplugin/markdown.lua | 18 ++++++++++++++++++ ftplugin/markdown.vim | 9 --------- ftplugin/rust.lua | 1 + ftplugin/rust.vim | 1 - ftplugin/scala.vim | 1 - ftplugin/text.lua | 12 ++++++++++++ ftplugin/text.vim | 12 ------------ ftplugin/typescript.lua | 13 +++++++++++++ ftplugin/typescript.vim | 7 ------- ftplugin/vimwiki.vim | 6 +----- 13 files changed, 50 insertions(+), 56 deletions(-) delete mode 100644 ftplugin/java.vim create mode 100644 ftplugin/javascript.lua delete mode 100644 ftplugin/javascript.vim create mode 100644 ftplugin/markdown.lua delete mode 100644 ftplugin/markdown.vim create mode 100644 ftplugin/rust.lua delete mode 100644 ftplugin/rust.vim delete mode 100644 ftplugin/scala.vim create mode 100644 ftplugin/text.lua delete mode 100644 ftplugin/text.vim create mode 100644 ftplugin/typescript.lua delete mode 100644 ftplugin/typescript.vim mode change 100644 => 120000 ftplugin/vimwiki.vim diff --git a/ftplugin/java.vim b/ftplugin/java.vim deleted file mode 100644 index d46f8b0..0000000 --- a/ftplugin/java.vim +++ /dev/null @@ -1,16 +0,0 @@ -let g:JavaImpDataDir = $HOME . "/.vim/JavaImp" - -" F7 to call clean redundant Java imports and sort them -function JavaImpClean() - %!~/bin/clean_imports.sh % - :JavaImpSort -endfunction -:command JavaImpClean exec JavaImpClean() -:nnoremap :JavaImpClean - -"let makeprg = 'java -cp /opt/boxen/homebrew/opt/checkstyle/libexec/checkstyle-6.0-all.jar -c '. vimrc_git . '/checkstyle.xml %:p' -let makeprg = 'checkstyle -c '. vimrc_git . '/checkstyle.xml ./%' - -let &makeprg=escape(makeprg, ' ') -setlocal errorformat=%f:%l:\ %m,%f:%l:%v:\ %m,%-G%.%# - diff --git a/ftplugin/javascript.lua b/ftplugin/javascript.lua new file mode 100644 index 0000000..4b02ba9 --- /dev/null +++ b/ftplugin/javascript.lua @@ -0,0 +1,5 @@ +vim.cmd('setlocal fdm=indent') +vim.cmd('setlocal smartindent') +vim.cmd('setlocal list') +-- set an alternate colorscheme from coding +vim.cmd('colorscheme breezy') diff --git a/ftplugin/javascript.vim b/ftplugin/javascript.vim deleted file mode 100644 index 740b094..0000000 --- a/ftplugin/javascript.vim +++ /dev/null @@ -1,5 +0,0 @@ -setlocal fdm=indent -setlocal smartindent -setlocal list -" set an alternate colorscheme from coding -colorscheme breezy diff --git a/ftplugin/markdown.lua b/ftplugin/markdown.lua new file mode 100644 index 0000000..f9f63dd --- /dev/null +++ b/ftplugin/markdown.lua @@ -0,0 +1,18 @@ +-- set a smaller indent +local indent = 2 +vim.opt.tabstop = indent +vim.opt.shiftwidth = indent +vim.opt.softtabstop = indent + +-- don't hard break text +vim.opt.textwidth = 0 +-- keep soft breaks between words +vim.cmd('setlocal linebreak') +-- turn list off as it interferes with soft wrapping +vim.cmd('setlocal nolist') +-- turn off breaking when typing new text +vim.cmd('setlocal formatoptions-=t') +-- turn off line width hint +vim.cmd('setlocal colorcolumn=0') +-- set an alternate colorscheme from coding +vim.cmd('colorscheme quiet') diff --git a/ftplugin/markdown.vim b/ftplugin/markdown.vim deleted file mode 100644 index 352e743..0000000 --- a/ftplugin/markdown.vim +++ /dev/null @@ -1,9 +0,0 @@ -" set a smaller indent -setlocal ts=2 -setlocal sw=2 - -" and set up the buffer just like a text file -let oldwd = getcwd() -exec "cd ~/.config/nvim/ftplugin" -source text.vim -exec "cd " . oldwd diff --git a/ftplugin/rust.lua b/ftplugin/rust.lua new file mode 100644 index 0000000..c996ff2 --- /dev/null +++ b/ftplugin/rust.lua @@ -0,0 +1 @@ +vim.g.rustfmt_autosave = 1 diff --git a/ftplugin/rust.vim b/ftplugin/rust.vim deleted file mode 100644 index 4ef03d1..0000000 --- a/ftplugin/rust.vim +++ /dev/null @@ -1 +0,0 @@ -let g:rustfmt_autosave = 1 diff --git a/ftplugin/scala.vim b/ftplugin/scala.vim deleted file mode 100644 index b7bbae5..0000000 --- a/ftplugin/scala.vim +++ /dev/null @@ -1 +0,0 @@ -au BufWrite * :Autoformat diff --git a/ftplugin/text.lua b/ftplugin/text.lua new file mode 100644 index 0000000..039327f --- /dev/null +++ b/ftplugin/text.lua @@ -0,0 +1,12 @@ +-- don't hard break text +vim.opt.textwidth = 0 +-- keep soft breaks between words +vim.cmd('setlocal linebreak') +-- turn list off as it interferes with soft wrapping +vim.cmd('setlocal nolist') +-- turn off breaking when typing new text +vim.cmd('setlocal formatoptions-=t') +-- turn off line width hint +vim.cmd('setlocal colorcolumn=0') +-- set an alternate colorscheme from coding +vim.cmd('colorscheme quiet') diff --git a/ftplugin/text.vim b/ftplugin/text.vim deleted file mode 100644 index 320f546..0000000 --- a/ftplugin/text.vim +++ /dev/null @@ -1,12 +0,0 @@ -" don't hard break text -setlocal tw=0 -" keep soft breaks between words -setlocal linebreak -" turn list off as it interferes with soft wrapping -setlocal nolist -" turn off breaking when typing new text -setlocal formatoptions-=t -" turn off line width hint -setlocal colorcolumn=0 -" set an alternate colorscheme from coding -colorscheme quiet diff --git a/ftplugin/typescript.lua b/ftplugin/typescript.lua new file mode 100644 index 0000000..1a74504 --- /dev/null +++ b/ftplugin/typescript.lua @@ -0,0 +1,13 @@ +vim.g.neoformat_try_node_exe = 1 + +-- set a smaller indent +local indent = 2 +vim.opt.tabstop = indent +vim.opt.shiftwidth = indent +vim.opt.softtabstop = indent + +vim.cmd('setlocal fdm=indent') +vim.cmd('setlocal smartindent') +vim.cmd('setlocal list') +-- set an alternate colorscheme from coding +vim.cmd('colorscheme breezy') diff --git a/ftplugin/typescript.vim b/ftplugin/typescript.vim deleted file mode 100644 index aaaae00..0000000 --- a/ftplugin/typescript.vim +++ /dev/null @@ -1,7 +0,0 @@ -let g:neoformat_try_node_exe = 1 -setlocal sw=2 ts=2 -setlocal fdm=indent -setlocal smartindent -setlocal list -" set an alternate colorscheme from coding -colorscheme breezy diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim deleted file mode 100644 index b8f49c5..0000000 --- a/ftplugin/vimwiki.vim +++ /dev/null @@ -1,5 +0,0 @@ -" and set up the buffer just like a markdown file -let oldwd = getcwd() -exec "cd ~/.config/nvim/ftplugin" -source markdown.vim -exec "cd " . oldwd diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim new file mode 120000 index 0000000..4d7d231 --- /dev/null +++ b/ftplugin/vimwiki.vim @@ -0,0 +1 @@ +markdown.vim \ No newline at end of file From 50470717d353e743a2271862878f56b4be24aa70 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Sat, 6 Jan 2024 11:44:12 -0500 Subject: [PATCH 29/48] Fix font size --- init.lua | 2 +- init.vim | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 33cf2c3..dfc5bab 100644 --- a/init.lua +++ b/init.lua @@ -122,7 +122,7 @@ vim.g.guioptions = guiopts vim.opt.mouse = "nv" -vim.opt.gfn = "FiraCode Nerd Font Mono:h12" +vim.opt.gfn = "FiraCode Nerd Font Mono:h10" require('nvim-projectconfig').setup({autocmd=true}) require("trouble").setup { diff --git a/init.vim b/init.vim index 3c26931..c9ead8b 100644 --- a/init.vim +++ b/init.vim @@ -109,9 +109,9 @@ set guioptions-=m set mouse=nv -set gfn=FiraCode\ Nerd\ Font\ Mono:h12 +set gfn=FiraCode\ Nerd\ Font\ Mono:h10 " from https://stackoverflow.com/a/51424640 -let s:fontsize = 14 +let s:fontsize = 10 function! AdjustFontSize(amount) let s:fontsize = s:fontsize+a:amount :execute "set gfn=FiraCode\\ Nerd\\ Font\\ Mono:h" . s:fontsize From abcaef846e31a645823077b1db0dc1923f7877c1 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Mon, 12 Feb 2024 09:08:41 -0500 Subject: [PATCH 30/48] Restore font after update --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index dfc5bab..33cf2c3 100644 --- a/init.lua +++ b/init.lua @@ -122,7 +122,7 @@ vim.g.guioptions = guiopts vim.opt.mouse = "nv" -vim.opt.gfn = "FiraCode Nerd Font Mono:h10" +vim.opt.gfn = "FiraCode Nerd Font Mono:h12" require('nvim-projectconfig').setup({autocmd=true}) require("trouble").setup { From 3ca0930d08d9580918a9885099ac43ef57a04331 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Wed, 10 Apr 2024 11:40:19 -0400 Subject: [PATCH 31/48] Add more vimwiki mappings - Ones for working with tags - One for finding incomplete tasks --- mapping.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mapping.vim b/mapping.vim index 56ba164..2cd187b 100644 --- a/mapping.vim +++ b/mapping.vim @@ -35,3 +35,14 @@ nnoremap xd TroubleToggle document_diagnostics nnoremap xq TroubleToggle quickfix nnoremap xl TroubleToggle loclist nnoremap gR TroubleToggle lsp_references + +nnoremap t e ~/Documents/Wiki/tags.md +nnoremap tr VimwikiRebuildTags +nnoremap tg VimwikiGenerateTagLinks + +function! VimwikiFindAllIncompleteTasks() + lvimgrep /- \[ \]/ * + lopen +endfunction + +nmap wa :call VimwikiFindAllIncompleteTasks() From cd9c45cf26aed736aa77432c3b2958439113a3e7 Mon Sep 17 00:00:00 2001 From: thomas-gideon-gm Date: Thu, 18 Apr 2024 17:21:36 -0400 Subject: [PATCH 32/48] macOS adjustments --- init.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 33cf2c3..1e635f7 100644 --- a/init.lua +++ b/init.lua @@ -122,9 +122,15 @@ vim.g.guioptions = guiopts vim.opt.mouse = "nv" -vim.opt.gfn = "FiraCode Nerd Font Mono:h12" +if vim.fn.has('macunix') then + vim.opt.gfn = "FiraCode Nerd Font Mono:h16" +else + vim.opt.gfn = "FiraCode Nerd Font Mono:h12" +end -require('nvim-projectconfig').setup({autocmd=true}) +if not vim.fn.has('macunix') then + require('nvim-projectconfig').setup({autocmd=true}) +end require("trouble").setup { -- your configuration comes here -- or leave it empty to use the default settings From 9d6de405f322a7aa51cd9db80935315195b414ed Mon Sep 17 00:00:00 2001 From: thomas-gideon-gm Date: Fri, 19 Apr 2024 09:54:14 -0400 Subject: [PATCH 33/48] Change mapping to work from shell --- mapping.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mapping.vim b/mapping.vim index 2cd187b..42aad21 100644 --- a/mapping.vim +++ b/mapping.vim @@ -5,7 +5,7 @@ nmap :UndotreeToggle " quickly toggle a left, vsplit for an insanely powerful file explorer nmap :NERDTreeToggle " open tree to current buffer -nmap :NERDTreeFind +nmap :NERDTreeFind " use similar key, esc, to exit terminal mode tnoremap From 45af25f204f7dbc8f0ac61e697b10c60020399f2 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Mon, 10 Jun 2024 10:14:04 -0400 Subject: [PATCH 34/48] Remove text and markdown specific colorscheme LSP breaks this because overlays with multiple lines are opened with a filetype of text causing the colorscheme to change unpredictably and sometimes break. Moved wiki/diary specific colorscheme to a project specific config outside of this repo. --- ftplugin/javascript.lua | 2 -- ftplugin/markdown.lua | 2 -- ftplugin/text.lua | 2 -- ftplugin/typescript.lua | 2 -- init.lua | 7 ++++--- lsp.vim | 2 +- plug.vim | 2 -- 7 files changed, 5 insertions(+), 14 deletions(-) diff --git a/ftplugin/javascript.lua b/ftplugin/javascript.lua index 4b02ba9..0c8031d 100644 --- a/ftplugin/javascript.lua +++ b/ftplugin/javascript.lua @@ -1,5 +1,3 @@ vim.cmd('setlocal fdm=indent') vim.cmd('setlocal smartindent') vim.cmd('setlocal list') --- set an alternate colorscheme from coding -vim.cmd('colorscheme breezy') diff --git a/ftplugin/markdown.lua b/ftplugin/markdown.lua index f9f63dd..04786ee 100644 --- a/ftplugin/markdown.lua +++ b/ftplugin/markdown.lua @@ -14,5 +14,3 @@ vim.cmd('setlocal nolist') vim.cmd('setlocal formatoptions-=t') -- turn off line width hint vim.cmd('setlocal colorcolumn=0') --- set an alternate colorscheme from coding -vim.cmd('colorscheme quiet') diff --git a/ftplugin/text.lua b/ftplugin/text.lua index 039327f..dc8a2cd 100644 --- a/ftplugin/text.lua +++ b/ftplugin/text.lua @@ -8,5 +8,3 @@ vim.cmd('setlocal nolist') vim.cmd('setlocal formatoptions-=t') -- turn off line width hint vim.cmd('setlocal colorcolumn=0') --- set an alternate colorscheme from coding -vim.cmd('colorscheme quiet') diff --git a/ftplugin/typescript.lua b/ftplugin/typescript.lua index 1a74504..94b3d25 100644 --- a/ftplugin/typescript.lua +++ b/ftplugin/typescript.lua @@ -9,5 +9,3 @@ vim.opt.softtabstop = indent vim.cmd('setlocal fdm=indent') vim.cmd('setlocal smartindent') vim.cmd('setlocal list') --- set an alternate colorscheme from coding -vim.cmd('colorscheme breezy') diff --git a/init.lua b/init.lua index 1e635f7..5535239 100644 --- a/init.lua +++ b/init.lua @@ -54,7 +54,8 @@ vim.opt.expandtab = true -- change buffer behaviors to no longer require changes when hiding a buffer vim.opt.hidden = true --- look for vimrc in the current director as well as $MYVIMRC +-- look for vimrc in the current directory as well as $MYVIMRC +-- e.g. place .nvim.lua at the root of a project directory for project specific settings vim.opt.exrc = true -- make looking for local changes secure vim.opt.secure = true @@ -95,8 +96,8 @@ vim.opt.pastetoggle = "" vim.api.nvim_create_autocmd("FocusLost", {pattern = "*", command = "wa"}) -- make sure to set TERM to xterm-256color in terminal program or app -vim.cmd("colorscheme breezy") -vim.opt.background = "light" +vim.cmd("colorscheme desert") +vim.opt.background = "dark" vim.opt.termguicolors = true -- ensure autoread works, to detect file changes outside the editor diff --git a/lsp.vim b/lsp.vim index b9d1df1..c269e14 100644 --- a/lsp.vim +++ b/lsp.vim @@ -69,7 +69,7 @@ cmp.setup({ EOF " Set updatetime for CursorHold -" 300ms of no cursor movement to trigger CursorHold +" ms of no cursor movement to trigger CursorHold set updatetime=750 " Show diagnostic popup on cursor hold autocmd CursorHold * lua vim.diagnostic.open_float() diff --git a/plug.vim b/plug.vim index 601c552..3be7332 100644 --- a/plug.vim +++ b/plug.vim @@ -13,8 +13,6 @@ Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' " visualize vim's undo tree Plug 'mbbill/undotree' -" Preferred color scheme -Plug 'fneu/breezy' " diagnostics display Plug 'folke/trouble.nvim' " icons for Trouble From 59683c0702004c6f6bf396a984b3eba3ef692d84 Mon Sep 17 00:00:00 2001 From: thomas-gideon-gm Date: Fri, 21 Jun 2024 09:53:33 -0400 Subject: [PATCH 35/48] Condition paste toggle on OS --- init.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 5535239..6989ec2 100644 --- a/init.lua +++ b/init.lua @@ -89,8 +89,10 @@ vim.opt.directory = os.getenv("HOME") .. "/.var/nvim/swp//" -- and undo vim.opt.undofile = true vim.opt.undodir = os.getenv("HOME") .. "/.nvim/undodir" --- make pastemode more accessible -vim.opt.pastetoggle = "" +if not vim.fn.has('macunix') then + -- make pastemode more accessible + vim.opt.pastetoggle = "" +end -- save when moving away vim.api.nvim_create_autocmd("FocusLost", {pattern = "*", command = "wa"}) From 21e9dfa8b0fe1f376f04459243269411b9102147 Mon Sep 17 00:00:00 2001 From: thomas-gideon-gm Date: Sat, 22 Jun 2024 09:10:01 -0400 Subject: [PATCH 36/48] Update rust tooling, convert more config to lua * Drop unmaintained rust-tools. * Adopted rustaceanvm * Convert Plug config to lua * Convert key mapping to lua, update LSP bindings * Remove unused syntastic plugin and config --- {ftplugin => after/ftplugin}/rust.lua | 0 init.lua | 7 +- init.vim | 133 -------------------------- lsp.vim | 19 ---- mapping.lua | 60 ++++++++++++ mapping.vim | 48 ---------- plug.lua | 105 ++++++++++++++++++++ plug.vim | 107 --------------------- syntastic.vim | 11 --- 9 files changed, 168 insertions(+), 322 deletions(-) rename {ftplugin => after/ftplugin}/rust.lua (100%) delete mode 100644 init.vim create mode 100644 mapping.lua delete mode 100644 mapping.vim create mode 100644 plug.lua delete mode 100644 plug.vim delete mode 100644 syntastic.vim diff --git a/ftplugin/rust.lua b/after/ftplugin/rust.lua similarity index 100% rename from ftplugin/rust.lua rename to after/ftplugin/rust.lua diff --git a/init.lua b/init.lua index 6989ec2..48b635d 100644 --- a/init.lua +++ b/init.lua @@ -4,12 +4,11 @@ local vimrc_git = os.getenv("HOME") .. "/src/vimrc" -- N.B. should come before plugins and plugin specific settings vim.g.mapleader = ' ' -vim.cmd("source " .. vimrc_git .. "/plug.vim") +vim.cmd("source " .. vimrc_git .. "/plug.lua") vim.cmd("source " .. vimrc_git .. "/airline.vim") -vim.cmd("source " .. vimrc_git .. "/syntastic.vim") -vim.cmd("source " .. vimrc_git .. "/fzf.vim") vim.cmd("source " .. vimrc_git .. "/lsp.vim") -vim.cmd("source " .. vimrc_git .. "/mapping.vim") +vim.cmd("source " .. vimrc_git .. "/mapping.lua") +vim.cmd("source " .. vimrc_git .. "/fzf.vim") vim.cmd("source " .. vimrc_git .. "/jsonnet.vim") vim.cmd("source " .. vimrc_git .. "/nerdtree.vim") vim.cmd("source " .. vimrc_git .. "/wiki.vim") diff --git a/init.vim b/init.vim deleted file mode 100644 index c9ead8b..0000000 --- a/init.vim +++ /dev/null @@ -1,133 +0,0 @@ -" set the directory where vimrc git project is located -let vimrc_git=$HOME . "/src/vimrc" - -" it is a big fat key, after all -" N.B. should come before plugins and plugin specific settings -let mapleader = "\" - -" source aux files also under git control -let oldwd = getcwd() -exec "cd " . vimrc_git -source plug.vim -source airline.vim -source syntastic.vim -source fzf.vim -source lsp.vim -source mapping.vim -source jsonnet.vim -source nerdtree.vim -source wiki.vim -exec "cd " . oldwd - -" set up a line number on the current line but relative above and below to help -" with motion commands -set number -set relativenumber - -" even with the nice space/tab autodetect, prefer 4 for tab stops -" but let file type specifics override (for instance a setting of 2 for markdown -set tabstop=4 -" default to folding on syntax -set foldmethod=syntax -" disable automatic line breaks, rely on visual wrapping instead -set textwidth=0 -" make white space visible, where that matters -set list! -" except for help -autocmd FileType help setlocal nolist -" set up folding preferences -set fde=1 -" vim's spelling is smart enough for code, to only check comments -set spell -" add a hint for long lines -set colorcolumn=120 -" default to expanding tabs, I'm not insane -set expandtab - -" change buffer behaviors to no longer require changes when hiding a buffer -set hidden - -" look for vimrc in the current director as well as $MYVIMRC -set exrc -" make looking for local changes secure -set secure -" more secure -set modelines=0 -" preserve some context -set scrolloff=3 -" make the cursor a bit easier to follows -set cursorline -" make search work a bit more like tab completion in bash -set incsearch -set wildmode=longest:full -set wildmenu -" line break handling -set linebreak -set showbreak=+ -" always on status line -set laststatus=2 - -" let backspace work more naturally -set backspace=start,indent,eol -" favor modern encoding -set enc=utf-8 -" more readable config for list mode -set listchars+=nbsp:¬,tab:»·,trail:· -set listchars-=eol:$ -" smarter handling of case during search -set ignorecase -set smartcase -" centralize swap to have backup without clutter -set directory=$HOME/.var/nvim/swp// -" and undo -set undofile -set undodir=$HOME/.nvim/undodir -" make pastemode more accessible -set pastetoggle= -" save when moving away -au FocusLost * :wa - -" make sure to set TERM to xterm-256color in terminal program or app -colorscheme breezy -set background=light -set termguicolors - -" ensure autoread works, to detect file changes outside the editor -set autoread -au CursorHold * checktime - -" for gui, make it easier to tell different instances apart -set title - -" keep nvim from resetting font back to default from terminal config -set guicursor= - -set guioptions-=r -set guioptions-=b -set guioptions-=T -set guioptions-=m - -set mouse=nv - -set gfn=FiraCode\ Nerd\ Font\ Mono:h10 -" from https://stackoverflow.com/a/51424640 -let s:fontsize = 10 -function! AdjustFontSize(amount) - let s:fontsize = s:fontsize+a:amount - :execute "set gfn=FiraCode\\ Nerd\\ Font\\ Mono:h" . s:fontsize -endfunction - -noremap :call AdjustFontSize(1) -noremap :call AdjustFontSize(-1) -inoremap :call AdjustFontSize(1)a -inoremap :call AdjustFontSize(-1)a - - -lua << EOF - require('nvim-projectconfig').setup({autocmd=true}) - require("trouble").setup { - -- your configuration comes here - -- or leave it empty to use the default settings - -- refer to the configuration section below - } -EOF diff --git a/lsp.vim b/lsp.vim index c269e14..0c01023 100644 --- a/lsp.vim +++ b/lsp.vim @@ -12,25 +12,6 @@ set shortmess+=c " Recognize slint files autocmd BufEnter *.slint :setlocal filetype=slint -" Configure LSP through rust-tools.nvim plugin. -" rust-tools will configure and enable certain LSP features for us. -" See https://github.com/simrat39/rust-tools.nvim#configuration -lua <", rt.hover_actions.hover_actions, { buffer = bufnr}) - -- Code action groups - vim.keymap.set("n", "a>", rt.code_action_group.code_action_group, { buffer = bufnr}) - end - }, - }, -- rust-analyer options -}) -EOF - " Setup Completion " See https://github.com/hrsh7th/nvim-cmp#basic-configuration lua <', vim.cmd.UndotreeToggle) +-- quickly toggle a left, vsplit for an insanely powerful file explorer +vim.keymap.set('n', '', vim.cmd.NERDTreeToggle) +vim.keymap.set('n', '', vim.cmd.NERDTreeFind) +-- use similar key, esc, to exit terminal mode +vim.cmd("tnoremap ") + +-- Code navigation shortcuts +-- from https://github.com/neovim/nvim-lspconfig/blob/master/test/minimal_init.lua#L34 +vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) +vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) +vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) +vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) +vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) +-- vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) +-- vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) +vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) +end, opts) +vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) +vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) +vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) +vim.keymap.set('n', 'e', vim.diagnostic.open_float, opts) +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) + + +vim.keymap.set('n', 'xx', vim.cmd.TroubleToggle, opts) +vim.keymap.set('n', 'xw', function() + vim.cmd("TroubleToggle workspace_diagnostics") +end, opts) +vim.keymap.set('n', 'xd', function() + vim.cmd("TroubleToggle workspace_diagnostics") +end, opts) +vim.keymap.set('n', 'xq', function() + vim.cmd("TroubleToggle quickfix") +end, opts) +vim.keymap.set('n', 'xl', function() + vim.cmd("TroubleToggle loclist") +end, opts) +-- work with Trouble to view lists of diagnostic warnings/errors + +vim.keymap.set('n', 't', function() + vim.cmd("e ~/Documents/Wiki/tags.md") +end, opts) +vim.keymap.set('n', 'tr', vim.cmd.VimwikiRebuildTags, opts) +vim.keymap.set('n', 'tg', vim.cmd.VimwikiGenerateTagLinks, opts) + +-- TODO translate to lua +--function! VimwikiFindAllIncompleteTasks() +-- lvimgrep /- \[ \]/ * +-- lopen +--endfunction + +--nmap wa :call VimwikiFindAllIncompleteTasks() diff --git a/mapping.vim b/mapping.vim deleted file mode 100644 index 42aad21..0000000 --- a/mapping.vim +++ /dev/null @@ -1,48 +0,0 @@ -" quickly clear Syntastic info -nmap :SyntasticReset -" toggle gundo's display -nmap :UndotreeToggle -" quickly toggle a left, vsplit for an insanely powerful file explorer -nmap :NERDTreeToggle -" open tree to current buffer -nmap :NERDTreeFind -" use similar key, esc, to exit terminal mode -tnoremap - -" from: https://sharksforarms.dev/posts/neovim-rust/ -" Code navigation shortcuts -nnoremap lua vim.lsp.buf.definition() -nnoremap K lua vim.lsp.buf.hover() -nnoremap gD lua vim.lsp.buf.implementation() -nnoremap lua vim.lsp.buf.signature_help() -nnoremap 1gD lua vim.lsp.buf.type_definition() -nnoremap gr lua vim.lsp.buf.references() -nnoremap g0 lua vim.lsp.buf.document_symbol() -nnoremap gW lua vim.lsp.buf.workspace_symbol() -nnoremap gd lua vim.lsp.buf.definition() -nnoremap ga lua vim.lsp.buf.code_action() -nnoremap rn lua vim.lsp.buf.rename() - -" Goto previous/next diagnostic warning/error -nnoremap g[ lua vim.diagnostic.goto_prev() -nnoremap g] lua vim.diagnostic.goto_next() -nnoremap gE lua vim.diagnostic.setloclist() - -" work with Trouble to view lists of diagnostic warnings/errors -nnoremap xx TroubleToggle -nnoremap xw TroubleToggle workspace_diagnostics -nnoremap xd TroubleToggle document_diagnostics -nnoremap xq TroubleToggle quickfix -nnoremap xl TroubleToggle loclist -nnoremap gR TroubleToggle lsp_references - -nnoremap t e ~/Documents/Wiki/tags.md -nnoremap tr VimwikiRebuildTags -nnoremap tg VimwikiGenerateTagLinks - -function! VimwikiFindAllIncompleteTasks() - lvimgrep /- \[ \]/ * - lopen -endfunction - -nmap wa :call VimwikiFindAllIncompleteTasks() diff --git a/plug.lua b/plug.lua new file mode 100644 index 0000000..518c76f --- /dev/null +++ b/plug.lua @@ -0,0 +1,105 @@ +local vim = vim +local Plug = vim.fn['plug#'] + +vim.call('plug#begin') + +-- I try to keep these to a minimum and to understand what each plugin does and +-- adds to my existing(set up. I try to capture the value, at least to me, each +-- plugin adds. I've tried to logically group them, as well, to spot overlap +-- and redundancy. + +-- dynamic font resizing(using ctl and arrow keys +Plug('tenxsoydev/size-matters.nvim') + + +-- informational +-- lightweight but sophisticated status line +Plug('vim-airline/vim-airline') +Plug('vim-airline/vim-airline-themes') +-- visualize vim's undo tree +Plug('mbbill/undotree') +-- diagnostics display +Plug('folke/trouble.nvim') +-- icons for Trouble +Plug('kyazdani42/nvim-web-devicons') + + +-- files, folders, projects, etc. +-- file and dir browser +Plug('preservim/nerdtree') +-- integrate ripgrep, especially to be able to open matches, hugely useful for +-- code aware search +Plug('jremmen/vim-ripgrep') +-- Support for the cd replacement, zoxide +Plug('nanotee/zoxide.vim') +-- taskwarrior +Plug('xarthurx/taskwarrior.vim') +-- Wiki support - my life is in vimwiki +Plug('vimwiki/vimwiki', { ['branch'] = 'dev' }) + + +-- git integration +Plug('tpope/vim-fugitive') +Plug('tpope/vim-rhubarb') +Plug('mhinz/vim-signify') +-- git support for nerdtree +Plug('Xuyuanp/nerdtree-git-plugin') +-- better support for JS +Plug('pangloss/vim-javascript') +-- find, complete, etc. on steroids +-- fast fuzzy finder +Plug('junegunn/fzf', { ['dir'] = '~/.fzf', ['do'] = function() + vim.fn['fzf#install']() +end }) +Plug('junegunn/fzf.vim') +-- auto detect tab and space handling(rather than setting per project +Plug('tpope/vim-sleuth') + + +-- tools - all languages +-- look for .editorconfig(and merge into vim settings +Plug('editorconfig/editorconfig-vim') +-- auto format all the things +Plug('sbdchd/neoformat') +-- load config(from $CWD/.config/init.vim +Plug('windwp/nvim-projectconfig') + +-- Collection of common configurations for the Nvim LSP client +Plug('neovim/nvim-lspconfig') +-- Add commands to add and manage lsp plugins +Plug('williamboman/nvim-lsp-installer') + +-- Completion framework +-- I found these when updating(my lsp configuration and after using the +-- additional sources for a while, find them super useful for general editing +-- too +-- See hrsh7th's other plugins for more completion sources! +Plug('hrsh7th/nvim-cmp') +-- LSP completion source for nvim-cmp +Plug('hrsh7th/cmp-nvim-lsp') +-- Snippet completion source for nvim-cmp +Plug('hrsh7th/cmp-vsnip') +-- Other useful completion sources +Plug('hrsh7th/cmp-path') +Plug('hrsh7th/cmp-buffer') +-- Snippet engine +Plug('hrsh7th/vim-vsnip') + +-- allows other programs and scripts to hook into NeoVim's language server +-- protocol support; adopted as a pre-requisite for prettier integration +Plug('jose-elias-alvarez/null-ls.nvim') + +-- specific languages, programming(and otherwise + +-- support for the Rust programming(language +Plug('rust-lang/rust.vim') +-- handles Rust configuration for LSP +Plug('mrcjkb/rustaceanvim') + +-- support for jsonnet +Plug('google/vim-jsonnet') + +-- nvm to make JS/TS/Node easier to work with +Plug('marene/nvm.vim') + +vim.call('plug#end') diff --git a/plug.vim b/plug.vim deleted file mode 100644 index 3be7332..0000000 --- a/plug.vim +++ /dev/null @@ -1,107 +0,0 @@ -call plug#begin("~/.config/nvim/plugged") -" I try to keep these to a minimum and to understand what each plugin does and -" adds to my existing set up. I try to capture the value, at least to me, each -" plugin adds. I've tried to logically group them, as well, to spot overlap -" and redundancy. -" -Plug 'tenxsoydev/size-matters.nvim' - - -" informational -" lightweight but sophisticated status line -Plug 'vim-airline/vim-airline' -Plug 'vim-airline/vim-airline-themes' -" visualize vim's undo tree -Plug 'mbbill/undotree' -" diagnostics display -Plug 'folke/trouble.nvim' -" icons for Trouble -Plug 'kyazdani42/nvim-web-devicons' - - -" files, folders, projects, etc. -" file and dir browser -Plug 'preservim/nerdtree' -" integrate ripgrep, especially to be able to open matches, hugely useful for -" code aware search -Plug 'jremmen/vim-ripgrep' -" Support for the cd replacement, zoxide -Plug 'nanotee/zoxide.vim' -" taskwarrior -Plug 'xarthurx/taskwarrior.vim' -" Wiki support - my life is in vimwiki -Plug 'vimwiki/vimwiki', { 'branch': 'dev' } - - -" git integration -Plug 'tpope/vim-fugitive' -Plug 'tpope/vim-rhubarb' -Plug 'mhinz/vim-signify' -" git support for nerdtree -Plug 'Xuyuanp/nerdtree-git-plugin' -" better support for JS -Plug 'pangloss/vim-javascript' -" find, complete, etc. on steroids -" fast fuzzy finder -Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } -Plug 'junegunn/fzf.vim' -" auto detect tab and space handling rather than setting per project -Plug 'tpope/vim-sleuth' - - -" tools - all languages -" look for .editorconfig and merge into vim settings -Plug 'editorconfig/editorconfig-vim' -" syntax checking on steroids -Plug 'scrooloose/syntastic' -" auto format all the things -Plug 'sbdchd/neoformat' -" load config from $CWD/.config/init.vim -Plug 'windwp/nvim-projectconfig' - -" Collection of common configurations for the Nvim LSP client -Plug 'neovim/nvim-lspconfig' -" Add commands to add and manage lsp plugins -Plug 'williamboman/nvim-lsp-installer' - -" Completion framework -" I found these when updating my lsp configuration and after using the -" additional sources for a while, find them super useful for general editing -" too -" See hrsh7th's other plugins for more completion sources! -Plug 'hrsh7th/nvim-cmp' -" LSP completion source for nvim-cmp -Plug 'hrsh7th/cmp-nvim-lsp' -" Snippet completion source for nvim-cmp -Plug 'hrsh7th/cmp-vsnip' -" Other useful completion sources -Plug 'hrsh7th/cmp-path' -Plug 'hrsh7th/cmp-buffer' -" Snippet engine -Plug 'hrsh7th/vim-vsnip' - -" allows other programs and scripts to hook into NeoVim's language server -" protocol support; adopted as a pre-requisite for prettier integration -Plug 'jose-elias-alvarez/null-ls.nvim' - -" specific languages, programming and otherwise - -" support for the Rust programming language -Plug 'rust-lang/rust.vim' -" the rest of the rust config came from: https://sharksforarms.dev/posts/neovim-rust/ -" To enable more of the features of rust-analyzer, such as inlay hints and more! -Plug 'simrat39/rust-tools.nvim' - -" support for jsonnet -Plug 'google/vim-jsonnet' - -" groovy syntax and indent -Plug 'vim-scripts/groovy.vim' -Plug 'vim-scripts/groovyindent-unix' - -" nvm to make JS/TS/Node easier to work with -Plug 'marene/nvm.vim' - - -" All of your Plugins must be added before the following line -call plug#end() " required diff --git a/syntastic.vim b/syntastic.vim deleted file mode 100644 index a1530dd..0000000 --- a/syntastic.vim +++ /dev/null @@ -1,11 +0,0 @@ -" configure syntastic, advanced syntax checker, with some reasonable behaviors -" -" always stick detected errors in the location list -let g:syntastic_always_populate_loc_list = 1 -" open but only when errors are detected; default closes when errors are cleared -" but doesn't open the list automatically -let g:syntastic_auto_loc_list = 0 -" check when first opening a file -let g:syntastic_check_on_open = 0 -" don't check on writing and quitting -let g:syntastic_check_on_wq = 0 From 23b07f56d9574d0ece2b6ac65149d514d014e718 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Sun, 23 Jun 2024 10:33:41 -0400 Subject: [PATCH 37/48] Restore breezy theme - Setting background to dark and disabling colorscheme switch based on filetype seems to have resolved the issues. --- init.lua | 2 +- plug.lua | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 48b635d..ef0a44b 100644 --- a/init.lua +++ b/init.lua @@ -97,7 +97,7 @@ end vim.api.nvim_create_autocmd("FocusLost", {pattern = "*", command = "wa"}) -- make sure to set TERM to xterm-256color in terminal program or app -vim.cmd("colorscheme desert") +vim.cmd("colorscheme breezy") vim.opt.background = "dark" vim.opt.termguicolors = true diff --git a/plug.lua b/plug.lua index 518c76f..b9334f7 100644 --- a/plug.lua +++ b/plug.lua @@ -11,6 +11,9 @@ vim.call('plug#begin') -- dynamic font resizing(using ctl and arrow keys Plug('tenxsoydev/size-matters.nvim') +-- custom colorscheme +Plug('fneu/breezy') + -- informational -- lightweight but sophisticated status line From b23fd9b050bac3b0b4b32c5f80cabe63c2f7c593 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Sun, 23 Jun 2024 10:34:51 -0400 Subject: [PATCH 38/48] Remove option missing from neovim --- init.lua | 4 ---- 1 file changed, 4 deletions(-) diff --git a/init.lua b/init.lua index ef0a44b..346fe0c 100644 --- a/init.lua +++ b/init.lua @@ -88,10 +88,6 @@ vim.opt.directory = os.getenv("HOME") .. "/.var/nvim/swp//" -- and undo vim.opt.undofile = true vim.opt.undodir = os.getenv("HOME") .. "/.nvim/undodir" -if not vim.fn.has('macunix') then - -- make pastemode more accessible - vim.opt.pastetoggle = "" -end -- save when moving away vim.api.nvim_create_autocmd("FocusLost", {pattern = "*", command = "wa"}) From 5e5dd9e4d209e59ad22ec532c27e83bd887e30b2 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Sun, 23 Jun 2024 10:35:09 -0400 Subject: [PATCH 39/48] Fix Os detection --- init.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 346fe0c..9ea6bb9 100644 --- a/init.lua +++ b/init.lua @@ -120,15 +120,14 @@ vim.g.guioptions = guiopts vim.opt.mouse = "nv" -if vim.fn.has('macunix') then - vim.opt.gfn = "FiraCode Nerd Font Mono:h16" -else +if vim.loop.os_uname().sysname == 'Linux' then vim.opt.gfn = "FiraCode Nerd Font Mono:h12" + require('nvim-projectconfig').setup({autocmd=true}) +else + vim.opt.gfn = "FiraCode Nerd Font Mono:h16" + require('nvim-projectconfig').setup() end -if not vim.fn.has('macunix') then - require('nvim-projectconfig').setup({autocmd=true}) -end require("trouble").setup { -- your configuration comes here -- or leave it empty to use the default settings From 994f52bd50e8ad1bff42e545e0b14f10e2bdad9d Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Sun, 23 Jun 2024 11:10:23 -0400 Subject: [PATCH 40/48] Set matching airline theme --- init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 9ea6bb9..8fb18f5 100644 --- a/init.lua +++ b/init.lua @@ -93,9 +93,10 @@ vim.opt.undodir = os.getenv("HOME") .. "/.nvim/undodir" vim.api.nvim_create_autocmd("FocusLost", {pattern = "*", command = "wa"}) -- make sure to set TERM to xterm-256color in terminal program or app -vim.cmd("colorscheme breezy") vim.opt.background = "dark" vim.opt.termguicolors = true +vim.cmd("colorscheme breezy") +vim.g.airline_theme = "breezy" -- ensure autoread works, to detect file changes outside the editor vim.opt.autoread = true From b135ce095b1eebbebdded42d7714aa5a27eb9a62 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Mon, 24 Jun 2024 10:27:53 -0400 Subject: [PATCH 41/48] Add project files - text.lua for markdown focused projects like personal wiki, diary - leptos.lua for Rust projects using leptos, to set some rust-analyzer settings that help with with conditional compilation used by cargo-leptos --- projects/leptos.lua | 18 ++++++++++++++++++ projects/text.lua | 3 +++ 2 files changed, 21 insertions(+) create mode 100644 projects/leptos.lua create mode 100644 projects/text.lua diff --git a/projects/leptos.lua b/projects/leptos.lua new file mode 100644 index 0000000..6c13efa --- /dev/null +++ b/projects/leptos.lua @@ -0,0 +1,18 @@ +vim.g.rustaceanvim = { + server = { + default_settings = { + ['rust-analyzer'] = { + cargo = { + features = { + "ssr" + }, + }, + rustfmt = { + overrideCommand = { + "leptosfmt", "--stdin", "--rustfmt" + }, + }, + }, + }, + }, +} diff --git a/projects/text.lua b/projects/text.lua new file mode 100644 index 0000000..5b75d71 --- /dev/null +++ b/projects/text.lua @@ -0,0 +1,3 @@ +vim.cmd('colorscheme quiet') +vim.opt.background = "light" +vim.opt.termguicolors = true From 12437b5bcd7093d3271399eb5d5fbfa997e84ca8 Mon Sep 17 00:00:00 2001 From: thomas-gideon-gm Date: Thu, 27 Jun 2024 16:35:56 -0400 Subject: [PATCH 42/48] Adjust key map settings --- init.lua | 3 ++- mapping.lua | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 8fb18f5..ade4c8f 100644 --- a/init.lua +++ b/init.lua @@ -20,6 +20,7 @@ end -- set up a line number on the current line but relative above and below to -- help with motion commands vim.opt.number = true +vim.opt.numberwidth = 2 vim.opt.relativenumber = true -- even with the nice space/tab autodetect, prefer 4 for tab stops but let file @@ -54,7 +55,7 @@ vim.opt.expandtab = true vim.opt.hidden = true -- look for vimrc in the current directory as well as $MYVIMRC --- e.g. place .nvim.lua at the root of a project directory for project specific settings +-- e.g. place .init.lua at the root of a project directory for project specific settings vim.opt.exrc = true -- make looking for local changes secure vim.opt.secure = true diff --git a/mapping.lua b/mapping.lua index 6325a4e..c6ad473 100644 --- a/mapping.lua +++ b/mapping.lua @@ -1,3 +1,17 @@ +-- from: https://sharksforarms.dev/posts/neovim-rust/ +-- Set completeopt to have a better completion experience +-- :help completeopt +-- menuone: popup even when there's only one match +-- noinsert: Do not insert text until a selection is made +-- noselect: Do not select, force user to select one from the menu +vim.opt.completeopt = "menuone,noinsert,noselect" + +-- Avoid showing extra messages when using completion +vim.opt.shortmess:append('c') + +-- extend timeout to allow time for three character shortcuts +vim.opt.timeoutlen = 1400 + local bufnr = vim.api.nvim_get_current_buf() local opts = { buffer = bufnr, noremap = true, silent = true } @@ -23,7 +37,7 @@ vim.keymap.set('n', 'wl', function() end, opts) vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) -vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) +vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) vim.keymap.set('n', 'e', vim.diagnostic.open_float, opts) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) From 22acd8bb5b76f8950042211a7f1921d7e7eb8c46 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Sat, 29 Jun 2024 09:50:52 -0400 Subject: [PATCH 43/48] Adjust package path To support using require() for settings converted to lua modules --- init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index ade4c8f..d744329 100644 --- a/init.lua +++ b/init.lua @@ -1,13 +1,17 @@ local vimrc_git = os.getenv("HOME") .. "/src/vimrc" +-- add to package path to allow use of require() for lua modules +package.path = string.format("%s;%s?.lua", package.path, vimrc_git.."/") -- it is a big fat key, after all -- N.B. should come before plugins and plugin specific settings vim.g.mapleader = ' ' -vim.cmd("source " .. vimrc_git .. "/plug.lua") +require("plug") +--vim.cmd("source " .. vimrc_git .. "/plug.lua") vim.cmd("source " .. vimrc_git .. "/airline.vim") vim.cmd("source " .. vimrc_git .. "/lsp.vim") -vim.cmd("source " .. vimrc_git .. "/mapping.lua") +require("mapping") +--vim.cmd("source " .. vimrc_git .. "/mapping.lua") vim.cmd("source " .. vimrc_git .. "/fzf.vim") vim.cmd("source " .. vimrc_git .. "/jsonnet.vim") vim.cmd("source " .. vimrc_git .. "/nerdtree.vim") From 372846fa2f5702ee800cb2820a302213d3dd3f8b Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Fri, 9 Aug 2024 08:27:28 -0400 Subject: [PATCH 44/48] Improve handling of leader init keymaps --- mapping.lua | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/mapping.lua b/mapping.lua index c6ad473..042bfcf 100644 --- a/mapping.lua +++ b/mapping.lua @@ -10,7 +10,7 @@ vim.opt.completeopt = "menuone,noinsert,noselect" vim.opt.shortmess:append('c') -- extend timeout to allow time for three character shortcuts -vim.opt.timeoutlen = 1400 +vim.opt.timeoutlen = 2500 local bufnr = vim.api.nvim_get_current_buf() local opts = { buffer = bufnr, noremap = true, silent = true } @@ -32,38 +32,38 @@ vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) -- vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) -- vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) -vim.keymap.set('n', 'wl', function() +vim.keymap.set('n', 'wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, opts) -vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) -vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) -vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) -vim.keymap.set('n', 'e', vim.diagnostic.open_float, opts) +vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) +vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) +vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) +vim.keymap.set('n', 'e', vim.diagnostic.open_float, opts) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) -vim.keymap.set('n', 'xx', vim.cmd.TroubleToggle, opts) -vim.keymap.set('n', 'xw', function() +vim.keymap.set('n', 'xx', vim.cmd.TroubleToggle, opts) +vim.keymap.set('n', 'xw', function() vim.cmd("TroubleToggle workspace_diagnostics") end, opts) -vim.keymap.set('n', 'xd', function() +vim.keymap.set('n', 'xd', function() vim.cmd("TroubleToggle workspace_diagnostics") end, opts) -vim.keymap.set('n', 'xq', function() +vim.keymap.set('n', 'xq', function() vim.cmd("TroubleToggle quickfix") end, opts) -vim.keymap.set('n', 'xl', function() +vim.keymap.set('n', 'xl', function() vim.cmd("TroubleToggle loclist") end, opts) -- work with Trouble to view lists of diagnostic warnings/errors -vim.keymap.set('n', 't', function() +vim.keymap.set('n', 'wt', function() vim.cmd("e ~/Documents/Wiki/tags.md") end, opts) -vim.keymap.set('n', 'tr', vim.cmd.VimwikiRebuildTags, opts) -vim.keymap.set('n', 'tg', vim.cmd.VimwikiGenerateTagLinks, opts) +vim.keymap.set('n', 'tr', vim.cmd.VimwikiRebuildTags, opts) +vim.keymap.set('n', 'tg', vim.cmd.VimwikiGenerateTagLinks, opts) -- TODO translate to lua --function! VimwikiFindAllIncompleteTasks() From 5025818b98c9aff2c24494c8af8c8eb4384a8fb1 Mon Sep 17 00:00:00 2001 From: thomas-gideon-gm Date: Fri, 23 Aug 2024 13:57:10 -0400 Subject: [PATCH 45/48] Fix leader binding --- mapping.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/mapping.lua b/mapping.lua index 042bfcf..894a9c9 100644 --- a/mapping.lua +++ b/mapping.lua @@ -12,8 +12,7 @@ vim.opt.shortmess:append('c') -- extend timeout to allow time for three character shortcuts vim.opt.timeoutlen = 2500 -local bufnr = vim.api.nvim_get_current_buf() -local opts = { buffer = bufnr, noremap = true, silent = true } +local opts = { noremap = true, silent = true } -- toggle gundo's display vim.keymap.set('n', '', vim.cmd.UndotreeToggle) @@ -25,23 +24,24 @@ vim.cmd("tnoremap ") -- Code navigation shortcuts -- from https://github.com/neovim/nvim-lspconfig/blob/master/test/minimal_init.lua#L34 -vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) -vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) -vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) -vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) -vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) +vim.keymap.set('n', 'ga', vim.lsp.buf.code_action) +vim.keymap.set('n', 'gD', vim.lsp.buf.declaration) +vim.keymap.set('n', 'gd', vim.lsp.buf.definition) +vim.keymap.set('n', 'K', vim.lsp.buf.hover) +vim.keymap.set('n', 'gi', vim.lsp.buf.implementation) +vim.keymap.set('n', '', vim.lsp.buf.signature_help) -- vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) -- vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) vim.keymap.set('n', 'wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, opts) -vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) -vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) -vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) -vim.keymap.set('n', 'e', vim.diagnostic.open_float, opts) +vim.keymap.set('n', 'D', vim.lsp.buf.type_definition) +vim.keymap.set('n', 'nr', vim.lsp.buf.rename) +vim.keymap.set('n', 'gr', vim.lsp.buf.references) +vim.keymap.set('n', 'e', vim.diagnostic.open_float) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist) vim.keymap.set('n', 'xx', vim.cmd.TroubleToggle, opts) From 6f99625cba0efe82ada7c7b5ac8af4a67152de20 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Wed, 11 Sep 2024 08:26:16 -0400 Subject: [PATCH 46/48] Migrate setting for upgraded plugin --- lsp.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lsp.vim b/lsp.vim index 0c01023..8e1bc37 100644 --- a/lsp.vim +++ b/lsp.vim @@ -79,7 +79,7 @@ lspconfig.denols.setup { } } -lspconfig.tsserver.setup { +lspconfig.ts_ls.setup { on_attach = on_attach, root_dir = util.root_pattern("package.json"), single_file_support = false From d6528e1d11900979a86882a12321f1b25325f82e Mon Sep 17 00:00:00 2001 From: thomas-gideon-gm Date: Wed, 2 Oct 2024 14:51:09 -0400 Subject: [PATCH 47/48] Make LSP diagnostics less intrusive --- lsp.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lsp.vim b/lsp.vim index 8e1bc37..7f31104 100644 --- a/lsp.vim +++ b/lsp.vim @@ -51,7 +51,7 @@ EOF " Set updatetime for CursorHold " ms of no cursor movement to trigger CursorHold -set updatetime=750 +set updatetime=3000 " Show diagnostic popup on cursor hold autocmd CursorHold * lua vim.diagnostic.open_float() " have a fixed column for the diagnostics to appear in From 615b221d6165fad70af0849033c64b2efefe75e3 Mon Sep 17 00:00:00 2001 From: thomas-gideon-gm Date: Wed, 15 Jan 2025 11:17:50 -0500 Subject: [PATCH 48/48] chore: Use different wiki path on mac --- wiki.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wiki.vim b/wiki.vim index cbad8a3..4fcabf7 100644 --- a/wiki.vim +++ b/wiki.vim @@ -1,4 +1,8 @@ " override the default location of vimwiki and change to markdown -let g:vimwiki_list = [{'path': '~/Documents/Wiki', 'syntax': 'markdown', 'ext': '.md'}] +if has('macunix') + let g:vimwiki_list = [{'path': '~/Personal Documents/Wiki', 'syntax': 'markdown', 'ext': '.md'}] +else + let g:vimwiki_list = [{'path': '~/Documents/Wiki', 'syntax': 'markdown', 'ext': '.md'}] +endif let g:vimwiki_dir_link = 'index' let g:vimwiki_global_ext = 0