/
python.vim
43 lines (40 loc) · 1.48 KB
/
python.vim
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
43
"PQ windows
set makeprg=C:\Users\Admin\AppData\Local\Programs\Python\Python35\python.exe\ -W\ ignore\ %
setlocal foldmethod=indent
:command! -range Comment <line1>,<line2>s@^@##@ | noh
:command! -range UnComment <line1>,<line2>s@^##@@ | noh
inoremap ( ()<Left>
inoremap (<CR> (<CR>)<Esc>O
inoremap (( (
inoremap () ()
inoremap [ []<Left>
inoremap [<CR> [<CR>]<Esc>O
inoremap [[ [
inoremap [] []
inoremap { {}<Left>
inoremap {<CR> {<CR>}<Esc>O
inoremap {{ {
inoremap {} {}
function! Cpp_CommentToggle () range
let comment=1 "
for line in range( a:firstline, a:lastline )
if match( getline(line), '^#') == -1 " no comment
let comment = 0
break
endif
endfor
if comment == 0
exe a:firstline.','.a:lastline."s@^@#@"
else
exe a:firstline.','.a:lastline."s@^#@@"
endif
endfunction " ---------- end of function Cpp_CommentToggle ----------
nnoremap <buffer> <silent> <LocalLeader>cc :call Cpp_CommentToggle()<CR>j
vnoremap <buffer> <silent> <LocalLeader>cc :call Cpp_CommentToggle()<CR>j
set listchars+=space:␣
"command! Prettify execute "!python3 -m autopep8 -i --ignore=E731 %"
"command! Prettify execute "!time /usr/local/bin/python3 -m autopep8 -i %"
command! Prettify execute "!~/for/forpython/miscutils/my-python-prettify.py -f %"
command! -nargs=? Init execute "!~/for/forpython/new_file.py new-file % <args>"
command! -nargs=? Snippet execute "read!~/for/forpython/new_file.py snippet <args>"
set number