mirror of
https://github.com/gryf/.vim.git
synced 2025-12-17 19:40:29 +01:00
Zmiany, zmiany, zmiany. Wywalony taglist, w zamian dodany taglisttoo z projektu
eclim. Wywalone funckje PyLint, na rzecz kompilera, funkcja generuj¿ca bufor z outputem z pylint zosta¿a wrzucona do .vimrc (inne podej¿cie - banalnie proste i skuteczne). Uzupełniona lista GetLatestVimScripts, stosowne zmiany w .vimrc.
This commit is contained in:
68
.vimrc
68
.vimrc
@@ -85,6 +85,8 @@ autocmd FileType python set smartindent cinwords=if,elif,else,for,while,try,exce
|
|||||||
autocmd FileType python set foldmethod=indent|set foldlevel=100|set list|set textwidth=78|set cinkeys-=0#
|
autocmd FileType python set foldmethod=indent|set foldlevel=100|set list|set textwidth=78|set cinkeys-=0#
|
||||||
autocmd FileType python set indentkeys-=0#|inoremap # X<BS>#
|
autocmd FileType python set indentkeys-=0#|inoremap # X<BS>#
|
||||||
autocmd FileType python set ofu=syntaxcomplete#Complete
|
autocmd FileType python set ofu=syntaxcomplete#Complete
|
||||||
|
autocmd FileType python compiler pylint
|
||||||
|
let g:pylint_onwrite = 0 " I don't want to run pylint on every save
|
||||||
|
|
||||||
"autocmd FileType python setlocal omnifunc=pysmell#Complete
|
"autocmd FileType python setlocal omnifunc=pysmell#Complete
|
||||||
let python_highlight_all=1
|
let python_highlight_all=1
|
||||||
@@ -95,9 +97,6 @@ autocmd FileType sql set nolist|set nosmartindent|set autoindent|set foldmethod=
|
|||||||
autocmd FileType vim set nolist|set nosmartindent|set autoindent|set foldmethod=manual
|
autocmd FileType vim set nolist|set nosmartindent|set autoindent|set foldmethod=manual
|
||||||
autocmd FileType snippet set nolist|set tabstop=4|set autoindent|set foldmethod=manual|set noexpandtab|set shiftwidth=4
|
autocmd FileType snippet set nolist|set tabstop=4|set autoindent|set foldmethod=manual|set noexpandtab|set shiftwidth=4
|
||||||
autocmd FileType snippets set noexpandtab, nolist
|
autocmd FileType snippets set noexpandtab, nolist
|
||||||
augroup mkd
|
|
||||||
autocmd BufRead *.mkd set ai formatoptions=tcroqn2 comments=n:>
|
|
||||||
augroup END
|
|
||||||
autocmd FileType rst set spf=/home/gryf/.vim/pol.utf8.add|set textwidth=80
|
autocmd FileType rst set spf=/home/gryf/.vim/pol.utf8.add|set textwidth=80
|
||||||
|
|
||||||
"}}}
|
"}}}
|
||||||
@@ -120,9 +119,9 @@ if $TERM == 'linux'
|
|||||||
endif
|
endif
|
||||||
"}}}
|
"}}}
|
||||||
"PLUGINS: {{{
|
"PLUGINS: {{{
|
||||||
"getscriptPlugin
|
"getscriptPlugin {{{2
|
||||||
"let g:GetLatestVimScripts_allowautoinstall=1 "allow autoinstall scripts
|
"let g:GetLatestVimScripts_allowautoinstall=1 "allow autoinstall scripts
|
||||||
|
"}}}
|
||||||
"TagList{{{2
|
"TagList{{{2
|
||||||
let Tlist_Use_Right_Window = 1
|
let Tlist_Use_Right_Window = 1
|
||||||
"show menu in gvim. usefull to pop it up from kbd
|
"show menu in gvim. usefull to pop it up from kbd
|
||||||
@@ -137,24 +136,27 @@ let Tlist_Sort_Type = "name"
|
|||||||
let Tlist_Exit_OnlyWindow = 1
|
let Tlist_Exit_OnlyWindow = 1
|
||||||
let Tlist_WinWidth = 40
|
let Tlist_WinWidth = 40
|
||||||
"}}}
|
"}}}
|
||||||
|
"NERDTree {{{2
|
||||||
"NERDTree
|
|
||||||
let NERDTreeWinSize = 40
|
let NERDTreeWinSize = 40
|
||||||
|
" }}}
|
||||||
"VimWIKI
|
"VimWIKI {{{2
|
||||||
let g:vimwiki_list = [{'html_header': '~/vimwiki/vimwiki_head.tpl',
|
let g:vimwiki_list = [{'html_header': '~/vimwiki/vimwiki_head.tpl',
|
||||||
\ 'html_footer': '~/vimwiki/vimwiki_foot.tpl'}]
|
\ 'html_footer': '~/vimwiki/vimwiki_foot.tpl'}]
|
||||||
|
" }}}
|
||||||
"ShowMarks
|
"ShowMarks {{{2
|
||||||
let g:showmarks_ignore_type = "hqprm"
|
let g:showmarks_ignore_type = "hqprm"
|
||||||
let g:showmarks_include = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
let g:showmarks_include = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
|
"}}}
|
||||||
"jsbeautify
|
"jsbeautify {{{3
|
||||||
nnoremap <silent> <leader>ff :call g:Jsbeautify()<cr>:retab!<cr>
|
nnoremap <silent> <leader>ff :call g:Jsbeautify()<cr>:retab!<cr>
|
||||||
|
"}}}
|
||||||
" pydiction
|
" pydiction {{{2
|
||||||
let g:pydiction_location = '/home/gryf/.vim/after/ftplugin/pytdiction/complete-dict'
|
let g:pydiction_location = '/home/gryf/.vim/after/ftplugin/pytdiction/complete-dict'
|
||||||
"}}}
|
"}}}
|
||||||
|
"TagListToo {{{2
|
||||||
|
let g:VerticalToolWindowSide = 'right'
|
||||||
|
"}}}
|
||||||
|
"}}}
|
||||||
"KEYS: User definied keyboard shortcuts {{{
|
"KEYS: User definied keyboard shortcuts {{{
|
||||||
|
|
||||||
"set <C-F1>=^[[11^
|
"set <C-F1>=^[[11^
|
||||||
@@ -175,8 +177,8 @@ if $TERM == 'rxvt-unicode'
|
|||||||
map <C-PageUp> :tabp<CR>
|
map <C-PageUp> :tabp<CR>
|
||||||
endif
|
endif
|
||||||
|
|
||||||
map <F5> :PyLint<cr>
|
map <F5> :call <SID>runPyLint()<cr>
|
||||||
map <F6> :call PyLintBuf()<cr>
|
map <F6> :call <SID>PyLintBuf()<cr>
|
||||||
|
|
||||||
"map ctags plugin to show popup menu in gvim
|
"map ctags plugin to show popup menu in gvim
|
||||||
"map <F6> :popup Tags<CR>
|
"map <F6> :popup Tags<CR>
|
||||||
@@ -228,18 +230,26 @@ map <C-F> :FufFile **/<CR>
|
|||||||
" endif
|
" endif
|
||||||
"endfunction
|
"endfunction
|
||||||
|
|
||||||
"function <SID>PyLint()
|
function <SID>runPyLint()
|
||||||
" :make
|
echohl Statement
|
||||||
" let l:mbe = 0
|
echo "Running pylint (ctrl-c to cancel) ..."
|
||||||
" if bufwinnr(bufnr('-MiniBufExplorer-')) != -1
|
echohl Normal
|
||||||
" let l:mbe = 1
|
:Pylint
|
||||||
" :CMiniBufExplorer
|
endfunction
|
||||||
" endif
|
function <SID>PyLintBuf()
|
||||||
" :cwindow
|
echohl Statement
|
||||||
" if l:mbe == 1
|
echo "Running pylint (ctrl-c to cancel) ..."
|
||||||
" :MiniBufExplorer
|
echohl Normal
|
||||||
" endif
|
let file = expand('%:p')
|
||||||
"endfunction
|
let cmd = 'pylint --reports=n --output-format=text "' . file . '"'
|
||||||
|
|
||||||
|
if has('win32') || has('win64')
|
||||||
|
let command = 'cmd /c "' . command . '"'
|
||||||
|
endif
|
||||||
|
|
||||||
|
exec "bel silent new " . file . ".lint"
|
||||||
|
exec "silent! read! " . cmd
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! <SID>StripTrailingWhitespaces()
|
function! <SID>StripTrailingWhitespaces()
|
||||||
" Preparation: save last search, and cursor position.
|
" Preparation: save last search, and cursor position.
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ ScriptID SourceID Filename
|
|||||||
2421 9423 pysmell.vim
|
2421 9423 pysmell.vim
|
||||||
152 3342 showmarks.vim
|
152 3342 showmarks.vim
|
||||||
2540 11006 snipMate.vim
|
2540 11006 snipMate.vim
|
||||||
273 7701 taglist.vim
|
#273 7701 taglist.vim # exchanged with taglisttoo
|
||||||
2607 10388 tasklist.vim
|
2607 10388 tasklist.vim
|
||||||
90 12743 vcscommand.vim
|
90 12743 vcscommand.vim
|
||||||
2226 12476 vimwiki.vim
|
2226 12476 vimwiki.vim
|
||||||
@@ -23,6 +23,8 @@ ScriptID SourceID Filename
|
|||||||
2536 12154 lucius.vim
|
2536 12154 lucius.vim
|
||||||
1165 3741 tolerable.vim
|
1165 3741 tolerable.vim
|
||||||
2465 11352 wombat256.vim
|
2465 11352 wombat256.vim
|
||||||
|
# compiler
|
||||||
|
891 10365 pylint.vim
|
||||||
# ftplugin
|
# ftplugin
|
||||||
2441 12763 pyflakes.vim
|
2441 12763 pyflakes.vim
|
||||||
30 9196 python_fn.vim
|
30 9196 python_fn.vim
|
||||||
|
|||||||
127
compiler/pylint.vim
Normal file
127
compiler/pylint.vim
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
" Vim compiler file for Python
|
||||||
|
" Compiler: Style checking tool for Python
|
||||||
|
" Maintainer: Oleksandr Tymoshenko <gonzo@univ.kiev.ua>
|
||||||
|
" Last Change: 2009 Apr 19
|
||||||
|
" Version: 0.5
|
||||||
|
" Contributors:
|
||||||
|
" Artur Wroblewski
|
||||||
|
" Menno
|
||||||
|
"
|
||||||
|
" Installation:
|
||||||
|
" Drop pylint.vim in ~/.vim/compiler directory. Ensure that your PATH
|
||||||
|
" environment variable includes the path to 'pylint' executable.
|
||||||
|
"
|
||||||
|
" Add the following line to the autocmd section of .vimrc
|
||||||
|
"
|
||||||
|
" autocmd FileType python compiler pylint
|
||||||
|
"
|
||||||
|
" Usage:
|
||||||
|
" Pylint is called after a buffer with Python code is saved. QuickFix
|
||||||
|
" window is opened to show errors, warnings and hints provided by Pylint.
|
||||||
|
" Code rate calculated by Pylint is displayed at the bottom of the
|
||||||
|
" window.
|
||||||
|
"
|
||||||
|
" Above is realized with :Pylint command. To disable calling Pylint every
|
||||||
|
" time a buffer is saved put into .vimrc file
|
||||||
|
"
|
||||||
|
" let g:pylint_onwrite = 0
|
||||||
|
"
|
||||||
|
" Displaying code rate calculated by Pylint can be avoided by setting
|
||||||
|
"
|
||||||
|
" let g:pylint_show_rate = 0
|
||||||
|
"
|
||||||
|
" Openning of QuickFix window can be disabled with
|
||||||
|
"
|
||||||
|
" let g:pylint_cwindow = 0
|
||||||
|
"
|
||||||
|
" Of course, standard :make command can be used as in case of every
|
||||||
|
" other compiler.
|
||||||
|
"
|
||||||
|
|
||||||
|
|
||||||
|
if exists('current_compiler')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let current_compiler = 'pylint'
|
||||||
|
|
||||||
|
if !exists('g:pylint_onwrite')
|
||||||
|
let g:pylint_onwrite = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists('g:pylint_show_rate')
|
||||||
|
let g:pylint_show_rate = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists('g:pylint_cwindow')
|
||||||
|
let g:pylint_cwindow = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists(':Pylint') != 2
|
||||||
|
command Pylint :call Pylint(0)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
|
||||||
|
command -nargs=* CompilerSet setlocal <args>
|
||||||
|
endif
|
||||||
|
|
||||||
|
" We should echo filename because pylint truncates .py
|
||||||
|
" If someone know better way - let me know :)
|
||||||
|
CompilerSet makeprg=(echo\ '[%]';\ pylint\ -r\ y\ %)
|
||||||
|
|
||||||
|
" We could omit end of file-entry, there is only one file
|
||||||
|
" %+I... - include code rating information
|
||||||
|
" %-G... - remove all remaining report lines from quickfix buffer
|
||||||
|
CompilerSet efm=%+P[%f],%t:\ %#%l:%m,%Z,%+IYour\ code%m,%Z,%-G%.%#
|
||||||
|
|
||||||
|
if g:pylint_onwrite
|
||||||
|
augroup python
|
||||||
|
au!
|
||||||
|
au BufWritePost * call Pylint(1)
|
||||||
|
augroup end
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! Pylint(writing)
|
||||||
|
if !a:writing && &modified
|
||||||
|
" Save before running
|
||||||
|
write
|
||||||
|
endif
|
||||||
|
|
||||||
|
if has('win32') || has('win16') || has('win95') || has('win64')
|
||||||
|
setlocal sp=>%s
|
||||||
|
else
|
||||||
|
setlocal sp=>%s\ 2>&1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If check is executed by buffer write - do not jump to first error
|
||||||
|
if !a:writing
|
||||||
|
silent make
|
||||||
|
else
|
||||||
|
silent make!
|
||||||
|
endif
|
||||||
|
|
||||||
|
if g:pylint_cwindow
|
||||||
|
cwindow
|
||||||
|
endif
|
||||||
|
|
||||||
|
call PylintEvaluation()
|
||||||
|
|
||||||
|
if g:pylint_show_rate
|
||||||
|
echon 'code rate: ' b:pylint_rate ', prev: ' b:pylint_prev_rate
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! PylintEvaluation()
|
||||||
|
let l:list = getqflist()
|
||||||
|
let b:pylint_rate = '0.00'
|
||||||
|
let b:pylint_prev_rate = '0.00'
|
||||||
|
for l:item in l:list
|
||||||
|
if l:item.type == 'I' && l:item.text =~ 'Your code has been rated'
|
||||||
|
let l:re_rate = '\(-\?[0-9]\{1,2\}\.[0-9]\{2\}\)/'
|
||||||
|
let b:pylint_rate = substitute(l:item.text, '.*rated at '.l:re_rate.'.*', '\1', 'g')
|
||||||
|
" Only if there is information about previous run
|
||||||
|
if l:item.text =~ 'previous run: '
|
||||||
|
let b:pylint_prev_rate = substitute(l:item.text, '.*previous run: '.l:re_rate.'.*', '\1', 'g')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
" markdown filetype file
|
|
||||||
if exists("did\_load\_filetypes")
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
augroup markdown
|
|
||||||
au! BufRead,BufNewFile *.mkd setfiletype mkd
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
" ftplugin for python.
|
|
||||||
" See: eclim_py plugin in plugins dir
|
|
||||||
" Global Variables {{{
|
|
||||||
|
|
||||||
if !exists("g:EclimPythonValidate")
|
|
||||||
let g:EclimPythonValidate = 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
" }}}
|
|
||||||
|
|
||||||
" Autocmds {{{
|
|
||||||
|
|
||||||
if g:EclimPythonValidate
|
|
||||||
augroup eclim_python_validate
|
|
||||||
autocmd! BufWritePost <buffer>
|
|
||||||
autocmd BufWritePost <buffer> call Validate(1)
|
|
||||||
augroup END
|
|
||||||
endif
|
|
||||||
|
|
||||||
" }}}
|
|
||||||
|
|
||||||
if !exists(":Validate")
|
|
||||||
command -nargs=0 -buffer Validate :call Validate(0)
|
|
||||||
endif
|
|
||||||
if !exists(":PyLint")
|
|
||||||
command -nargs=0 -buffer PyLint :call PyLint()
|
|
||||||
endif
|
|
||||||
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -18,29 +18,23 @@
|
|||||||
" License along with this program. If not, see
|
" License along with this program. If not, see
|
||||||
" <http://www.gnu.org/licenses/>.
|
" <http://www.gnu.org/licenses/>.
|
||||||
" ============================================================================
|
" ============================================================================
|
||||||
let s:Eclim_ver = '1.5.4'
|
let s:Eclim_ver = '1.5.6'
|
||||||
|
|
||||||
" Further Description: {{{1
|
" Further Description: {{{1
|
||||||
" @gryf: Python and editor helpers taken over from Eclim project. There are
|
" @gryf: taglist and editor helpers taken over from Eclim project. There are
|
||||||
" couple of nice tools, which I want to have separately from Eclim project.
|
" couple of nice tools, which I want to have separately from Eclim project.
|
||||||
" Just for my conviniece and because I mainly work with Python files, I'll
|
" Just for my conviniece, I've puted all of necessary things into this one file.
|
||||||
" put all of necessary thing into this one file.
|
|
||||||
"
|
"
|
||||||
" Added:
|
" Added:
|
||||||
" :Buffers
|
" :Buffers
|
||||||
" :Sign
|
" :Sign
|
||||||
" :Signs
|
" :Signs
|
||||||
" :PyLint
|
|
||||||
" :Validate (pyflakes)
|
|
||||||
" :QuickFixClear
|
" :QuickFixClear
|
||||||
" :LocationListClear
|
" :LocationListClear
|
||||||
" TODO:
|
" TODO:
|
||||||
" :Validate (rope) [this one is not crucial. at least for now.]
|
" :taglisttoo
|
||||||
" :SignClearUser
|
" :SignClearUser
|
||||||
" :SignClearAll
|
" :SignClearAll
|
||||||
" (w daleszej kolejności)
|
|
||||||
" :PythonRegex
|
|
||||||
" :LocateFile (do silnego przerobienia)
|
|
||||||
"
|
"
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
@@ -103,7 +97,7 @@ endif
|
|||||||
" Command Declarations {{{2
|
" Command Declarations {{{2
|
||||||
|
|
||||||
if !exists(":Buffers")
|
if !exists(":Buffers")
|
||||||
command Buffers :call Buffers()
|
command Buffers :call s:Buffers()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if has('signs')
|
if has('signs')
|
||||||
@@ -122,10 +116,10 @@ if has('signs')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if !exists(":QuickFixClear")
|
if !exists(":QuickFixClear")
|
||||||
command QuickFixClear :call setqflist([]) | call SignsUpdate()
|
command QuickFixClear :call setqflist([]) | call s:SignsUpdate()
|
||||||
endif
|
endif
|
||||||
if !exists(":LocationListClear")
|
if !exists(":LocationListClear")
|
||||||
command LocationListClear :call setloclist(0, []) | call SignsUpdate()
|
command LocationListClear :call setloclist(0, []) | call s:SignsUpdate()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
@@ -134,10 +128,10 @@ endif
|
|||||||
|
|
||||||
if g:EclimSignLevel
|
if g:EclimSignLevel
|
||||||
augroup eclim_qf
|
augroup eclim_qf
|
||||||
autocmd QuickFixCmdPost *make* call SignsShow('', 'qf')
|
autocmd QuickFixCmdPost *make* call s:SignsShow('', 'qf')
|
||||||
autocmd QuickFixCmdPost grep*,vimgrep* call SignsShow('i', 'qf')
|
autocmd QuickFixCmdPost grep*,vimgrep* call s:SignsShow('i', 'qf')
|
||||||
autocmd QuickFixCmdPost lgrep*,lvimgrep* call SignsShow('i', 'loc')
|
autocmd QuickFixCmdPost lgrep*,lvimgrep* call s:SignsShow('i', 'loc')
|
||||||
autocmd BufWinEnter * call SignsUpdate()
|
autocmd BufWinEnter * call s:SignsUpdate()
|
||||||
augroup END
|
augroup END
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -177,7 +171,7 @@ endif
|
|||||||
|
|
||||||
" Buffers() eclim/autoload/eclim/common/buffers.vim {{{2
|
" Buffers() eclim/autoload/eclim/common/buffers.vim {{{2
|
||||||
" Like, :buffers, but opens a temporary buffer.
|
" Like, :buffers, but opens a temporary buffer.
|
||||||
function! Buffers()
|
function! s:Buffers()
|
||||||
redir => list
|
redir => list
|
||||||
silent exec 'buffers'
|
silent exec 'buffers'
|
||||||
redir END
|
redir END
|
||||||
@@ -367,9 +361,13 @@ function! DelayedCommand(command, ...)
|
|||||||
exec 'augroup END'
|
exec 'augroup END'
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
" EchoTrace(message) eclim/autoload/eclim/util.vim {{{2
|
" EchoTrace(message, [time_elapsed]) eclim/autoload/eclim/util.vim {{{2
|
||||||
function! EchoTrace(message)
|
function! EchoTrace(message, ...)
|
||||||
call s:EchoLevel(a:message, 6, g:EclimTraceHighlight)
|
if a:0 > 0
|
||||||
|
call s:EchoLevel('(' . a:1 . 's) ' . a:message, 6, g:EclimTraceHighlight)
|
||||||
|
else
|
||||||
|
call s:EchoLevel(a:message, 6, g:EclimTraceHighlight)
|
||||||
|
endif
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
" EchoWarning(message) eclim/autoload/eclim/util.vim {{{2
|
" EchoWarning(message) eclim/autoload/eclim/util.vim {{{2
|
||||||
@@ -414,7 +412,12 @@ endfunction " }}}
|
|||||||
" Escapes the supplied buffer name so that it can be safely used by buf*
|
" Escapes the supplied buffer name so that it can be safely used by buf*
|
||||||
" functions.
|
" functions.
|
||||||
function! EscapeBufferName(name)
|
function! EscapeBufferName(name)
|
||||||
let name = escape(a:name, ' ')
|
let name = a:name
|
||||||
|
" escaping the space in cygwin could lead to the dos path error message that
|
||||||
|
" cygwin throws when a dos path is referenced.
|
||||||
|
if !has('win32unix')
|
||||||
|
let name = escape(a:name, ' ')
|
||||||
|
endif
|
||||||
return substitute(name, '\(.\{-}\)\[\(.\{-}\)\]\(.\{-}\)', '\1[[]\2[]]\3', 'g')
|
return substitute(name, '\(.\{-}\)\[\(.\{-}\)\]\(.\{-}\)', '\1[[]\2[]]\3', 'g')
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
@@ -489,7 +492,14 @@ function! GoToBufferWindowOrOpen(name, cmd)
|
|||||||
exec winnr . "winc w"
|
exec winnr . "winc w"
|
||||||
call DelayedCommand('doautocmd WinEnter')
|
call DelayedCommand('doautocmd WinEnter')
|
||||||
else
|
else
|
||||||
silent exec a:cmd . ' ' . escape(Simplify(a:name), ' ')
|
let cmd = a:cmd
|
||||||
|
" if splitting and the buffer is a unamed empty buffer, then switch to an
|
||||||
|
" edit.
|
||||||
|
if cmd == 'split' && expand('%') == '' &&
|
||||||
|
\ !&modified && line('$') == 1 && getline(1) == ''
|
||||||
|
let cmd = 'edit'
|
||||||
|
endif
|
||||||
|
silent exec cmd . ' ' . escape(Simplify(a:name), ' ')
|
||||||
endif
|
endif
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
@@ -535,7 +545,7 @@ function! SetLocationList(list, ...)
|
|||||||
if g:EclimShowCurrentError && len(loclist) > 0
|
if g:EclimShowCurrentError && len(loclist) > 0
|
||||||
call DelayedCommand('call ShowCurrentError()')
|
call DelayedCommand('call ShowCurrentError()')
|
||||||
endif
|
endif
|
||||||
call SignsUpdate()
|
call s:SignsUpdate()
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
" ClearLocationList([namespace, namespace, ...]) eclim/autoload/eclim/util.vim {{{2
|
" ClearLocationList([namespace, namespace, ...]) eclim/autoload/eclim/util.vim {{{2
|
||||||
@@ -566,7 +576,7 @@ function! ClearLocationList(...)
|
|||||||
else
|
else
|
||||||
call setloclist(0, [], 'r')
|
call setloclist(0, [], 'r')
|
||||||
endif
|
endif
|
||||||
call SignsUpdate()
|
call s:SignsUpdate()
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
" SetQuickfixList(list, [action]) eclim/autoload/eclim/util.vim {{{2
|
" SetQuickfixList(list, [action]) eclim/autoload/eclim/util.vim {{{2
|
||||||
@@ -599,7 +609,7 @@ function! SetQuickfixList(list, ...)
|
|||||||
if g:EclimShowCurrentError && len(qflist) > 0
|
if g:EclimShowCurrentError && len(qflist) > 0
|
||||||
call DelayedCommand('call ShowCurrentError()')
|
call DelayedCommand('call ShowCurrentError()')
|
||||||
endif
|
endif
|
||||||
call SignsUpdate()
|
call s:SignsUpdate()
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
" ShowCurrentError() eclim/autoload/eclim/util.vim {{{2
|
" ShowCurrentError() eclim/autoload/eclim/util.vim {{{2
|
||||||
@@ -688,11 +698,19 @@ function! System(cmd, ...)
|
|||||||
|
|
||||||
if len(a:000) > 0 && a:000[0]
|
if len(a:000) > 0 && a:000[0]
|
||||||
let result = ''
|
let result = ''
|
||||||
call EchoTrace('exec: ' . a:cmd)
|
let begin = localtime()
|
||||||
exec a:cmd
|
try
|
||||||
|
exec a:cmd
|
||||||
|
finally
|
||||||
|
call EchoTrace('exec: ' . a:cmd, localtime() - begin)
|
||||||
|
endtry
|
||||||
else
|
else
|
||||||
call EchoTrace('system: ' . a:cmd)
|
let begin = localtime()
|
||||||
let result = system(a:cmd)
|
try
|
||||||
|
let result = system(a:cmd)
|
||||||
|
finally
|
||||||
|
call EchoTrace('system: ' . a:cmd, localtime() - begin)
|
||||||
|
endtry
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let &shell = saveshell
|
let &shell = saveshell
|
||||||
@@ -757,8 +775,8 @@ function! TempWindow(name, lines, ...)
|
|||||||
exec bufwinnr(name) . "winc w"
|
exec bufwinnr(name) . "winc w"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
set modifiable
|
setlocal modifiable
|
||||||
set noreadonly
|
setlocal noreadonly
|
||||||
call append(1, a:lines)
|
call append(1, a:lines)
|
||||||
retab
|
retab
|
||||||
silent 1,1delete _
|
silent 1,1delete _
|
||||||
@@ -769,7 +787,7 @@ function! TempWindow(name, lines, ...)
|
|||||||
setlocal readonly
|
setlocal readonly
|
||||||
endif
|
endif
|
||||||
|
|
||||||
doautocmd BufEnter
|
silent doautocmd BufEnter
|
||||||
|
|
||||||
" Store filename and window number so that plugins can use it if necessary.
|
" Store filename and window number so that plugins can use it if necessary.
|
||||||
if filename != expand('%:p')
|
if filename != expand('%:p')
|
||||||
@@ -1006,7 +1024,7 @@ endfunction " }}}
|
|||||||
" This function supports a severity level by examining the 'type' key of the
|
" This function supports a severity level by examining the 'type' key of the
|
||||||
" dictionaries in the location or quickfix list. It supports 'i' (info), 'w'
|
" dictionaries in the location or quickfix list. It supports 'i' (info), 'w'
|
||||||
" (warning), and 'e' (error).
|
" (warning), and 'e' (error).
|
||||||
function! SignsUpdate()
|
function! s:SignsUpdate()
|
||||||
if !has('signs') || !g:EclimSignLevel
|
if !has('signs') || !g:EclimSignLevel
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@@ -1103,7 +1121,7 @@ function! SignsShow(type, list)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call SignsUpdate()
|
call s:SignsUpdate()
|
||||||
|
|
||||||
redraw!
|
redraw!
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
@@ -1152,249 +1170,6 @@ endif " }}}
|
|||||||
|
|
||||||
" End Display Signs: }}}
|
" End Display Signs: }}}
|
||||||
|
|
||||||
" Python Django: {{{1
|
|
||||||
|
|
||||||
" GetProjectPath([path]) eclim/autoload/eclim/python/django/util.vim {{{2
|
|
||||||
function! DjangoGetProjectPath(...)
|
|
||||||
let path = len(a:000) > 0 ? a:000[0] : escape(expand('%:p:h'), ' ')
|
|
||||||
let dir = findfile("manage.py", path . ';')
|
|
||||||
if dir != ''
|
|
||||||
let dir = substitute(fnamemodify(dir, ':p:h'), '\', '/', 'g')
|
|
||||||
" secondary check on the dir, if settings.py exists, then probably the
|
|
||||||
" right dir, otherwise, search again from the parent.
|
|
||||||
if !filereadable(dir . '/settings.py')
|
|
||||||
return DjangoGetProjectPath(path . '/..')
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
return dir
|
|
||||||
endfunction " }}}
|
|
||||||
|
|
||||||
" }}}
|
|
||||||
|
|
||||||
" Python Validate: {{{1
|
|
||||||
|
|
||||||
" Global Variables eclim/autoload/eclim/python/validate.vim {{{2
|
|
||||||
" if the user has the pyflakes plugin from vim.org, then disable our
|
|
||||||
" validation since the two overlap and may result in errors
|
|
||||||
let s:pyflakes_enabled = 1
|
|
||||||
if exists('g:pyflakes_builtins')
|
|
||||||
let s:pyflakes_enabled = 0
|
|
||||||
endif
|
|
||||||
if !exists('g:EclimValidateBuffer')
|
|
||||||
let g:EclimValidateBuffer = 1
|
|
||||||
endif
|
|
||||||
" }}}
|
|
||||||
|
|
||||||
" Script Variables eclim/autoload/eclim/python/validate.vim {{{2
|
|
||||||
let s:warnings = '\(' . join([
|
|
||||||
\ 'imported but unused',
|
|
||||||
\ 'local variable .* assigned to but never used',
|
|
||||||
\ ], '\|') . '\)'
|
|
||||||
" }}}
|
|
||||||
|
|
||||||
" Validate(on_save) eclim/autoload/eclim/python/validate.vim {{{2
|
|
||||||
" Validates the current file.
|
|
||||||
function! Validate(on_save)
|
|
||||||
if g:EclimValidateBuffer == 0
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
if WillWrittenBufferClose()
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
if &filetype != "python"
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
let results = []
|
|
||||||
let syntax_error = ValidateSyntax()
|
|
||||||
|
|
||||||
if syntax_error == ''
|
|
||||||
if s:pyflakes_enabled
|
|
||||||
if !executable('pyflakes')
|
|
||||||
if !exists('g:eclim_python_pyflakes_warn')
|
|
||||||
call EchoWarning("Unable to find 'pyflakes' command.")
|
|
||||||
let g:eclim_python_pyflakes_warn = 1
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
let command = 'pyflakes "' . expand('%:p') . '"'
|
|
||||||
let results = split(System(command), '\n')
|
|
||||||
if v:shell_error > 1 " pyflakes returns 1 if there where warnings.
|
|
||||||
call EchoError('Error running command: ' . command)
|
|
||||||
let results = []
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" rope validation
|
|
||||||
" currently too slow for running on every save.
|
|
||||||
"
|
|
||||||
" gryf: this stuff should be rewriten somehow. For now it is just to
|
|
||||||
" complicated.
|
|
||||||
"
|
|
||||||
"if eclim#project#util#IsCurrentFileInProject(0) && !a:on_save
|
|
||||||
" let project = eclim#project#util#GetCurrentProjectRoot()
|
|
||||||
" let filename = eclim#project#util#GetProjectRelativeFilePath(expand('%:p'))
|
|
||||||
" let rope_results = eclim#python#rope#Validate(project, filename)
|
|
||||||
" " currently rope gets confused with iterator var on list comprehensions
|
|
||||||
" let rope_results = filter(rope_results, "v:val !~ '^Unresolved variable'")
|
|
||||||
" let results += rope_results
|
|
||||||
"endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !empty(results) || syntax_error != ''
|
|
||||||
call filter(results, "v:val !~ 'unable to detect undefined names'")
|
|
||||||
|
|
||||||
let errors = []
|
|
||||||
if syntax_error != ''
|
|
||||||
let lnum = substitute(syntax_error, '.*(line \(\d\+\))', '\1', '')
|
|
||||||
let text = substitute(syntax_error, '\(.*\)\s\+(line .*', '\1', '')
|
|
||||||
if lnum == syntax_error
|
|
||||||
let lnum = 1
|
|
||||||
let text .= ' (unknown line)'
|
|
||||||
endif
|
|
||||||
call add(errors, {
|
|
||||||
\ 'filename': Simplify(expand('%')),
|
|
||||||
\ 'lnum': lnum,
|
|
||||||
\ 'text': text,
|
|
||||||
\ 'type': 'e'
|
|
||||||
\ })
|
|
||||||
endif
|
|
||||||
|
|
||||||
if syntax_error == ''
|
|
||||||
for error in results
|
|
||||||
let file = substitute(error, '\(.\{-}\):[0-9]\+:.*', '\1', '')
|
|
||||||
let line = substitute(error, '.\{-}:\([0-9]\+\):.*', '\1', '')
|
|
||||||
let message = substitute(error, '.\{-}:[0-9]\+:\(.*\)', '\1', '')
|
|
||||||
let dict = {
|
|
||||||
\ 'filename': Simplify(file),
|
|
||||||
\ 'lnum': line,
|
|
||||||
\ 'text': message,
|
|
||||||
\ 'type': message =~ s:warnings ? 'w' : 'e',
|
|
||||||
\ }
|
|
||||||
|
|
||||||
call add(errors, dict)
|
|
||||||
endfor
|
|
||||||
endif
|
|
||||||
|
|
||||||
call SetLocationList(errors)
|
|
||||||
if g:EclimOpenQFLists
|
|
||||||
:lopen
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
call ClearLocationList()
|
|
||||||
endif
|
|
||||||
endfunction " }}}
|
|
||||||
|
|
||||||
" ValidateSyntax() eclim/autoload/eclim/python/validate.vim {{{2
|
|
||||||
function ValidateSyntax()
|
|
||||||
let syntax_error = ''
|
|
||||||
|
|
||||||
if has('python')
|
|
||||||
|
|
||||||
python << EOF
|
|
||||||
import re, vim
|
|
||||||
from compiler import parseFile
|
|
||||||
try:
|
|
||||||
parseFile(vim.eval('expand("%:p")'))
|
|
||||||
except SyntaxError, se:
|
|
||||||
vim.command("let syntax_error = \"%s\"" % re.sub(r'"', r'\"', str(se)))
|
|
||||||
except IndentationError, ie:
|
|
||||||
vim.command("let syntax_error = \"%s (line %s)\"" % (
|
|
||||||
re.sub(r'"', r'\"', ie.msg), ie.lineno)
|
|
||||||
)
|
|
||||||
EOF
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
return syntax_error
|
|
||||||
endfunction " }}}
|
|
||||||
|
|
||||||
" PyLint() eclim/autoload/eclim/python/validate.vim {{{2
|
|
||||||
function! PyLint()
|
|
||||||
|
|
||||||
if &filetype != "python"
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
let file = expand('%:p')
|
|
||||||
|
|
||||||
if !executable('pylint')
|
|
||||||
call EchoError("Unable to find 'pylint' command.")
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
let pylint_env = ''
|
|
||||||
if exists('g:EclimPyLintEnv')
|
|
||||||
let pylint_env = g:EclimPyLintEnv
|
|
||||||
else
|
|
||||||
let paths = []
|
|
||||||
|
|
||||||
let django_dir = DjangoGetProjectPath()
|
|
||||||
if django_dir != ''
|
|
||||||
call add(paths, fnamemodify(django_dir, ':h'))
|
|
||||||
let settings = fnamemodify(django_dir, ':t')
|
|
||||||
if has('win32') || has('win64')
|
|
||||||
let pylint_env =
|
|
||||||
\ 'set DJANGO_SETTINGS_MODULE='. settings . '.settings && '
|
|
||||||
else
|
|
||||||
let pylint_env =
|
|
||||||
\ 'DJANGO_SETTINGS_MODULE="'. settings . '.settings" '
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !empty(paths)
|
|
||||||
if has('win32') || has('win64')
|
|
||||||
let pylint_env .= 'set "PYTHONPATH=' . join(paths, ';') . '" && '
|
|
||||||
else
|
|
||||||
let pylint_env .= 'PYTHONPATH="$PYTHONPATH:' . join(paths, ':') . '"'
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" TODO: switch to 'parseable' output format.
|
|
||||||
let command = pylint_env .
|
|
||||||
\ ' pylint --reports=n --output-format=text "' . file . '"'
|
|
||||||
if has('win32') || has('win64')
|
|
||||||
let command = 'cmd /c "' . command . '"'
|
|
||||||
endif
|
|
||||||
|
|
||||||
call Echo('Running pylint (ctrl-c to cancel) ...')
|
|
||||||
let result = System(command)
|
|
||||||
call Echo(' ')
|
|
||||||
if v:shell_error == 1
|
|
||||||
call EchoError('Error running command: ' . command)
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
if result =~ ':'
|
|
||||||
let errors = []
|
|
||||||
for error in split(result, '\n')
|
|
||||||
if error =~ '^[CWERF]\(: \)\?[0-9]'
|
|
||||||
let line = substitute(error, '.\{-}:\s*\([0-9]\+\):.*', '\1', '')
|
|
||||||
let message = substitute(error, '.\{-}:\s*[0-9]\+:\(.*\)', '\1', '')
|
|
||||||
let dict = {
|
|
||||||
\ 'filename': Simplify(file),
|
|
||||||
\ 'lnum': line,
|
|
||||||
\ 'text': message,
|
|
||||||
\ 'type': error =~ '^E' ? 'e' : 'w',
|
|
||||||
\ }
|
|
||||||
|
|
||||||
call add(errors, dict)
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
call SetQuickfixList(errors)
|
|
||||||
if g:EclimOpenQFLists
|
|
||||||
:copen
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
call SetQuickfixList([], 'r')
|
|
||||||
endif
|
|
||||||
endfunction " }}}
|
|
||||||
|
|
||||||
" }}}
|
|
||||||
|
|
||||||
" Eclim Help: {{{1
|
" Eclim Help: {{{1
|
||||||
|
|
||||||
" BufferHelp(lines, orientation, size) eclim/autoload/eclim/help.vim {{{
|
" BufferHelp(lines, orientation, size) eclim/autoload/eclim/help.vim {{{
|
||||||
@@ -1423,7 +1198,7 @@ function! BufferHelp(lines, orientation, size)
|
|||||||
setlocal buftype=nofile bufhidden=delete
|
setlocal buftype=nofile bufhidden=delete
|
||||||
nnoremap <buffer> <silent> ? :bd<cr>
|
nnoremap <buffer> <silent> ? :bd<cr>
|
||||||
|
|
||||||
set modifiable noreadonly
|
setlocal modifiable noreadonly
|
||||||
silent 1,$delete _
|
silent 1,$delete _
|
||||||
call append(1, a:lines)
|
call append(1, a:lines)
|
||||||
retab
|
retab
|
||||||
@@ -1482,58 +1257,6 @@ function! GetAllBuffers()
|
|||||||
|
|
||||||
echo buffers
|
echo buffers
|
||||||
return buffers
|
return buffers
|
||||||
|
|
||||||
"let buffers = []
|
|
||||||
"let filelength = 0
|
|
||||||
"for entry in split(list, '\n')
|
|
||||||
" let buffer = {}
|
|
||||||
" let buffer.status = substitute(entry, '\s*[0-9]\+\s\+\(.\{-}\)\s\+".*', '\1', '')
|
|
||||||
" let buffer.path = substitute(entry, '.\{-}"\(.\{-}\)".*', '\1', '')
|
|
||||||
" let buffer.path = fnamemodify(buffer.path, ':p')
|
|
||||||
" let buffer.file = fnamemodify(buffer.path, ':p:t')
|
|
||||||
" let buffer.dir = fnamemodify(buffer.path, ':p:h')
|
|
||||||
" exec 'let buffer.bufnr = ' . substitute(entry, '\s*\([0-9]\+\).*', '\1', '')
|
|
||||||
" exec 'let buffer.lnum = ' .
|
|
||||||
" \ substitute(entry, '.*"\s\+line\s\+\([0-9]\+\).*', '\1', '')
|
|
||||||
" call add(buffers, buffer)
|
|
||||||
|
|
||||||
" if len(buffer.file) > filelength
|
|
||||||
" let filelength = len(buffer.file)
|
|
||||||
" endif
|
|
||||||
"endfor
|
|
||||||
|
|
||||||
"if g:EclimBuffersSort != ''
|
|
||||||
" call sort(buffers, 'BufferCompare')
|
|
||||||
"endif
|
|
||||||
|
|
||||||
"let lines = []
|
|
||||||
"for buffer in buffers
|
|
||||||
" call add(lines, s:BufferEntryToLine(buffer, filelength))
|
|
||||||
"endfor
|
|
||||||
|
|
||||||
"call TempWindow('[buffers]', lines)
|
|
||||||
"let b:eclim_buffers = buffers
|
|
||||||
|
|
||||||
"" syntax
|
|
||||||
"set ft=eclim_buffers
|
|
||||||
"hi link BufferActive Special
|
|
||||||
"hi link BufferHidden Comment
|
|
||||||
"syntax match BufferActive /+\?active\s\+\(\[RO\]\)\?/
|
|
||||||
"syntax match BufferHidden /+\?hidden\s\+\(\[RO\]\)\?/
|
|
||||||
|
|
||||||
"" mappings
|
|
||||||
"nnoremap <silent> <buffer> <cr> :call <SID>BufferOpen(g:EclimBuffersDefaultAction)<cr>
|
|
||||||
"nnoremap <silent> <buffer> E :call <SID>BufferOpen('edit')<cr>
|
|
||||||
"nnoremap <silent> <buffer> S :call <SID>BufferOpen('split')<cr>
|
|
||||||
"nnoremap <silent> <buffer> T :call <SID>BufferOpen('tablast \| tabnew')<cr>
|
|
||||||
"nnoremap <silent> <buffer> D :call <SID>BufferDelete()<cr>
|
|
||||||
|
|
||||||
"augroup eclim_buffers
|
|
||||||
" autocmd!
|
|
||||||
" autocmd BufAdd,BufWinEnter,BufDelete,BufWinLeave *
|
|
||||||
" \ call eclim#common#buffers#BuffersUpdate()
|
|
||||||
" autocmd BufUnload <buffer> autocmd! eclim_buffers
|
|
||||||
"augroup END
|
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
" ViewAllSigns(name) {{{2
|
" ViewAllSigns(name) {{{2
|
||||||
@@ -1564,23 +1287,6 @@ function! SignsViewAllSigns(name)
|
|||||||
augroup END
|
augroup END
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
"let filename = expand('%:p')
|
|
||||||
"let signs = SignsGetExisting(a:name)
|
|
||||||
"call sort(signs, 's:CompareSigns')
|
|
||||||
"let content = map(signs, "v:val.line . '|' . getline(v:val.line)")
|
|
||||||
|
|
||||||
"call TempWindow('[Sign List]', content)
|
|
||||||
|
|
||||||
"set ft=qf
|
|
||||||
"nnoremap <silent> <buffer> <cr> :call <SID>JumpToSign()<cr>
|
|
||||||
|
|
||||||
"" Store filename so that plugins can use it if necessary.
|
|
||||||
"let b:filename = filename
|
|
||||||
"augroup temp_window
|
|
||||||
" autocmd! BufWinLeave <buffer>
|
|
||||||
" call GoToBufferWindowRegister(filename)
|
|
||||||
"augroup END
|
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
" TODO: remove this
|
" TODO: remove this
|
||||||
@@ -1622,122 +1328,6 @@ function! SignsGetAllExisting(buffernr, mark_name)
|
|||||||
return existing
|
return existing
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
" PyLintBuf() create pylint-output buffer {{{2
|
|
||||||
function! PyLintBuf()
|
|
||||||
|
|
||||||
if &filetype != "python"
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
let file = expand('%:p')
|
|
||||||
|
|
||||||
if !executable('pylint')
|
|
||||||
call EchoError("Unable to find 'pylint' command.")
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
let pylint_env = ''
|
|
||||||
if exists('g:EclimPyLintEnv')
|
|
||||||
let pylint_env = g:EclimPyLintEnv
|
|
||||||
else
|
|
||||||
let paths = []
|
|
||||||
|
|
||||||
if !empty(paths)
|
|
||||||
if has('win32') || has('win64')
|
|
||||||
let pylint_env .= 'set "PYTHONPATH=' . join(paths, ';') . '" && '
|
|
||||||
else
|
|
||||||
let pylint_env .= 'PYTHONPATH="$PYTHONPATH:' . join(paths, ':') . '"'
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" TODO: switch to 'parseable' output format.
|
|
||||||
let command = pylint_env .
|
|
||||||
\ ' pylint --reports=n --output-format=text "' . file . '"'
|
|
||||||
if has('win32') || has('win64')
|
|
||||||
let command = 'cmd /c "' . command . '"'
|
|
||||||
endif
|
|
||||||
|
|
||||||
call Echo('Running pylint (ctrl-c to cancel) ...')
|
|
||||||
let result = System(command)
|
|
||||||
call Echo(' ')
|
|
||||||
if v:shell_error == 1
|
|
||||||
call EchoError('Error running command: ' . command)
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
exec "bel silent new " . file . ".lint"
|
|
||||||
|
|
||||||
for i in split(result, "\n")
|
|
||||||
call append("$", i)
|
|
||||||
endfor
|
|
||||||
|
|
||||||
"remove first empty line
|
|
||||||
exec "delete 1"
|
|
||||||
endfunction " }}}
|
|
||||||
|
|
||||||
" Marks() {{{2
|
|
||||||
" Like, :marks, but opens a temporary buffer.
|
|
||||||
function! Marks()
|
|
||||||
redir => list
|
|
||||||
silent exec 'marks'
|
|
||||||
redir END
|
|
||||||
|
|
||||||
let marks = []
|
|
||||||
let filelength = 0
|
|
||||||
for entry in split(list, '\n')
|
|
||||||
echo entry
|
|
||||||
let buffer = {}
|
|
||||||
let buffer.status = substitute(entry, '\s*[0-9]\+\s\+\(.\{-}\)\s\+".*', '\1', '')
|
|
||||||
let buffer.path = substitute(entry, '.\{-}"\(.\{-}\)".*', '\1', '')
|
|
||||||
let buffer.path = fnamemodify(buffer.path, ':p')
|
|
||||||
let buffer.file = fnamemodify(buffer.path, ':p:t')
|
|
||||||
let buffer.dir = fnamemodify(buffer.path, ':p:h')
|
|
||||||
exec 'let buffer.bufnr = ' . substitute(entry, '\s*\([0-9]\+\).*', '\1', '')
|
|
||||||
exec 'let buffer.lnum = ' .
|
|
||||||
\ substitute(entry, '.*"\s\+line\s\+\([0-9]\+\).*', '\1', '')
|
|
||||||
call add(marks, buffer)
|
|
||||||
|
|
||||||
if len(buffer.file) > filelength
|
|
||||||
let filelength = len(buffer.file)
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
|
|
||||||
if g:EclimBuffersSort != ''
|
|
||||||
call sort(buffers, 'BufferCompare')
|
|
||||||
endif
|
|
||||||
|
|
||||||
let lines = []
|
|
||||||
for buffer in buffers
|
|
||||||
call add(lines, s:BufferEntryToLine(buffer, filelength))
|
|
||||||
endfor
|
|
||||||
|
|
||||||
call TempWindow('[marks]', lines)
|
|
||||||
let b:eclim_buffers = buffers
|
|
||||||
|
|
||||||
" syntax
|
|
||||||
set ft=eclim_buffers
|
|
||||||
hi link BufferActive Special
|
|
||||||
hi link BufferHidden Comment
|
|
||||||
syntax match BufferActive /+\?active\s\+\(\[RO\]\)\?/
|
|
||||||
syntax match BufferHidden /+\?hidden\s\+\(\[RO\]\)\?/
|
|
||||||
|
|
||||||
" mappings
|
|
||||||
nnoremap <silent> <buffer> <cr> :call <SID>BufferOpen(g:EclimBuffersDefaultAction)<cr>
|
|
||||||
nnoremap <silent> <buffer> E :call <SID>BufferOpen('edit')<cr>
|
|
||||||
nnoremap <silent> <buffer> S :call <SID>BufferOpen('split')<cr>
|
|
||||||
nnoremap <silent> <buffer> T :call <SID>BufferOpen('tablast \| tabnew')<cr>
|
|
||||||
nnoremap <silent> <buffer> D :call <SID>BufferDelete()<cr>
|
|
||||||
|
|
||||||
"augroup eclim_buffers
|
|
||||||
" autocmd!
|
|
||||||
" autocmd BufAdd,BufWinEnter,BufDelete,BufWinLeave *
|
|
||||||
" \ call eclim#common#buffers#BuffersUpdate()
|
|
||||||
" autocmd BufUnload <buffer> autocmd! eclim_buffers
|
|
||||||
"augroup END
|
|
||||||
endfunction " }}}
|
|
||||||
command Marks :call Marks()
|
|
||||||
|
|
||||||
" s:BufferOpen2(cmd) {{{2
|
" s:BufferOpen2(cmd) {{{2
|
||||||
function! s:BufferOpen2(cmd)
|
function! s:BufferOpen2(cmd)
|
||||||
let line = line('.')
|
let line = line('.')
|
||||||
4546
plugin/taglist.vim
4546
plugin/taglist.vim
File diff suppressed because it is too large
Load Diff
2224
plugin/taglisttoo.vim
Normal file
2224
plugin/taglisttoo.vim
Normal file
File diff suppressed because it is too large
Load Diff
104
syntax/mkd.vim
104
syntax/mkd.vim
@@ -1,104 +0,0 @@
|
|||||||
" Vim syntax file
|
|
||||||
" Language: Markdown
|
|
||||||
" Maintainer: Ben Williams <benw@plasticboy.com>
|
|
||||||
" URL: http://plasticboy.com/markdown-vim-mode/
|
|
||||||
" Version: 9
|
|
||||||
" Last Change: 2009 May 18
|
|
||||||
" Remark: Uses HTML syntax file
|
|
||||||
" Remark: I don't do anything with angle brackets (<>) because that would too easily
|
|
||||||
" easily conflict with HTML syntax
|
|
||||||
" TODO: Handle stuff contained within stuff (e.g. headings within blockquotes)
|
|
||||||
|
|
||||||
|
|
||||||
" Read the HTML syntax to start with
|
|
||||||
if version < 600
|
|
||||||
so <sfile>:p:h/html.vim
|
|
||||||
else
|
|
||||||
runtime! syntax/html.vim
|
|
||||||
unlet b:current_syntax
|
|
||||||
endif
|
|
||||||
|
|
||||||
if version < 600
|
|
||||||
syntax clear
|
|
||||||
elseif exists("b:current_syntax")
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
" don't use standard HiLink, it will not work with included syntax files
|
|
||||||
if version < 508
|
|
||||||
command! -nargs=+ HtmlHiLink hi link <args>
|
|
||||||
else
|
|
||||||
command! -nargs=+ HtmlHiLink hi def link <args>
|
|
||||||
endif
|
|
||||||
|
|
||||||
syn spell toplevel
|
|
||||||
syn case ignore
|
|
||||||
syn sync linebreaks=1
|
|
||||||
|
|
||||||
"additions to HTML groups
|
|
||||||
syn region htmlBold start=/\\\@<!\(^\|\A\)\@=\*\@<!\*\*\*\@!/ end=/\\\@<!\*\@<!\*\*\*\@!\($\|\A\)\@=/ contains=@Spell,htmlItalic
|
|
||||||
syn region htmlItalic start=/\\\@<!\(^\|\A\)\@=\*\@<!\*\*\@!/ end=/\\\@<!\*\@<!\*\*\@!\($\|\A\)\@=/ contains=htmlBold,@Spell
|
|
||||||
syn region htmlBold start=/\\\@<!\(^\|\A\)\@=_\@<!___\@!/ end=/\\\@<!_\@<!___\@!\($\|\A\)\@=/ contains=htmlItalic,@Spell
|
|
||||||
syn region htmlItalic start=/\\\@<!\(^\|\A\)\@=_\@<!__\@!/ end=/\\\@<!_\@<!__\@!\($\|\A\)\@=/ contains=htmlBold,@Spell
|
|
||||||
|
|
||||||
" [link](URL) | [link][id] | [link][]
|
|
||||||
syn region mkdLink matchgroup=mkdDelimiter start="\!\?\[" end="\]\ze\s*[[(]" contains=@Spell nextgroup=mkdURL,mkdID skipwhite oneline
|
|
||||||
syn region mkdID matchgroup=mkdDelimiter start="\[" end="\]" contained
|
|
||||||
syn region mkdURL matchgroup=mkdDelimiter start="(" end=")" contained
|
|
||||||
|
|
||||||
" Link definitions: [id]: URL (Optional Title)
|
|
||||||
" TODO handle automatic links without colliding with htmlTag (<URL>)
|
|
||||||
syn region mkdLinkDef matchgroup=mkdDelimiter start="^ \{,3}\zs\[" end="]:" oneline nextgroup=mkdLinkDefTarget skipwhite
|
|
||||||
syn region mkdLinkDefTarget start="<\?\zs\S" excludenl end="\ze[>[:space:]\n]" contained nextgroup=mkdLinkTitle,mkdLinkDef skipwhite skipnl oneline
|
|
||||||
syn region mkdLinkTitle matchgroup=mkdDelimiter start=+"+ end=+"+ contained
|
|
||||||
syn region mkdLinkTitle matchgroup=mkdDelimiter start=+'+ end=+'+ contained
|
|
||||||
syn region mkdLinkTitle matchgroup=mkdDelimiter start=+(+ end=+)+ contained
|
|
||||||
|
|
||||||
"define Markdown groups
|
|
||||||
syn match mkdLineContinue ".$" contained
|
|
||||||
syn match mkdRule /^\s*\*\s\{0,1}\*\s\{0,1}\*$/
|
|
||||||
syn match mkdRule /^\s*-\s\{0,1}-\s\{0,1}-$/
|
|
||||||
syn match mkdRule /^\s*_\s\{0,1}_\s\{0,1}_$/
|
|
||||||
syn match mkdRule /^\s*-\{3,}$/
|
|
||||||
syn match mkdRule /^\s*\*\{3,5}$/
|
|
||||||
syn match mkdListItem "^\s*[-*+]\s\+"
|
|
||||||
syn match mkdListItem "^\s*\d\+\.\s\+"
|
|
||||||
syn match mkdCode /^\s*\n\(\(\s\{4,}[^ ]\|\t\+[^\t]\).*\n\)\+/
|
|
||||||
syn match mkdLineBreak / \+$/
|
|
||||||
syn region mkdCode start=/\\\@<!`/ end=/\\\@<!`/
|
|
||||||
syn region mkdCode start=/\s*``[^`]*/ end=/[^`]*``\s*/
|
|
||||||
syn region mkdBlockquote start=/^\s*>/ end=/$/ contains=mkdLineBreak,mkdLineContinue,@Spell
|
|
||||||
syn region mkdCode start="<pre[^>]*>" end="</pre>"
|
|
||||||
syn region mkdCode start="<code[^>]*>" end="</code>"
|
|
||||||
|
|
||||||
"HTML headings
|
|
||||||
syn region htmlH1 start="^\s*#" end="\($\|#\+\)" contains=@Spell
|
|
||||||
syn region htmlH2 start="^\s*##" end="\($\|#\+\)" contains=@Spell
|
|
||||||
syn region htmlH3 start="^\s*###" end="\($\|#\+\)" contains=@Spell
|
|
||||||
syn region htmlH4 start="^\s*####" end="\($\|#\+\)" contains=@Spell
|
|
||||||
syn region htmlH5 start="^\s*#####" end="\($\|#\+\)" contains=@Spell
|
|
||||||
syn region htmlH6 start="^\s*######" end="\($\|#\+\)" contains=@Spell
|
|
||||||
syn match htmlH1 /^.\+\n=\+$/ contains=@Spell
|
|
||||||
syn match htmlH2 /^.\+\n-\+$/ contains=@Spell
|
|
||||||
|
|
||||||
"highlighting for Markdown groups
|
|
||||||
HtmlHiLink mkdString String
|
|
||||||
HtmlHiLink mkdCode String
|
|
||||||
HtmlHiLink mkdBlockquote Comment
|
|
||||||
HtmlHiLink mkdLineContinue Comment
|
|
||||||
HtmlHiLink mkdListItem Identifier
|
|
||||||
HtmlHiLink mkdRule Identifier
|
|
||||||
HtmlHiLink mkdLineBreak Todo
|
|
||||||
HtmlHiLink mkdLink htmlLink
|
|
||||||
HtmlHiLink mkdURL htmlString
|
|
||||||
HtmlHiLink mkdID Identifier
|
|
||||||
HtmlHiLink mkdLinkDef mkdID
|
|
||||||
HtmlHiLink mkdLinkDefTarget mkdURL
|
|
||||||
HtmlHiLink mkdLinkTitle htmlString
|
|
||||||
|
|
||||||
HtmlHiLink mkdDelimiter Delimiter
|
|
||||||
|
|
||||||
let b:current_syntax = "mkd"
|
|
||||||
|
|
||||||
delcommand HtmlHiLink
|
|
||||||
" vim: ts=8
|
|
||||||
Reference in New Issue
Block a user