summaryrefslogtreecommitdiff
path: root/vimrc
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2019-07-31 08:25:21 -0700
committerBen Sima <ben@bsima.me>2019-07-31 08:25:21 -0700
commit63faf38dd786601adcaadd3945a5babc17f67613 (patch)
tree10f25b5c8d168af1daa4d85287a8027dc833357d /vimrc
parent20ada3229a944020a398f79cf92d1a1a4694ba4e (diff)
improve vim
Diffstat (limited to 'vimrc')
-rw-r--r--vimrc26
1 files changed, 19 insertions, 7 deletions
diff --git a/vimrc b/vimrc
index 5da401c..f585f90 100644
--- a/vimrc
+++ b/vimrc
@@ -30,8 +30,8 @@ if has('syntax') && !exists('g:syntax_on')
syntax enable
endif
-""" Simple Mappings
-let maplocalleader = ","
+""" Make , the leader key
+let mapleader = ","
" easy escape
imap fd <Esc>
@@ -48,22 +48,34 @@ nmap ;o :buffer <C-R>=expand("%:h") . "/" <CR>
" list buffers
nmap ,l :ls<cr>
-" delete buffer
-nmap ,u :bdelete<cr>
+" kill buffer
+nmap ,k :bdelete<cr>
-" ,d insert current date
+" insert current date
nmap <silent> ,d :r !date +\%Y.\%m.\%d<cr>
nmap <silent> ,D :r !date +\%Y.\%m.\%d..\%H.\%M.\%S<cr>
" grep (ripgrep)
-nmap ,g :Rg
+nmap ,g :Rg
+
+" clear out trailing whitespace and lines ending in whitespace
+nmap <silent> ,w :%s/[\t ]\+$//e<cr>
" Use <C-L> to clear the highlighting of :set hlsearch.
if maparg('<C-L>', 'n') ==# ''
nnoremap <silent> <C-L> :nohlsearch<C-R>=has('diff')?'<Bar>diffupdate':''<CR><CR><C-L>
endif
-""" Easily find cursor with crosshair (\c)
+" trailing spaces are always bad
+syntax match Warning display "\s\+$"
+" mixed tabs and spaces
+syntax match Warning display " \+\t"
+syntax match Warning display "\t\+ "
+
+" mark columns 80 and 81 in red for long lines...
+match ErrorMsg /\%80v.\%81v./
+
+""" Easily find cursor with crosshair (,c)
:hi CursorLine cterm=NONE term=reverse ctermbg=7 guibg=Grey90
:hi CursorColumn cterm=NONE term=reverse ctermbg=7 guibg=Grey90
:nnoremap <Leader>c :set cursorline! cursorcolumn!<CR>