vim

vim config files
git clone https://git.bracken.jp/vim.git
Log | Files | Refs | LICENSE

commit a6c1c00a7a7171ecd556bf60a2bfe8c244985c54
parent 12204f4e49730f6fba4c14a174a0b3a555e9d481
Author: Chris Bracken <chris@bracken.jp>
Date:   Tue, 23 Mar 2021 15:20:44 -0700

Improve up vimrc commenting

Standardise formatting and clarify wording in a few places.

Diffstat:
Mvimrc | 88+++++++++++++++++++++++++++++++++++++++++--------------------------------------
1 file changed, 46 insertions(+), 42 deletions(-)

diff --git a/vimrc b/vimrc @@ -9,7 +9,7 @@ Plugin 'rhysd/vim-clang-format' Plugin 'spacehi.vim' " Highlight bad whitespace Plugin 'vimwiki/vimwiki' -" Language support +" Language support plugins. Plugin 'dart-lang/dart-vim-plugin' Plugin 'fatih/vim-go' Plugin 'keith/swift.vim' @@ -18,7 +18,7 @@ Plugin 'google/vim-ft-bzl' call vundle#end() filetype plugin indent on -" Bind fancier manpage plugin to Shift-k +" Bind fancier manpage plugin to Shift-k. runtime ftplugin/man.vim set keywordprg=:Man @@ -26,60 +26,64 @@ let mapleader=',' let s:cpo_save=&cpo set cpo&vim -" Middle-mouse paste +" Enable middle-mouse paste. map! <S-Insert> <MiddleMouse> map <S-Insert> <MiddleMouse> -" Kill ex mode +" Kill ex mode. noremap Q <NOP> -" Kill arrow keys, for great justice +" Kill arrow keys, for great justice. noremap <Up> <NOP> noremap <Down> <NOP> noremap <Left> <NOP> noremap <Right> <NOP> -" Retain selection on <,> +" Retain selection on <,>. vmap < <gv vmap > >gv let &cpo=s:cpo_save unlet s:cpo_save " Basic options -set incsearch " Turn on incrememental searching -set hlsearch " Highlight search -set visualbell " Less noise -set number " Relative line numbering -set ruler " Show row/col in status -set laststatus=1 " Only show status line if > 1 window -set showmatch " Flash matching paren -set history=50 " 50 lines of cmdline history -set wildmenu " Nicer autocomplete +set incsearch " Turn on incrememental searching. +set hlsearch " Highlight search. +set visualbell " Less noise. +set number " Use line numbering. +set ruler " Show row/col in status. +set laststatus=1 " Only show status line if > 1 window. +set showmatch " Highlight matching bracket. +set history=50 " Keep 50 lines of cmdline history. +set wildmenu " Nicer autocomplete. set wildmode=longest,full -set wildignore=*.o,*.pyc -set spelllang=en_ca +set wildignore=*.o,*.pyc " Ignore some filetypes during completion. +set spelllang=en_ca " Set the spelling language. " Omnicomplete set completeopt+=longest " Indentation/tabulation -set autoindent " Copy indent from current line when starting a new line -set smartindent " Attempt to autoindent when starting a new line -set smarttab " Use shiftwidth rather than tabstop at start of line -set tabstop=2 " Number of spaces a tab counts for -set shiftwidth=2 " Number of spaces for each step of autoindent -set softtabstop=2 " Number of spaces a tab counts for when editing -set expandtab " Insert spaces rather than tabs - -" Fix python's indent overrides +set autoindent " Copy indent from current line when starting a new line. +set smartindent " Attempt to autoindent when starting a new line. +set smarttab " Use shiftwidth rather than tabstop at start of line. +set tabstop=2 " Number of spaces per tab. +set shiftwidth=2 " Number of spaces for each step of autoindent. +set softtabstop=2 " Number of spaces per tab when editing. +set expandtab " Insert spaces in place of tabs. + +" Fix python's indent overrides. au FileType python setl ts=2 sw=2 sts=2 et -" Whitespace highlighting +" Configure whitespace highlighting. let g:spacehi_spacecolor="ctermbg=red guibg=red" let g:spacehi_tabcolor="ctermbg=red guibg=red" let g:spacehi_nbspcolor="ctermbg=red guibg=red" -" Golang +" Configure tag file locations. +set tags+=~/.local/tags/system.tags +set tags+=~/.local/tags/cxx.tags + +" Configure golang support. let g:go_fmt_command = "goimports" let g:go_highlight_functions = 1 let g:go_highlight_methods = 1 @@ -88,7 +92,7 @@ let g:go_highlight_operators = 1 let g:go_highlight_build_constraints = 1 let g:syntastic_go_checkers = ["go", "golint", "errcheck"] -" VimWiki +" Configure VimWiki. let wiki_1 = {} let wiki_1.index = 'Home' let wiki_1.path = '~/Documents/personal.wiki/' @@ -113,46 +117,46 @@ let wiki_3.syntax = 'markdown' let wiki_3.ext = '.md' let g:vimwiki_list = [wiki_1, wiki_2, wiki_3] -" Only consider files under a VimWiki path to be VimWiki +" Only consider files under a VimWiki path to be VimWiki. let g:vimwiki_global_ext = 0 -" Personal wiki index, diary, new entry +" Personal wiki index, diary, new entry. nmap <leader>jw 1<Plug>VimwikiIndex nmap <leader>jd 3<Plug>VimwikiDiaryIndex nmap <leader>jn 3<Plug>VimwikiMakeDiaryNote -" Work wiki index, diary, new entry +" Work wiki index, diary, new entry. nmap <leader>kw 2<Plug>VimwikiIndex nmap <leader>kd 3<Plug>VimwikiDiaryIndex nmap <leader>kn 3<Plug>VimwikiMakeDiaryNote -" Wiki diary previous, next day +" Wiki diary previous, next day. au FileType vimwiki nmap <leader>dp <Plug>VimwikiDiaryPrevDay au FileType vimwiki nmap <leader>dn <Plug>VimwikiDiaryNextDay -" Colorscheme and syntax highlighting +" Configure colour scheme and syntax highlighting. if &t_Co > 2 syntax enable set background=dark - " No background colour in terminal + " No background colour in terminal. hi Normal ctermbg=none - " Visual selection colour + " Visual selection colour. hi Visual ctermbg=237 - " Spelling mistake hightlight colour + " Spelling mistake hightlight colour. hi SpellLocal cterm=underline ctermbg=58 hi SpellBad cterm=underline ctermbg=88 - " Completion menu colour + " Completion menu colour. hi Pmenu ctermbg=0 ctermfg=8 hi PmenuSel ctermbg=8 ctermfg=15 - " Line numbers + " Line number colour. hi LineNr ctermfg=7 - " Highlight cursor line, max column + " Highlight cursor line, max column. set cursorline hi ColorColumn guibg=grey24 ctermbg=235 hi CursorLine guibg=grey24 ctermbg=235 cterm=bold @@ -180,7 +184,7 @@ endif """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Functions -" Apply clang-format to a range of lines (or all) +" Apply clang-format to a range of lines (or all). function ClangFormat() let l:line_start = getpos("'<")[1] let l:line_end = getpos("'>")[1] @@ -193,7 +197,7 @@ endfunction autocmd FileType c,cpp,objc nnoremap <buffer><Leader>cf :<C-u>ClangFormat<CR> autocmd FileType c,cpp,objc vnoremap <buffer><Leader>cf :ClangFormat<CR> -" Toggle relative numbering +" Toggle absolute/relative numbering. function! ToggleNumbering() if (&number == 0) set number