[Python] Vimrc

Marco Giusti marco.giusti a posteo.de
Lun 2 Mar 2015 12:30:42 CET


On Sun, Mar 01 2015, Lorenzo Mainardi wrote:
> Buongiorno a tutti,
> sto iniziando a sviluppare un progetto web con Python, Flask e Postgres.
> Uso da sempre vim, avete qualche plugin o qualche impostazione da
> suggerirmi?
> Grazie

Perbacco! Per quanto possano sembrare semplici, mi trovo benissimo con
queste. Per esempio lancio pyflakes (F2) e non bisogno neanche di
salvare oppure cerco velocemente tutte le occorrenze di una funzione (-g).

Ciao
m.


set autowrite
set grepprg=ack-grep\ -H
let mapleader = "-"
noremap <F5> <Esc>:make<CR>
noremap <F6> <Esc>:cp<CR>
noremap <F7> <Esc>:cn<CR>
nnoremap <leader>G :execute "grep! ".shellescape(expand("<cword>"))." %"<cr>:copen<cr>
nnoremap <leader>g :execute "grep! ".shellescape(expand("<cword>"))." ."<cr>:copen<cr>
nnoremap <leader>wG :execute "grep! -w ".shellescape(expand("<cword>"))." %"<cr>:copen<cr>
nnoremap <leader>wg :execute "grep! -w ".shellescape(expand("<cword>"))." ."<cr>:copen<cr>
nnoremap <leader>tg :execute "grep! -w --ignore-dir=tests ".shellescape(expand("<cword>"))." ."<cr>:copen<cr>
nnoremap <leader>tG :execute "grep! -w --ignore-dir=tests ".shellescape(expand("<cword>"))." %"<cr>:copen<cr>

autocmd FileType python set ts=4 sts=4 sw=4 smarttab expandtab
autocmd FileType python set textwidth=79 number
autocmd FileType python set foldmethod=indent foldnestmax=2
autocmd FileType python nnoremap <space> za
autocmd FileType python vnoremap <space> zf
autocmd FileType python noremap <F2> <Esc>:compiler pep8<CR>:make<CR>
autocmd FileType python noremap <F3> <Esc>:compiler pyflakes<CR>:make<CR>
autocmd FileType python noremap <F4> <Esc>:compiler trial<CR>:make<CR>
autocmd FileType python noremap <F5> <Esc>:compiler unit2<CR>:make<CR>


Maggiori informazioni sulla lista Python