Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- source $VIMRUNTIME/mswin.vim
- behave mswin
- " In keeping with FGL standards, this vimrc favors tabs over spaces
- " Alaestor's _vimrc file (2017 FGL)
- "CUSTOM KEY MAPS
- " Esc remove search highlighting
- " < indent {} block to the left
- " > indent {} block to the right
- " <leader>[ folds file entirely, and opens one level.
- " <leader>] expands all folds
- " <leader><backspace> removes trailing whitespace
- " <leader>= reindent file and remove trailing whitespace
- " F2 toggle error highlighting
- " F3 toggle viewing whitespace characters
- " F4 identify syntax highlighting group
- "TROLL REMAPS
- " <leader>~ replace newlines with spaces, remove redundant whitespace
- " <leader>` put a space before every newline
- set nocompatible
- syntax on
- filetype plugin on
- filetype indent on
- "file finding (':find *.cpp' and ':b ' for buffers)
- set path+=** "recursive
- set wildmenu
- set ignorecase
- set smartcase
- "folding
- set mouse=a
- set foldcolumn=1
- set foldlevelstart=1 "start folded
- set foldnestmax=10
- set foldmethod=syntax "indent or manual or syntax
- "editor layout
- set visualbell t_vb=
- au GuiEnter * set visualbell t_vb=
- set laststatus=2
- set number
- set numberwidth=5
- set lazyredraw
- set ruler
- set nowrap
- "control
- set backspace=indent,eol,start
- set sc
- "matching pairs
- set matchpairs+=<:>
- "whitespace characters
- set shiftwidth=4
- set tabstop=4
- "indenting style... I love cindent!!!
- "issue: templates. +0 no indent to incomplete line. fixes, but not optimal.
- set cindent
- set cinoptions=h0,:0,=s,l1,cs,C1,(s,)50,*300,U1,Ws,m1,N-s,+0
- "disable automatic comment-insertion when you newline
- autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
- set listchars=tab:>-,trail:¬,extends:>,precedes:<,eol:»,nbsp:#,space:·
- "set list to default on
- "keybind
- nnoremap <F3> :set invlist<CR>
- "highlighting
- colorscheme FGL_custom
- " errors
- set hlsearch
- let s:ehl = 0
- function! ToggleEH()
- if s:ehl == 0
- let s:ehl = 1
- let w:hlWidthLimit = matchadd("ErrorMsg",'\%>79v.\+',-1)
- let w:hlRedundant = matchadd("ErrorMsg",'\(\s\+$\| \+\ze\t\|\t\zs \+\)\(\%#\)\@!',-1)
- let w:hlDoubleSpace = matchadd("ErrorMsg",'\ \ ',-1)
- else
- let s:ehl = 0
- call matchdelete(w:hlWidthLimit)
- call matchdelete(w:hlRedundant)
- call matchdelete(w:hlDoubleSpace)
- endif
- endfunction
- call ToggleEH() " to default on
- "keybind
- nnoremap <F2> :call ToggleEH()<CR>
- nnoremap <F4> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
- "keymapping utility
- "unhighlight search terms
- nnoremap <Esc> :noh<CR><Esc>
- "easily indent {} blocks from normal mode
- nnoremap < <Esc>viB<
- nnoremap > <Esc>viB>
- "fold and expand
- nnoremap <leader>[ zMzr
- nnoremap <leader>] zR
- "remove trailing whitespace
- nmap <leader><Backspace> :%s/\s\+$//e<CR>:%s/\ \ /\ /e<CR>
- "reformat indent and remove trailing whitespace
- nnoremap <leader>= mzgg=G:%s/\s\+$//e<CR>:%s/\ \ /\ /e<CR>:noh<CR><Esc>`z
- "trolly: replace newlines with spaces, remove redundant whitespace
- nnoremap <leader>~ :%s/\n/\ /<CR>:%s/\s\+\s/\ /<CR>:noh<CR><Esc>
- "trolly: put a space before every newline
- nnoremap <leader>` :%s/$/\ /e<CR>:noh<CR><Esc>
- "loose file definitions
- "backup files
- set backup "nobackup
- set writebackup "nowritebackup
- set backupdir=%TMP%//
- "swap file
- set swapfile "noswapfile
- set directory=%TMP%//
- "undo file
- set undofile "noundofile
- set undolevels=500 "1000
- set undoreload=5000 "10000
- set undodir=%TMP%//
- "useful links
- "https://youtu.be/XA2WjJbmmoM 'How to Do 90% of What Plugins Do'
- "http://vim.wikia.com/wiki/Vim_Tips_Wiki
- "http://vimdoc.sourceforge.net/htmldoc/indent.html#cinoptions-values
- "http://vimdoc.sourceforge.net/htmldoc/indent.html#cinkeys-format
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement