mirror of
https://github.com/gryf/.vim.git
synced 2025-12-17 19:40:29 +01:00
Added pmx specific stuff
This commit is contained in:
4
.vimrc
4
.vimrc
@@ -424,5 +424,9 @@ if $TERM == 'linux' && !has('gui_running')
|
|||||||
" fallback to basic 8-color colorscheme
|
" fallback to basic 8-color colorscheme
|
||||||
colorscheme pablo
|
colorscheme pablo
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if has('win32') && $_PMX == '1'
|
||||||
|
source $VIM/vimfiles/pmxrc.vim
|
||||||
|
endif
|
||||||
"}}}
|
"}}}
|
||||||
" vim:ts=4:sw=4:wrap:fdm=marker:
|
" vim:ts=4:sw=4:wrap:fdm=marker:
|
||||||
|
|||||||
@@ -50,6 +50,24 @@ else
|
|||||||
let b:did_pylint_plugin = 1
|
let b:did_pylint_plugin = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if !exists('*s:CheckPylint')
|
||||||
|
function s:CheckPylint()
|
||||||
|
python << EOF
|
||||||
|
try:
|
||||||
|
import vim
|
||||||
|
from pylint import lint
|
||||||
|
from pylint.reporters.text import TextReporter
|
||||||
|
except ImportError:
|
||||||
|
vim.command("return 0")
|
||||||
|
vim.command("return 1")
|
||||||
|
EOF
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
|
if s:CheckPylint() == 0
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
if !exists("b:did_pylint_init")
|
if !exists("b:did_pylint_init")
|
||||||
let b:did_pylint_init = 0
|
let b:did_pylint_init = 0
|
||||||
|
|
||||||
@@ -59,16 +77,9 @@ if !exists("b:did_pylint_init")
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
python << EOF
|
python << EOF
|
||||||
import vim
|
|
||||||
import sys
|
import sys
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
|
|
||||||
try:
|
|
||||||
from pylint import lint
|
|
||||||
from pylint.reporters.text import TextReporter
|
|
||||||
except ImportError:
|
|
||||||
raise AssertionError('Pylint is required for this plugin')
|
|
||||||
|
|
||||||
class VImPylint(object):
|
class VImPylint(object):
|
||||||
|
|
||||||
sys_stderr = sys.stderr
|
sys_stderr = sys.stderr
|
||||||
|
|||||||
@@ -22,3 +22,7 @@ snippet ~
|
|||||||
|
|
||||||
snippet ...
|
snippet ...
|
||||||
…
|
…
|
||||||
|
snippet fn
|
||||||
|
`expand("%")`
|
||||||
|
snippet fp
|
||||||
|
`expand("%:p")`
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ snippet imp
|
|||||||
import ${1:module}
|
import ${1:module}
|
||||||
# Module Docstring
|
# Module Docstring
|
||||||
snippet docs
|
snippet docs
|
||||||
'''
|
"""
|
||||||
File: ${1:`Filename('$1.py', 'foo.py')`}
|
File: ${1:`Filename('$1.py', 'foo.py')`}
|
||||||
Author: ${2:`g:snips_author`}
|
Author: ${2:`g:snips_author`}
|
||||||
Description: ${3}
|
Description: ${3}
|
||||||
'''
|
"""
|
||||||
snippet wh
|
snippet wh
|
||||||
while ${1:condition}:
|
while ${1:condition}:
|
||||||
${2:# code...}
|
${2:# code...}
|
||||||
@@ -19,7 +19,9 @@ snippet for
|
|||||||
# New Class
|
# New Class
|
||||||
snippet cl
|
snippet cl
|
||||||
class ${1:ClassName}(${2:object}):
|
class ${1:ClassName}(${2:object}):
|
||||||
"""${3:docstring for $1}"""
|
"""
|
||||||
|
${3:docstring for $1}
|
||||||
|
"""
|
||||||
def __init__(self, ${4:arg}):
|
def __init__(self, ${4:arg}):
|
||||||
${5:super($1, self).__init__()}
|
${5:super($1, self).__init__()}
|
||||||
self.$4 = $4
|
self.$4 = $4
|
||||||
@@ -27,7 +29,9 @@ snippet cl
|
|||||||
# New Function
|
# New Function
|
||||||
snippet def
|
snippet def
|
||||||
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||||
"""${3:docstring for $1}"""
|
"""
|
||||||
|
${3:docstring for $1}
|
||||||
|
"""
|
||||||
${4:pass}
|
${4:pass}
|
||||||
snippet deff
|
snippet deff
|
||||||
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||||
@@ -106,9 +110,11 @@ snippet docmodule
|
|||||||
"""
|
"""
|
||||||
snippet debug
|
snippet debug
|
||||||
LOG.debug(self.${1:method_name}.__doc__.strip())
|
LOG.debug(self.${1:method_name}.__doc__.strip())
|
||||||
|
snippet pywin
|
||||||
|
import pywin.debugger; pywin.debugger.set_trace()
|
||||||
snippet edbg
|
snippet edbg
|
||||||
import sys
|
import sys
|
||||||
pydevdPath = r"/mnt/data/IDE/eclipse/plugins/org.python.pydev.debug_1.6.5.2011020317/pysrc"
|
pydevdPath = r"/home/share/data/IDE/eclipse/plugins/org.python.pydev.debug_1.6.5.2011020317/pysrc"
|
||||||
if not pydevdPath in sys.path:
|
if not pydevdPath in sys.path:
|
||||||
sys.path.append(pydevdPath)
|
sys.path.append(pydevdPath)
|
||||||
import pydevd
|
import pydevd
|
||||||
|
|||||||
12
bundle_pmx/compiler/autopylint.vim
Normal file
12
bundle_pmx/compiler/autopylint.vim
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
" Vim compiler file for Python
|
||||||
|
" Compiler: Static code checking tool for Python
|
||||||
|
" Maintainer: Roman 'gryf' Dobosz
|
||||||
|
" Last Change: 2010-09-12
|
||||||
|
" Version: 1.0
|
||||||
|
if exists("current_compiler")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let current_compiler = "autopylint"
|
||||||
|
CompilerSet makeprg=$VIM\\bin\\autopylint.py\ -p8\ %:p
|
||||||
|
CompilerSet efm=%f\|\ %t\|\ %l\|\ %c\|\ %m,%f\|\ %t\|\ %l\|\ %m
|
||||||
69
bundle_pmx/ftplugin/python/common.vim
Normal file
69
bundle_pmx/ftplugin/python/common.vim
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
setlocal cinkeys-=0#
|
||||||
|
setlocal indentkeys-=0#
|
||||||
|
setlocal expandtab
|
||||||
|
setlocal foldlevel=100
|
||||||
|
setlocal foldmethod=indent
|
||||||
|
setlocal list
|
||||||
|
setlocal noautoindent
|
||||||
|
setlocal smartindent
|
||||||
|
setlocal cinwords=if,elif,else,for,while,try,except,finally,def,class,with
|
||||||
|
setlocal smarttab
|
||||||
|
setlocal textwidth=78
|
||||||
|
setlocal colorcolumn=+1
|
||||||
|
" overwrite status line
|
||||||
|
setlocal statusline=%<%F\ %{TagInStatusLine()}\ %h%m%r%=%(%l,%c%V%)\ %3p%%
|
||||||
|
|
||||||
|
set wildignore+=*.pyc
|
||||||
|
|
||||||
|
inoremap # X<BS>#
|
||||||
|
|
||||||
|
"set ofu=syntaxcomplete#Complete
|
||||||
|
|
||||||
|
"autocmd FileType python setlocal omnifunc=pysmell#Complete
|
||||||
|
let python_highlight_all=1
|
||||||
|
|
||||||
|
"I don't want to have pyflakes errors in qfix, it interfering with Pep8/Pylint
|
||||||
|
let g:pyflakes_use_quickfix = 0
|
||||||
|
|
||||||
|
"Load views for py files
|
||||||
|
autocmd BufWinLeave *.py mkview
|
||||||
|
autocmd BufWinEnter *.py silent loadview
|
||||||
|
|
||||||
|
compiler autopylint
|
||||||
|
|
||||||
|
if !exists('*<SID>PyLintBuf')
|
||||||
|
function <SID>PyLintBuf(save_and_close)
|
||||||
|
echohl Statement
|
||||||
|
echo "Running pylint (ctrl-c to cancel) ..."
|
||||||
|
echohl Normal
|
||||||
|
let filename = expand('%:p')
|
||||||
|
let cmd = expand('$VIM') . '\bin\autopylint.py -8 "' . filename . '"'
|
||||||
|
|
||||||
|
if has('win32') || has('win64')
|
||||||
|
let cmd = 'cmd /c ' . cmd
|
||||||
|
endif
|
||||||
|
|
||||||
|
exec "bel silent new " . filename . ".lint"
|
||||||
|
exec "silent! read! " . cmd
|
||||||
|
if a:save_and_close != 0
|
||||||
|
exec "w!"
|
||||||
|
exec "bd"
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
command -bang -nargs=? PyLintBuf call <SID>PyLintBuf(<bang>0)
|
||||||
|
endif
|
||||||
|
map <F6> :PyLintBuf<cr>
|
||||||
|
|
||||||
|
finish "end here. all below is just for the record.
|
||||||
|
|
||||||
|
" Pylint function, which can be optionally mapped to some keys. Currently
|
||||||
|
" not used.
|
||||||
|
if !exists('*<SID>runPyLint')
|
||||||
|
function <SID>runPyLint()
|
||||||
|
echohl Statement
|
||||||
|
echo "Running pylint (ctrl-c to cancel) ..."
|
||||||
|
echohl Normal
|
||||||
|
:Pylint
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
55
bundle_pmx/ftplugin/python/pep8.vim
Normal file
55
bundle_pmx/ftplugin/python/pep8.vim
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
if exists("b:did_pdpep8_functions")
|
||||||
|
finish " only load once
|
||||||
|
else
|
||||||
|
let b:did_pdpep8_functions = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists('*s:pdPep8')
|
||||||
|
function s:pdPep8()
|
||||||
|
set lazyredraw
|
||||||
|
" Close any existing cwindows.
|
||||||
|
cclose
|
||||||
|
let l:grepformat_save = &grepformat
|
||||||
|
let l:grepprogram_save = &grepprg
|
||||||
|
set grepformat&vim
|
||||||
|
set grepformat&vim
|
||||||
|
let &grepformat = '%f:%l:%m'
|
||||||
|
let &grepprg = 'c:\\Python27\\Scripts\\pep8.exe --repeat --ignore=E111'
|
||||||
|
if &readonly == 0 | update | endif
|
||||||
|
silent! grep! %
|
||||||
|
let &grepformat = l:grepformat_save
|
||||||
|
let &grepprg = l:grepprogram_save
|
||||||
|
let l:mod_total = 0
|
||||||
|
let l:win_count = 1
|
||||||
|
" Determine correct window height
|
||||||
|
windo let l:win_count = l:win_count + 1
|
||||||
|
if l:win_count <= 2 | let l:win_count = 4 | endif
|
||||||
|
windo let l:mod_total = l:mod_total + winheight(0)/l:win_count |
|
||||||
|
\ execute 'resize +'.l:mod_total
|
||||||
|
" Open cwindow
|
||||||
|
execute 'belowright copen '.l:mod_total
|
||||||
|
nnoremap <buffer> <silent> c :cclose<CR>
|
||||||
|
set nolazyredraw
|
||||||
|
redraw!
|
||||||
|
endfunction
|
||||||
|
command! Pep8 call s:pdPep8()
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists('*s:pdPep8Buf')
|
||||||
|
function s:pdPep8Buf()
|
||||||
|
echohl Statement
|
||||||
|
echo "Running pep8 (ctrl-c to cancel) ..."
|
||||||
|
echohl Normal
|
||||||
|
let file = expand('%:p')
|
||||||
|
"let cmd = 'pylint --reports=n --output-format=text "' . file . '"'
|
||||||
|
let cmd = 'c:\\Python26\\Scripts\\pep8.exe "' . file . '"'
|
||||||
|
|
||||||
|
if has('win32') || has('win64')
|
||||||
|
let cmd = 'cmd /c "' . cmd . '"'
|
||||||
|
endif
|
||||||
|
|
||||||
|
exec "bel silent new " . file . ".lint"
|
||||||
|
exec "silent! read! " . cmd
|
||||||
|
endfunction
|
||||||
|
command! Pep8buf call s:pdPep8Buf()
|
||||||
|
endif
|
||||||
90
bundle_pmx/snippets/pmx.snippets
Normal file
90
bundle_pmx/snippets/pmx.snippets
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
|
||||||
|
snippet edbg
|
||||||
|
import sys
|
||||||
|
pydevdPath = r"c:\eclipse\plugins\org.python.pydev.debug_2.0.0.2011040403\pysrc"
|
||||||
|
if not pydevdPath in sys.path:
|
||||||
|
sys.path.append(pydevdPath)
|
||||||
|
import pydevd
|
||||||
|
pydevd.settrace()
|
||||||
|
snippet utimport
|
||||||
|
import pdunittest.common.pmxunittest as pmxunittest
|
||||||
|
|
||||||
|
snippet classt
|
||||||
|
class ${1:Foo}Tests(pmxunittest.TestCase):
|
||||||
|
"""
|
||||||
|
Tests for class $1 Tests
|
||||||
|
"""
|
||||||
|
def setUp(self):
|
||||||
|
"""
|
||||||
|
TODO: Setup test
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
"""
|
||||||
|
TODO: Cleanup test
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
def test_${2:method}(self):
|
||||||
|
"""
|
||||||
|
Test $2 method of class $1
|
||||||
|
"""
|
||||||
|
${3:pass}
|
||||||
|
snippet runt
|
||||||
|
def run():
|
||||||
|
"""
|
||||||
|
runs unit tests in "interactive" mode
|
||||||
|
"""
|
||||||
|
suite1 = pmxunittest.TestLoader().loadTestsFromTestCase(${1:ClassTests})
|
||||||
|
suite = pmxunittest.TestSuite([suite1])
|
||||||
|
ret = pmxunittest.TextTestRunner().run(suite)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
run()
|
||||||
|
|
||||||
|
# How to run manually:
|
||||||
|
#
|
||||||
|
# C:\> cd L:\runtime\pdpyapp
|
||||||
|
# C:\> L:
|
||||||
|
# L:\runtime\pdpyapp> startapp pdunittest\${2:`expand("%:t:r")`}
|
||||||
|
#
|
||||||
|
# Use parameters:
|
||||||
|
# -c (--changes) to check db changes after test run
|
||||||
|
# -c -r (--report) to gather detailed html report additionally
|
||||||
|
|
||||||
|
tested_modules = ['${3:module}'] # modules referenced by the test
|
||||||
|
automatic_run = ${4:True} # should it be run automatically?
|
||||||
|
execution_time = 0.000 # estimated time of test ru
|
||||||
|
snippet deft
|
||||||
|
def test_${1:fname}(self):
|
||||||
|
"""
|
||||||
|
Test for $1
|
||||||
|
"""
|
||||||
|
${2:pass}
|
||||||
|
snippet trace
|
||||||
|
import traceback
|
||||||
|
print "", 80*"-"
|
||||||
|
for _line in traceback.format_stack():
|
||||||
|
print _line.strip()
|
||||||
|
snippet pdlog
|
||||||
|
from PDLOG import PDLOG
|
||||||
|
PDLOG(${1:31337}, ${2:"msg"})
|
||||||
|
snippet head
|
||||||
|
"""
|
||||||
|
Project: 8202 / EBR
|
||||||
|
Description: ${2:description}
|
||||||
|
Created: ${3:00}.${4:2010}, ${5:author}
|
||||||
|
|
||||||
|
$RCSfile: ebrfoo.py,v $
|
||||||
|
$Source: /var/cvs/pmx/pylib/ebrfoo.py,v $
|
||||||
|
$Date: 2010/10/06 14:24:13 $
|
||||||
|
$Author: foo $
|
||||||
|
$Revision: 1.0 $
|
||||||
|
|
||||||
|
(c) Copyright ${6:2010} Rockwell Automation,
|
||||||
|
40-382 Katowice, Poland
|
||||||
|
"""
|
||||||
|
vcsid = "$Header: /var/cvs/pmx/pylib/ebrfoo.py,v 1.1 2009/10/06 14:24:13 foo Exp $"
|
||||||
|
${7}
|
||||||
88
bundle_pmx/snippets/spyce.snippets
Normal file
88
bundle_pmx/snippets/spyce.snippets
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
snippet #!
|
||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
snippet imp
|
||||||
|
import ${1:module}
|
||||||
|
# Module Docstring
|
||||||
|
snippet docs
|
||||||
|
'''
|
||||||
|
File: ${1:`Filename('$1.py', 'foo.py')`}
|
||||||
|
Author: ${2:`g:snips_author`}
|
||||||
|
Description: ${3}
|
||||||
|
'''
|
||||||
|
snippet wh
|
||||||
|
while ${1:condition}:
|
||||||
|
${2:# code...}
|
||||||
|
snippet for
|
||||||
|
for ${1:needle} in ${2:haystack}:
|
||||||
|
${3:# code...}
|
||||||
|
# New Class
|
||||||
|
snippet cl
|
||||||
|
class ${1:ClassName}(${2:object}):
|
||||||
|
"""${3:docstring for $1}"""
|
||||||
|
def __init__(self, ${4:arg}):
|
||||||
|
${5:super($1, self).__init__()}
|
||||||
|
self.$4 = $4
|
||||||
|
${6}
|
||||||
|
# New Function
|
||||||
|
snippet def
|
||||||
|
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||||
|
"""${3:docstring for $1}"""
|
||||||
|
${4:pass}
|
||||||
|
snippet deff
|
||||||
|
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||||
|
${3}
|
||||||
|
# New Method
|
||||||
|
snippet defs
|
||||||
|
def ${1:mname}(self, ${2:arg}):
|
||||||
|
${3:pass}
|
||||||
|
# New Property
|
||||||
|
snippet property
|
||||||
|
def ${1:foo}():
|
||||||
|
doc = "${2:The $1 property.}"
|
||||||
|
def fget(self):
|
||||||
|
${3:return self._$1}
|
||||||
|
def fset(self, value):
|
||||||
|
${4:self._$1 = value}
|
||||||
|
# Lambda
|
||||||
|
snippet ld
|
||||||
|
${1:var} = lambda ${2:vars} : ${3:action}
|
||||||
|
snippet .
|
||||||
|
self.
|
||||||
|
snippet try Try/Except
|
||||||
|
try:
|
||||||
|
${1:pass}
|
||||||
|
except ${2:Exception}, ${3:e}:
|
||||||
|
${4:raise $3}
|
||||||
|
snippet try Try/Except/Else
|
||||||
|
try:
|
||||||
|
${1:pass}
|
||||||
|
except ${2:Exception}, ${3:e}:
|
||||||
|
${4:raise $3}
|
||||||
|
else:
|
||||||
|
${5:pass}
|
||||||
|
snippet try Try/Except/Finally
|
||||||
|
try:
|
||||||
|
${1:pass}
|
||||||
|
except ${2:Exception}, ${3:e}:
|
||||||
|
${4:raise $3}
|
||||||
|
finally:
|
||||||
|
${5:pass}
|
||||||
|
snippet try Try/Except/Else/Finally
|
||||||
|
try:
|
||||||
|
${1:pass}
|
||||||
|
except ${2:Exception}, ${3:e}:
|
||||||
|
${4:raise $3}
|
||||||
|
else:
|
||||||
|
${5:pass}
|
||||||
|
finally:
|
||||||
|
${6:pass}
|
||||||
|
# if __name__ == '__main__':
|
||||||
|
snippet ifmain
|
||||||
|
if __name__ == '__main__':
|
||||||
|
${1:main()}
|
||||||
|
# __magic__
|
||||||
|
snippet _
|
||||||
|
__${1:init}__${2}
|
||||||
|
snippet dbg
|
||||||
|
import pywin.debugger; pywin.debugger.set_trace()
|
||||||
205
pmxrc.vim
Normal file
205
pmxrc.vim
Normal file
@@ -0,0 +1,205 @@
|
|||||||
|
set fileencoding=utf-8
|
||||||
|
set runtimepath+=$VIM/vimfiles/bundle_pmx
|
||||||
|
set viewoptions=cursor
|
||||||
|
"set guifont=Consolas:h10:cEASTEUROPE
|
||||||
|
set guifont=DejaVu_Sans_Mono:h9:cEASTEUROPE
|
||||||
|
set shiftwidth=2
|
||||||
|
set softtabstop=2
|
||||||
|
set tabstop=2
|
||||||
|
set listchars=tab:>-,trail:.
|
||||||
|
set guioptions=ceg
|
||||||
|
set mouse=a
|
||||||
|
set enc=utf-8
|
||||||
|
set printoptions=number:y
|
||||||
|
set pfn=Consolas:h10:cEASTEUROPE
|
||||||
|
|
||||||
|
let Tlist_Ctags_Cmd = expand('$VIM/bin/ctags.exe')
|
||||||
|
let g:tagbar_ctags_bin = expand('$VIM/bin/ctags.exe')
|
||||||
|
let g:browser = '"c:\Program Files\Mozilla Firefox\firefox.exe"'
|
||||||
|
|
||||||
|
autocmd BufWritePre *.spy :StripTrailingWhitespaces
|
||||||
|
autocmd BufWritePre *.spi :StripTrailingWhitespaces
|
||||||
|
autocmd BufWritePre *.opl :StripTrailingWhitespaces
|
||||||
|
autocmd BufRead *.opl set filetype=pd_opl
|
||||||
|
|
||||||
|
"CTRL-P
|
||||||
|
" Don't rely on VCS system, just do stuff relative to current dir. PMX sources
|
||||||
|
" are too huge
|
||||||
|
let g:ctrlp_working_path_mode = 0
|
||||||
|
|
||||||
|
"Grep
|
||||||
|
" Note: xargs from GnuWin32 package are unusable with this plugin - it refuses
|
||||||
|
" to pass find output to the grep. Fortunately, cygwin version (which is
|
||||||
|
" newer in fact) is working just fine. The only thing that is needed to
|
||||||
|
" set is to quote arguments passed to find:
|
||||||
|
let Grep_Shell_Quote_Char='"'
|
||||||
|
" If for some reason it is needed to use tools from GnuWin32 project, comment
|
||||||
|
" out following line:
|
||||||
|
let Grep_Cygwin_Find=1
|
||||||
|
" and uncomment one below:
|
||||||
|
"let Grep_Find_Use_Xargs=0
|
||||||
|
" Note: without xargs processing of the output will be much more slower than
|
||||||
|
" with it.
|
||||||
|
|
||||||
|
if has("gui_running")
|
||||||
|
highlight SpellBad term=underline gui=undercurl guisp=Orange
|
||||||
|
endif
|
||||||
|
|
||||||
|
"maximize window
|
||||||
|
au GUIEnter * simalt ~x
|
||||||
|
|
||||||
|
function GuiTabLabel()
|
||||||
|
" add the tab number
|
||||||
|
let label = '' "'['.tabpagenr()
|
||||||
|
|
||||||
|
" count number of open windows in the tab
|
||||||
|
"let wincount = tabpagewinnr(v:lnum, '$')
|
||||||
|
"if wincount > 1
|
||||||
|
" let label .= ', '.wincount
|
||||||
|
"endif
|
||||||
|
"let label .= '] '
|
||||||
|
|
||||||
|
let buflist = tabpagebuflist(v:lnum)
|
||||||
|
|
||||||
|
" add the file name without path information
|
||||||
|
let n = bufname(buflist[tabpagewinnr(v:lnum) - 1])
|
||||||
|
let label .= fnamemodify(n, ':t')
|
||||||
|
|
||||||
|
" modified since the last save?
|
||||||
|
for bufnr in buflist
|
||||||
|
if getbufvar(bufnr, '&modified')
|
||||||
|
let label .= ' *'
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return label
|
||||||
|
endfunction
|
||||||
|
set guitablabel=%{GuiTabLabel()}
|
||||||
|
|
||||||
|
"PMX: {{{
|
||||||
|
if exists("g:vim_bin_path")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let g:vim_bin_path = expand($VIM) . '/bin'
|
||||||
|
|
||||||
|
let $REF_DRIVE='R:'
|
||||||
|
let $LOCAL_DRIVE='L:'
|
||||||
|
let $PMXOS='WINNT'
|
||||||
|
let $PDMODE='RELEASE'
|
||||||
|
let $SOLUTION='mes'
|
||||||
|
let $OUIDICTPATH='../genR.WIN'
|
||||||
|
let $PATH='c:\Python23;' . $PATH
|
||||||
|
let $USE_HG_REPO='Y'
|
||||||
|
|
||||||
|
if !exists("g:pmx_path")
|
||||||
|
let g:pmx_path = "L:"
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !has("python")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Switch between HG and CVS in vcscommand plugin
|
||||||
|
function <SID>VCSSwitch()
|
||||||
|
echohl Statement
|
||||||
|
if exists("g:VCSTypeOverride")
|
||||||
|
if g:VCSTypeOverride == "HG"
|
||||||
|
let g:VCSTypeOverride = "CVS"
|
||||||
|
echo "Switched to CVS"
|
||||||
|
else
|
||||||
|
let g:VCSTypeOverride = "HG"
|
||||||
|
echo "Switched to HG"
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
let g:VCSTypeOverride = "HG"
|
||||||
|
echo "Switched to HG"
|
||||||
|
endif
|
||||||
|
echohl Normal
|
||||||
|
endfunction
|
||||||
|
map <F3> :call <SID>VCSSwitch()<cr>
|
||||||
|
|
||||||
|
|
||||||
|
" stupid hard-coded way to add paths to let VIm know where to look for the
|
||||||
|
" files, yet it is not perfect.
|
||||||
|
python << EOF
|
||||||
|
import os
|
||||||
|
import vim
|
||||||
|
|
||||||
|
pmx_path = vim.eval("g:pmx_path")
|
||||||
|
pmx_path = pmx_path.replace("\\", "/")
|
||||||
|
|
||||||
|
if not pmx_path.endswith("/"):
|
||||||
|
pmx_path += "/"
|
||||||
|
|
||||||
|
vim.command("set tags+=" + pmx_path + ".vim_cache/tags")
|
||||||
|
|
||||||
|
pyothers = ["runtime/System/BIN.Win/others/python/Lib/PIL",
|
||||||
|
"runtime/System/BIN.Win/others/python/Lib/coverage",
|
||||||
|
"runtime/System/BIN.Win/others/python/Lib/ctypes",
|
||||||
|
"runtime/System/BIN.Win/others/python/Lib/pyPdf"]
|
||||||
|
|
||||||
|
pyfiles = ["runtime/System/pylib",
|
||||||
|
"runtime/System/pylib/PythonWin",
|
||||||
|
"runtime/System/pylib/pdgui",
|
||||||
|
"runtime/System/pylib/pdoracle",
|
||||||
|
"runtime/System/pylib/pdpersis",
|
||||||
|
"runtime/System/pylib/pdunittest",
|
||||||
|
"runtime/System/pylib/pdtest",
|
||||||
|
"runtime/System/pylib/pdutil",
|
||||||
|
"runtime/System/pylib/spyce",
|
||||||
|
"runtime/System/pylib/std",
|
||||||
|
"runtime/System/pylib/std/lib-old",
|
||||||
|
"runtime/System/pylib/std/lib-tk",
|
||||||
|
"runtime/System/pylib/win32/lib"]
|
||||||
|
|
||||||
|
for i in pyfiles:
|
||||||
|
vim.command("set path+=" + pmx_path + i)
|
||||||
|
|
||||||
|
for i in pyothers:
|
||||||
|
vim.command("set path+=" + pmx_path + i)
|
||||||
|
|
||||||
|
def map_drive_L(path):
|
||||||
|
assert os.path.exists(path)
|
||||||
|
path = os.path.abspath(path)
|
||||||
|
if os.path.exists("L:"):
|
||||||
|
os.system("subst L: /D")
|
||||||
|
os.system("subst L: " + path)
|
||||||
|
|
||||||
|
def update_tags():
|
||||||
|
assert os.path.exists(pmx_path)
|
||||||
|
|
||||||
|
opl_cfg = os.path.normpath(os.path.join(vim.eval("$VIM"),
|
||||||
|
"bin",
|
||||||
|
"ctags_opl.cnf"))
|
||||||
|
opl_path = os.path.normpath(os.path.join(pmx_path, "opl"))
|
||||||
|
pylib_path = os.path.join(pmx_path, "runtime", "system", "pylib")
|
||||||
|
pylib_path = os.path.normpath(pylib_path)
|
||||||
|
pylib_path += " " + os.path.normpath(pmx_path + \
|
||||||
|
'runtime/System/BIN.Win/others/python/Lib')
|
||||||
|
|
||||||
|
tag_dir = os.path.join(pmx_path, ".vim_cache")
|
||||||
|
tag_path = os.path.normpath(os.path.join(tag_dir, "tags"))
|
||||||
|
|
||||||
|
if not os.path.exists(tag_dir):
|
||||||
|
os.mkdir(tag_dir)
|
||||||
|
|
||||||
|
# find tags for python files and tags for OPL files if exists
|
||||||
|
ctags = os.path.join(vim.eval("$VIM"), "bin", "ctags.exe")
|
||||||
|
ctags = os.path.normpath(ctags)
|
||||||
|
cmd = 'start cmd /c '
|
||||||
|
cmd += ctags + ' -R --python-kinds=-i'
|
||||||
|
if os.path.exists(opl_path) and os.path.exists(opl_cfg):
|
||||||
|
cmd += ' --options=' + opl_cfg
|
||||||
|
cmd += ' -f ' + tag_path + ' ' + pylib_path
|
||||||
|
if os.path.exists(opl_path) and os.path.exists(opl_cfg):
|
||||||
|
cmd += ' ' + opl_path
|
||||||
|
print cmd
|
||||||
|
os.system(cmd)
|
||||||
|
EOF
|
||||||
|
|
||||||
|
command -nargs=1 -complete=dir MapDriveL py map_drive_L(<f-args>)
|
||||||
|
command UpdateTags py update_tags()
|
||||||
|
"}}}
|
||||||
|
|
||||||
|
" vim:ts=4:sw=4:wrap:fdm=marker:
|
||||||
Reference in New Issue
Block a user