Compare commits
2 Commits
78fd8f6d45
...
2640761dc5
Author | SHA1 | Date | |
---|---|---|---|
2640761dc5 | |||
0227534656 |
127
vimrc
127
vimrc
|
@ -15,6 +15,8 @@
|
||||||
"
|
"
|
||||||
"###################################################################################################
|
"###################################################################################################
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
scriptencoding utf-8
|
scriptencoding utf-8
|
||||||
" @note If the file contains a BOM then vim will automatically set `bomb` for
|
" @note If the file contains a BOM then vim will automatically set `bomb` for
|
||||||
" the buffer so that the BOM is written out again.
|
" the buffer so that the BOM is written out again.
|
||||||
|
@ -62,24 +64,25 @@ endfunction
|
||||||
" file in the root folder that you want it applied to.
|
" file in the root folder that you want it applied to.
|
||||||
"
|
"
|
||||||
" Some variables cannot be customized in an .lvimrc because their value is used
|
" Some variables cannot be customized in an .lvimrc because their value is used
|
||||||
" by settings in this file when it's sourced. These have been flagged with a note.
|
" by settings in this file when it's sourced. These have been flagged with the
|
||||||
|
" note :unsupported-in-lvimrc.
|
||||||
"
|
"
|
||||||
" Also take note that an .lvimrc has precedence because it's loaded after this
|
" Also take note that an .lvimrc has precedence because it's loaded after this
|
||||||
" and the private vimrc.
|
" and the private vimrc.
|
||||||
|
|
||||||
" --------------------------------------------------------------------------------------------------
|
" --------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
" @note unsupported in lvimrc
|
" @note :unsupported-in-lvimrc
|
||||||
let g:campo_max_line_length = 120 " Display a vertical bar at x=<n>.
|
let g:campo_max_line_length = 120 " Display a vertical bar at x=<n>.
|
||||||
|
|
||||||
" Set the row height of the quickfix pane, which is used to display results
|
" Set the row height of the quickfix pane, which is used to display results
|
||||||
" from various plugins (like ctrl-p, ripgrep, compilation errors, etc), in rows
|
" from various plugins (like ctrlp, ripgrep, compilation errors, etc), in rows
|
||||||
let g:quickfix_pane_height = 20
|
let g:quickfix_pane_height = 20
|
||||||
|
|
||||||
""""""""""""""
|
""""""""""""""
|
||||||
" COLORS
|
" COLORS
|
||||||
""""""""""""""
|
""""""""""""""
|
||||||
let g:campo_default_bg_mode = 'dark' " Start vim with the dark theme. Set to 'light' for the light theme.
|
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_dark_theme = 'campo-dark-simple' "'campo-dark-blue'
|
||||||
let g:campo_light_theme = 'campo-light-simple' "'campo-light'
|
let g:campo_light_theme = 'campo-light-simple' "'campo-light'
|
||||||
let g:campo_theme_use_rainbow_parens = 1
|
let g:campo_theme_use_rainbow_parens = 1
|
||||||
|
@ -126,7 +129,6 @@ let g:campo_directories_to_force_stripping_trailing_whitespace = []
|
||||||
" e.g. let g:campo_files_to_force_stripping_trailing_whitespace = ['/z/modules/test.h', '/d/build/config.h']
|
" e.g. let g:campo_files_to_force_stripping_trailing_whitespace = ['/z/modules/test.h', '/d/build/config.h']
|
||||||
let g:campo_files_to_force_stripping_trailing_whitespace = []
|
let g:campo_files_to_force_stripping_trailing_whitespace = []
|
||||||
|
|
||||||
|
|
||||||
""""""""""""""
|
""""""""""""""
|
||||||
" SEARCH
|
" SEARCH
|
||||||
""""""""""""""
|
""""""""""""""
|
||||||
|
@ -141,8 +143,9 @@ let g:campo_custom_search_args = ""
|
||||||
""""""""""""""
|
""""""""""""""
|
||||||
" CTAGS
|
" CTAGS
|
||||||
""""""""""""""
|
""""""""""""""
|
||||||
|
|
||||||
" I use the ctags executable from https://github.com/universal-ctags/ctags-win32/releases
|
" I use the ctags executable from https://github.com/universal-ctags/ctags-win32/releases
|
||||||
|
"
|
||||||
|
" Be sure to check out the ctags plugin config in section #3 for additional API functions.
|
||||||
|
|
||||||
" If != 0 then ctag generation will always happen on a file save, otherwise
|
" If != 0 then ctag generation will always happen on a file save, otherwise
|
||||||
" it'll only be triggered if the file being saved has an extension in the
|
" it'll only be triggered if the file being saved has an extension in the
|
||||||
|
@ -170,6 +173,13 @@ let g:campo_ctags_exclude = ['*.txt', '*.config', '.cache']
|
||||||
" * Exclude a directory with `let g:campo_custom_ctags_args = '--exclude=3rd_party'`
|
" * Exclude a directory with `let g:campo_custom_ctags_args = '--exclude=3rd_party'`
|
||||||
let g:campo_custom_ctags_args = ""
|
let g:campo_custom_ctags_args = ""
|
||||||
|
|
||||||
|
""""""""""""""
|
||||||
|
" JAI
|
||||||
|
""""""""""""""
|
||||||
|
" Set to your Jai install path. Used for various commands, like for example
|
||||||
|
" searching the modules and how_to directories with CtrlP
|
||||||
|
let g:campo_jai_path = ''
|
||||||
|
|
||||||
"################################################################
|
"################################################################
|
||||||
"################################################################
|
"################################################################
|
||||||
"################################################################
|
"################################################################
|
||||||
|
@ -882,6 +892,29 @@ let g:syntastic_check_on_wq = 0
|
||||||
let g:rg_highlight = 1
|
let g:rg_highlight = 1
|
||||||
let g:rg_window_height = g:quickfix_pane_height
|
let g:rg_window_height = g:quickfix_pane_height
|
||||||
|
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
" C-TAGS
|
||||||
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
|
" Set extra paths to use when searching for ctags files. By default the current
|
||||||
|
" directory is always checked. You can use this to combine tag lookups from
|
||||||
|
" different projects, e.g. set it to the Jai directory and you can look up
|
||||||
|
" current project tags and Jai module tags (of course this isn't needed if you
|
||||||
|
" have Jai module tags in your local file).
|
||||||
|
"
|
||||||
|
" This destructively overwrites the tags option value.
|
||||||
|
"
|
||||||
|
" Call this from a .vimrc.private or .lvimrc file, e.g.
|
||||||
|
" call g:SetExtraCtagsPaths([g:campo_jai_path.'/tags'])
|
||||||
|
"
|
||||||
|
function! g:SetExtraCtagsPaths(paths_array)
|
||||||
|
let l:list = './tags,tags' " This is the default tags list set by vim.
|
||||||
|
for path in a:paths_array
|
||||||
|
let l:list = l:list . ',' . path
|
||||||
|
endfor
|
||||||
|
let &tags=l:list
|
||||||
|
endfunction
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" CTRL-P
|
" CTRL-P
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
@ -901,7 +934,43 @@ let g:rg_window_height = g:quickfix_pane_height
|
||||||
" ctrl-o = ask how to open a file search result.
|
" ctrl-o = ask how to open a file search result.
|
||||||
" ctrl-p | ctrl-n = traverse search history.
|
" ctrl-p | ctrl-n = traverse search history.
|
||||||
|
|
||||||
noremap <leader>g :CtrlP<cr>
|
" CtrlP finds the tags file by using vim's 'tags' option value. I initially
|
||||||
|
" tried changing the tags value to the working_path if one is provided. I made
|
||||||
|
" a copy of the current tags value and attempted to restore it when CtrlP was
|
||||||
|
" exited without an action or a tag action took place. I wasn't able to get
|
||||||
|
" the tags restored because there's no vim event that gets triggered when a
|
||||||
|
" tag is opened using the :tag comment. I tried a bunch of autocmds on buffer,
|
||||||
|
" window and cmdline events but wasn't able to find anything that fired AFTER
|
||||||
|
" the tag command. So we're instead just setting the tags list once for the
|
||||||
|
" session and not bothering with changing it on the fly. See g:SetExtraCtagsPaths
|
||||||
|
function! CtrlP_Search(search_path)
|
||||||
|
" If a:search_path is empty then ctrlp will use g:ctrlp_working_path_mode to determine the cwd to search in.
|
||||||
|
execute 'CtrlP ' . a:search_path
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! CtrlP_JaiSearch(jai_rel_search_path)
|
||||||
|
if g:campo_jai_path == ''
|
||||||
|
call PrintError("g:campo_jai_path isn't set!")
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let l:path = g:campo_jai_path
|
||||||
|
if a:jai_rel_search_path != ''
|
||||||
|
let l:path = l:path. '/' . a:jai_rel_search_path
|
||||||
|
endif
|
||||||
|
if !isdirectory(l:path)
|
||||||
|
call PrintError("Directory ".l:path." doesn't exist.")
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
call CtrlP_Search(l:path)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" CtrlP File Searching
|
||||||
|
noremap <leader>g :call CtrlP_Search('')<cr> " Search in current directory
|
||||||
|
noremap <leader>gg :call CtrlP_JaiSearch('')<cr> " Search in Jai directory
|
||||||
|
noremap <leader>gm :call CtrlP_JaiSearch('modules')<cr> " Search in Jai modules
|
||||||
|
noremap <leader>gh :call CtrlP_JaiSearch('how_to')<cr> " Search in Jai how_to
|
||||||
|
noremap <leader>ge :call CtrlP_JaiSearch('examples')<cr> " Search in Jai examples
|
||||||
|
|
||||||
let g:ctrlp_map = '<leader>f'
|
let g:ctrlp_map = '<leader>f'
|
||||||
let g:ctrlp_cmd = 'CtrlPTag' " Search tags by default.
|
let g:ctrlp_cmd = 'CtrlPTag' " Search tags by default.
|
||||||
let g:ctrlp_by_filename = 1 " File search by filename as opposed to full path.
|
let g:ctrlp_by_filename = 1 " File search by filename as opposed to full path.
|
||||||
|
@ -913,12 +982,6 @@ let g:ctrlp_switch_buffer = 'et' " If a file is already open, open it again in a
|
||||||
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
|
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
|
||||||
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard'] " If a git repo, use checked in files (ignore things in .gitignore); fallback to globpath()
|
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard'] " If a git repo, use checked in files (ignore things in .gitignore); fallback to globpath()
|
||||||
|
|
||||||
" @fixme Not sure why I can't get these new mappings (c-m, c-cr) to register...
|
|
||||||
"let g:ctrlp_prompt_mappings = {
|
|
||||||
" \ 'AcceptSelection("h")': ['<c-x>', '<c-cr>'],
|
|
||||||
" \ 'AcceptSelection("v")': ['<c-v>', '<c-m>'],
|
|
||||||
" \ }
|
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" GIT
|
" GIT
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
@ -956,7 +1019,7 @@ let g:clojure_fuzzy_indent_blacklist = ['-fn$', '\v^with-%(meta|out-str|loading-
|
||||||
let g:rainbow_active = 1 " Always on
|
let g:rainbow_active = 1 " Always on
|
||||||
let s:light_rainbow = ['red', 'green', 'magenta', 'cyan', 'yellow', 'white', 'gray', 'blue']
|
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:dark_rainbow = ['darkblue', 'red', 'black', 'darkgreen', 'darkyellow', 'darkred', 'darkgray']
|
||||||
let s:rainbow_theme = g:campo_default_bg_mode
|
let s:rainbow_theme = g:campo_light_dark_mode
|
||||||
|
|
||||||
function! UpdateRainbowConf()
|
function! UpdateRainbowConf()
|
||||||
let g:rainbow_conf = {
|
let g:rainbow_conf = {
|
||||||
|
@ -985,11 +1048,6 @@ function! ReloadRainbow()
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
" C-TAGS
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
set tags+=tags;$HOME
|
|
||||||
|
|
||||||
"---------------------------------------------------------------------------------------------------
|
"---------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
"################################################################
|
"################################################################
|
||||||
|
@ -1045,12 +1103,21 @@ set statusline=%<%f\ (%{&ft})\ %-4(%m%)%=%-19(%3l,%02c%03V%)
|
||||||
exec "autocmd ColorScheme " . g:campo_dark_theme . " call ReloadRainbow()"
|
exec "autocmd ColorScheme " . g:campo_dark_theme . " call ReloadRainbow()"
|
||||||
exec "autocmd ColorScheme " . g:campo_light_theme . " call ReloadRainbow()"
|
exec "autocmd ColorScheme " . g:campo_light_theme . " call ReloadRainbow()"
|
||||||
|
|
||||||
" Switch between light and dark themes.
|
" Toggle between light and dark themes.
|
||||||
noremap <leader>l :call ChangeBgTheme('light', 0)<cr>
|
noremap <leader>l :call ToggleLightDarkTheme()<cr>
|
||||||
noremap <leader>ll :call ChangeBgTheme('dark', 0)<cr>
|
|
||||||
|
|
||||||
function! ChangeBgTheme(bg, onlySetTheme)
|
let s:current_light_dark_mode = g:campo_light_dark_mode
|
||||||
if a:bg =~ 'light'
|
|
||||||
|
function! ToggleLightDarkTheme()
|
||||||
|
if s:current_light_dark_mode == 'light'
|
||||||
|
call ChangeLightDarkMode('dark', 0)
|
||||||
|
else
|
||||||
|
call ChangeLightDarkMode('light', 0)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ChangeLightDarkMode(mode, onlySetTheme)
|
||||||
|
if a:mode == 'light'
|
||||||
let s:rainbow_theme = 'light'
|
let s:rainbow_theme = 'light'
|
||||||
let s:theme = g:campo_light_theme
|
let s:theme = g:campo_light_theme
|
||||||
exe 'colorscheme ' . s:theme
|
exe 'colorscheme ' . s:theme
|
||||||
|
@ -1065,15 +1132,18 @@ function! ChangeBgTheme(bg, onlySetTheme)
|
||||||
exe 'colorscheme ' . s:theme
|
exe 'colorscheme ' . s:theme
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
let s:current_light_dark_mode = a:mode
|
||||||
|
|
||||||
if !a:onlySetTheme
|
if !a:onlySetTheme
|
||||||
exec 'AirlineTheme' a:bg
|
exec 'AirlineTheme' a:mode
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
if g:campo_default_bg_mode =~ 'light'
|
" Set the intial light/dark mode.
|
||||||
call ChangeBgTheme('light', 1)
|
if g:campo_light_dark_mode =~ 'light'
|
||||||
|
call ChangeLightDarkMode('light', 1)
|
||||||
else
|
else
|
||||||
call ChangeBgTheme('dark', 1)
|
call ChangeLightDarkMode('dark', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -1430,3 +1500,4 @@ noremap <leader>n :call RenameFile()<cr>
|
||||||
|
|
||||||
"---------------------------------------------------------------------------------------------------
|
"---------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
let g:campo_vimrc_initialized = 1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user