Formatting changes in vimrc
This commit is contained in:
parent
816a0be564
commit
7e586d284d
527
vimrc
527
vimrc
|
@ -1,31 +1,27 @@
|
||||||
" @incomplete Move all leader definitions to the bottom, so that it's easier to see them.
|
"-----------------------------------------------------------------------------------------------------------------------
|
||||||
" @incomplete Add setup steps (plugins, cache setup, search tool, etc).
|
" The config is chopped up into sections. Search for these headings to quickly jump to a particular section.
|
||||||
|
|
||||||
"###################################################################################################
|
|
||||||
"
|
"
|
||||||
" The config is chopped up into sections. These are the headings, which you
|
|
||||||
" can use to quickly jump to a particular section:
|
|
||||||
|
|
||||||
" #0 GLOBALS
|
" #0 GLOBALS
|
||||||
" #1 PLUGINS
|
" #1 PLUGINS
|
||||||
" #2 BASE CONFIG
|
" #2 BASE CONFIG
|
||||||
" #3 PLUGIN CONFIGS
|
" #3 CUSTOM AUTOCMDS
|
||||||
" #4 VISUALS
|
" #4 KEY MAPPINGS
|
||||||
" #5 CUSTOM FUNCTIONS / COMMANDS
|
" #5 PLUGIN CONFIGS
|
||||||
|
" #6 VISUALS (COLORS, HIGHLIGHTING)
|
||||||
|
" #7 CUSTOM FUNCTIONS & COMMANDS
|
||||||
"
|
"
|
||||||
"###################################################################################################
|
" @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.
|
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.
|
|
||||||
set encoding=utf-8 fileencoding=utf-8 fileencodings=ucs-bom,utf8,prc
|
set encoding=utf-8 fileencoding=utf-8 fileencodings=ucs-bom,utf8,prc
|
||||||
set nocompatible
|
set nocompatible
|
||||||
filetype off
|
filetype off
|
||||||
|
|
||||||
" Store the current system name so that we can conditionally set configs for
|
" Store the current system name so that we can conditionally set configs for different platforms.
|
||||||
" different platforms
|
|
||||||
let s:uname = system("echo -n \"$(uname)\"")
|
let s:uname = system("echo -n \"$(uname)\"")
|
||||||
let g:vim_dir = $HOME . "/.vim"
|
let g:vim_dir = $HOME . "/.vim"
|
||||||
let mapleader=","
|
let mapleader=","
|
||||||
|
@ -39,7 +35,7 @@ endfunction
|
||||||
|
|
||||||
if has('termguicolors')
|
if has('termguicolors')
|
||||||
set termguicolors
|
set termguicolors
|
||||||
" Set Vim-specific sequences for RGB colors
|
" Set Vim-specific sequences for RGB colors.
|
||||||
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
|
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
|
||||||
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
|
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
|
||||||
endif
|
endif
|
||||||
|
@ -51,26 +47,27 @@ function! PrintError(msg) abort
|
||||||
echohl None
|
echohl None
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"################################################################
|
|
||||||
"################################################################
|
|
||||||
"################################################################
|
|
||||||
"#0 GLOBALS
|
|
||||||
"################################################################
|
|
||||||
"################################################################
|
|
||||||
"################################################################
|
|
||||||
|
|
||||||
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
|
" #0 GLOBALS
|
||||||
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
|
|
||||||
|
|
||||||
|
"-----------------------------------------------------------------------------------------------------------------------
|
||||||
" @note The following globals can be used to customize various functions in
|
" @note The following globals can be used to customize various functions in
|
||||||
" this file. The easiest way to set them is in ~/.vimrc.private or an .lvimrc
|
" this file. The easiest way to set them is in ~/.vimrc.private or an .lvimrc
|
||||||
" 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
|
||||||
" by settings in this file when it's sourced. These have been flagged with the
|
" used by settings in this file when it's sourced. These have been flagged
|
||||||
" note :unsupported-in-lvimrc.
|
" 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>.
|
||||||
|
@ -79,17 +76,19 @@ let g:campo_max_line_length = 120 " Display a vertical bar at x=<n>.
|
||||||
" from various plugins (like ctrlp, 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_light_dark_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
|
||||||
|
|
||||||
""""""""""""""
|
|
||||||
|
"##################################################################################
|
||||||
" FORMATTING
|
" FORMATTING
|
||||||
""""""""""""""
|
"##################################################################################
|
||||||
" When set to 1, all files will be stripped of trailing whitespace when the
|
" When set to 1, all files will be stripped of trailing whitespace when the
|
||||||
" file is saved. Set to 0 to disable. You can customize which files are
|
" file is saved. Set to 0 to disable. You can customize which files are
|
||||||
" ignored or always stripped; see below.
|
" ignored or always stripped; see below.
|
||||||
|
@ -129,9 +128,10 @@ 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
|
||||||
""""""""""""""
|
"##################################################################################
|
||||||
" This is included in the ripgrep args. You can use this to do things like
|
" This is included in the ripgrep args. You can use this to do things like
|
||||||
" ignore folders in your project or limit the search to specific file types.
|
" ignore folders in your project or limit the search to specific file types.
|
||||||
" For example, if you want to ignore the 3rd_party dir and only search C files
|
" For example, if you want to ignore the 3rd_party dir and only search C files
|
||||||
|
@ -140,12 +140,13 @@ let g:campo_files_to_force_stripping_trailing_whitespace = []
|
||||||
" let g:campo_custom_search_args = \"-g \"!3rd_party/*\" -tc"
|
" let g:campo_custom_search_args = \"-g \"!3rd_party/*\" -tc"
|
||||||
let g:campo_custom_search_args = ""
|
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.
|
" Be sure to check out the ctags plugin config in section #5 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
|
||||||
|
@ -173,9 +174,10 @@ 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
|
" JAI
|
||||||
""""""""""""""
|
"##################################################################################
|
||||||
" Set to your Jai install path. Used for various commands, like for example
|
" Set to your Jai install path. Used for various commands, like for example
|
||||||
" searching the modules and how_to directories with CtrlP
|
" searching the modules and how_to directories with CtrlP
|
||||||
let g:campo_jai_path = ''
|
let g:campo_jai_path = ''
|
||||||
|
@ -183,19 +185,18 @@ let g:campo_jai_path = ''
|
||||||
" Args to include when compiling a Jai file.
|
" Args to include when compiling a Jai file.
|
||||||
let g:campo_jai_build_args = ''
|
let g:campo_jai_build_args = ''
|
||||||
|
|
||||||
"################################################################
|
|
||||||
"################################################################
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
"################################################################
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
" #1 PLUGINS
|
" #1 PLUGINS
|
||||||
"################################################################
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
"################################################################
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
"################################################################
|
|
||||||
|
|
||||||
call plug#begin('~/.vim/plugged')
|
call plug#begin('~/.vim/plugged')
|
||||||
|
|
||||||
"////////////////////////////////////////////////////////////////
|
"##################################################################################
|
||||||
" MISC
|
" MISC
|
||||||
"////////////////////////////////////////////////////////////////
|
"##################################################################################
|
||||||
|
|
||||||
Plug 'vim-airline/vim-airline' " Enhanced status/tabline.
|
Plug 'vim-airline/vim-airline' " Enhanced status/tabline.
|
||||||
Plug 'embear/vim-localvimrc' " Add a .lvimrc to a folder to override .vimrc config.
|
Plug 'embear/vim-localvimrc' " Add a .lvimrc to a folder to override .vimrc config.
|
||||||
|
@ -217,9 +218,9 @@ if IsWindows()
|
||||||
Plug 'suxpert/vimcaps' " Disable capslock (useful if the OS isn't configured to do so).
|
Plug 'suxpert/vimcaps' " Disable capslock (useful if the OS isn't configured to do so).
|
||||||
endif
|
endif
|
||||||
|
|
||||||
"////////////////////////////////////////////////////////////////
|
"##################################################################################
|
||||||
" COLORS
|
" COLORS
|
||||||
"////////////////////////////////////////////////////////////////
|
"##################################################################################
|
||||||
|
|
||||||
Plug 'luochen1990/rainbow', { 'commit': '1c45e0f' } " Rainbow parens. Locked to an older commit that still works fine on my PC.
|
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'
|
Plug 'vim-airline/vim-airline-themes'
|
||||||
|
@ -230,9 +231,9 @@ endif
|
||||||
|
|
||||||
Plug 'dracula/vim', { 'as': 'dracula' }
|
Plug 'dracula/vim', { 'as': 'dracula' }
|
||||||
|
|
||||||
"//////////////////////////////
|
"/////////////////////////////////////////////////
|
||||||
" SYNTAX HIGHLIGHTING
|
" SYNTAX HIGHLIGHTING
|
||||||
"//////////////////////////////
|
"/////////////////////////////////////////////////
|
||||||
|
|
||||||
Plug 'rluba/jai.vim' " Jai
|
Plug 'rluba/jai.vim' " Jai
|
||||||
Plug 'bfrg/vim-cpp-modern' " C/C++
|
Plug 'bfrg/vim-cpp-modern' " C/C++
|
||||||
|
@ -245,24 +246,20 @@ Plug 'tpope/vim-markdown' " Markdown
|
||||||
"Plug 'rust-lang/rust.vim' " Rust
|
"Plug 'rust-lang/rust.vim' " Rust
|
||||||
"Plug 'jdonaldson/vaxe' " Haxe
|
"Plug 'jdonaldson/vaxe' " Haxe
|
||||||
|
|
||||||
"//////////////////////////////
|
"
|
||||||
|
"
|
||||||
|
"
|
||||||
|
|
||||||
call plug#end()
|
call plug#end()
|
||||||
filetype plugin indent on
|
filetype plugin indent on
|
||||||
|
|
||||||
"---------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
"################################################################
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
"################################################################
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
"################################################################
|
|
||||||
" #2 BASE CONFIG
|
" #2 BASE CONFIG
|
||||||
"################################################################
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
"################################################################
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
"################################################################
|
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
" BASIC EDITING CONFIGURATION
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
set hidden
|
set hidden
|
||||||
set history=10000
|
set history=10000
|
||||||
set expandtab
|
set expandtab
|
||||||
|
@ -308,7 +305,6 @@ set scrolloff=3 " keep more context when scrolling off the end
|
||||||
set cursorline
|
set cursorline
|
||||||
set cursorcolumn
|
set cursorcolumn
|
||||||
|
|
||||||
"
|
|
||||||
" Store swap, backup and undo files in a central spot. I have my settings in a
|
" Store swap, backup and undo files in a central spot. I have my settings in a
|
||||||
" `vimrc.private` so that my drive paths aren't in this config. If you want to
|
" `vimrc.private` so that my drive paths aren't in this config. If you want to
|
||||||
" set them here then add:
|
" set them here then add:
|
||||||
|
@ -329,7 +325,6 @@ augroup backupCmds
|
||||||
augroup END
|
augroup END
|
||||||
set writebackup " Make buckup before overwriting the current buffer.
|
set writebackup " Make buckup before overwriting the current buffer.
|
||||||
|
|
||||||
"
|
|
||||||
" Keep undo history across sessions by storing it in a file. The undo save
|
" Keep undo history across sessions by storing it in a file. The undo save
|
||||||
" location is set in the vimrc.private file. You can also set it here with:
|
" location is set in the vimrc.private file. You can also set it here with:
|
||||||
" set undodir=<path>
|
" set undodir=<path>
|
||||||
|
@ -374,6 +369,9 @@ if &term =~ '256color'
|
||||||
set t_ut=
|
set t_ut=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Status line
|
||||||
|
set statusline=%<%f\ (%{&ft})\ %-4(%m%)%=%-19(%3l,%02c%03V%)
|
||||||
|
|
||||||
" Disable arrow keys.
|
" Disable arrow keys.
|
||||||
noremap <up> <nop>
|
noremap <up> <nop>
|
||||||
noremap <down> <nop>
|
noremap <down> <nop>
|
||||||
|
@ -384,8 +382,11 @@ inoremap <down> <nop>
|
||||||
inoremap <left> <nop>
|
inoremap <left> <nop>
|
||||||
inoremap <right> <nop>
|
inoremap <right> <nop>
|
||||||
|
|
||||||
"---------------------------------------------------------------
|
|
||||||
" Load vimrc.private
|
"/////////////////////////////////////////////////
|
||||||
|
" LOAD PRIVATE VIMRC
|
||||||
|
"/////////////////////////////////////////////////
|
||||||
|
|
||||||
" This should be done after above base settings that don't use the global
|
" This should be done after above base settings that don't use the global
|
||||||
" campo variables.
|
" campo variables.
|
||||||
"
|
"
|
||||||
|
@ -395,12 +396,17 @@ if filereadable($HOME . "/.vimrc.private")
|
||||||
source $HOME/.vimrc.private
|
source $HOME/.vimrc.private
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Settings that use the global campo variables.
|
|
||||||
|
" Settings that use the global campo variables:
|
||||||
let &colorcolumn=g:campo_max_line_length
|
let &colorcolumn=g:campo_max_line_length
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
" CUSTOM AUTOCMDS
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
|
" #3 CUSTOM AUTOCMDS
|
||||||
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
|
|
||||||
augroup campoCmds
|
augroup campoCmds
|
||||||
" Clear all autocmds in the group.
|
" Clear all autocmds in the group.
|
||||||
autocmd!
|
autocmd!
|
||||||
|
@ -489,9 +495,17 @@ augroup campoCmds
|
||||||
|
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
" MISC KEY MAPS
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
|
" #4 KEY MAPPINGS
|
||||||
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
|
|
||||||
|
|
||||||
|
"##################################################################################
|
||||||
|
" MISC
|
||||||
|
"##################################################################################
|
||||||
|
|
||||||
" Lowercase the e (have a habit of making it uppercase).
|
" Lowercase the e (have a habit of making it uppercase).
|
||||||
:ca E e
|
:ca E e
|
||||||
|
@ -515,9 +529,75 @@ nnoremap <silent> <leader>rv :source $MYVIMRC<cr>
|
||||||
" the full %/ quickly otherwise it won't replace it.
|
" the full %/ quickly otherwise it won't replace it.
|
||||||
cmap %/ %:p:h/
|
cmap %/ %:p:h/
|
||||||
|
|
||||||
"------------------------------------------------------------
|
" Open a terminal within vim. Use `exit` to close it.
|
||||||
" Remap saving and quiting.
|
" DISABLING because I don't use this and I want to use the <leader>t for opening my todo file.
|
||||||
"
|
"if exists(':terminal')
|
||||||
|
" noremap <leader>t :terminal<cr>
|
||||||
|
" tnoremap <leader>te <C-\><C-n>
|
||||||
|
" tnoremap <A-h> <C-\><C-n><C-w>h
|
||||||
|
" tnoremap <A-j> <C-\><C-n><C-w>j
|
||||||
|
" tnoremap <A-k> <C-\><C-n><C-w>k
|
||||||
|
" tnoremap <A-l> <C-\><C-n><C-w>l
|
||||||
|
" nnoremap <A-h> <C-w>h
|
||||||
|
" nnoremap <A-j> <C-w>j
|
||||||
|
" nnoremap <A-k> <C-w>k
|
||||||
|
" nnoremap <A-l> <C-w>l
|
||||||
|
"endif
|
||||||
|
|
||||||
|
" Jump to other buffers.
|
||||||
|
noremap <c-k> <c-w><Up>
|
||||||
|
noremap <c-j> <c-w><Down>
|
||||||
|
noremap <c-l> <c-w><Right>
|
||||||
|
noremap <c-h> <c-w><Left>
|
||||||
|
|
||||||
|
" Make it easier to jump around the command line. The default behaviour is
|
||||||
|
" using the arrow keys with or without shift.
|
||||||
|
:cnoremap <C-J> <S-Left>
|
||||||
|
:cnoremap <C-K> <S-Right>
|
||||||
|
|
||||||
|
" Window splitting - couldn't figure out how to remap <c-w>v & <c-w>n to <c-m>
|
||||||
|
" & <c-n>
|
||||||
|
noremap <leader>m :vsplit<cr>
|
||||||
|
noremap <leader>mm :split<cr>
|
||||||
|
|
||||||
|
" Forward delete and replace a word.
|
||||||
|
noremap <leader>d ciw
|
||||||
|
|
||||||
|
" Allow fast pasting by accessing the system clipboard register.
|
||||||
|
noremap <leader>p "+p
|
||||||
|
" Likely won't need to use this if pasting with <leader>p, but just in case here ya go.
|
||||||
|
noremap <leader>pp :set paste! paste?<cr>
|
||||||
|
|
||||||
|
" Toggle line numbers.
|
||||||
|
noremap <leader>o :set number! number?<cr>
|
||||||
|
|
||||||
|
" Show spell checking.
|
||||||
|
" You can add new entries to the dict by moving the cursor over the word and pressing `zg`.
|
||||||
|
noremap <leader>j :exec &spell==&spell? "se spell! spelllang=en_us" : "se spell!"<cr>
|
||||||
|
noremap <leader>= z=
|
||||||
|
|
||||||
|
" Clear the search buffer (highlighting) when hitting return.
|
||||||
|
nnoremap <cr> :nohlsearch<cr>
|
||||||
|
|
||||||
|
" Switch to the previous file.
|
||||||
|
nnoremap <leader><leader> <c-^>
|
||||||
|
|
||||||
|
" Replace currently selected text with default register without yanking it.
|
||||||
|
vnoremap p "_dP
|
||||||
|
|
||||||
|
" Switch between C++ source and header files.
|
||||||
|
noremap <leader>v :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR>
|
||||||
|
"noremap <leader>vv :e %:p:s,.h$,.X123X,:s,.c$,.h,:s,.X123X$,.c,<CR>
|
||||||
|
"noremap <leader>vvv :e %:p:s,.h$,.X123X,:s,.cc$,.h,:s,.X123X$,.cc,<CR>
|
||||||
|
|
||||||
|
" Replace all instances of the highlighted text with whatever you enter.
|
||||||
|
nnoremap <c-g> :%s///g<left><left>
|
||||||
|
|
||||||
|
|
||||||
|
"##################################################################################
|
||||||
|
" SAVING AND QUITING
|
||||||
|
"##################################################################################
|
||||||
|
|
||||||
" I used to have a BufWritePost autocommand that ran the ctags generator but
|
" I used to have a BufWritePost autocommand that ran the ctags generator but
|
||||||
" it ends up running multiple times when saving multiple buffers at once. In
|
" it ends up running multiple times when saving multiple buffers at once. In
|
||||||
" order to only call it once for a group of saves I've had to remap the
|
" order to only call it once for a group of saves I've had to remap the
|
||||||
|
@ -617,76 +697,10 @@ command! Qa qall
|
||||||
" Disable Ex mode.
|
" Disable Ex mode.
|
||||||
noremap Q <Nop>
|
noremap Q <Nop>
|
||||||
|
|
||||||
"------------------------------------------------------------
|
|
||||||
|
|
||||||
" Open a terminal within vim. Use `exit` to close it.
|
"##################################################################################
|
||||||
" DISABLING because I don't use this and I want to use the <leader>t for opening my todo file.
|
|
||||||
"if exists(':terminal')
|
|
||||||
" noremap <leader>t :terminal<cr>
|
|
||||||
" tnoremap <leader>te <C-\><C-n>
|
|
||||||
" tnoremap <A-h> <C-\><C-n><C-w>h
|
|
||||||
" tnoremap <A-j> <C-\><C-n><C-w>j
|
|
||||||
" tnoremap <A-k> <C-\><C-n><C-w>k
|
|
||||||
" tnoremap <A-l> <C-\><C-n><C-w>l
|
|
||||||
" nnoremap <A-h> <C-w>h
|
|
||||||
" nnoremap <A-j> <C-w>j
|
|
||||||
" nnoremap <A-k> <C-w>k
|
|
||||||
" nnoremap <A-l> <C-w>l
|
|
||||||
"endif
|
|
||||||
|
|
||||||
" Jump to other buffers.
|
|
||||||
noremap <c-k> <c-w><Up>
|
|
||||||
noremap <c-j> <c-w><Down>
|
|
||||||
noremap <c-l> <c-w><Right>
|
|
||||||
noremap <c-h> <c-w><Left>
|
|
||||||
|
|
||||||
" Make it easier to jump around the command line. The default behaviour is
|
|
||||||
" using the arrow keys with or without shift.
|
|
||||||
:cnoremap <C-J> <S-Left>
|
|
||||||
:cnoremap <C-K> <S-Right>
|
|
||||||
|
|
||||||
" Window splitting - couldn't figure out how to remap <c-w>v & <c-w>n to <c-m>
|
|
||||||
" & <c-n>
|
|
||||||
noremap <leader>m :vsplit<cr>
|
|
||||||
noremap <leader>mm :split<cr>
|
|
||||||
|
|
||||||
" Forward delete and replace a word.
|
|
||||||
noremap <leader>d ciw
|
|
||||||
|
|
||||||
" Allow fast pasting by accessing the system clipboard register.
|
|
||||||
noremap <leader>p "+p
|
|
||||||
" Likely won't need to use this if pasting with <leader>p, but just in case here ya go.
|
|
||||||
noremap <leader>pp :set paste! paste?<cr>
|
|
||||||
|
|
||||||
" Toggle line numbers.
|
|
||||||
noremap <leader>o :set number! number?<cr>
|
|
||||||
|
|
||||||
" Show spell checking.
|
|
||||||
" You can add new entries to the dict by moving the cursor over the word and pressing `zg`.
|
|
||||||
noremap <leader>j :exec &spell==&spell? "se spell! spelllang=en_us" : "se spell!"<cr>
|
|
||||||
noremap <leader>= z=
|
|
||||||
|
|
||||||
" Clear the search buffer (highlighting) when hitting return.
|
|
||||||
nnoremap <cr> :nohlsearch<cr>
|
|
||||||
|
|
||||||
" Switch to the previous file.
|
|
||||||
nnoremap <leader><leader> <c-^>
|
|
||||||
|
|
||||||
" Replace currently selected text with default register without yanking it.
|
|
||||||
vnoremap p "_dP
|
|
||||||
|
|
||||||
" Switch between C++ source and header files.
|
|
||||||
noremap <leader>v :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp,<CR>
|
|
||||||
"noremap <leader>vv :e %:p:s,.h$,.X123X,:s,.c$,.h,:s,.X123X$,.c,<CR>
|
|
||||||
"noremap <leader>vvv :e %:p:s,.h$,.X123X,:s,.cc$,.h,:s,.X123X$,.cc,<CR>
|
|
||||||
|
|
||||||
" Replace all instances of the highlighted text with whatever you enter.
|
|
||||||
nnoremap <c-g> :%s///g<left><left>
|
|
||||||
|
|
||||||
|
|
||||||
"////////////////////////////////////////////////////////////////
|
|
||||||
" MULTIPURPOSE TAB KEY
|
" MULTIPURPOSE TAB KEY
|
||||||
"////////////////////////////////////////////////////////////////
|
"##################################################################################
|
||||||
function! InsertTabWrapper()
|
function! InsertTabWrapper()
|
||||||
let l:col = col('.') - 1
|
let l:col = col('.') - 1
|
||||||
if !l:col || getline('.')[l:col - 1] !~ '\k'
|
if !l:col || getline('.')[l:col - 1] !~ '\k'
|
||||||
|
@ -699,32 +713,34 @@ inoremap <tab> <c-r>=InsertTabWrapper()<cr>
|
||||||
inoremap <s-tab> <c-n>
|
inoremap <s-tab> <c-n>
|
||||||
|
|
||||||
|
|
||||||
"---------------------------------------------------------------------------------------------------
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
|
" #5 PLUGIN CONFIGS
|
||||||
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
|
|
||||||
"################################################################
|
|
||||||
"################################################################
|
|
||||||
"################################################################
|
|
||||||
"#3 PLUGIN CONFIGS
|
|
||||||
"################################################################
|
|
||||||
"################################################################
|
|
||||||
"################################################################
|
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
" LOCAL VIMRC
|
" LOCAL VIMRC
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
let g:localvimrc_sandbox = 0
|
let g:localvimrc_sandbox = 0
|
||||||
let g:localvimrc_ask = 0
|
let g:localvimrc_ask = 0
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
|
" LION (TEXT ALIGNMENT)
|
||||||
|
"##################################################################################
|
||||||
|
let b:lion_squeeze_spaces = 1
|
||||||
|
|
||||||
|
"##################################################################################
|
||||||
" TAGBAR
|
" TAGBAR
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
noremap <F12> :TagbarToggle<cr>
|
noremap <F12> :TagbarToggle<cr>
|
||||||
" Sort tags by their order in the source file. Press 's' to sort them alphabetically.
|
" Sort tags by their order in the source file. Press 's' to sort them alphabetically.
|
||||||
let g:tagbar_sort = 0
|
let g:tagbar_sort = 0
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
" GITGUTTER
|
" GITGUTTER
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
let g:gitgutter_enabled = 1
|
let g:gitgutter_enabled = 1
|
||||||
let g:gitgutter_highlight_lines = 0
|
let g:gitgutter_highlight_lines = 0
|
||||||
nnoremap <leader>hh :GitGutterToggle<cr>
|
nnoremap <leader>hh :GitGutterToggle<cr>
|
||||||
|
@ -738,9 +754,9 @@ augroup gitGutterPluginCmds
|
||||||
autocmd BufWritePost * GitGutter
|
autocmd BufWritePost * GitGutter
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
" SYNTASTIC
|
" SYNTASTIC
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
" NOTE: there is a status line config in the status line section
|
" NOTE: there is a status line config in the status line section
|
||||||
let g:syntastic_always_populate_loc_list = 1
|
let g:syntastic_always_populate_loc_list = 1
|
||||||
let g:syntastic_auto_loc_list = 1
|
let g:syntastic_auto_loc_list = 1
|
||||||
|
@ -754,16 +770,15 @@ let g:syntastic_check_on_wq = 0
|
||||||
"let g:syntastic_rust_rustc_fname = ''
|
"let g:syntastic_rust_rustc_fname = ''
|
||||||
"let g:syntastic_rust_checkers = ['rustc']
|
"let g:syntastic_rust_checkers = ['rustc']
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
" RIPGREP
|
" RIPGREP
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
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
|
" C-TAGS
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
|
|
||||||
" Set extra paths to use when searching for ctags files. By default the current
|
" 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
|
" 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
|
" different projects, e.g. set it to the Jai directory and you can look up
|
||||||
|
@ -783,9 +798,9 @@ function! g:SetExtraCtagsPaths(paths_array)
|
||||||
let &tags=l:list
|
let &tags=l:list
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
" CTRL-P
|
" CTRL-P
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
" keybindings:
|
" keybindings:
|
||||||
"
|
"
|
||||||
" leader-f = open CtrlP in tag searching mode.
|
" leader-f = open CtrlP in tag searching mode.
|
||||||
|
@ -850,40 +865,39 @@ 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()
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
" GIT
|
" GIT
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
|
|
||||||
noremap <leader>gb :Git blame -w<cr>
|
noremap <leader>gb :Git blame -w<cr>
|
||||||
" Ignore whitespace changes; follow renames and copies.
|
" Ignore whitespace changes; follow renames and copies.
|
||||||
command! -bar -bang -nargs=* Blame :Git blame<bang> -wCM <args>
|
command! -bar -bang -nargs=* Blame :Git blame<bang> -wCM <args>
|
||||||
command! -bar -bang -nargs=* Gblame :Git blame<bang> -wCM <args>
|
command! -bar -bang -nargs=* Gblame :Git blame<bang> -wCM <args>
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
" GIST VIM
|
" GIST VIM
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
let g:gist_detect_filetype = 1
|
let g:gist_detect_filetype = 1
|
||||||
let g:gist_open_browser_after_post = 1
|
let g:gist_open_browser_after_post = 1
|
||||||
let g:gist_show_privates = 1
|
let g:gist_show_privates = 1
|
||||||
let g:gist_post_private = 1
|
let g:gist_post_private = 1
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
" VIM-CLOJURE-STATIC
|
" VIM-CLOJURE-STATIC
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
" Default
|
" Default
|
||||||
let g:clojure_fuzzy_indent = 1
|
let g:clojure_fuzzy_indent = 1
|
||||||
let g:clojure_align_multiline_strings = 1
|
let g:clojure_align_multiline_strings = 1
|
||||||
let g:clojure_fuzzy_indent_patterns = ['^match', '^with', '^def', '^let']
|
let g:clojure_fuzzy_indent_patterns = ['^match', '^with', '^def', '^let']
|
||||||
let g:clojure_fuzzy_indent_blacklist = ['-fn$', '\v^with-%(meta|out-str|loading-context)$']
|
let g:clojure_fuzzy_indent_blacklist = ['-fn$', '\v^with-%(meta|out-str|loading-context)$']
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
" RUST.VIM
|
" RUST.VIM
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
"let g:rustfmt_autosave = 1 " auto run rust formatter when saving
|
"let g:rustfmt_autosave = 1 " auto run rust formatter when saving
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
" RAINBOW
|
" RAINBOW
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
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']
|
||||||
|
@ -916,57 +930,17 @@ function! ReloadRainbow()
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"---------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
"################################################################
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
"################################################################
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
"################################################################
|
" #6 VISUALS (COLORS, HIGHLIGHTING)
|
||||||
"#4 VISUALS
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
"################################################################
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
"################################################################
|
|
||||||
"################################################################
|
|
||||||
|
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"###########################################################################
|
||||||
" LAYOUT
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
|
|
||||||
"////////////////////////////////////////////////////////////////
|
|
||||||
" CENTER THE BUFFER
|
|
||||||
"////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
function! CenterPane()
|
|
||||||
" centers the current pane as the middle 2 of 4 imaginary columns
|
|
||||||
" should be called in a window with a single pane
|
|
||||||
" Taken from https://dev.to/vinneycavallo/easily-center-content-in-vim
|
|
||||||
lefta vnew
|
|
||||||
wincmd w
|
|
||||||
exec 'vertical resize' string(&columns * 0.65)
|
|
||||||
endfunction
|
|
||||||
nnoremap <leader>c :call CenterPane()<cr>
|
|
||||||
|
|
||||||
function! RemoveCenterPane()
|
|
||||||
wincmd w
|
|
||||||
close
|
|
||||||
endfunction
|
|
||||||
nnoremap <leader>cw :call RemoveCenterPane()<cr>
|
|
||||||
|
|
||||||
|
|
||||||
"////////////////////////////////////////////////////////////////
|
|
||||||
" TEXT ALIGNMENT PLUGIN
|
|
||||||
"////////////////////////////////////////////////////////////////
|
|
||||||
let b:lion_squeeze_spaces = 1
|
|
||||||
|
|
||||||
|
|
||||||
"////////////////////////////////////////////////////////////////
|
|
||||||
" STATUS LINE
|
|
||||||
"////////////////////////////////////////////////////////////////
|
|
||||||
set statusline=%<%f\ (%{&ft})\ %-4(%m%)%=%-19(%3l,%02c%03V%)
|
|
||||||
|
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
" COLORS
|
" COLORS
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"###########################################################################
|
||||||
|
|
||||||
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()"
|
||||||
|
@ -1014,7 +988,6 @@ else
|
||||||
call ChangeLightDarkMode('dark', 1)
|
call ChangeLightDarkMode('dark', 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
" Open the current color scheme for editing.
|
" Open the current color scheme for editing.
|
||||||
function! EditColorScheme()
|
function! EditColorScheme()
|
||||||
let l:path = g:vim_dir . '/colors/' . s:theme . '.vim'
|
let l:path = g:vim_dir . '/colors/' . s:theme . '.vim'
|
||||||
|
@ -1027,9 +1000,9 @@ endfunction
|
||||||
|
|
||||||
command -nargs=0 EditColorScheme call EditColorScheme()
|
command -nargs=0 EditColorScheme call EditColorScheme()
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
" HIGHLIGHTS - TODO, NOTE, FIXME, etc
|
" HIGHLIGHTS - TODO, NOTE, FIXME, etc
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
|
|
||||||
" NOTE: These depend on custom color names (Bugs, Notes and Notices) defined
|
" 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
|
" in the campo color themes. Since most themes won't define these, you can
|
||||||
|
@ -1072,19 +1045,18 @@ augroup vimrc_annotated_notes
|
||||||
\ containedin=.*Comment,vimCommentTitle
|
\ containedin=.*Comment,vimCommentTitle
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
"---------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
"################################################################
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
"################################################################
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
"################################################################
|
" #7 CUSTOM FUNCTIONS & COMMANDS
|
||||||
"#5 CUSTOM FUNCTIONS / COMMANDS
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
"################################################################
|
"|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
"################################################################
|
|
||||||
"################################################################
|
|
||||||
|
"##################################################################################
|
||||||
|
" COMPILING CODE
|
||||||
|
"##################################################################################
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
" BUILD COMMANDS
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
" AsyncRun status line
|
" AsyncRun status line
|
||||||
let g:airline_section_error = airline#section#create_right(['%{g:asyncrun_status}'])
|
let g:airline_section_error = airline#section#create_right(['%{g:asyncrun_status}'])
|
||||||
|
|
||||||
|
@ -1108,9 +1080,9 @@ let errormarker_warninggroup = "BuildWarn"
|
||||||
let errormarker_infogroup = "BuildInfo"
|
let errormarker_infogroup = "BuildInfo"
|
||||||
|
|
||||||
|
|
||||||
"""""""""""""""""""""""""
|
"/////////////////////////////////////////////////
|
||||||
" Custom error formats
|
" CUSTOM ERROR FORMATS
|
||||||
"""""""""""""""""""""""""
|
"/////////////////////////////////////////////////
|
||||||
|
|
||||||
" @note: You can debug the error parsing by running :ShowErrorEntries
|
" @note: You can debug the error parsing by running :ShowErrorEntries
|
||||||
" This will print the valid entries. You'll know parsing is correct when the
|
" This will print the valid entries. You'll know parsing is correct when the
|
||||||
|
@ -1127,17 +1099,18 @@ function! ShowErrorEntries()
|
||||||
endfunction
|
endfunction
|
||||||
command -nargs=0 ShowErrorEntries call ShowErrorEntries()
|
command -nargs=0 ShowErrorEntries call ShowErrorEntries()
|
||||||
|
|
||||||
|
|
||||||
" Jai
|
" Jai
|
||||||
"
|
"
|
||||||
" Z:\path\main.jai:100,10: Error: Undeclared identifier 's1'.
|
" Z:\path\main.jai:100,10: Error: Undeclared identifier 's1'.
|
||||||
set errorformat=\\\ %#%f:%l\\,%c:\ %t%[A-z]%#:\ %m
|
set errorformat=\\\ %#%f:%l\\,%c:\ %t%[A-z]%#:\ %m
|
||||||
|
|
||||||
|
|
||||||
" Microsoft compiler: cl.exe
|
" Microsoft compiler: cl.exe
|
||||||
"
|
"
|
||||||
" Z:\path\main.cpp(2808): error C2220: the following warning is treated as an error
|
" Z:\path\main.cpp(2808): error C2220: the following warning is treated as an error
|
||||||
set errorformat+=\\\ %#%f(%l):\ %#%t%[A-z]%#\ %[A-z]%#%n:\ %m
|
set errorformat+=\\\ %#%f(%l):\ %#%t%[A-z]%#\ %[A-z]%#%n:\ %m
|
||||||
|
|
||||||
|
|
||||||
" Microsoft MSBuild errors
|
" Microsoft MSBuild errors
|
||||||
"
|
"
|
||||||
" @note I got this off the Internet and haven't tested it yet.
|
" @note I got this off the Internet and haven't tested it yet.
|
||||||
|
@ -1145,15 +1118,17 @@ set errorformat+=\\\ %#%f(%l):\ %#%t%[A-z]%#\ %[A-z]%#%n:\ %m
|
||||||
" Z:\path\main.cpp(2808): error C2220: the following warning is treated as an error
|
" Z:\path\main.cpp(2808): error C2220: the following warning is treated as an error
|
||||||
set errorformat+=\\\ %#%f(%l\\,%c):\ %m
|
set errorformat+=\\\ %#%f(%l\\,%c):\ %m
|
||||||
|
|
||||||
|
|
||||||
" Microsoft HLSL compiler: fxc.exe
|
" Microsoft HLSL compiler: fxc.exe
|
||||||
"
|
"
|
||||||
" @note I got this off the Internet and haven't tested it yet.
|
" @note I got this off the Internet and haven't tested it yet.
|
||||||
" @todo Add an example
|
" @todo Add an example
|
||||||
set errorformat+=\\\ %#%f(%l\\\,%c-%*[0-9]):\ %#%t%[A-z]%#\ %m
|
set errorformat+=\\\ %#%f(%l\\\,%c-%*[0-9]):\ %#%t%[A-z]%#\ %m
|
||||||
|
|
||||||
"""""""""""""""""""""""""
|
|
||||||
" Build functions
|
"/////////////////////////////////////////////////
|
||||||
"""""""""""""""""""""""""
|
" BUILD FUNCTIONS
|
||||||
|
"/////////////////////////////////////////////////
|
||||||
|
|
||||||
function! HideBuildResultsAndClearErrors()
|
function! HideBuildResultsAndClearErrors()
|
||||||
RemoveErrorMarkers
|
RemoveErrorMarkers
|
||||||
|
@ -1269,9 +1244,9 @@ nnoremap <F6> :cp<CR>
|
||||||
nnoremap <C-p> :cp<CR>
|
nnoremap <C-p> :cp<CR>
|
||||||
|
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
" SEARCH
|
" TEXT SEARCH
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
|
|
||||||
" Search using ripgrep (first install with Rust: cargo install ripgrep).
|
" Search using ripgrep (first install with Rust: cargo install ripgrep).
|
||||||
function! Search(path, search_args, case_insensitive=0)
|
function! Search(path, search_args, case_insensitive=0)
|
||||||
|
@ -1297,25 +1272,28 @@ function! Search(path, search_args, case_insensitive=0)
|
||||||
exec l:cmd
|
exec l:cmd
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"/////////////////////////////////////////////////
|
||||||
" Search in current directory.
|
" SEARCH IN CURRENT DIRECTORY
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"/////////////////////////////////////////////////
|
||||||
|
|
||||||
" Case insensitive:
|
" Case insensitive:
|
||||||
noremap <leader>s :call Search('.', g:campo_custom_search_args, 1)<cr>
|
noremap <leader>s :call Search('.', g:campo_custom_search_args, 1)<cr>
|
||||||
" Case sensitive:
|
" Case sensitive:
|
||||||
noremap <leader>ss :call Search('.', g:campo_custom_search_args)<cr>
|
noremap <leader>ss :call Search('.', g:campo_custom_search_args)<cr>
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"/////////////////////////////////////////////////
|
||||||
" # Search in directory containing the active file.
|
" SEARCH IN DIRECTORY CONTAINING THE ACTIVE FILE
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"/////////////////////////////////////////////////
|
||||||
|
|
||||||
" Case insensitive:
|
" Case insensitive:
|
||||||
noremap <leader>sf :call Search(expand('%:p:h'), g:campo_custom_search_args, 1)<cr>
|
noremap <leader>sf :call Search(expand('%:p:h'), g:campo_custom_search_args, 1)<cr>
|
||||||
" Case sensitive:
|
" Case sensitive:
|
||||||
noremap <leader>ssf :call Search(expand('%:p:h'), g:campo_custom_search_args)<cr>
|
noremap <leader>ssf :call Search(expand('%:p:h'), g:campo_custom_search_args)<cr>
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"/////////////////////////////////////////////////
|
||||||
" Search in Jai folders
|
" SEARCH IN JAI FOLDERS
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"/////////////////////////////////////////////////
|
||||||
|
|
||||||
" Case insensitive:
|
" Case insensitive:
|
||||||
noremap <leader>sg :call Search(g:campo_jai_path, g:campo_custom_search_args, 1)<cr>
|
noremap <leader>sg :call Search(g:campo_jai_path, g:campo_custom_search_args, 1)<cr>
|
||||||
noremap <leader>sm :call Search(g:campo_jai_path . '/modules', g:campo_custom_search_args, 1)<cr>
|
noremap <leader>sm :call Search(g:campo_jai_path . '/modules', g:campo_custom_search_args, 1)<cr>
|
||||||
|
@ -1333,9 +1311,10 @@ noremap <leader>sse :call Search(g:campo_jai_path . '/examples', g:campo_custom_
|
||||||
nnoremap <expr> o (&buftype is# "quickfix" ? "<CR>\|:lopen<CR>" : "o")
|
nnoremap <expr> o (&buftype is# "quickfix" ? "<CR>\|:lopen<CR>" : "o")
|
||||||
nnoremap <expr> p (&buftype is# "quickfix" ? "<CR>\|:copen<CR>" : "p")
|
nnoremap <expr> p (&buftype is# "quickfix" ? "<CR>\|:copen<CR>" : "p")
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
||||||
" SEARCH & REPLACE
|
"##################################################################################
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
" TEXT SEARCH & REPLACE
|
||||||
|
"##################################################################################
|
||||||
|
|
||||||
" @warning I've stopped using this because it sometimes locks up vim and I
|
" @warning I've stopped using this because it sometimes locks up vim and I
|
||||||
" have to force exit the process then clean up the swap files.
|
" have to force exit the process then clean up the swap files.
|
||||||
|
@ -1402,9 +1381,10 @@ noremap <leader>r :call GlobalReplaceIt(0)<cr>
|
||||||
noremap <leader>rr :call GlobalReplaceIt(1)<cr>
|
noremap <leader>rr :call GlobalReplaceIt(1)<cr>
|
||||||
|
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
" RENAME CURRENT FILE
|
" RENAME CURRENT FILE
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"##################################################################################
|
||||||
|
|
||||||
function! RenameFile()
|
function! RenameFile()
|
||||||
let l:old_name = expand('%')
|
let l:old_name = expand('%')
|
||||||
let l:new_name = input('New file name: ', expand('%'), 'file')
|
let l:new_name = input('New file name: ', expand('%'), 'file')
|
||||||
|
@ -1419,6 +1399,27 @@ function! RenameFile()
|
||||||
endfunction
|
endfunction
|
||||||
noremap <leader>n :call RenameFile()<cr>
|
noremap <leader>n :call RenameFile()<cr>
|
||||||
|
|
||||||
"---------------------------------------------------------------------------------------------------
|
|
||||||
|
"##################################################################################
|
||||||
|
" CENTER THE BUFFER
|
||||||
|
"##################################################################################
|
||||||
|
|
||||||
|
function! CenterPane()
|
||||||
|
" centers the current pane as the middle 2 of 4 imaginary columns
|
||||||
|
" should be called in a window with a single pane
|
||||||
|
" Taken from https://dev.to/vinneycavallo/easily-center-content-in-vim
|
||||||
|
lefta vnew
|
||||||
|
wincmd w
|
||||||
|
exec 'vertical resize' string(&columns * 0.65)
|
||||||
|
endfunction
|
||||||
|
nnoremap <leader>c :call CenterPane()<cr>
|
||||||
|
|
||||||
|
function! RemoveCenterPane()
|
||||||
|
wincmd w
|
||||||
|
close
|
||||||
|
endfunction
|
||||||
|
nnoremap <leader>cw :call RemoveCenterPane()<cr>
|
||||||
|
|
||||||
|
"-----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
let g:campo_vimrc_initialized = 1
|
let g:campo_vimrc_initialized = 1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user