summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2023-01-31 23:45:53 +0000
committerJosh Rahm <rahm@google.com>2023-01-31 23:45:53 +0000
commit9f55dc011912dfc93c517434ed8ab123634ef9a7 (patch)
treeb69ade51e83d4c69a88c3b3798fc7f5516c2283b
parent44153f8f8a0303f79ca3e4e04496610f830214e6 (diff)
downloadconfig.vim-9f55dc011912dfc93c517434ed8ab123634ef9a7.tar.gz
config.vim-9f55dc011912dfc93c517434ed8ab123634ef9a7.tar.bz2
config.vim-9f55dc011912dfc93c517434ed8ab123634ef9a7.zip
Add support for fancycolorcol
-rw-r--r--init.vim31
1 files changed, 22 insertions, 9 deletions
diff --git a/init.vim b/init.vim
index 3be0235..c53d899 100644
--- a/init.vim
+++ b/init.vim
@@ -99,10 +99,12 @@ inoremap <C-+> <Plug>(vsnip-expand)
" to the leftmost position.
noremap ^ ^zH
+noremap <leader>t <cmd>TroubleToggle<cr>
+
augroup InitVim
au!
- autocmd BufRead *.java,*.c,*.cpp,*.cxx TSBufEnable highlight
+ autocmd BufRead *.java,*.c,*.cpp,*.cxx,*.hs TSBufEnable highlight
" Automatically start insert mode when opening a new terminal.
autocmd TermOpen * startinsert
@@ -117,7 +119,9 @@ augroup InitVim
\ { higroup = "IncSearch", timeout = 100 });
augroup END
-" Local configuration that can be set by hostname or just a local
+" Local configuration that can be set by hostname or just a local configuration.
+" Local files are ignored by .gitignore so they won't be added to the repo,
+" allowing local (*cough* work) configuration to be separate from general
" configuration.
if isdirectory(printf('%s/.config/nvim/%s', $HOME, hostname))
@@ -146,18 +150,27 @@ noremap <C-w>. <cmd>lua require('windownav').goto_terminal()<cr>
noremap <C-w>I <cmd>lua require('windownav').goto_initvim()<cr>
noremap <C-w>' <cmd>lua require('windownav').goto_lastwin()<cr>
+set textwidth=80
+set colorcolumn=+1
if has('rneovim')
- hi ColorColumn guifg=#3a3a3a guibg=none gui=None
+ function! HighlightColorColumns() abort
+ hi MyColorColumn guifg=#3a3a3a guibg=none gui=None
+ hi MyRedColorColumn guifg=#5a1a1a guibg=none gui=None
+ endfunction
+ call HighlightColorColumns()
" This is my patched version of neovim.
- set fillchars+=colorcol:│
+ if has('fancycolorcol')
+ set colorcolumn=+1/│/MyColorColumn/b,+20/│/MyRedColorColumn/
+ else
+ hi! link ColorColumn MyColorColumn
+ set fillchars+=colorcol:│
+ endif
+
augroup InitVim
- au ColorScheme * hi ColorColumn guifg=#3a3a3a guibg=none gui=None
+ au ColorScheme * call HighlightColorColumns()
augroup END
endif
-set colorcolumn=81
-set textwidth=80
-
" Opens a terminal in the directory of the current file.
command! TERM exec "term sh -c 'cd " . expand('%:p:h') . " && exec $SHELL'"
@@ -205,7 +218,7 @@ lua << EOF
-- for example, context is off by default, use this to turn it on
show_current_context = true,
show_current_context_start = faels,
- char_highlight_list = { "ColorColumn" }
+ char_highlight_list = { "MyColorColumn" }
}
require('aerial').setup({