aboutsummaryrefslogtreecommitdiff
path: root/vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim')
-rw-r--r--vim/after/ftplugin/php.vim7
-rw-r--r--vim/after/ftplugin/vim.vim27
m---------vim/bundle/big_file_options0
m---------vim/bundle/insert_cancel0
m---------vim/bundle/insert_suspend_hlsearch0
m---------vim/bundle/markdown_autoformat0
m---------vim/bundle/perl_version_bump0
m---------vim/bundle/repeat0
m---------vim/bundle/strip_trailing_whitespace0
-rw-r--r--vim/vimrc80
10 files changed, 75 insertions, 39 deletions
diff --git a/vim/after/ftplugin/php.vim b/vim/after/ftplugin/php.vim
index 587062e5..70e92dfd 100644
--- a/vim/after/ftplugin/php.vim
+++ b/vim/after/ftplugin/php.vim
@@ -28,3 +28,10 @@ nnoremap <buffer> <LocalLeader>c
\ :<C-U>call compiler#Make('php')<CR>
let b:undo_ftplugin = b:undo_ftplugin
\ . '|nunmap <buffer> <LocalLeader>c'
+
+" Get rid of the core ftplugin's square-bracket maps on unload
+let b:undo_ftplugin = b:undo_ftplugin
+ \ . '|nunmap <buffer> [['
+ \ . '|ounmap <buffer> [['
+ \ . '|nunmap <buffer> ]]'
+ \ . '|ounmap <buffer> ]]'
diff --git a/vim/after/ftplugin/vim.vim b/vim/after/ftplugin/vim.vim
index 5726e1e4..9710b2d8 100644
--- a/vim/after/ftplugin/vim.vim
+++ b/vim/after/ftplugin/vim.vim
@@ -23,16 +23,17 @@ nnoremap <buffer> <LocalLeader>l
let b:undo_ftplugin = b:undo_ftplugin
\ . '|nunmap <buffer> <LocalLeader>l'
-" Just get rid of the core ftplugin's square-bracket maps; I don't use them
-silent! nunmap <buffer> [[
-silent! vunmap <buffer> [[
-silent! nunmap <buffer> ]]
-silent! vunmap <buffer> ]]
-silent! nunmap <buffer> []
-silent! vunmap <buffer> []
-silent! nunmap <buffer> ][
-silent! vunmap <buffer> ][
-silent! nunmap <buffer> ]"
-silent! vunmap <buffer> ]"
-silent! nunmap <buffer> ["
-silent! vunmap <buffer> ["
+" Get rid of the core ftplugin's square-bracket maps on unload
+let b:undo_ftplugin = b:undo_ftplugin
+ \ . '|nunmap <buffer> [['
+ \ . '|vunmap <buffer> [['
+ \ . '|nunmap <buffer> ]]'
+ \ . '|vunmap <buffer> ]]'
+ \ . '|nunmap <buffer> []'
+ \ . '|vunmap <buffer> []'
+ \ . '|nunmap <buffer> ]['
+ \ . '|vunmap <buffer> ]['
+ \ . '|nunmap <buffer> ]"'
+ \ . '|vunmap <buffer> ]"'
+ \ . '|nunmap <buffer> ["'
+ \ . '|vunmap <buffer> ["'
diff --git a/vim/bundle/big_file_options b/vim/bundle/big_file_options
-Subproject d1d90c2c57676499c184660288502e2d6f166e8
+Subproject 10e23336ae2fb213f44affc8c8b37b0d9bc2305
diff --git a/vim/bundle/insert_cancel b/vim/bundle/insert_cancel
-Subproject c55d432ff756495c15032c22f6f8f57673569b4
+Subproject 8228d9f73730fb751ab7aab301bc07286b45a36
diff --git a/vim/bundle/insert_suspend_hlsearch b/vim/bundle/insert_suspend_hlsearch
-Subproject 6f11733166454e1502a5832f8504826d7f411a8
+Subproject 0b7cb75d1bd8eac9e411ee344f78608122e69d6
diff --git a/vim/bundle/markdown_autoformat b/vim/bundle/markdown_autoformat
-Subproject a109355774c8b1eccfa865156e557ee1734b3f0
+Subproject aea3e81506a08945dabc2766fe0a7b4d59d67fc
diff --git a/vim/bundle/perl_version_bump b/vim/bundle/perl_version_bump
-Subproject 80c98e8b11832cf78f2fc3ee43599749be8ee6a
+Subproject 3ea1890e49b064cb7e8fc1481fc70d5a4c919cc
diff --git a/vim/bundle/repeat b/vim/bundle/repeat
-Subproject 8106e142dfdc278ff3eaaadd7b362ad7949d435
+Subproject 43d2678fa59d068c815d8298331c195e850ff5a
diff --git a/vim/bundle/strip_trailing_whitespace b/vim/bundle/strip_trailing_whitespace
-Subproject ddf61eb54415c7cb308a2600b963f6579011214
+Subproject 1878ccd255b91ffabbe754d8b843e795fa95e03
diff --git a/vim/vimrc b/vim/vimrc
index 300fc3a5..982bd5ba 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -9,7 +9,7 @@ runtime system.vim
" Load filetype settings, plugins, and maps
if has('autocmd')
- let g:maplocalleader = ','
+ let g:maplocalleader = '\\'
filetype plugin indent on
endif
@@ -32,15 +32,15 @@ if has('syntax') && !exists('g:syntax_on')
endif
" The all-important default indent settings; filetypes to tweak
-set autoindent " Use indent of previous line on new lines
-set expandtab " Use spaces instead of tabs
-set shiftwidth=4 " Indent with four spaces
+setglobal autoindent " Use indent of previous line on new lines
+setglobal expandtab " Use spaces instead of tabs
+setglobal shiftwidth=4 " Indent with four spaces
" Spaces to insert on Tab key insert
if v:version > 703 || v:version == 703 && has('patch693')
- set softtabstop=-1 " Refer to 'shiftwidth' if supported
+ setglobal softtabstop=-1 " Refer to 'shiftwidth' if supported
else
- set softtabstop=4 " Otherwise just four spaces
+ setglobal softtabstop=4 " Otherwise just four spaces
endif
" Let me backspace over pretty much anything
@@ -69,11 +69,14 @@ endif
" Delete comment leaders when joining lines, if supported
if v:version > 703 || v:version == 703 && has('patch541')
- set formatoptions+=j
+ setglobal formatoptions+=j
endif
+" Keep more command and search history
+set history=500
+
" Don't assume I'm editing C; let the filetype set this
-set include=
+setglobal include=
" Don't join lines with two spaces at the end of sentences
set nojoinspaces
@@ -96,13 +99,13 @@ if v:version >= 700
endif
" Add angle brackets to pairs of matched characters
-set matchpairs+=<:>
+setglobal matchpairs+=<:>
" Don't allow setting options via buffer content
-set nomodeline
+setglobal nomodeline
" Treat numbers with a leading zero as decimal, not octal
-set nrformats-=octal
+setglobal nrformats-=octal
" Abbreviate some more regularly displayed messages
set shortmess+=I " Don't show startup splash screen
@@ -112,7 +115,7 @@ set shortmess+=w " written -> [w], appended -> [a]
" Clear default 'comments' value, let the filetype handle it
if has('comments')
- set comments=
+ setglobal comments=
endif
" Highlight settings for search
@@ -124,7 +127,7 @@ endif
" More sensible language-agnostic setting for gf/:find
if has('file_in_path')
- set path=.,,**
+ setglobal path=.,,**
endif
" Don't load GUI menus; set here before GUI starts
@@ -134,10 +137,10 @@ endif
" Line break behaviour settings for 'wrap'
if has('linebreak')
- set linebreak " Break lines at word boundaries
- set showbreak=... " Prefix wrapped rows with three dots
+ setglobal linebreak " Break lines at word boundaries
+ set showbreak=... " Prefix wrapped rows with three dots
if exists('+breakindent')
- set breakindent " Indent wrapped lines, if supported
+ setglobal breakindent " Indent wrapped lines, if supported
endif
endif
@@ -167,9 +170,9 @@ endif
nnoremap <silent> <C-L> :<C-U>nohlsearch<CR><C-L>
vnoremap <silent> <C-L> :<C-U>nohlsearch<CR>gv<C-L>
-" Stack insert Ctrl-C to undo the escaped insert operation
+" Remap insert Ctrl-C to undo the escaped insert operation
" Default to not-quite-correct vim-tiny-compatible map if no plugin
-inoremap <Plug>InsertCancel <C-C>u
+inoremap <Plug>InsertCancel <Esc>u
imap <C-C> <Plug>InsertCancel
" Remap normal J to stay in place while joining lines
@@ -183,6 +186,12 @@ if v:version >= 700
xnoremap <Space> <C-F>
endif
+" Remap normal/visual <Backspace> to scroll up a page
+nnoremap <Backspace> <C-B>
+if v:version >= 700
+ xnoremap <Backspace> <C-B>
+endif
+
" Remap normal/visual & to preserve substitution flags
nnoremap <silent> & :&&<CR>
if v:version >= 700
@@ -216,17 +225,17 @@ nnoremap <Bslash>a :<C-U>ToggleOptionFlagLocal formatoptions a<CR>
" \b toggles copy-pasteable linebreak settings
nmap <Bslash>b <Plug>CopyLinebreakToggle
" \c toggles 'cursorline'
-nnoremap <Bslash>c :<C-U>set cursorline! cursorline?<CR>
+nnoremap <Bslash>c :<C-U>setlocal cursorline! cursorline?<CR>
" \C toggles 'cursorcolumn'
-nnoremap <Bslash>C :<C-U>set cursorcolumn! cursorcolumn?<CR>
+nnoremap <Bslash>C :<C-U>setlocal cursorcolumn! cursorcolumn?<CR>
" \d inserts the local date (POSIX date)
nnoremap <Bslash>d :read !date<CR>
" \D inserts the UTC date (POSIX date)
nnoremap <Bslash>D :read !date -u<CR>
" \e forces a buffer to be editable
-nnoremap <Bslash>e :set modifiable noreadonly<CR>
+nnoremap <Bslash>e :setlocal modifiable noreadonly<CR>
" \f shows the current 'formatoptions' at a glance
-nnoremap <Bslash>f :<C-U>set formatoptions?<CR>
+nnoremap <Bslash>f :<C-U>setlocal formatoptions?<CR>
" \g changes directory to the current file's location
nnoremap <Bslash>g :<C-U>cd %:h<CR>:pwd<CR>
" \h toggles highlighting search results
@@ -238,13 +247,15 @@ nnoremap <Bslash>j :<C-U>buffers<CR>:buffer<Space>
" \k shows my marks
nnoremap <Bslash>k :<C-U>marks<CR>
" \l toggles showing tab, end-of-line, and trailing whitespace
-nnoremap <Bslash>l :<C-U>set list! list?<CR>
+nnoremap <Bslash>l :<C-U>setlocal list! list?<CR>
" \m shows all maps
nnoremap <Bslash>m :<C-U>map<CR>
" \M shows buffer-local maps
nnoremap <Bslash>M :<C-U>map <buffer><CR>
" \n toggles line numbers
-nnoremap <Bslash>n :<C-U>set number! number?<CR>
+nnoremap <Bslash>n :<C-U>setlocal number! number?<CR>
+" \N toggles 'ruler'
+nnoremap <Bslash>N :<C-U>set ruler! ruler?<CR>
" \o opens a line below in paste mode
nmap <Bslash>o <Plug>PasteOpenBelow
" \o opens a line above in paste mode
@@ -255,10 +266,14 @@ nnoremap <Bslash>p :<C-U>set paste! paste?<CR>
nnoremap <Bslash>q gqap
" \r reloads .vimrc
nnoremap <Bslash>r :<C-U>source $MYVIMRC<CR>
+" \R reloads filetype
+nnoremap <Bslash>R :<C-U>doautocmd filetypedetect BufRead<CR>
" \s toggles spell checking
nnoremap <Bslash>s :<C-U>setlocal spell! spell?<CR>
" \t shows current filetype
-nnoremap <Bslash>t :<C-U>set filetype?<CR>
+nnoremap <Bslash>t :<C-U>setlocal filetype?<CR>
+" \T clears filetype (follow with \R)
+nnoremap <Bslash>T :<C-U>setlocal filetype=NONE<CR>
" \u sets US English spelling (compare \z)
nnoremap <Bslash>u :<C-U>setlocal spelllang=en_us<CR>
" \v shows all global variables
@@ -266,7 +281,7 @@ nnoremap <Bslash>v :<C-U>let g: v:<CR>
" \V shows all local variables
nnoremap <Bslash>V :<C-U>let b: t: w:<CR>
" \w toggles wrapping
-nnoremap <Bslash>w :<C-U>set wrap! wrap?<CR>
+nnoremap <Bslash>w :<C-U>setlocal wrap! wrap?<CR>
" \x strips trailing whitespace via a custom plugin
nmap <Bslash>x <Plug>StripTrailingWhitespace
" \y shows all registers
@@ -274,5 +289,18 @@ nnoremap <Bslash>y :<C-U>registers<CR>
" \z sets NZ English spelling (compare \u)
nnoremap <Bslash>z :<C-U>setlocal spelllang=en_nz<CR>
+" \DEL deletes the current buffer
+nnoremap <Bslash><Delete> :<C-U>bdelete<CR>
+" \INS edits a new buffer
+nnoremap <Bslash><Insert> :<C-U>enew<CR>
+
" Source any .vim files from ~/.vim/config
runtime! config/*.vim
+
+" Flag that we loaded, tell the user if we reload
+if 1
+ if exists('g:loaded_vimrc')
+ echomsg 'Reloaded vimrc: '.$MYVIMRC
+ endif
+ let g:loaded_vimrc = 1
+endif