Skip to content

Instantly share code, notes, and snippets.

@moorepants
Created September 15, 2011 01:23
Show Gist options
  • Save moorepants/1218291 to your computer and use it in GitHub Desktop.
Save moorepants/1218291 to your computer and use it in GitHub Desktop.
vim settings for luke
this is my html file that i keep in .vim/after/ftplugin
-------------------------------------------------------
set tabstop=2 " hard tab shows up as 2 spaces
set shiftwidth=2 " autoindent and >> make 2 spaces
set textwidth=79 " wrap lines after 79 characters
this is my vimrc
----------------
syntax on
filetype on
filetype indent on
" This causes vim to load pyflakes
filetype plugin indent on
set autowrite " saves the file when you swith buffers or execute external commands, otherwise vim asks if you want to save
set autoindent " will indent lines following indented lines
set bs=indent,eol,start
set list listchars=tab:▷⋅,trail:⋅,nbsp:⋅ " adds some symbols for tabs, trailing whitespace, and non=breaking spaces
"set exrc " allows you to set a custom local vimrc in working directories
set textwidth=79 " sets wrapping default as 79 characters
" maps keys to commands
map <F2> :w<CR>
map <F8> :TlistToggle<CR><C-w>h
let Tlist_Inc_Winwidth=0
set fileencodings=ucs-bom,utf-8,default,latin2
" load some overrides for particular filetypes
autocmd FileType html source ~/.vim/after/ftplugin/html.vim
autocmd FileType python source ~/.vim/after/ftplugin/python.vim
autocmd FileType tex source ~/.vim/after/ftplugin/tex.vim
autocmd FileType matlab source ~/.vim/after/ftplugin/matlab.vim
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
"if has("autocmd")
" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"endif
"highlights end of line whitespace as red
if has('gui_running')
hi WhiteSpaceEOL guibg=#FF0000
else
hi WhiteSpaceEOL ctermbg=Red
endif
match WhitespaceEOL /\s\+\%#\@<!$/
" Mappings fuer plugin/ToggleComment.vim
noremap <silent> ,# :call CommentLineToEnd('#')<CR>+
noremap <silent> ;# :call CommentLineToEnd('###')<CR>+
noremap <silent> ,% :call CommentLineToEnd('%')<CR>+
noremap <silent> ;% :call CommentLineToEnd('%%%')<CR>+
noremap <silent> ,/ :call CommentLineToEnd('// ')<CR>+
noremap <silent> ," :call CommentLineToEnd('" ')<CR>+
noremap <silent> ,; :call CommentLineToEnd('; ')<CR>+
noremap <silent> ,- :call CommentLineToEnd('-- ')<CR>+
noremap <silent> ,* :call CommentLinePincer('/* ', ' */')<CR>+
noremap <silent> ,< :call CommentLinePincer('<!-- ', ' -->')<CR>+
" and/or Filetype specific mappings: Meta-c (Alt-c) and Meta-Shift-C
autocmd FileType c noremap <silent> <buffer> <M-c> :call CommentLineToEnd('// ')<CR>+
autocmd FileType c noremap <silent> <buffer> <M-C> :call CommentLinePincer('/* ', ' */')<CR>+
autocmd FileType make noremap <silent> <buffer> <M-c> :call CommentLineToEnd('# ')<CR>+
autocmd FileType html noremap <silent> <buffer> <M-c> :call CommentLinePincer('<!-- ', ' -->')<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment