jamezpolley avatar jamezpolley committed 8bb478f

Tidy vimrc a little, and update README to have a little bit more detail.

Comments (0)

Files changed (2)

   call pathogen#helptags()
 
 .. _pathogen: https://github.com/tpope/vim-pathogen
+
+============
+Top features
+============
+
+vimrc
+=====
+
+gui options
+-----------
+I switch between using MacVim/Gvim and console vim. I like to have a light
+background when I'm running a GUI client, but dark on the console. The ``if
+has("gui_running")`` stanza near the top of the file accomplishes this, and
+also sets an appropriate font depending on the platform.
+
+python-inspired
+---------------
+I work in Python a lot, so I always like to be aware of trailing whitespace and
+hard tab characters. I also like to be reminded when a line goes over 80
+characters wide. The ``list``/``listchars`` options help with the first two,
+while the ``HighlightTooLongLines()`` function looks after the latter.
+
+The ``Pylint()`` function calls pylint on the current file, and I have this
+mapped to ``\l`` for easy access. Since I started using the `Syntastic`_
+plugin, I don't use this an awful lot.
+
+Other filetype helpers
+----------------------
+I edit restructered text a lot, so the ``rst reading helper`` maps ``@h`` to a
+sequence of keystrokes that makes it it easy for me to create headings.
+
+I have ``,x``, ``,h``, and ``,j`` mapped to external commands which tidy up
+xml, html, and json respectively. I don't edit these a lot, but when I do, I
+like to stay sane.
+
+I rely on Ctags a lot, so I have ``\C`` mapped to an external call to generate
+generates tags for me. I don't use this a lot any more, thanks to `tagbar`_ and
+`easytags`_
-"Enable Pathogen
-runtime bundle/vim-pathogen/autoload/pathogen.vim
-call pathogen#infect()
-call pathogen#helptags()
-
 " Things that need no explanation
 set nocompatible
 syntax on
-
+filetype plugin indent on
+set secure               " Don't allow FS modifications in CWD .vimrc/.exrc.
 "Allow unsaved buffers to be hidden
 set hidden
-
-if has("gui_running")
-  if has("gui_macvim")
-    set guifont=Menlo\ Regular:h10
-  else
-    set guifont=Monaco\ 8
-  endif
-  "default is agimrLtT
-  "but let's turn off the Toolbar
-  set guioptions=agimt
-  set background=light
-else
-  set background=dark
-endif
-
+"Stolen from https://github.com/ikanobori/dotfiles/blob/master/vim/vimrc
+set noerrorbells
 " Tweaks to help mousiness work in normal vim inside an xterm.
 set mouse=a
 set ttymouse=xterm2
-	
 " Attempt to get sane indenting:
 set autoindent
 set shiftwidth=2
 set tabstop=2
 set softtabstop=2
+set backspace=2
 set expandtab            " Make sure that ^T, <<, >>, and the like use spaces.
 set cinoptions=l1,g0.5s,h0.5s,i2s,+2s,(0,W2s
-
 " Don't mess with my terminal unless I tell you to!
 set notitle
 set norestorescreen
-
-" Nice helper stuff:
 set showmode
 set showmatch
 set ruler
 set showcmd
 set incsearch
 set hlsearch             " Highlight previous search results
-set backspace=2
 
+"Set GUI options based on platform
+if has("gui_running")
+  if has("gui_macvim")
+    set guifont=Menlo\ Regular:h10
+  else
+    set guifont=Monaco\ 8
+  endif
+  "default is agimrLtT
+  "but let's turn off the Toolbar
+  set guioptions=agimt
+  set background=light
+else
+  set background=dark
+endif
+
+"These settings were inspired by python's style guidelines, but I like to have
+"them active everywhere
+"
 " Make it so that tabs and trailing spaces are always visible:
 " (Relys on syntax highlighting to turn them yellow.)
 set list
 set listchars=tab:\>\_,trail:\_,extends:»,precedes:«
-
-" So we can see tabs and trailing spaces.
 hi SpecialKey ctermbg=Yellow guibg=Yellow
-
-filetype plugin indent on
-
 " Highlight lines > 80 chars
 function! HighlightTooLongLines()
   highlight def link RightMargin Error
     exec 'match RightMargin /\%<' . (&textwidth + 4) . 'v.\%>' . (&textwidth + 2) . 'v/'
   endif
 endfunction
-
 augroup filetypedetect
 au BufNewFile,BufRead * call HighlightTooLongLines()
 augroup END
 
-" Clever tab - if at start of line insert spaces; else complete word.
-"function! CleverTab()
-"   if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
-"      return "\<Tab>"
-"   else
-"      return "\<C-X>\<C-N>"
-"endfunction
-"inoremap <Tab> <C-R>=CleverTab()<CR>
-
 " Tab-complete filenames to longest unambiguous match and present menu:
 set wildmenu wildmode=longest:full
 :au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g'\"" | endif
 
-autocmd BufWrite mytips             :helptags ~/.vim/doc/
-autocmd BufRead  mytips             set filetype=help
-autocmd BufRead  mytips             set noreadonly
-autocmd BufRead  mytips             set modifiable
-
-nmap <leader>h :tabnew ~/.vim/doc/mytips<CR>
-
-
-set secure               " Don't allow FS modifications in CWD .vimrc/.exrc.
-
 " Turn on word-wrapping.
 map gw :se tw=75<CR>
 " Get rid of trailing whitespace.
 omap } /\S/;/^\s*$<CR>:call histdel("search", -1)<CR>:let @/ = histget("search", -1)<CR>:nohlsearch<CR>:<CR>
 vmap } /\S/;/^\s*$<CR>
 
-" rst heading helper
+"rst heading helper
 let @h = "yypVr"
 
-" select xml text to format and hit ,x
+"select xml text to format and hit ,x
 vmap ,x :!tidy -q -i -xml<CR>
 
-" select html text to format and hit ,h
+"select html text to format and hit ,h
 vmap ,h :!tidy -q -i<CR>
 
-" Tidy JSON
+"Tidy JSON
 vmap ,j :!python -m json.tool<CR>
 
-"" Don't put comments on the left-margin
+""Don't put comments on the left-margin
 inoremap # X#
 
 " pay attention to modelines, so i can deal with different tab conventions
 inoremap <expr> <C-n> pumvisible() ? '<C-n>' : '<C-n><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
 inoremap <expr> <M-,> pumvisible() ? '<C-n>' : '<C-x><C-o><C-n><C-p><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
 
-"SuperTab settings - http://www.vim.org/scripts/script.php?script_id=1643
-let g:SuperTabSetDefaultCompletionType = "context"
-let g:SuperTabContextDefaultCompletionType = "<c-x><c-u>"
-
 "Iffing we don't have python, don't define this function
 if has('python')
   command Pylint :call Pylint()
   nmap <leader>l :Pylint<CR>
 endif
 
-nmap <leader>n :NERDTree<CR>
-
-set tags=./tags;~/.vim/tags
-let g:easytags_by_filetype = '~/.vim/tags/'
-let g:easytags_on_cursorhold = 0
-let g:easytags_dynamic_files = 1
-
-"map <leader>T :TaskList<CR>
-"map <leader>P :TlistToggle<CR>
-"map <leader>L :Tlist<cr>
-map <leader>P :TagbarToggle<CR>
-
+"Generate Exuberant Ctags from files under the CWD
 map <leader>C :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
 
 set updatetime=4000
 endfunction
 nnoremap <silent> <Leader>ml :call AppendModeline()<CR>
 
-"Stolen from https://github.com/ikanobori/dotfiles/blob/master/vim/vimrc
-set noerrorbells
-
 set laststatus=2
 "Set pythonworkon just so the statusline has something to work with for now
-
 let g:pythonworkon=""
-
 "From http://vim.1045645.n5.nabble.com/Show-ruler-at-bottom-line-instead-of-statusline-td3378371.html
 if has("statusline")
   command UpdateStatus :call UpdateStatus()
   endfunction
   autocmd VimEnter * :UpdateStatus
 endif
-
 :UpdateStatus
 
+"Set up and enable easy access to various plugins
+"NERDTree
+nmap <leader>n :NERDTree<CR>
+"Tagbar
+map <leader>P :TagbarToggle<CR>
+"easytags
+set tags=./tags;~/.vim/tags
+let g:easytags_by_filetype = '~/.vim/tags/'
+let g:easytags_on_cursorhold = 0
+let g:easytags_dynamic_files = 1
 "Syntastic
 set statusline+=%#warningmsg#
 set statusline+=%{SyntasticStatuslineFlag()}
 let g:syntastic_auto_loc_list_height=5
 let g:syntastic_quiet_warnings=1
 let g:syntastic_mode_map = {'mode': 'active', 'active_filetypes': ['python'], 'passive_filetypes': ['rst','puppet']}
-
 "RopeVim
 map <leader>j :RopeGotoDefinition<CR>
 map <leader>r :RopeRename<CR>
-
-"For SimpyIFold
+"SimpyIFold
 let g:SimpylFold_docstring_preview = 1
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.