From 6a70dfe99a84641d5e72e4d49fde85e59b0890f3 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sun, 21 Jul 2013 23:20:10 +1200 Subject: Observe VimL convention of two-space indents --- vim/gvimrc | 4 +- vim/vimrc | 396 ++++++++++++++++++++++++++++++------------------------------- 2 files changed, 200 insertions(+), 200 deletions(-) diff --git a/vim/gvimrc b/vim/gvimrc index 09ff824f..9b6c8848 100644 --- a/vim/gvimrc +++ b/vim/gvimrc @@ -2,9 +2,9 @@ " these are both workable monospace fonts, but Ubuntu Mono doesn't render very " nicely on Windows a lot of the time if has("unix") - silent! set guifont=Ubuntu\ Mono\ 12 + silent! set guifont=Ubuntu\ Mono\ 12 else - silent! set guifont=Consolas:h11 + silent! set guifont=Consolas:h11 endif " Use the system GUI clipboard; use console dialogs instead of popup windows; diff --git a/vim/vimrc b/vim/vimrc index daabafc0..c9cd0ad8 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -8,81 +8,81 @@ silent! call pathogen#helptags() " Load plugins and indentation for file types if has('autocmd') - filetype indent plugin on - - " Shortcuts to quickly switch to common file types; handy when using - " editing abstractions like sudoedit(8) - nnoremap _ap :setlocal filetype=apache - nnoremap _bi :setlocal filetype=bindzone - nnoremap _cs :setlocal filetype=css - nnoremap _ht :setlocal filetype=html - nnoremap _js :setlocal filetype=javascript - nnoremap _md :setlocal filetype=markdown - nnoremap _pl :setlocal filetype=perl - nnoremap _ph :setlocal filetype=php - nnoremap _py :setlocal filetype=python - nnoremap _rb :setlocal filetype=ruby - nnoremap _sh :setlocal filetype=sh - nnoremap _vi :setlocal filetype=vim - nnoremap _xm :setlocal filetype=xml + filetype indent plugin on + + " Shortcuts to quickly switch to common file types; handy when using + " editing abstractions like sudoedit(8) + nnoremap _ap :setlocal filetype=apache + nnoremap _bi :setlocal filetype=bindzone + nnoremap _cs :setlocal filetype=css + nnoremap _ht :setlocal filetype=html + nnoremap _js :setlocal filetype=javascript + nnoremap _md :setlocal filetype=markdown + nnoremap _pl :setlocal filetype=perl + nnoremap _ph :setlocal filetype=php + nnoremap _py :setlocal filetype=python + nnoremap _rb :setlocal filetype=ruby + nnoremap _sh :setlocal filetype=sh + nnoremap _vi :setlocal filetype=vim + nnoremap _xm :setlocal filetype=xml endif " Use backup features if on a UNIX-like system and not using sudo(8) if !strlen($SUDO_USER) && has('unix') - " Keep backups with a .bak extension in ~/.vim/undo; the double-slash at - " the end of the directory is supposed to prod Vim into keeping the full - " path to the file in its backup filename to avoid collisions, but I don't - " think it actually works - set backup - set backupext=.bak - set backupdir^=~/.vim/backup// + " Keep backups with a .bak extension in ~/.vim/undo; the double-slash at + " the end of the directory is supposed to prod Vim into keeping the full + " path to the file in its backup filename to avoid collisions, but I don't + " think it actually works + set backup + set backupext=.bak + set backupdir^=~/.vim/backup// - " This option already includes various temporary directories, but we - " append to it so that we don't back up anything in a shared memory - " filesystem either - set backupskip+=*/shm/* + " This option already includes various temporary directories, but we + " append to it so that we don't back up anything in a shared memory + " filesystem either + set backupskip+=*/shm/* - " Create the backup directory if necessary and possible - if !isdirectory($HOME . '/.vim/backup') && exists('*mkdir') - call mkdir($HOME . '/.vim/backup', 'p', 0700) - endif + " Create the backup directory if necessary and possible + if !isdirectory($HOME . '/.vim/backup') && exists('*mkdir') + call mkdir($HOME . '/.vim/backup', 'p', 0700) + endif " Don't use backups at all otherwise else - set nobackup - set nowritebackup + set nobackup + set nowritebackup endif " Options dependent on the syntax feature if has('syntax') - " Use syntax highlighting - syntax enable + " Use syntax highlighting + syntax enable - " Use my custom color scheme if possible, otherwise I'm happy with - " whatever the default is - silent! colorscheme sahara + " Use my custom color scheme if possible, otherwise I'm happy with + " whatever the default is + silent! colorscheme sahara - " Don't syntax highlight beyond 300 characters; mostly for efficiency - " reasons, but also useful for prodding me into breaking up unreadable - " long lines as well when writing code - if exists('&synmaxcol') - set synmaxcol=300 - endif + " Don't syntax highlight beyond 300 characters; mostly for efficiency + " reasons, but also useful for prodding me into breaking up unreadable + " long lines as well when writing code + if exists('&synmaxcol') + set synmaxcol=300 + endif endif " Command-line based features if has('cmdline_info') - " Show my current position in the status bar - set ruler + " Show my current position in the status bar + set ruler - " Show the keystrokes being entered in the screen - set showcmd + " Show the keystrokes being entered in the screen + set showcmd - " Show the mode we're using if not normal mode (e.g. --INSERT--) - set showmode + " Show the mode we're using if not normal mode (e.g. --INSERT--) + set showmode endif " Some mild heresy; use the familiar Readline bindings of ^A and ^E on the @@ -104,7 +104,7 @@ inoremap " to use the proper character in UTF-8 HTML documents so I nicked this from " Tim Pope if has('digraphs') - digraph ./ 8230 + digraph ./ 8230 endif " Try Mac line-endings if UNIX or DOS don't make sense; this has never @@ -113,7 +113,7 @@ set fileformats+=mac " Use UTF-8 by default wherever possible if has('multi_byte') - set encoding=utf-8 + set encoding=utf-8 endif " Adopt the indent of the last line on new lines; interestingly, plugins that @@ -166,14 +166,14 @@ nnoremap J mzJ`z " very handy " if has('eval') - function! ToggleFormatFlag(flag) - let l:operation = (&formatoptions =~ a:flag) ? '-=' : '+=' - silent! exec 'setlocal formatoptions' . l:operation . a:flag - setlocal formatoptions? - endfunction - nnoremap a :call ToggleFormatFlag('a') - nnoremap c :call ToggleFormatFlag('c') - nnoremap t :call ToggleFormatFlag('t') + function! ToggleFormatFlag(flag) + let l:operation = (&formatoptions =~ a:flag) ? '-=' : '+=' + silent! exec 'setlocal formatoptions' . l:operation . a:flag + setlocal formatoptions? + endfunction + nnoremap a :call ToggleFormatFlag('a') + nnoremap c :call ToggleFormatFlag('c') + nnoremap t :call ToggleFormatFlag('t') endif " Keep plenty of command and search history, because disk space is cheap @@ -215,14 +215,14 @@ set shellslash " editing if has('eval') - " Perform file transfers silently - let g:netrw_silent = 1 + " Perform file transfers silently + let g:netrw_silent = 1 - " Use a tree-style file listing - let g:netrw_liststyle = 3 + " Use a tree-style file listing + let g:netrw_liststyle = 3 - " Don't list the current directory shortcut, and don't show tags files - let g:netrw_list_hide = '^\.,^tags$' + " Don't list the current directory shortcut, and don't show tags files + let g:netrw_list_hide = '^\.,^tags$' endif " Don't show line numbers by default, but \n toggles them @@ -252,55 +252,55 @@ set sidescrolloff=16 " Some special settings for searching, if available if has('extra_search') - " Highlight search results, \h toggles this - set hlsearch - - " Searching as I enter my pattern, \i toggles this - set incsearch - nnoremap h :set hlsearch! - nnoremap i :set incsearch! - - " Pressing ^L will clear highlighting until the next search-related - " operation; quite good because the highlighting gets distracting after - " you've found what you wanted - nnoremap :nohlsearch - - " Clear search highlighting as soon as I enter insert mode, and restore it - " once I leave it - if has('autocmd') - augroup highlight - autocmd! - silent! autocmd InsertEnter * set nohlsearch - silent! autocmd InsertLeave * set hlsearch - augroup END - endif + " Highlight search results, \h toggles this + set hlsearch + + " Searching as I enter my pattern, \i toggles this + set incsearch + nnoremap h :set hlsearch! + nnoremap i :set incsearch! + + " Pressing ^L will clear highlighting until the next search-related + " operation; quite good because the highlighting gets distracting after + " you've found what you wanted + nnoremap :nohlsearch + + " Clear search highlighting as soon as I enter insert mode, and restore it + " once I leave it + if has('autocmd') + augroup highlight + autocmd! + silent! autocmd InsertEnter * set nohlsearch + silent! autocmd InsertLeave * set hlsearch + augroup END + endif endif " Configure spell checking features, if available if has('spell') - " Don't check spelling by default, but bind \s to toggle this - set nospell - nnoremap s :setlocal spell! + " Don't check spelling by default, but bind \s to toggle this + set nospell + nnoremap s :setlocal spell! - " Use New Zealand English for spelling by default (it's almost identical - " to British English), but bind \u to switch to US English and \z to - " switch back - set spelllang=en_nz - nnoremap u :setlocal spelllang=en_us - nnoremap z :setlocal spelllang=en_nz + " Use New Zealand English for spelling by default (it's almost identical + " to British English), but bind \u to switch to US English and \z to + " switch back + set spelllang=en_nz + nnoremap u :setlocal spelllang=en_us + nnoremap z :setlocal spelllang=en_nz endif " Don't keep .viminfo information for files in temporary directories or shared " memory filesystems; this is because they're used as scratch spaces for tools " like sudoedit(8) and pass(1) and hence could present a security problem if has('viminfo') && has('autocmd') - augroup viminfoskip - autocmd! - silent! autocmd BufNewFile,BufReadPre - \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/* - \ setlocal viminfo= - augroup END + augroup viminfoskip + autocmd! + silent! autocmd BufNewFile,BufReadPre + \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/* + \ setlocal viminfo= + augroup END endif " Preserve the flags for a pattern when repeating a substitution with &; I don't @@ -313,32 +313,32 @@ vnoremap & :&& " get in the way if kept in their own directory if !strlen($SUDO_USER) && has('unix') - " Use swap files but keep them in ~/.vim/swap; the double-slash at the end - " of the directory prods Vim into keeping the full path to the file in its - " undo filename to avoid collisions - set swapfile - set directory^=~/.vim/swap// - - " Create the ~/.vim/swap directory if necessary and possible - if !isdirectory($HOME . '/.vim/swap') && exists('*mkdir') - call mkdir($HOME . '/.vim/swap', 'p', 0700) - endif - - " Don't keep swap files for files in temporary directories or shared memory - " filesystems; this is because they're used as scratch spaces for tools - " like sudoedit(8) and pass(1) and hence could present a security problem - if has('autocmd') - augroup swapskip - autocmd! - silent! autocmd BufNewFile,BufReadPre - \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/* - \ setlocal noswapfile - augroup END - endif + " Use swap files but keep them in ~/.vim/swap; the double-slash at the end + " of the directory prods Vim into keeping the full path to the file in its + " undo filename to avoid collisions + set swapfile + set directory^=~/.vim/swap// + + " Create the ~/.vim/swap directory if necessary and possible + if !isdirectory($HOME . '/.vim/swap') && exists('*mkdir') + call mkdir($HOME . '/.vim/swap', 'p', 0700) + endif + + " Don't keep swap files for files in temporary directories or shared memory + " filesystems; this is because they're used as scratch spaces for tools + " like sudoedit(8) and pass(1) and hence could present a security problem + if has('autocmd') + augroup swapskip + autocmd! + silent! autocmd BufNewFile,BufReadPre + \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/* + \ setlocal noswapfile + augroup END + endif " Otherwise, don't use swap files at all else - set noswapfile + set noswapfile endif " Don't bother about checking whether Escape is being used as a means to enter @@ -370,15 +370,15 @@ set ttimeoutlen=50 " arguments or modifiers; I fat-finger these commands a lot because I type " them so rapidly, and they don't correspond to any other commands I use if has('user_commands') - command! -bang -complete=file -nargs=? E e - command! -bang -complete=file -nargs=? W w - command! -bang -complete=file -nargs=? WQ wq - command! -bang -complete=file -nargs=? Wq wq - command! -bang Q q - command! -bang Qa qa - command! -bang QA qa - command! -bang Wa wa - command! -bang WA wa + command! -bang -complete=file -nargs=? E e + command! -bang -complete=file -nargs=? W w + command! -bang -complete=file -nargs=? WQ wq + command! -bang -complete=file -nargs=? Wq wq + command! -bang Q q + command! -bang Qa qa + command! -bang QA qa + command! -bang Wa wa + command! -bang WA wa endif " Keep screeds of undo history @@ -389,26 +389,26 @@ set undolevels=2000 " plugins like Gundo or Undotree. if !strlen($SUDO_USER) && has('unix') && has('persistent_undo') - " Keep per-file undo history in ~/.vim/undo; the double-slash at the end - " of the directory prods Vim into keeping the full path to the file in its - " undo filename to avoid collisions - set undofile - set undodir^=~/.vim/undo// - - " Create the ~/.vim/undo directory if necessary and possible - if !isdirectory($HOME . '/.vim/undo') && exists('*mkdir') - call mkdir($HOME . '/.vim/undo', 'p', 0700) - endif - - " Don't track changes to sensitive files - if has('autocmd') - augroup undoskip - autocmd! - silent! autocmd BufWritePre - \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/* - \ setlocal noundofile - augroup END - endif + " Keep per-file undo history in ~/.vim/undo; the double-slash at the end + " of the directory prods Vim into keeping the full path to the file in its + " undo filename to avoid collisions + set undofile + set undodir^=~/.vim/undo// + + " Create the ~/.vim/undo directory if necessary and possible + if !isdirectory($HOME . '/.vim/undo') && exists('*mkdir') + call mkdir($HOME . '/.vim/undo', 'p', 0700) + endif + + " Don't track changes to sensitive files + if has('autocmd') + augroup undoskip + autocmd! + silent! autocmd BufWritePre + \ /tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*,*/shm/* + \ setlocal noundofile + augroup END + endif endif " Unmap F1, I don't use it, I prefer :help @@ -425,56 +425,56 @@ nnoremap Q " When in visual block mode, let me move the cursor anywhere in the buffer; " don't restrict me only to regions with text if has('virtualedit') - set virtualedit+=block + set virtualedit+=block endif " Configuration for the command completion feature; rather than merely cycling " through possible completions with Tab, show them above the command line if has('wildmenu') - " Use the wild menu, both completing and showing all possible completions - " with a single Tab press, just as I've configured Bash to do - set wildmenu - set wildmode=longest:list - - " Don't complete certain files that I'm not likely to want to manipulate - " from within Vim: - if has('wildignore') - set wildignore+=*.a,*.o - set wildignore+=*.bmp,*.gif,*.ico,*.jpg,*.png - set wildignore+=.DS_Store,.git,.hg,.svn - set wildignore+=*~,*.swp,*.tmp - endif - - " Complete files without case sensitivity, if the option is available - if exists('&wildignorecase') - set wildignorecase - endif + " Use the wild menu, both completing and showing all possible completions + " with a single Tab press, just as I've configured Bash to do + set wildmenu + set wildmode=longest:list + + " Don't complete certain files that I'm not likely to want to manipulate + " from within Vim: + if has('wildignore') + set wildignore+=*.a,*.o + set wildignore+=*.bmp,*.gif,*.ico,*.jpg,*.png + set wildignore+=.DS_Store,.git,.hg,.svn + set wildignore+=*~,*.swp,*.tmp + endif + + " Complete files without case sensitivity, if the option is available + if exists('&wildignorecase') + set wildignorecase + endif endif " Configuration for window features if has('windows') - " Show the status in a distinct bar above the command line only if there's - " more than one window on the screen or in the current tab - set laststatus=1 - - " New split windows appear below or to the right of the existing window, - " not above or to the left per the default - set splitbelow - if has('vertsplit') - set splitright - endif - - " Only show the tab bar if there's more than one tab - if exists('&showtabline') - set showtabline=1 - endif - - " Get rid of visually noisy folding characters - if has('folding') - let &fillchars = 'diff: ,fold: ,vert: ' - endif + " Show the status in a distinct bar above the command line only if there's + " more than one window on the screen or in the current tab + set laststatus=1 + + " New split windows appear below or to the right of the existing window, + " not above or to the left per the default + set splitbelow + if has('vertsplit') + set splitright + endif + + " Only show the tab bar if there's more than one tab + if exists('&showtabline') + set showtabline=1 + endif + + " Get rid of visually noisy folding characters + if has('folding') + let &fillchars = 'diff: ,fold: ,vert: ' + endif endif " Use the tilde as an operator with motions, rather than just swapping the @@ -501,8 +501,8 @@ nnoremap k gk " character that will fit on the screen, preceding the next line with three " periods to make it obvious that it's a continuation of the previous line if has('linebreak') - set linebreak - set showbreak=... + set linebreak + set showbreak=... endif " I really like ZZ and ZQ, so I wrote a couple more mappings; ZW forces a @@ -520,6 +520,6 @@ nnoremap Y y$ " useful for defining FileType rules on systems which happen to have files of " a known type with atypical suffixes or locations if filereadable(glob('~/.vimrc.local')) - source ~/.vimrc.local + source ~/.vimrc.local endif -- cgit v1.2.3