Skip to content

Instantly share code, notes, and snippets.

@aulizko
Created June 9, 2009 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aulizko/126805 to your computer and use it in GitHub Desktop.
Save aulizko/126805 to your computer and use it in GitHub Desktop.
" Nathan L Smith's .vimrc file. Based on
" John Lam's .vimrc file
" General options
set nocompatible
set autoread
filetype on
filetype indent on
filetype plugin on
" Use ruby syntax for capfiles
au BufNewFile,BufRead capfile setf ruby
syntax on
" allow to use hidden buffers
set hidden
" increase command history size
set history=1000
" Make file/command completion useful
set wildmenu
" Set the terminal title
set title
" Store temporary files in a central spot
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
" Stifle many interruptive prompts
set shortmess=atI
" Stop distracting your co-workers
set visualbell
" Show the cursor position all the time
set ruler
" Display incomplete commands
set showcmd
" Turn on number vertical line
set number
" Jump 5 lines when running out of the screen
set scrolljump=7
" Indicate jump out of the screen when 10 lines before end of the screen
set scrolloff=7
" Searcging options
set incsearch
set hlsearch
set ignorecase smartcase
" remember some stuff after quiting vim:
" marks, registers, searches, buffer list
set viminfo='20,<50,s10,h,%
" Use four space tabs
set tabstop=4
set shiftwidth=4
set expandtab
" Allow extending % behaviour
runtime macros/matchit.vim
" Set GUI options
if has("gui_running")
" No menus and no toolbar
set guioptions-=m
set guioptions-=T
" Left handed scrollbar
set guioptions-=r
set guioptions+=l
set co=200
set lines=45
endif
" Setup 80 column word wrap
set wrap
set ruler
set bg=dark
" Smart tab
map <right> :bnext<cr>
map <left> :bprev<cr>
map <down> :bd<cr>
" Enable JavaScript code folding
function! JavaScriptFold()
setl foldmethod=syntax
setl foldlevelstart=99
syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend
function! FoldText()
return substitute(getline(v:foldstart), '{.*', '{...}', '')
endfunction
setl foldtext=FoldText()
endfunction
au FileType javascript call JavaScriptFold()
au FileType javascript setl fen
au FileType javascript setl foldlevel=99
" Enable PHP folding
let php_folding=1
au FileType php setl foldlevel=99
" MacVim Specific options
if has("gui_macvim")
set transp=0
set anti enc=utf-8 tenc=macroman gfn=Monaco:h14
endif
" encoding problems
set termencoding=utf-8
" I live in Russia, so that I rarely need cp1251
set fileencodings=utf8,cp1251
set encoding=utf8
" MySql support (TODO: review selected engine)
if has("autocmd")
autocmd BufRead *.sql set filetype=mysql
endif
" filetype plugin indent on
cabbr jslint !js /Users/xan/bin/runjslint.js "`cat %`" \| /Users/xan/bin/format_jslint_output.py
colorscheme railscasts
" Remap leader key to the ','
let mapleader = ','
" Fuzzy finder textmate
map <leader>t :FuzzyFinderFile<CR>
" Open html file in the Firefox
map <Leader>p :!open -a Firefox %<CR><CR>
" Open nerdtree
map <leader>l :NERDTree<CR>
" Catch trailing whitespace
set listchars=tab:>-,trail:·,eol:$
nmap <silent> <leader>s :set nolist!<CR>
" Remove annoying search highlighting
nmap <silent> <leader>n :silent :nohlsearch<CR>
" Who does need this?
map H ^
map L $
" Map russian keys to the cursor movement keys
map Я Z
map к r
map К R
map ш i
map Ш I
map щ o
map Щ O
map в d
map р h
map о j
map л k
map д l
" closetag plugin required this:
:au Filetype html,xml,xsl source ~/.vim/scripts/closetag.vim
let mapleader = ","
"-------------------------"
"--------Hot keys---------"
"-------------------------"
" Пробел в нормальном режиме перелистывает страницы
nmap <Space> <PageDown>
" C-c and C-v - Copy/Paste в "глобальный клипборд"
vmap <C-c> "+yi
imap <C-v> <esc>"+gPi
" Поиск и замена слова под курсором
nmap ; :%s/\<<c-r>=expand("<cword>")<cr>\>/
" Редко когда надо [ без пары =)
imap [ []<LEFT>
" " Аналогично и для {
imap {<CR> {<CR>}<Esc>O
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment