aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-06-23 00:21:15 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-06-23 00:31:58 +1200
commitefd92082c6c42c3172e8130950ef0fbb6b2eca61 (patch)
treee084d57b34686e843eaf5a97769dcd246970bcac
parent0625928cffec63a68c39b9eeb222ae7e67dcccca (diff)
downloaddotfiles-efd92082c6c42c3172e8130950ef0fbb6b2eca61.tar.gz
dotfiles-efd92082c6c42c3172e8130950ef0fbb6b2eca61.zip
Fix up .vimrc comments
-rw-r--r--vim/vimrc89
1 files changed, 37 insertions, 52 deletions
diff --git a/vim/vimrc b/vim/vimrc
index 40800c16..89de66cb 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -15,7 +15,7 @@ if has('syntax') && !has('g:syntax_on')
" Use syntax highlighting
syntax enable
- " Use the 'sahara' colorscheme if using the GUI or if we have 256 colors
+ " Use my colorscheme if using the GUI or if we have 256 colors
if has('gui_running') || &t_Co >= 256
silent! colorscheme sahara
endif
@@ -34,8 +34,8 @@ set expandtab " Use spaces instead of tabs
set shiftround " Round indenting to multiples of 'shiftwidth'
set shiftwidth=4 " Indent with four spaces
-" Spaces to insert on Tab key press; if supported, use negative value to
-" mirror 'shiftwidth'
+" Spaces to insert on Tab key press; use negative value to mirror 'shiftwidth'
+" if supported
if v:version > 703 || v:version == 703 && has('patch693')
set softtabstop=-1
else
@@ -55,34 +55,28 @@ else
set visualbell t_vb=
endif
-" Start with blank comment strings rather than the old default; let the
-" filetype handle it
+" Clear default comment string, let the filetype handle it
set comments=
-" Show only one line of @ symbols for a truncated last line if possible, and
-" show none at all if not
+" How to deal with lines wrapping beyond the last screen row
if v:version > 704 || v:version == 704 && has('patch2109')
- set display=truncate
+ set display=truncate " Show '@@@' on the last line, if supported
else
- set display=lastline
+ set display=lastline " Just let it run off the screen
endif
-" Don't wait to see if Escape in insert mode precedes a key for an Alt binding
+" Don't wait for a key after Escape in insert mode
set noesckeys
-" Try to set the 'j' flag for 'formatoptions', to automatically delete comment
-" leaders when joining lines, if supported
+" Delete comment leaders when joining lines, if supported
if v:version > 703 || v:version == 703 && has('patch541')
set formatoptions+=j
endif
-" Don't join lines with two spaces at the end of sentences; I don't two-space,
-" despite the noble Steve Losh's exhortations
+" Don't join lines with two spaces at the end of sentences
set nojoinspaces
-" Don't bother drawing the screen while executing macros or other automated or
-" scripted processes, just draw the screen as it is when the operation
-" completes
+" Don't redraw the screen during batch execution
set lazyredraw
" Define list characters
@@ -91,25 +85,23 @@ set listchars+=precedes:< " Unwrapped text to screen left
set listchars+=tab:>- " Tab characters, preserve width
set listchars+=trail:_ " Trailing spaces
-" Add angle brackets to pairs of characters to match
+" Add angle brackets to pairs of matched characters
set matchpairs+=<:>
-" Don't use modelines at all, they're apparently potential security problems
-" and I've never used them anyway
+" Don't allow setting options via buffer content
set nomodeline
-" Don't assume a number with a leading zero is octal; it's far more likely a
-" zero-padded decimal, so increment and decrement with ^A and ^X on that basis
+" Increment/decrement numbers with a leading zero as decimal, not octal
set nrformats-=octal
" Always tell me the number of lines changed by a command
set report=0
-" Set up short message settings
+" Abbreviate some of the regularly displayed messages
set shortmess=
set shortmess+=f " (file 3 of 5) -> (3 of 5)
set shortmess+=i " [Incomplete last line] -> [noeol]
-set shortmess+=I " I donated to Uganda, thanks Bram
+set shortmess+=I " Don't show startup splash screen
set shortmess+=l " 999 lines, 888 characters -> 999L, 888C
set shortmess+=m " [Modified] -> [+]
set shortmess+=n " [New File] -> [New]
@@ -200,8 +192,7 @@ if has('windows')
" Don't resize windows we're not splitting (tmux-like; think Mondrian)
set noequalalways
- " New split windows appear below or to the right of the existing window,
- " not above or to the left per the default
+ " Split windows to the right and bottom
set splitbelow
if has('vertsplit')
set splitright
@@ -214,43 +205,39 @@ if has('windows')
endif
-" Rebind Ctrl-C in insert mode to undo the current insert operation
+" Rebind insert Ctrl-C to undo the current insert operation
inoremap <C-C> <C-C>u
-" Rebind <Space> in normal mode as a lazy scroll
+" Rebind normal <Space> to scroll down a page
nnoremap <Space> <C-F>
-" Preserve the flags for a pattern when repeating a substitution with &
+" Rebind normal & to preserve substitution flags
nnoremap <silent> & :<C-U>&&<CR>
-" Pressing ^L will clear highlighting until the next search-related operation
+" Stack normal Ctrl-L to clear search highlighting before redraw
nnoremap <silent> <C-L> :<C-U>nohlsearch<CR><C-L>
-" Cycle through things with unimpaired.vim-style bindings:
-" Buffers
+" Cycle through buffers
nnoremap [b :<C-U>bprevious<CR>
nnoremap ]b :<C-U>bnext<CR>
-" Quicklist items (more often :helpgrep results)
+" Cycle through quicklist items (more often :helpgrep results)
nnoremap [c :<C-U>cprevious<CR>
nnoremap ]c :<C-U>cnext<CR>
-" Location list items
+" Cycle through location list items
nnoremap [l :<C-U>lprevious<CR>
nnoremap ]l :<C-U>lnext<CR>
-" Insert blank lines above and below via my custom unimpaired.vim rip
+" Insert blank lines above and below current line
nmap [<Space> <Plug>PutBlankLinesAbove
nmap ]<Space> <Plug>PutBlankLinesBelow
-" Swap the j/gj and k/gk command pairs so that we move by screen row, not
-" buffer line, with j/k
+" Swap buffer line vs screen row motions
nnoremap j gj
nnoremap k gk
nnoremap gj j
nnoremap gk k
-" Change and delete with C and D both cut off the remainder of the line from
-" the cursor, but Y yanks the whole line, which is inconsistent (and can be
-" done with yy anyway); this fixes it so it only yanks the rest of the line
+" Remap Y to yank to end of line (consistent with C, D)
nnoremap Y y$
" ZA does an unconditional write for all buffers
@@ -265,15 +252,14 @@ if has('digraphs')
digraph 8: 9731 " Snowman (SNOWMAN U+2603)
endif
-" Use different keys for global and local leaders
+" Use different keys for global and local leaders for plugins
if 1
let g:mapleader = '\'
let g:maplocalleader = '_'
endif
-" Leader mappings below; we use a literal backslash rather than <Leader> for
-" the mappings here, because I want many of these to work even on tiny
-" stripped-down Vims like Debian's. The settings above are for plugins.
+" Leader mappings below; use a literal backslash rather than <Leader> so that
+" the non-plugin mappings work on vim-tiny
" \a toggles 'formatoptions' 'a' flag using a plugin
nnoremap \a :<C-U>ToggleOptionFlagLocal formatoptions a<CR>
@@ -284,9 +270,9 @@ nnoremap \c :<C-U>set cursorcolumn! cursorcolumn?<CR>
nnoremap \C :<C-U>set cursorline! cursorline?<CR>
" Current date and time insertion commands, requiring POSIX date(1)
if has('unix')
- " \d: Local date
+ " \d inserts the local date
nnoremap \d :<C-U>read !date<CR>
- " \D: UTC
+ " \D inserts the UTC date
nnoremap \D :<C-U>read !date -u<CR>
endif
" \f shows the current 'formatoptions' at a glance
@@ -312,17 +298,17 @@ nnoremap \r :<C-U>source $MYVIMRC<CR>
nnoremap \s :<C-U>setlocal spell! spell?<CR>
" \t shows current filetype
nnoremap \t :<C-U>set filetype?<CR>
-" \u sets US English spelling
+" \u sets US English spelling (compare \z)
nnoremap \u :<C-U>setlocal spelllang=en_us spelllang?<CR>
" \w toggles wrapping
nnoremap \w :<C-U>set wrap! wrap?<CR>
" \x strips trailing whitespace via a custom plugin
nmap \x <Plug>StripTrailingWhitespace
-" \z sets NZ English spelling
+" \z sets NZ English spelling (compare \u)
nnoremap \z :<C-U>setlocal spelllang=en_nz spelllang?<CR>
" Add the packaged version of matchit.vim included in the distribution, if
-" possible; plugin/macros.vim loads this for older Vims
+" supported; plugin/macros.vim loads this for older Vims
if has('packages')
packadd! matchit
endif
@@ -346,11 +332,10 @@ if 1
let g:loaded_netrwPlugin = 1
" I don't use Vim servers
let g:loaded_rrhelper = 1
- " System dictionaries plus custom per-machine spell files are fine
+ " I don't need extra spelling files
let g:loaded_spellfile_plugin = 1
endif
-" Source all .vim files from ~/.vim/config, which may override any of the
-" above
+" Source all .vim files from ~/.vim/config
runtime! config/*.vim