aboutsummaryrefslogtreecommitdiff
path: root/vim/vimrc
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-09 15:47:14 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-09 15:47:14 +1200
commitb4a2c25d7e81c88077c408e7189fbc23e771fb36 (patch)
tree9eba14fcffd5084c8a1d1d08e4f37b80b0f30a46 /vim/vimrc
parentMerge branch 'release/v1.24.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-b4a2c25d7e81c88077c408e7189fbc23e771fb36.tar.gz
dotfiles-b4a2c25d7e81c88077c408e7189fbc23e771fb36.zip
Merge branch 'release/v1.25.0'v1.25.0
* release/v1.25.0: Add extra Perl file detection rules Adjust comment on scripts.vim load Don't defer package load for matchit Clear b:current_compiler on unload Adjust comments in filetype.vim Specify which Vim to run in Makefile Tweak HTML indenting to indent after <p> Use !=# for &filetype match Revert :setglobal changes Overhaul ftplugin check, lint, tidy Change local leader back to comma Overhaul base after-ftplugins Remove Perl indent string again Tidy space and backspace mappings Upgrade and adjust config for diff_prune.vim Highlight overly long Git commit subjects as error Test 'modifiable' for spellchecking text/markdown Disable concealing when editing Vim help Add patterns for Vim help file detection Move shebang updating into filetype.vim Use stridx() for shebang check Correct filetype reset; blank, not NONE Correct a comment on shebang_update.vim
Diffstat (limited to 'vim/vimrc')
-rw-r--r--vim/vimrc63
1 files changed, 35 insertions, 28 deletions
diff --git a/vim/vimrc b/vim/vimrc
index 982bd5ba..3678e375 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
-setglobal autoindent " Use indent of previous line on new lines
-setglobal expandtab " Use spaces instead of tabs
-setglobal shiftwidth=4 " Indent with four spaces
+set autoindent " Use indent of previous line on new lines
+set expandtab " Use spaces instead of tabs
+set shiftwidth=4 " Indent with four spaces
" Spaces to insert on Tab key insert
if v:version > 703 || v:version == 703 && has('patch693')
- setglobal softtabstop=-1 " Refer to 'shiftwidth' if supported
+ set softtabstop=-1 " Refer to 'shiftwidth' if supported
else
- setglobal softtabstop=4 " Otherwise just four spaces
+ set softtabstop=4 " Otherwise just four spaces
endif
" Let me backspace over pretty much anything
@@ -69,14 +69,14 @@ endif
" Delete comment leaders when joining lines, if supported
if v:version > 703 || v:version == 703 && has('patch541')
- setglobal formatoptions+=j
+ set formatoptions+=j
endif
" Keep more command and search history
set history=500
" Don't assume I'm editing C; let the filetype set this
-setglobal include=
+set include=
" Don't join lines with two spaces at the end of sentences
set nojoinspaces
@@ -99,13 +99,13 @@ if v:version >= 700
endif
" Add angle brackets to pairs of matched characters
-setglobal matchpairs+=<:>
+set matchpairs+=<:>
" Don't allow setting options via buffer content
-setglobal nomodeline
+set nomodeline
" Treat numbers with a leading zero as decimal, not octal
-setglobal nrformats-=octal
+set nrformats-=octal
" Abbreviate some more regularly displayed messages
set shortmess+=I " Don't show startup splash screen
@@ -115,7 +115,7 @@ set shortmess+=w " written -> [w], appended -> [a]
" Clear default 'comments' value, let the filetype handle it
if has('comments')
- setglobal comments=
+ set comments=
endif
" Highlight settings for search
@@ -127,7 +127,7 @@ endif
" More sensible language-agnostic setting for gf/:find
if has('file_in_path')
- setglobal path=.,,**
+ set path=.,,**
endif
" Don't load GUI menus; set here before GUI starts
@@ -137,10 +137,10 @@ endif
" Line break behaviour settings for 'wrap'
if has('linebreak')
- setglobal linebreak " Break lines at word boundaries
- set showbreak=... " Prefix wrapped rows with three dots
+ set linebreak " Break lines at word boundaries
+ set showbreak=... " Prefix wrapped rows with three dots
if exists('+breakindent')
- setglobal breakindent " Indent wrapped lines, if supported
+ set breakindent " Indent wrapped lines, if supported
endif
endif
@@ -180,16 +180,12 @@ imap <C-C> <Plug>InsertCancel
nnoremap <Plug>FixedJoin mzJ`z
nmap J <Plug>FixedJoin
-" Remap normal/visual <Space> to scroll down a page
+" Remap normal/visual space to scroll down a page, backspace up
nnoremap <Space> <C-F>
+nnoremap <BS> <C-B>
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>
+ xnoremap <BS> <C-B>
endif
" Remap normal/visual & to preserve substitution flags
@@ -273,7 +269,7 @@ nnoremap <Bslash>s :<C-U>setlocal spell! spell?<CR>
" \t shows current filetype
nnoremap <Bslash>t :<C-U>setlocal filetype?<CR>
" \T clears filetype (follow with \R)
-nnoremap <Bslash>T :<C-U>setlocal filetype=NONE<CR>
+nnoremap <Bslash>T :<C-U>setlocal filetype=<CR>
" \u sets US English spelling (compare \z)
nnoremap <Bslash>u :<C-U>setlocal spelllang=en_us<CR>
" \v shows all global variables
@@ -289,6 +285,13 @@ nnoremap <Bslash>y :<C-U>registers<CR>
" \z sets NZ English spelling (compare \u)
nnoremap <Bslash>z :<C-U>setlocal spelllang=en_nz<CR>
+" \= runs the whole buffer through =, preserving position
+nnoremap <Bslash>= :<C-U>call vimrc#Anchor('1G=G')<CR>
+" \+ runs the whole buffer through gq, preserving position
+nnoremap <Bslash>+ :<C-U>call vimrc#Anchor('1GgqG')<CR>
+" \. runs the configured make program to location list
+nnoremap <Bslash>. :<C-U>lmake!<CR>
+
" \DEL deletes the current buffer
nnoremap <Bslash><Delete> :<C-U>bdelete<CR>
" \INS edits a new buffer
@@ -297,10 +300,14 @@ 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
+" If we reloaded, reload filetype detection for the active buffer too, so that
+" any local settings for it are restored
+if exists('g:loaded_vimrc')
+ if &filetype !=# ''
+ doautocmd filetypedetect BufRead
endif
+ echomsg 'Reloaded vimrc: '.$MYVIMRC
+endif
+if 1
let g:loaded_vimrc = 1
endif