1. Andrei Sosnin
  2. .vim

Commits

Andrei Sosnin  committed a6be963

added a piece of code to make vim recognize python modules to open them easily with `gf` + tweaks

  • Participants
  • Parent commits 5c0b626
  • Branches default

Comments (0)

Files changed (2)

File ftplugin/python/pyflakes.vim

View file
  • Ignore whitespace
 
 " Disabled updates to have faster response
 " Now this can be done on demand by pressing <F7> in normal mode
-" au BufLeave <buffer> call s:ClearPyflakes()
-" au BufEnter <buffer> call s:RunPyflakes()
+au BufLeave <buffer> call s:ClearPyflakes()
+au BufEnter <buffer> call s:RunPyflakes()
 " au InsertEnter <buffer> call s:RunPyflakes()
 " au CursorHold <buffer> call s:RunPyflakes()
 " au CursorHoldI <buffer> call s:RunPyflakes()
 "   for here?
 noremap <buffer><silent> u u:PyflakesUpdate<CR>
 noremap <buffer><silent> <F7> :PyflakesUpdate<CR>
-" noremap <buffer><silent> dd dd:PyflakesUpdate<CR>
-" noremap <buffer><silent> dw dw:PyflakesUpdate<CR>
-" noremap <buffer><silent> <C-R> <C-R>:PyflakesUpdate<CR>
+noremap <buffer><silent> dd dd:PyflakesUpdate<CR>
+noremap <buffer><silent> dw dw:PyflakesUpdate<CR>
+noremap <buffer><silent> <C-R> <C-R>:PyflakesUpdate<CR>
 
 " WideMsg() prints [long] message up to (&columns-1) length
 " guaranteed without "Press Enter" prompt.

File vimrc

View file
  • Ignore whitespace
 " toggle Gundo
 nnoremap <F8> :GundoToggle<cr>
 " run pyflakes
-nnoremap <F6> :PyflakesUpdate<cr>
+"nnoremap <F6> :PyflakesUpdate<cr>
 " jump to next/prev change and center screen
 nnoremap <leader>[ [czz
 nnoremap <leader>] ]czz
 nnoremap <c-p> :bp<cr>
 nnoremap <c-n> :bn<cr>
+nnoremap <c-tab> <c-w><c-w>
 " close buffer without closing window
 nmap ,d :b#<bar>bd#<CR>
 " autowrite on focus loss
 au FocusLost * :wa
+
+" `gf` jumps to the filename under the cursor.  Point at an import statement
+" and jump to it!
+python << EOF
+import os
+import sys
+import vim
+for p in sys.path:
+    if os.path.isdir(p):
+        vim.command(r"set path+=%s" % (p.replace(" ", r"\ ")))
+EOF
+
 set autoindent
 set backspace=indent,eol,start
 if exists('+colorcolumn')
 set foldlevel=99
 set foldmethod=indent
 set formatoptions=qrn1
-set guioptions=tlei "left-side scroll
+set guioptions=tei " no scrollbar
 set guioptions-=mlLlTt  "remove toolbar
 set guioptions+=A
 set gdefault