" Multi-version vimrc compatible with version 4 and above. vim:set fdm=marker:
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Note that "if <condition> | call Something() | endif" syntax is unsupported
-" in Vim 4 so we write all our functions out the long way. It does work in
+" Note that "if <condition> | call Something() | endif" syntax is unsupported
+" in Vim 4 so we write all our functions out the long way. It does work in
" autocommand definitions, however.
" Vim 4 complains if version isn't set in the configuration file.
version 4.0
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Handle options safe to use in version 4. Vim 4 parses but ignores the
-" "if version" syntax used later in this file so we don't use it. No attempt
+" Handle options safe to use in version 4. Vim 4 parses but ignores the
+" "if version" syntax used later in this file so we don't use it. No attempt
" is made to make this configuration compatible with Vim 3.
" Some of these settings should strictly be wrapped inside "if has()" blocks
" but that would cause them not to be ignored by Vim 4.
" Don't timeout waiting to interpet, eg, <ESC>OA as an escape code.
se ttimeoutlen=100
+" Remember undo list for closed (but not wiped) buffers.
+se hidden
+
" Use ^B to search backward when completing.
inoremap <C-b> <C-p>
" Use ^L to show matching completions but don't select one.
inoremap <C-l> <C-n><C-p>
" Swap jump keys.
-noremap ' `
-noremap ` '
+nnoremap ' `
+nnoremap ` '
+
+" Select previous widnow.
+nnoremap <C-w>^ <C-w>p
+nnoremap <C-w><C-^> <C-w>p
"}}}1
" Find stuff.
" Set extra columns depending on window status.
fun! Extra_Columns(extra, var, ...) "{{{2
" Vim 6 doesn't have winnr("$"). Determine which windows are open
- " ourselves by using :windo to incremement a counter. As Vim 5
+ " ourselves by using :windo to incremement a counter. As Vim 5
" doesn't have :windo we require Vim 6 for this.
if v:version < "600"
return ""
" Reuse windows when using sbuffer.
se switchbuf=useopen
+" Allow persistent variable saving for localvimrc.
+se viminfo+=!
+
" Do we have Unicode?
fun! Has_Unicode() "{{{2
if ! has('multi_byte')
if version >= "600" "{{{1
version 6.0
-if has("gui_win32")
+if has("win32") || has("win64")
se encoding=utf-8
endif
" Less intrusive syntax highlighting.
if has("syntax")
- syn enable
+ " The :syntax enable command tries to source the syntax.vim runtime script.
+ " Parsing this .vimrc will fail if for some reason the runtime doesn't
+ " exist, as could be the case if the binary was installed with no support
+ " files. GNU On Windows is one example of an incomplete installation.
+ try
+ syn enable
+ catch
+ endtry
endif
" Set colours.
endif
endif "}}}1
+" move.
+nmap <A-u> <Plug>MoveLineHalfPageUp
+nmap <A-d> <Plug>MoveLineHalfPageDown
+vmap <A-u> <Plug>MoveBlockHalfPageUp
+vmap <A-d> <Plug>MoveBlockHalfPageDown
+
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Handle options only available in Vim 7 and above.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Transparency.
if has("gui_macvim")
se transparency=15
-endif
+endif
" Yet more GUI options. Add tabs.
if has("gui")
let g:NERDSpaceDelims=1
endif "}}}1
+" localvimrc.
+let g:localvimrc_persistent=1
+
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Handle options only available in Vim 7.2 and above.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Remove persistent undo file with \U.
call Mapping("U", ":call <SID>Clear_Undo()<CR>:<CR>")
+" Toggle gundo window with \g.
+call Mapping("g", ":call gundo#GundoToggle()<CR>:<CR>")
+
" Use a persistent undo file if it exists.
fun! <SID>Check_Undo() "{{{2
if filereadable(undofile(expand("%")))
au Display WinEnter * if &diff | se cursorbind | endif
endif
endif
+
+" Mapping to reload the gundo window.
+if has("autocmd")
+ au Mode BufEnter * if &ft == "gundo" | try | nnoremap <silent> <buffer> <unique> r :call gundo#GundoToggle()<CR>:call gundo#GundoToggle()<CR> | catch | endtry | endif
+endif
+
endif "}}}1
" Resize after startup.