Created
April 7, 2011 12:55
-
-
Save gennad/907729 to your computer and use it in GitHub Desktop.
My .vimrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
"Включаем распознавание типов файлов и типо-специфичные плагины: | |
filetype on | |
filetype plugin on | |
filetype plugin indent on | |
"Настройки табов для Python, согласно рекоммендациям | |
set tabstop=4 | |
set shiftwidth=4 | |
set softtabstop=4 "4 пробела в табе | |
"Автоотступ | |
"set autoindent | |
"Подсвечиваем все что можно подсвечивать | |
let python_highlight_all = 1 | |
"Включаем 256 цветов в терминале, мы ведь работаем из иксов? | |
"Нужно во многих терминалах, например в gnome-terminal | |
set t_Co=256 | |
"Настройка omnicomletion для Python (а так же для js, html и css) | |
autocmd FileType python set omnifunc=pythoncomplete#Complete | |
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS | |
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags | |
autocmd FileType css set omnifunc=csscomplete#CompleteCSS | |
"Перед сохранением вырезаем пробелы на концах (только в .py файлах) | |
""autocmd BufWritePre *.py normal m`:%s/\s\+$//e `` | |
"В .py файлах включаем умные отступы после ключевых слов | |
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class | |
"Вызываем SnippletsEmu(см. дальше в топике) по ctrl-j | |
"вместо tab по умолчанию (на табе автокомплит) | |
let g:snippetsEmu_key = "<C-j>" | |
syntax on "Включить подсветку синтаксиса | |
set nu "Включаем нумерацию строк | |
set mousehide "Спрятать курсор мыши когда набираем текст | |
set mouse=a "Включить поддержку мыши | |
set termencoding=utf-8 "Кодировка терминала | |
set novisualbell "Не мигать | |
set t_vb= "Не пищать! (Опции 'не портить текст', к сожалению, нету) | |
"Удобное поведение backspace | |
set backspace=indent,eol,start whichwrap+=<,>,[,] | |
"Вырубаем черточки на табах | |
"set showtabline=0 | |
set showtabline=2 | |
"Колоночка, чтобы показывать плюсики для скрытия блоков кода: | |
set foldcolumn=1 | |
"Переносим на другую строчку, разрываем строки | |
set wrap | |
set linebreak | |
"Вырубаем .swp и ~ (резервные) файлы | |
set nobackup | |
set noswapfile | |
set encoding=utf-8 " Кодировка файлов по умолчанию | |
set fileencodings=utf8 | |
"colorscheme wombat | |
colorscheme myevening | |
""autocmd VimEnter * NERDTree | |
""autocmd BufEnter * NERDTreeMirror | |
set tags=tags;/ | |
:match ErrorMsg '\%>79v.\+' | |
:inoremap # X<C-H># | |
nnoremap <C-J> o<Esc> | |
au VimEnter * NERDTree | |
autocmd VimEnter * wincmd w | |
autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft() | |
" Close all open buffers on entering a window if the only | |
" buffer that's left is the NERDTree buffer | |
function! s:CloseIfOnlyNerdTreeLeft() | |
if exists("t:NERDTreeBufName") | |
if bufwinnr(t:NERDTreeBufName) != -1 | |
if winnr("$") == 1 | |
q | |
endif | |
endif | |
endif | |
endfunction | |
if version >= 700 | |
hi SpellBad guisp=red gui=undercurl guifg=NONE guibg=NONE ctermfg=red ctermbg=NONE term=underline cterm=underline | |
hi SpellCap guisp=yellow gui=undercurl guifg=NONE guibg=NONE ctermfg=yellow ctermbg=NONE term=underline cterm=underline | |
hi SpellRare guisp=blue gui=undercurl guifg=NONE guibg=NONE ctermfg=yellow ctermbg=NONE term=underline cterm=underline | |
hi SpellLocal guisp=orange gui=undercurl guifg=NONE guibg=NONE ctermfg=yellow ctermbg=NONE term=underline cterm=underline | |
endif | |
set expandtab " Use the appropriate number of spaces to insert a <Tab>. | |
" Spaces are used in indents with the '>' and '<' commands | |
" and when 'autoindent' is on. To insert a real tab when | |
" 'expandtab' is on, use CTRL-V <Tab>. | |
set smarttab " When on, a <Tab> in front of a line inserts blanks | |
" according to 'shiftwidth'. 'tabstop' is used in other | |
" places. A <BS> will delete a 'shiftwidth' worth of space | |
" at the start of the line. | |
set showcmd " Show (partial) command in status line. | |
set showmatch " When a bracket is inserted, briefly jump to the matching | |
" one. The jump is only done if the match can be seen on the | |
" screen. The time to show the match can be set with | |
" 'matchtime'. | |
set hlsearch " When there is a previous search pattern, highlight all | |
" its matches. | |
set incsearch " While typing a search command, show immediately where the | |
" so far typed pattern matches. | |
set ignorecase " Ignore case in search patterns. | |
set smartcase " Override the 'ignorecase' option if the search pattern | |
" contains upper case characters. | |
let g:DirDiffDynamicDiffText = 1 | |
" Disable all blinking: | |
set guicursor+=a:blinkon0 | |
" Remove trailing spaces on save | |
autocmd BufWritePre *.js :%s/\s\+$//e | |
autocmd BufWritePre *.html :%s/\s\+$//e | |
autocmd BufWritePre *.py :%s/\s\+$//e | |
" PyLint | |
"autocmd BufWritePost *.py !pylint <afile> | |
"set makeprg=pylint\ --reports=n\ --output-format=parseable\ %:p | |
"set errorformat=%f:%l:\ %m | |
autocmd FileType python compiler pylint | |
let g:pylint_onwrite = 0 | |
"set binary | |
""au BufWritePre * :set binary | set noeol | |
""au BufWritePost * :set nobinary | set eol | |
function Maximize_Window() | |
silent !wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz | |
endfunction | |
au GUIEnter * call Maximize_Window() | |
au BufWritePost .c,.cpp,*.h,.py silent! !ctags -R & | |
"command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis | wincmd p | diffthis | |
command DiffOrig let g:diffline = line('.') | vert new | set bt=nofile | r # | 0d_ | diffthis | :exe "norm! ".g:diffline."G" | wincmd p | diffthis | wincmd p | |
nnoremap <Leader>do :DiffOrig<cr> | |
nnoremap <leader>dc :q<cr>:diffoff<cr>:exe "norm! ".g:diffline."G"<cr> | |
let g:pydiction_location = '/home/gennad/.vim/ftplugin/pydiction/complete-dict' | |
let g:SCMDiffCommand = 'git' | |
"au BufWritePre *.py,*.cc,*.html $put _ | $;?\(^\s*$\)\@!?+1,$d | |
"au BufWritePre *.py,*.cc,*.html :%s#\($\n\s*\)\+\%$## | |
"au BufWritePre *.py,*.cc,*.html call Save_C() | |
"au BufWritePre *.py,*.cc,*.html :v/\_s*\S/d | |
" | |
let g:CodeReviewer_reviewer="GZ" | |
let g:CodeReviewer_reviewFile=$HOME . "/review_GZ.rev" | |
let g:loaded_CodeReviewer = 0 | |
map <F1> :TlistToggle<cr> | |
map <F2> :w<cr> | |
map <F4> :NERDTreeToggle<cr> | |
map <F10> :Bclose<cr> | |
map <F11> :!python %<cr> | |
map <F12> ZZ | |
map <F7> :VCSVimDiff<CR> | |
map <S-F7> :DirDiff<CR> | |
map <S-F6> :Pylint<CR> | |
let g:ProjRootIndicators = [".git", "setup.py", "setup.cfg", "README"] | |
let g:PyUnitTestsStructure = "flat" | |
function TrimEndLines() | |
let save_cursor = getpos(".") | |
:silent! %s#\($\n\s*\)\+\%$## | |
call setpos('.', save_cursor) | |
endfunction | |
au BufWritePre *.py,*.cc,*.html call TrimEndLines() | |
"set guifont=Inconsolata\ 12 | |
set guifont=Mono\ 11 | |
abbr pd import pdb; pdb.set_trace() | |
abbr im import | |
abbr d def | |
abbr fr from | |
abbr el else | |
abbr cl class | |
abbr fo for | |
abbr wh while | |
abbr p print | |
" <Ctrl-l> redraws the screen and removes any search highlighting. | |
nnoremap <silent> <C-l> :noh<CR> | |
"au InsertLeave <buffer> update | |
"au InsertLeave <buffer> write | |
"au InsertLeave *.py update | |
autocmd BufLeave,FocusLost,InsertLeave * silent! wall | |
"inoremap [C-c] [Esc][Esc] | |
inoremap <C-c> <Esc><Esc> | |
map <C-n> :bn<CR> | |
map <C-p> :bp<CR> | |
nnoremap <silent> <Leader>c :CommandT<CR> | |
"inoremap <C-c> :w<CR> | |
"au BufWritePre *.py,*.cc,*.html mark p<cr>`p | |
" Useful commands: | |
" Ctrl + O Ctrl - I --- rotate files | |
" gt / gT --- go next tab / go prev tab | |
" Ctrl + ] / Ctrl + t --- go to definition / return | |
" \do / \dc --- show modified files / return | |
" F6 --- pep8 | |
" :Pydoc re.compile | |
" :Gcommit --- git commit | |
" :Pylint --- pylint | |
" | |
" ScmDiff | |
" Ctrl + D | |
" Ctrl + G | |
" | |
" Tasklist | |
" \t | |
" q | |
" <cr> | |
" | |
" Surround | |
" visual + s + ' | |
" | |
" MRU | |
" :MRU | |
" | |
" vim-pyunit | |
" F8 --- run nosetests | |
" Shift + F8 --- Run nosetests for all test files | |
" F9 --- Switch between source and test file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment