diff --git a/.vim/colors/campo-dark-blue.vim b/.vim/colors/campo-dark-blue.vim index d9f1db7..13d1ec4 100644 --- a/.vim/colors/campo-dark-blue.vim +++ b/.vim/colors/campo-dark-blue.vim @@ -15,29 +15,32 @@ endif set background=dark hi clear -syntax reset +if exists("syntax_on") + syntax reset +endif source $HOME/.vim/colors/utils let g:colors_name = "campo-dark-blue" " Shared colors -let s:blue = "3699cc" -let s:purple = "ce93d8" -let s:grey = "b0bec5" -let s:orange = "ffb74d" -let s:yellow = "fff176" -let s:green = "88b888" -let s:red = "ef2929" -let s:text = "f1f1e8" " A majority of the syntax will use this. -let s:bg = "072730" -let s:select = "546e8f" -let s:window = "37474f" -let s:comment = "5dea82" -let s:tab = "03404a" -let s:error = "e40e0e" -let s:proc = "0eefcb" -let s:warn = "dcd53e" -let s:spell = "aaf53e" +let s:blue = "3699cc" +let s:purple = "ce93d8" +let s:grey = "b0bec5" +let s:orange = "ffb74d" +let s:yellow = "fff176" +let s:green = "88b888" +let s:red = "ef2929" +let s:text = "f1f1e8" " A majority of the syntax will use this. +let s:bg = "072730" +let s:select = "546e8f" +let s:window = "37474f" +let s:comment = "5dea82" +let s:annotated_note = "8dea82" +let s:tab = "03404a" +let s:error = "e40e0e" +let s:proc = "0eefcb" +let s:warn = "dcd53e" +let s:spell = "aaf53e" " Vim call X("Normal", s:text, s:bg, "") @@ -83,7 +86,7 @@ call X("Identifier", s:grey, "", "none") call X("Statement", s:text, "", "") " 'return', 'goto', 'case', 'break', etc call X("Conditional", s:text, "", "") call X("Repeat", s:text, "", "") " 'for' and 'while' -call X("Structure", "ae90ea", "", "") +call X("Structure", "ae90ea", "", "") " enum, struct, union call X("Function", s:proc, "", "") call X("Constant", s:text, "", "") " Constants, e.g. SOME_CONST call X("Boolean", s:text, "", "") " true, false @@ -96,11 +99,12 @@ call X("Define", "a5bce4", "", "none") call X("Include", s:text, "", "") " #include in C/C++ call X("Number", s:text, "", "") -" Notes -call X("Todo", "b8fbb0", s:bg, "underline") -call X("Bugs", "d8fbb0", s:bg, "standout") -call X("Notes", "ffffff", s:bg, "standout") -call X("Notices", s:warn, s:bg, "bold") +" Notes and annotated comment text +call X("MyTitle", s:text, "", "bold") " // # Some Title +call X("MyAnnotatedNote", s:text, "", "bold") " // @incomplete +call X("MyNote", s:annotated_note, "", "standout") " // NOTE:, IDEA:, TODO: +call X("MyEmphasis", s:yellow, "", "bold") " // WARNING:, IMPORTANT: +call X("MyBug", s:red, "", "standout") " // FIXME:, BUG:, DEPRECATED: " Build markers call X("BuildError", s:error, s:bg, "bold") @@ -123,31 +127,6 @@ call X("cStorageClass", s:text, "", "") call X("cConditional", s:text, "", "") call X("cRepeat", s:text, "", "") -" Python Highlighting -call X("pythonInclude", s:red, "", "") -call X("pythonStatement", s:blue, "", "") -call X("pythonConditional", s:purple, "", "") -call X("pythonRepeat", s:purple, "", "") -call X("pythonException", s:purple, "", "") -call X("pythonFunction", s:proc, "", "") -call X("pythonSelf", s:grey, "", "") -call X("pythonOperator", s:purple, "", "") -call X("pythonExtraOperator", s:purple, "", "") -call X("pythonClass", s:proc, "", "") -call X("pythonDecorator", s:orange, "", "") -call X("pythonDocstring", s:comment, "", "") -call X("pythonBuiltinObj", s:yellow, "", "") -call X("pythonBuiltinType", s:orange, "", "") -call X("pythonNumber", s:orange, "", "") - -" JS Highlighting -call X("javaScriptBraces", s:text, "", "") -call X("javaScriptFunction", s:purple, "", "") -call X("javaScriptConditional", s:purple, "", "") -call X("javaScriptRepeat", s:purple, "", "") -call X("javaScriptNumber", s:orange, "", "") -call X("javaScriptMember", s:orange, "", "") - " HTML Highlighting call X("htmlTag", s:text, "", "") call X("htmlTagName", s:text, "", "") diff --git a/.vim/colors/campo-dark-greenish.vim b/.vim/colors/campo-dark-greenish.vim index c2d509e..fbbb934 100644 --- a/.vim/colors/campo-dark-greenish.vim +++ b/.vim/colors/campo-dark-greenish.vim @@ -5,6 +5,8 @@ " The theme file original copied from the Tomorrow theme. " See https://github.com/chriskempson/vim-tomorrow-theme.git for it. " Hex color conversion functions borrowed from the theme "Desert256". +" +" @todo convert to new format (see campo-dark-blue.vim) if has('termguicolors') " Supports 24-bit color range diff --git a/.vim/colors/campo-dark-grey-blue.vim b/.vim/colors/campo-dark-grey-blue.vim index bf5b606..06eb251 100644 --- a/.vim/colors/campo-dark-grey-blue.vim +++ b/.vim/colors/campo-dark-grey-blue.vim @@ -7,7 +7,8 @@ " Hex color conversion functions borrowed from the theme "Desert256". " @TODO port these colors over to a copy of campo-dark-greyscale so that I -" have better control over the C syntax highlighting. +" have better control over the C syntax highlighting. And use the improved +" format used in campo-dark-blue.vim if has('termguicolors') diff --git a/.vim/colors/campo-dark-greyscale.vim b/.vim/colors/campo-dark-greyscale.vim index d9b8547..b967668 100644 --- a/.vim/colors/campo-dark-greyscale.vim +++ b/.vim/colors/campo-dark-greyscale.vim @@ -3,6 +3,8 @@ " Version: 1.0 " " Hex color conversion functions borrowed from the theme "Desert256". +" +" @todo convert to new format (see campo-dark-blue.vim) if has('termguicolors') " Supports 24-bit color range diff --git a/.vim/colors/campo-light-greyscale.vim b/.vim/colors/campo-light-greyscale.vim index 3e6631d..9fb47fa 100644 --- a/.vim/colors/campo-light-greyscale.vim +++ b/.vim/colors/campo-light-greyscale.vim @@ -1,6 +1,7 @@ " A very simple light colorscheme. " Maintainer: Michael Campagnaro " Version: 1.0 +" if has('termguicolors') " Supports 24-bit color range diff --git a/.vim/colors/campo-light.vim b/.vim/colors/campo-light.vim index cd4381b..4d1f2b3 100644 --- a/.vim/colors/campo-light.vim +++ b/.vim/colors/campo-light.vim @@ -5,6 +5,8 @@ " The theme file original copied from the Tomorrow theme. " See https://github.com/chriskempson/vim-tomorrow-theme.git for it. " Hex color conversion functions borrowed from the theme "Desert256". +" +" @todo convert to new format (see campo-dark-blue.vim) let g:campo_theme_use_rainbow_parens = 1 @@ -13,7 +15,7 @@ let s:foreground = "263238" let s:background = "fbfbfb" let s:selection = "e3fc8d" let s:line = "d5d5d5" -let s:comment = "7c7c7c" +let s:comment = "4c4c4c" let s:red = "d62a28" let s:orange = "ff7800" let s:yellow = "eab700" @@ -294,13 +296,14 @@ if has("gui_running") || &t_Co == 88 || &t_Co == 256 call X("Number", s:black, "", "") "call X("Ignore", "666666", "", "") - " Custom TODO/NOTE colors - call X("Todo", s:red, s:background, "underline") - call X("Bugs", s:red, s:background, "standout") - call X("Notes","666666", "ffffff","bold") - call X("Notices","dcd53e",s:background,"bold") - call X("ErrorMsg", s:error_msg_foreground, s:error_msg_background, "underline") + " Notes and annotated comment text + call X("MyTitle", s:foreground, "", "bold") " // # Some Title + call X("MyAnnotatedNote", s:foreground, "", "bold") " // @incomplete + call X("MyNote", "", s:black, "standout") " // NOTE:, IDEA:, TODO: + call X("MyEmphasis", s:orange, "", "bold,standout") " // WARNING:, IMPORTANT: + call X("MyBug", s:red, "", "standout") " // FIXME:, BUG:, DEPRECATED: + call X("ErrorMsg", s:error_msg_foreground, s:error_msg_background, "underline") " Vim Highlighting call X("vimCommand", s:blue, "", "none") diff --git a/.vimrc b/.vimrc index 0185072..c804645 100644 --- a/.vimrc +++ b/.vimrc @@ -13,7 +13,9 @@ " @incomplete Add setup steps (plugins, cache setup, search tool, etc). "----------------------------------------------------------------------------------------------------------------------- -let g:campo_vimrc_initialized = 0 " Will be set to 1 at the end of the file. Can be used to avoid changes on subsequent vimrc reloads. +if !exists("g:campo_vimrc_initialized") + let g:campo_vimrc_initialized = 0 " Will be set to 1 at the end of the file. Can be used to avoid changes on subsequent vimrc reloads. +endif scriptencoding utf-8 " @note If the file contains a BOM then vim will automatically set `bomb` for the buffer so that the BOM is written out again. @@ -86,7 +88,6 @@ let g:quickfix_pane_height = 20 let g:campo_light_dark_mode = 'dark' " Start vim with the dark theme. Set to 'light' for the light theme. let g:campo_dark_theme = 'campo-dark-simple' "'campo-dark-blue' let g:campo_light_theme = 'campo-light-simple' "'campo-light' -let g:campo_theme_use_rainbow_parens = 1 "################################################################################## @@ -256,7 +257,6 @@ endif " COLORS "################################################################################## -Plug 'luochen1990/rainbow', { 'commit': '1c45e0f' } " Rainbow parens. Locked to an older commit that still works fine on my PC. Plug 'vim-airline/vim-airline-themes' if IsWindows() @@ -287,7 +287,6 @@ Plug 'tpope/vim-markdown' " Markdown call plug#end() filetype plugin indent on - "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| " #2 BASE CONFIG @@ -375,7 +374,11 @@ set complete+=kspell " Spell checking autocomplete. set complete-=i " Don't scan all included files since it's really slow. set termguicolors -syntax on " Enable highlighting for syntax + +" Disabled this because it clears my custom syntax highlights (see campoSyntax augroup) +" when the vimrc file is resourced. I guess I don't need to set this to have +" syntax highlighting. It's probably being enabled by a plugin. +"set syntax on set wildmenu set wildmode=longest,list,full @@ -393,11 +396,10 @@ set listchars=tab:»\ ,trail:·,extends:>,precedes:<,nbsp:+ set timeoutlen=250 ttimeoutlen=0 " Don't set it too low otherwise you won't be able to type use multi-key sequences. -" @fixme might be broken if lowered to 100 from original value of 4000. Will -" first try 500 and tweak from there. -" UPDATE: I lowered this to 250 and eventually started seeing some plugin -" errors related to paren formatting. I think 800 might be the sweet spot. -set updatetime=800 " I lowered this to make git-gutter updates faster. +" Keeping this a bit low to make git-gutter updates faster. The original value +" was 4000. I tried 250 and eventually started seeing some plugin errors +" related to paren formatting. 800 seems to be the sweet spot. +set updatetime=800 " Fix vim's background colour erase - http://snk.tuxfamily.org/log/vim-256color-bce.html if &term =~ '256color' @@ -476,7 +478,7 @@ augroup campoCmds " @fixme Reload lvimrc after sourcing this file on a save. I tried calling " a function that does the source and a call to lvimrc's API but got an " error complaining that the function cannot be created while it's in use. - autocmd BufWritePost .vimrc silent! source $MYVIMRC + autocmd BufWritePost $MYVIMRC silent! source $MYVIMRC autocmd BufWritePost *.vim silent! source $MYVIMRC autocmd BufWritePost ~/.vimrc.private silent! source $MYVIMRC autocmd BufWritePost ~/.vimrc_templates.private silent! source $MYVIMRC @@ -965,41 +967,6 @@ let g:clojure_fuzzy_indent_blacklist = ['-fn$', '\v^with-%(meta|out-str|loading- "################################################################################## "let g:rustfmt_autosave = 1 " auto run rust formatter when saving -"################################################################################## -" RAINBOW -"################################################################################## -let g:rainbow_active = 1 " Always on -let s:light_rainbow = ['red', 'green', 'magenta', 'cyan', 'yellow', 'white', 'gray', 'blue'] -let s:dark_rainbow = ['darkblue', 'red', 'black', 'darkgreen', 'darkyellow', 'darkred', 'darkgray'] -let s:rainbow_theme = g:campo_light_dark_mode - -fu! UpdateRainbowConf() - let g:rainbow_conf = { - \ 'ctermfgs': (s:rainbow_theme == "light"? s:dark_rainbow : s:light_rainbow) - \} -"\ 'separately': { -"\ '*': 0, " Disable all -"\ 'c++': {} " Only enable c++ -"\ } -endfu - -call UpdateRainbowConf() - -fu! ReloadRainbow() - if g:campo_theme_use_rainbow_parens - if exists(':RainbowToggle') - call UpdateRainbowConf() - call rainbow#clear() | call rainbow#hook() - endif - else - let g:rainbow_active = 0 - if exists(':RainbowToggle') - call UpdateRainbowConf() - call rainbow#clear() - endif - endif -endfu - "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| @@ -1012,8 +979,25 @@ endfu " COLORS "########################################################################### -exec "autocmd ColorScheme " . g:campo_dark_theme . " call ReloadRainbow()" -exec "autocmd ColorScheme " . g:campo_light_theme . " call ReloadRainbow()" +" Custom notes highlights. These are used in my color schemes. +" +" @incomplete I can't get these to only match in comments. Not a big deal but +" would be nice to fix. +augroup campoSyntax + autocmd! + + autocmd Syntax * syntax match MyAnnotatedNote /@\S\+/ containedin=.*Comment,vimCommentTitle display + autocmd Syntax * syntax match MyTitle /#\+ .\+$/ containedin=.*Comment,vimCommentTitle display + autocmd Syntax * syntax match MyNote /\v<(NOTE|IDEA|TODO):/ containedin=.*Comment,vimCommentTitle display + autocmd Syntax * syntax match MyEmphasis /\v<(WARNING|IMPORTANT):/ containedin=.*Comment,vimCommentTitle display + autocmd Syntax * syntax match MyBug /\v<(FIXME|BUG|DEPRECATED):/ containedin=.*Comment,vimCommentTitle display + + highlight link MyAnnotatedNote CampoAnnotatedNote + highlight link MyTitle CampoTitle + highlight link MyNote CampoNote + highlight link MyEmphasis CampoEmphasis + highlight link MyBug CampoBug +augroup END " Toggle between light and dark themes. noremap l :call ToggleLightDarkTheme() @@ -1030,18 +1014,13 @@ endfu fu! ChangeLightDarkMode(mode, onlySetTheme) if a:mode == 'light' - let s:rainbow_theme = 'light' let s:theme = g:campo_light_theme exe 'colorscheme ' . s:theme set background=light else - let s:rainbow_theme = 'dark' let s:theme = g:campo_dark_theme - " We have to set the theme twice in order to get its correct dark-theme colors. - " Weird stuff. exe 'colorscheme ' . s:theme set background=dark - exe 'colorscheme ' . s:theme endif let s:current_light_dark_mode = a:mode @@ -1070,51 +1049,6 @@ endfu command -nargs=0 EditColorScheme call EditColorScheme() -"################################################################################## -" HIGHLIGHTS - TODO, NOTE, FIXME, etc -"################################################################################## - -" NOTE: These depend on custom color names (Bugs, Notes and Notices) defined -" in the campo color themes. Since most themes won't define these, you can -" use WildMenu as substitution. -" -" FIXME: the custom Bugs, Notes and Notices highlighting for campo-light isn't -" working... - -augroup vimrc_bugs - autocmd! - autocmd Syntax * syn match MyBugs /\v<(FIXME|BUG|DEPRECATED):/ - \ containedin=.*Comment,vimCommentTitle -augroup END -hi def link MyBugs Bugs - -augroup vimrc_notes - autocmd! - autocmd Syntax * syn match MyNotes /\v<(IDEA|NOTE|QUESTION|WARNING|IMPORTANT):/ - \ containedin=.*Comment,vimCommentTitle -augroup END -hi def link MyNotes Notes - -augroup vimrc_notices - autocmd! - autocmd Syntax * syn match MyNotices /\v<(WARNING|IMPORTANT):/ - \ containedin=.*Comment,vimCommentTitle -augroup END -hi def link MyNotices Notices - -augroup vimrc_annotated_todo - autocmd! - " This was a major pain in the ass to get working... - autocmd Syntax * syn match cTodo /@\S\+/ - \ containedin=.*Comment,vimCommentTitle -augroup END - -augroup vimrc_annotated_notes - autocmd! - autocmd Syntax * syn match cTodo /#\+ .\+$/ - \ containedin=.*Comment,vimCommentTitle -augroup END - "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| "|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||