aboutsummaryrefslogtreecommitdiff
path: root/stow/vim/.vim/ftplugin/python/python.vim
blob: dd2ff0252fcede7b7eb2f123ceea7438fd8d0338 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
" ~/.vim/ftplugin/python/python.vim
" Python-specific vim configuration

" Tabs are expanded to 4 spaces
setlocal tabstop=4 shiftwidth=4 expandtab
" Show existing tabs (they can be deleted with :retab)
setlocal list

" Column marker: 90 characters
call matchadd('ColorColumn', '\%91v', 100)
setlocal textwidth=90

let b:ale_python_pylint_options = '-d invalid-name'
let b:ale_fixers = ['yapf']

" Mappings

let mapleader = " "

nnoremap <buffer> <leader>C :sp ~/.vim/ftplugin/python/python.vim<CR>
nnoremap <buffer> <leader>x :! ./%
nnoremap <buffer> <leader>X :! ./%<CR>

"nnoremap <buffer> gd :YcmCompleter GoTo<CR>
"nnoremap <buffer> gr :YcmCompleter GoToReferences<CR>
"nnoremap <buffer> gR :YcmCompleter RefactorRename<Space>
"nnoremap <buffer> <leader>gd :YcmCompleter GetDoc<CR>
"nnoremap <buffer> <leader>gT :YcmCompleter GetType<CR>

nnoremap gd <Plug>(coc-definition)
nnoremap gy <Plug>(coc-type-definition)
nnoremap gi <Plug>(coc-implementation)
nnoremap gr <Plug>(coc-references)

nnoremap <buffer> <leader>db :!tmux split-window -l '40\%' 'python -m̀ pdb %'

let mapleader = ","

inoremap <buffer> <leader>temp <Esc>:-1r ~/.vim/ftplugin/python/snips/template<CR>Gdd?<+++><CR>cf>
inoremap <buffer> <leader>class <Esc>:-1r ~/.vim/ftplugin/python/snips/class<CR>Gdd?<+++><CR>cf>
inoremap <buffer> <leader>if <Esc>:-1r ~/.vim/ftplugin/python/snips/if<CR>Gdd?<+++><CR>cf>
inoremap <buffer> <leader>for <Esc>:-1r ~/.vim/ftplugin/python/snips/for<CR>Gdd?<+++><CR>cf>