mirror of
https://github.com/gryf/.vim.git
synced 2025-12-17 11:30:29 +01:00
Modified wombat color theme (colors for column adn visual block)
Modified class for reST, added support for acronyms html Cosmetic changes on pylint python module Removed leftovers from nerd tree plugin
This commit is contained in:
3
.vimrc
3
.vimrc
@@ -72,7 +72,7 @@ set noswapfile
|
||||
:let html_ignore_folding = 1
|
||||
:let html_use_encoding = "utf-8"
|
||||
"}}}
|
||||
"COMMON: specific vim behaviour for Python files {{{
|
||||
"COMMON: specific vim behaviour {{{
|
||||
"
|
||||
"remove all trailing whitespace for specified files before write
|
||||
autocmd BufWritePre *.py :call <SID>StripTrailingWhitespaces()
|
||||
@@ -183,7 +183,6 @@ map <F11> :lprevious<CR>
|
||||
map <F12> :lnext<CR>
|
||||
map <S-F9> :QFix<CR>
|
||||
map <S-F11> :LWin<CR>
|
||||
map <S-F12> :call ToggleQFonValidate()<CR>
|
||||
|
||||
"remove trailing whitespaces
|
||||
map <C-e> :%s/\s\+$//<CR>
|
||||
|
||||
@@ -20,8 +20,11 @@ def parsable_pylint(filename):
|
||||
"""
|
||||
Simple wrapper for pylint checker. Provides nice, parseable output.
|
||||
filename - python fileneame to check
|
||||
returns list of dicts of errors, i.e.:
|
||||
[{'lnum': 5, 'col': 10, 'type': 'C0324', text: 'Comma not followed by a space'},
|
||||
|
||||
Returns list of dicts of errors, i.e.:
|
||||
[{'lnum': 5, 'col': 10, 'type': 'C0324',
|
||||
'text': 'Comma not followed by a space'},
|
||||
{'lnum': 12, 'type': 'C0111', 'text': 'Missing docstring'},
|
||||
....
|
||||
]
|
||||
|
||||
@@ -38,6 +41,7 @@ def parsable_pylint(filename):
|
||||
lint.Run(args, reporter=reporter, exit=False)
|
||||
sys.stderr = SYS_STDERR
|
||||
|
||||
# see, if we have other errors than 'No config found...' message
|
||||
DUMMY_STDERR.seek(0)
|
||||
error_list = DUMMY_STDERR.readlines()
|
||||
DUMMY_STDERR.truncate(0)
|
||||
@@ -77,9 +81,8 @@ if __name__ == "__main__":
|
||||
for line in parsable_pylint(args[0]):
|
||||
line['short'] = line['type'][0]
|
||||
line['fname'] = args[0]
|
||||
if 'col' in line:
|
||||
out = "%(fname)s: %(short)s: %(lnum)s: %(col)s: %(type)s %(text)s"
|
||||
else:
|
||||
if 'col' not in line:
|
||||
out = "%(fname)s: %(short)s: %(lnum)s: 0: %(type)s %(text)s"
|
||||
|
||||
print out % line
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
" Vim color file
|
||||
" Maintainer: David Liang (bmdavll at gmail dot com)
|
||||
" Last Change: November 28 2008
|
||||
" Last Change: 2010-09-13
|
||||
"
|
||||
" wombat256.vim - a modified version of Wombat by Lars Nielsen that also
|
||||
" works on xterms with 88 or 256 colors. The algorithm for approximating the
|
||||
@@ -15,7 +15,7 @@ if version > 580
|
||||
endif
|
||||
endif
|
||||
|
||||
let g:colors_name = "wombat256"
|
||||
let g:colors_name = "wombat256grf"
|
||||
|
||||
if !has("gui_running") && &t_Co != 88 && &t_Co != 256
|
||||
finish
|
||||
@@ -251,10 +251,10 @@ call <SID>X("CursorColumn", "", "2d2d2d", "")
|
||||
"CursorIM
|
||||
"Question
|
||||
"IncSearch
|
||||
call <SID>X("Search", "444444", "af87d7", "")
|
||||
call <SID>X("Search", "444444", "ffab4b", "")
|
||||
call <SID>X("MatchParen", "ecee90", "857b6f", "bold")
|
||||
call <SID>X("SpecialKey", "6c6c6c", "2d2d2d", "none")
|
||||
call <SID>X("Visual", "ecee90", "597418", "none")
|
||||
call <SID>X("Visual", "", "26512D", "none")
|
||||
call <SID>X("LineNr", "857b6f", "121212", "none")
|
||||
call <SID>X("SignColumn", "", "121212", "none")
|
||||
call <SID>X("Folded", "a0a8b0", "404048", "none")
|
||||
@@ -337,7 +337,7 @@ call <SID>X("DiffChange", "", "424242", "bold")
|
||||
" DiffText xxx term=reverse cterm=bold ctermbg=9
|
||||
|
||||
" VIm 7.3 features
|
||||
call <SID>X("ColorColumn", "", "121212", "")
|
||||
call <SID>X("ColorColumn", "", "32322e", "")
|
||||
|
||||
if ! has('gui_running')
|
||||
" spell, make it underline, and less bright colors. only for terminal
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
" Author: Roman 'gryf' Dobosz (gryf73 at gmail.com)
|
||||
" Version: 1.0
|
||||
" Last Modified: 2010-09-12
|
||||
" Description: {{{
|
||||
"
|
||||
" Overview
|
||||
" --------
|
||||
@@ -42,6 +43,8 @@
|
||||
" [2] http://pypi.python.org/pypi/pep8
|
||||
" [3] http://www.vim.org/scripts/script.php?script_id=2441
|
||||
" [4] http://pypi.python.org/pypi/setuptools
|
||||
"
|
||||
" }}}
|
||||
|
||||
if exists("b:did_pep8_plugin")
|
||||
finish " only load once
|
||||
@@ -53,7 +56,7 @@ if !exists("b:did_pep8_init")
|
||||
let b:did_pep8_init = 0
|
||||
|
||||
if !has('python')
|
||||
echoerr "Error: the pep8_fn.vim plugin requires Vim to be compiled with +python"
|
||||
echoerr "pep8_fn.vim plugin requires Vim to be compiled with +python"
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
" File: pythonlint.vim
|
||||
" File: pylint_fn.vim
|
||||
" Author: Roman 'gryf' Dobosz (gryf73 at gmail.com)
|
||||
" Version: 1.0
|
||||
" Last Modified: 2010-09-11
|
||||
"
|
||||
" Description: " {{{
|
||||
"
|
||||
" Overview
|
||||
" --------
|
||||
" This plugin provides ":Pylint" command, which put pylint result into quickfix
|
||||
@@ -18,7 +20,7 @@
|
||||
"
|
||||
" Installation
|
||||
" ------------
|
||||
" 1. Copy the pythonlint.vim file to the $HOME/.vim/ftplugin/python or
|
||||
" 1. Copy the pylint_fn.vim file to the $HOME/.vim/ftplugin/python or
|
||||
" $HOME/vimfiles/ftplugin/python or $VIM/vimfiles/ftplugin/python
|
||||
" directory. If python directory doesn't exists, it should be created.
|
||||
" Refer to the following Vim help topics for more information about Vim
|
||||
@@ -40,6 +42,7 @@
|
||||
" [1] http://www.logilab.org/project/pylint
|
||||
" [2] http://www.vim.org/scripts/script.php?script_id=2441
|
||||
" [3] http://pypi.python.org/pypi/setuptools
|
||||
" }}}
|
||||
|
||||
if exists("b:did_pylint_plugin")
|
||||
finish " only load once
|
||||
@@ -51,7 +54,7 @@ if !exists("b:did_pylint_init")
|
||||
let b:did_pylint_init = 0
|
||||
|
||||
if !has('python')
|
||||
echoerr "Error: the pythonlint.vim plugin requires Vim to be compiled with +python"
|
||||
echoerr "Error: pylint_fn.vim requires Vim to be compiled with +python"
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
@@ -12,10 +12,15 @@ map <F5> :call <SID>Rst2Blogger()<cr>
|
||||
" suitable to copy and paste into blogger post.
|
||||
fun <SID>Rst2Blogger()
|
||||
python << EOF
|
||||
import re
|
||||
|
||||
from docutils import core
|
||||
from docutils import nodes
|
||||
from docutils.writers.html4css1 import Writer, HTMLTranslator
|
||||
|
||||
import vim
|
||||
|
||||
|
||||
class NoHeaderHTMLTranslator(HTMLTranslator):
|
||||
def __init__(self, document):
|
||||
HTMLTranslator.__init__(self,document)
|
||||
@@ -41,6 +46,21 @@ class NoHeaderHTMLTranslator(HTMLTranslator):
|
||||
def depart_section(self, node):
|
||||
pass
|
||||
|
||||
def visit_acronym(self, node):
|
||||
node_text = node.children[0].astext()
|
||||
node_text = node_text.replace('\n', ' ')
|
||||
patt = re.compile(r'^(.+)\s<(.+)>')
|
||||
|
||||
if patt.match(node_text):
|
||||
node.children[0] = nodes.Text(patt.match(node_text).groups()[0])
|
||||
self.body.append(\
|
||||
self.starttag(node, 'acronym',
|
||||
'', title=patt.match(node_text).groups()[1]))
|
||||
|
||||
else:
|
||||
self.body.append(self.starttag(node, 'acronym', ''))
|
||||
|
||||
|
||||
_w = Writer()
|
||||
_w.translator_class = NoHeaderHTMLTranslator
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
" ============================================================================
|
||||
" File: exec_menuitem.vim
|
||||
" Description: plugin for NERD Tree that provides an execute file menu item
|
||||
" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
" Last Change: 22 July, 2009
|
||||
" License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
" ============================================================================
|
||||
if exists("g:loaded_nerdtree_exec_menuitem")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_nerdtree_exec_menuitem = 1
|
||||
|
||||
call NERDTreeAddMenuItem({
|
||||
\ 'text': '(!)Execute file',
|
||||
\ 'shortcut': '!',
|
||||
\ 'callback': 'NERDTreeExecFile',
|
||||
\ 'isActiveCallback': 'NERDTreeExecFileActive' })
|
||||
|
||||
function! NERDTreeExecFileActive()
|
||||
let node = g:NERDTreeFileNode.GetSelected()
|
||||
return !node.path.isDirectory && node.path.isExecutable
|
||||
endfunction
|
||||
|
||||
function! NERDTreeExecFile()
|
||||
let treenode = g:NERDTreeFileNode.GetSelected()
|
||||
echo "==========================================================\n"
|
||||
echo "Complete the command to execute (add arguments etc):\n"
|
||||
let cmd = treenode.path.str({'escape': 1})
|
||||
let cmd = input(':!', cmd . ' ')
|
||||
|
||||
if cmd != ''
|
||||
exec ':!' . cmd
|
||||
else
|
||||
echo "Aborted"
|
||||
endif
|
||||
endfunction
|
||||
@@ -1,194 +0,0 @@
|
||||
" ============================================================================
|
||||
" File: fs_menu.vim
|
||||
" Description: plugin for the NERD Tree that provides a file system menu
|
||||
" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
" Last Change: 17 July, 2009
|
||||
" License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
" ============================================================================
|
||||
if exists("g:loaded_nerdtree_fs_menu")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_nerdtree_fs_menu = 1
|
||||
|
||||
call NERDTreeAddMenuItem({'text': '(a)dd a childnode', 'shortcut': 'a', 'callback': 'NERDTreeAddNode'})
|
||||
call NERDTreeAddMenuItem({'text': '(m)ove the curent node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'})
|
||||
call NERDTreeAddMenuItem({'text': '(d)elete the curent node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'})
|
||||
if g:NERDTreePath.CopyingSupported()
|
||||
call NERDTreeAddMenuItem({'text': '(c)copy the current node', 'shortcut': 'c', 'callback': 'NERDTreeCopyNode'})
|
||||
endif
|
||||
|
||||
"FUNCTION: s:echo(msg){{{1
|
||||
function! s:echo(msg)
|
||||
redraw
|
||||
echomsg "NERDTree: " . a:msg
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:echoWarning(msg){{{1
|
||||
function! s:echoWarning(msg)
|
||||
echohl warningmsg
|
||||
call s:echo(a:msg)
|
||||
echohl normal
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:promptToDelBuffer(bufnum, msg){{{1
|
||||
"prints out the given msg and, if the user responds by pushing 'y' then the
|
||||
"buffer with the given bufnum is deleted
|
||||
"
|
||||
"Args:
|
||||
"bufnum: the buffer that may be deleted
|
||||
"msg: a message that will be echoed to the user asking them if they wish to
|
||||
" del the buffer
|
||||
function! s:promptToDelBuffer(bufnum, msg)
|
||||
echo a:msg
|
||||
if nr2char(getchar()) ==# 'y'
|
||||
exec "silent bdelete! " . a:bufnum
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: NERDTreeAddNode(){{{1
|
||||
function! NERDTreeAddNode()
|
||||
let curDirNode = g:NERDTreeDirNode.GetSelected()
|
||||
|
||||
let newNodeName = input("Add a childnode\n".
|
||||
\ "==========================================================\n".
|
||||
\ "Enter the dir/file name to be created. Dirs end with a '/'\n" .
|
||||
\ "", curDirNode.path.str({'format': 'Glob'}) . g:NERDTreePath.Slash())
|
||||
|
||||
if newNodeName ==# ''
|
||||
call s:echo("Node Creation Aborted.")
|
||||
return
|
||||
endif
|
||||
|
||||
try
|
||||
let newPath = g:NERDTreePath.Create(newNodeName)
|
||||
let parentNode = b:NERDTreeRoot.findNode(newPath.getParent())
|
||||
|
||||
let newTreeNode = g:NERDTreeFileNode.New(newPath)
|
||||
if parentNode.isOpen || !empty(parentNode.children)
|
||||
call parentNode.addChild(newTreeNode, 1)
|
||||
call NERDTreeRender()
|
||||
call newTreeNode.putCursorHere(1, 0)
|
||||
endif
|
||||
catch /^NERDTree/
|
||||
call s:echoWarning("Node Not Created.")
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
"FUNCTION: NERDTreeMoveNode(){{{1
|
||||
function! NERDTreeMoveNode()
|
||||
let curNode = g:NERDTreeFileNode.GetSelected()
|
||||
let newNodePath = input("Rename the current node\n" .
|
||||
\ "==========================================================\n" .
|
||||
\ "Enter the new path for the node: \n" .
|
||||
\ "", curNode.path.str())
|
||||
|
||||
if newNodePath ==# ''
|
||||
call s:echo("Node Renaming Aborted.")
|
||||
return
|
||||
endif
|
||||
|
||||
try
|
||||
let bufnum = bufnr(curNode.path.str())
|
||||
|
||||
call curNode.rename(newNodePath)
|
||||
call NERDTreeRender()
|
||||
|
||||
"if the node is open in a buffer, ask the user if they want to
|
||||
"close that buffer
|
||||
if bufnum != -1
|
||||
let prompt = "\nNode renamed.\n\nThe old file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)"
|
||||
call s:promptToDelBuffer(bufnum, prompt)
|
||||
endif
|
||||
|
||||
call curNode.putCursorHere(1, 0)
|
||||
|
||||
redraw
|
||||
catch /^NERDTree/
|
||||
call s:echoWarning("Node Not Renamed.")
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" FUNCTION: NERDTreeDeleteNode() {{{1
|
||||
function! NERDTreeDeleteNode()
|
||||
let currentNode = g:NERDTreeFileNode.GetSelected()
|
||||
let confirmed = 0
|
||||
|
||||
if currentNode.path.isDirectory
|
||||
let choice =input("Delete the current node\n" .
|
||||
\ "==========================================================\n" .
|
||||
\ "STOP! To delete this entire directory, type 'yes'\n" .
|
||||
\ "" . currentNode.path.str() . ": ")
|
||||
let confirmed = choice ==# 'yes'
|
||||
else
|
||||
echo "Delete the current node\n" .
|
||||
\ "==========================================================\n".
|
||||
\ "Are you sure you wish to delete the node:\n" .
|
||||
\ "" . currentNode.path.str() . " (yN):"
|
||||
let choice = nr2char(getchar())
|
||||
let confirmed = choice ==# 'y'
|
||||
endif
|
||||
|
||||
|
||||
if confirmed
|
||||
try
|
||||
call currentNode.delete()
|
||||
call NERDTreeRender()
|
||||
|
||||
"if the node is open in a buffer, ask the user if they want to
|
||||
"close that buffer
|
||||
let bufnum = bufnr(currentNode.path.str())
|
||||
if buflisted(bufnum)
|
||||
let prompt = "\nNode deleted.\n\nThe file is open in buffer ". bufnum . (bufwinnr(bufnum) ==# -1 ? " (hidden)" : "") .". Delete this buffer? (yN)"
|
||||
call s:promptToDelBuffer(bufnum, prompt)
|
||||
endif
|
||||
|
||||
redraw
|
||||
catch /^NERDTree/
|
||||
call s:echoWarning("Could not remove node")
|
||||
endtry
|
||||
else
|
||||
call s:echo("delete aborted")
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
" FUNCTION: NERDTreeCopyNode() {{{1
|
||||
function! NERDTreeCopyNode()
|
||||
let currentNode = g:NERDTreeFileNode.GetSelected()
|
||||
let newNodePath = input("Copy the current node\n" .
|
||||
\ "==========================================================\n" .
|
||||
\ "Enter the new path to copy the node to: \n" .
|
||||
\ "", currentNode.path.str())
|
||||
|
||||
if newNodePath != ""
|
||||
"strip trailing slash
|
||||
let newNodePath = substitute(newNodePath, '\/$', '', '')
|
||||
|
||||
let confirmed = 1
|
||||
if currentNode.path.copyingWillOverwrite(newNodePath)
|
||||
call s:echo("Warning: copying may overwrite files! Continue? (yN)")
|
||||
let choice = nr2char(getchar())
|
||||
let confirmed = choice ==# 'y'
|
||||
endif
|
||||
|
||||
if confirmed
|
||||
try
|
||||
let newNode = currentNode.copy(newNodePath)
|
||||
call NERDTreeRender()
|
||||
call newNode.putCursorHere(0, 0)
|
||||
catch /^NERDTree/
|
||||
call s:echoWarning("Could not copy node")
|
||||
endtry
|
||||
endif
|
||||
else
|
||||
call s:echo("Copy aborted.")
|
||||
endif
|
||||
redraw
|
||||
endfunction
|
||||
|
||||
" vim: set sw=4 sts=4 et fdm=marker:
|
||||
Reference in New Issue
Block a user