mirror of
https://github.com/tomru/DotfilesOld.git
synced 2026-03-03 06:27:21 +01:00
initial commit
This commit is contained in:
86
create_symlinks.py
Executable file
86
create_symlinks.py
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import logging
|
||||
|
||||
|
||||
logging.basicConfig(level=logging.WARN)
|
||||
|
||||
home = os.path.abspath(os.environ['HOME'])
|
||||
path = os.path.join(home, '.dotfiles')
|
||||
excludes = ['create_symlinks.py', 'delete_symlinks.py']
|
||||
|
||||
"""
|
||||
Recursivly create symbolic links for all files found beneath src_path to
|
||||
dst_path. The directory structure will be created as needed.
|
||||
|
||||
"""
|
||||
def symlink_rec(src_path, dst_path):
|
||||
logging.debug("symlink_rec called with %s and %s" %
|
||||
(src_path, dst_path))
|
||||
if not os.path.isdir(src_path):
|
||||
raise Exception
|
||||
for f in os.listdir(src_path):
|
||||
if f.startswith('.'):
|
||||
continue
|
||||
if f not in excludes:
|
||||
n_src_path = os.path.join(src_path, f)
|
||||
if os.path.isdir(n_src_path):
|
||||
logging.debug("Go down into %s" % (n_src_path))
|
||||
n_dst_path = os.path.join(dst_path, f)
|
||||
if not os.path.exists(n_dst_path):
|
||||
try:
|
||||
logging.warn("Make directory %s" % (n_dst_path))
|
||||
os.mkdir(n_dst_path)
|
||||
except Exception, msg:
|
||||
logging.error("Failed creating directory %s" %
|
||||
(n_dst_path))
|
||||
logging.error(msg)
|
||||
return # abort or lower levels might fail too
|
||||
symlink_rec(n_src_path, n_dst_path)
|
||||
logging.debug("Finished directory %s" % (n_src_path))
|
||||
elif os.path.isfile(n_src_path):
|
||||
n_dst_path = os.path.join(dst_path, f)
|
||||
try:
|
||||
logging.warn("Symlinking %s to %s" %
|
||||
(n_src_path, n_dst_path))
|
||||
os.symlink(n_src_path, n_dst_path)
|
||||
except Exception, msg:
|
||||
logging.error("Failed to symlink %s to %s " %
|
||||
(n_src_path, n_dst_path))
|
||||
logging.error(msg)
|
||||
|
||||
|
||||
"""
|
||||
Create symbolic links from files in <path> to <home> with '.'-prefixed.
|
||||
For directories in <path> will be '.'-prefixed created in <home> if
|
||||
needed and symlink_rec is called on them.
|
||||
|
||||
"""
|
||||
for f in os.listdir(path):
|
||||
print f
|
||||
if f.startswith('.'):
|
||||
continue
|
||||
if f not in excludes:
|
||||
src_path = os.path.join(path, f)
|
||||
if os.path.isdir(src_path):
|
||||
logging.debug("Go down into %s" % (src_path))
|
||||
dst_path = os.path.join(home, '.' + f)
|
||||
if not os.path.exists(dst_path):
|
||||
try:
|
||||
logging.warn("Make directory %s" % (dst_path))
|
||||
os.mkdir(dst_path)
|
||||
except Exception, msg:
|
||||
logging.error("Failed creating directory %s" %
|
||||
(dst_path))
|
||||
logging.error(msg)
|
||||
symlink_rec(src_path, dst_path)
|
||||
logging.debug("Finished directory %s" % (src_path))
|
||||
elif os.path.isfile(src_path):
|
||||
dst_path = os.path.join(home, '.' + f)
|
||||
try:
|
||||
logging.warn("Symlinking %s to %s" % (src_path, dst_path))
|
||||
os.symlink(src_path, dst_path)
|
||||
except Exception, msg:
|
||||
logging.error("Failed to symlink %s to %s " %
|
||||
(src_path, dst_path))
|
||||
logging.error(msg)
|
||||
85
delete_symlinks.py
Executable file
85
delete_symlinks.py
Executable file
@@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import logging
|
||||
|
||||
|
||||
logging.basicConfig(level=logging.WARN)
|
||||
|
||||
home = os.path.abspath(os.environ['HOME'])
|
||||
path = os.path.join(home, '.dotfiles')
|
||||
excludes = ['create_symlinks.py', 'delete_symlinks.py']
|
||||
|
||||
"""
|
||||
Recursivly delte symbolic links for all files found beneath src_path to
|
||||
dst_path.
|
||||
|
||||
"""
|
||||
def symlink_rec(src_path, dst_path):
|
||||
logging.debug("symlink_rec called with %s and %s" %
|
||||
(src_path, dst_path))
|
||||
if not os.path.isdir(src_path):
|
||||
raise Exception
|
||||
for f in os.listdir(src_path):
|
||||
if f.startswith('.'):
|
||||
continue
|
||||
if f not in excludes:
|
||||
n_src_path = os.path.join(src_path, f)
|
||||
if os.path.isdir(n_src_path):
|
||||
n_dst_path = os.path.join(dst_path, f)
|
||||
if not os.path.exists(n_dst_path):
|
||||
#nothing to do here
|
||||
continue
|
||||
logging.debug("Go down into %s" % (n_src_path))
|
||||
symlink_rec(n_src_path, n_dst_path)
|
||||
logging.debug("Finished directory %s" % (n_src_path))
|
||||
elif os.path.isfile(n_src_path):
|
||||
n_dst_path = os.path.join(dst_path, f)
|
||||
try:
|
||||
if not os.path.islink(n_dst_path):
|
||||
loggin.warn("Won't delete %s, not a symbolic link"
|
||||
% n_dst_path)
|
||||
continue
|
||||
logging.warn("Removing symbolic link %s" %
|
||||
(n_dst_path))
|
||||
os.remove(n_dst_path)
|
||||
except Exception, msg:
|
||||
logging.error("Failed to delete symlink %s" %
|
||||
(n_dst_path))
|
||||
logging.error(msg)
|
||||
|
||||
|
||||
"""
|
||||
Remove symbolic links from files in <path> to <home> with '.'-prefixed.
|
||||
For directories in <path> the '.'-prefixed name will be searched in
|
||||
<home> for further symbolic links to delete.
|
||||
|
||||
"""
|
||||
|
||||
print "Do you really want to delete all symbolic links in %s to the files in %s ? (YES,No)" % (home, path)
|
||||
|
||||
for f in os.listdir(path):
|
||||
print f
|
||||
if f.startswith('.'):
|
||||
continue
|
||||
if f not in excludes:
|
||||
src_path = os.path.join(path, f)
|
||||
if os.path.isdir(src_path):
|
||||
logging.debug("Go down into %s" % (src_path))
|
||||
dst_path = os.path.join(home, '.' + f)
|
||||
if not os.path.exists(dst_path):
|
||||
#nothing to delete in here
|
||||
continue
|
||||
symlink_rec(src_path, dst_path)
|
||||
logging.debug("Finished directory %s" % (src_path))
|
||||
elif os.path.isfile(src_path):
|
||||
dst_path = os.path.join(home, '.' + f)
|
||||
if not os.path.islink(dst_path):
|
||||
logging.warn("Won't remove %s. Is not a symbolic link")
|
||||
continue
|
||||
try:
|
||||
logging.warn("Remove %s" % (dst_path))
|
||||
os.remove(dst_path)
|
||||
except Exception, msg:
|
||||
logging.error("Failed to remove %s to %s " %
|
||||
(src_path, dst_path))
|
||||
logging.error(msg)
|
||||
8
gitconfig
Normal file
8
gitconfig
Normal file
@@ -0,0 +1,8 @@
|
||||
[user]
|
||||
name = Thomas Ruoff
|
||||
email = ThomasRuoff@gmail.com
|
||||
[color]
|
||||
branch = auto
|
||||
diff = auto
|
||||
interactive = auto
|
||||
status = auto
|
||||
1227
vim/doc/NERD_tree.txt
Normal file
1227
vim/doc/NERD_tree.txt
Normal file
File diff suppressed because it is too large
Load Diff
160
vim/doc/tags
Normal file
160
vim/doc/tags
Normal file
@@ -0,0 +1,160 @@
|
||||
'Tlist_Auto_Highlight_Tag' taglist.txt /*'Tlist_Auto_Highlight_Tag'*
|
||||
'Tlist_Auto_Open' taglist.txt /*'Tlist_Auto_Open'*
|
||||
'Tlist_Auto_Update' taglist.txt /*'Tlist_Auto_Update'*
|
||||
'Tlist_Close_On_Select' taglist.txt /*'Tlist_Close_On_Select'*
|
||||
'Tlist_Compact_Format' taglist.txt /*'Tlist_Compact_Format'*
|
||||
'Tlist_Ctags_Cmd' taglist.txt /*'Tlist_Ctags_Cmd'*
|
||||
'Tlist_Display_Prototype' taglist.txt /*'Tlist_Display_Prototype'*
|
||||
'Tlist_Display_Tag_Scope' taglist.txt /*'Tlist_Display_Tag_Scope'*
|
||||
'Tlist_Enable_Fold_Column' taglist.txt /*'Tlist_Enable_Fold_Column'*
|
||||
'Tlist_Exit_OnlyWindow' taglist.txt /*'Tlist_Exit_OnlyWindow'*
|
||||
'Tlist_File_Fold_Auto_Close' taglist.txt /*'Tlist_File_Fold_Auto_Close'*
|
||||
'Tlist_GainFocus_On_ToggleOpen' taglist.txt /*'Tlist_GainFocus_On_ToggleOpen'*
|
||||
'Tlist_Highlight_Tag_On_BufEnter' taglist.txt /*'Tlist_Highlight_Tag_On_BufEnter'*
|
||||
'Tlist_Inc_Winwidth' taglist.txt /*'Tlist_Inc_Winwidth'*
|
||||
'Tlist_Max_Submenu_Items' taglist.txt /*'Tlist_Max_Submenu_Items'*
|
||||
'Tlist_Max_Tag_Length' taglist.txt /*'Tlist_Max_Tag_Length'*
|
||||
'Tlist_Process_File_Always' taglist.txt /*'Tlist_Process_File_Always'*
|
||||
'Tlist_Show_Menu' taglist.txt /*'Tlist_Show_Menu'*
|
||||
'Tlist_Show_One_File' taglist.txt /*'Tlist_Show_One_File'*
|
||||
'Tlist_Sort_Type' taglist.txt /*'Tlist_Sort_Type'*
|
||||
'Tlist_Use_Horiz_Window' taglist.txt /*'Tlist_Use_Horiz_Window'*
|
||||
'Tlist_Use_Right_Window' taglist.txt /*'Tlist_Use_Right_Window'*
|
||||
'Tlist_Use_SingleClick' taglist.txt /*'Tlist_Use_SingleClick'*
|
||||
'Tlist_WinHeight' taglist.txt /*'Tlist_WinHeight'*
|
||||
'Tlist_WinWidth' taglist.txt /*'Tlist_WinWidth'*
|
||||
:NERDTree NERD_tree.txt /*:NERDTree*
|
||||
:NERDTreeFromBookmark NERD_tree.txt /*:NERDTreeFromBookmark*
|
||||
:NERDTreeToggle NERD_tree.txt /*:NERDTreeToggle*
|
||||
:Snippet snippets_emu.txt /*:Snippet*
|
||||
:TlistAddFiles taglist.txt /*:TlistAddFiles*
|
||||
:TlistAddFilesRecursive taglist.txt /*:TlistAddFilesRecursive*
|
||||
:TlistClose taglist.txt /*:TlistClose*
|
||||
:TlistDebug taglist.txt /*:TlistDebug*
|
||||
:TlistHighlightTag taglist.txt /*:TlistHighlightTag*
|
||||
:TlistLock taglist.txt /*:TlistLock*
|
||||
:TlistMessages taglist.txt /*:TlistMessages*
|
||||
:TlistOpen taglist.txt /*:TlistOpen*
|
||||
:TlistSessionLoad taglist.txt /*:TlistSessionLoad*
|
||||
:TlistSessionSave taglist.txt /*:TlistSessionSave*
|
||||
:TlistShowPrototype taglist.txt /*:TlistShowPrototype*
|
||||
:TlistShowTag taglist.txt /*:TlistShowTag*
|
||||
:TlistToggle taglist.txt /*:TlistToggle*
|
||||
:TlistUndebug taglist.txt /*:TlistUndebug*
|
||||
:TlistUnlock taglist.txt /*:TlistUnlock*
|
||||
:TlistUpdate taglist.txt /*:TlistUpdate*
|
||||
CreateBundleSnippet snippets_emu.txt /*CreateBundleSnippet*
|
||||
CreateSnippet snippets_emu.txt /*CreateSnippet*
|
||||
NERDChristmasTree NERD_tree.txt /*NERDChristmasTree*
|
||||
NERDTree NERD_tree.txt /*NERDTree*
|
||||
NERDTree-! NERD_tree.txt /*NERDTree-!*
|
||||
NERDTree-? NERD_tree.txt /*NERDTree-?*
|
||||
NERDTree-B NERD_tree.txt /*NERDTree-B*
|
||||
NERDTree-C NERD_tree.txt /*NERDTree-C*
|
||||
NERDTree-D NERD_tree.txt /*NERDTree-D*
|
||||
NERDTree-F NERD_tree.txt /*NERDTree-F*
|
||||
NERDTree-H NERD_tree.txt /*NERDTree-H*
|
||||
NERDTree-J NERD_tree.txt /*NERDTree-J*
|
||||
NERDTree-K NERD_tree.txt /*NERDTree-K*
|
||||
NERDTree-O NERD_tree.txt /*NERDTree-O*
|
||||
NERDTree-P NERD_tree.txt /*NERDTree-P*
|
||||
NERDTree-R NERD_tree.txt /*NERDTree-R*
|
||||
NERDTree-T NERD_tree.txt /*NERDTree-T*
|
||||
NERDTree-U NERD_tree.txt /*NERDTree-U*
|
||||
NERDTree-X NERD_tree.txt /*NERDTree-X*
|
||||
NERDTree-c-j NERD_tree.txt /*NERDTree-c-j*
|
||||
NERDTree-c-k NERD_tree.txt /*NERDTree-c-k*
|
||||
NERDTree-contents NERD_tree.txt /*NERDTree-contents*
|
||||
NERDTree-e NERD_tree.txt /*NERDTree-e*
|
||||
NERDTree-f NERD_tree.txt /*NERDTree-f*
|
||||
NERDTree-go NERD_tree.txt /*NERDTree-go*
|
||||
NERDTree-gtab NERD_tree.txt /*NERDTree-gtab*
|
||||
NERDTree-m NERD_tree.txt /*NERDTree-m*
|
||||
NERDTree-o NERD_tree.txt /*NERDTree-o*
|
||||
NERDTree-p NERD_tree.txt /*NERDTree-p*
|
||||
NERDTree-q NERD_tree.txt /*NERDTree-q*
|
||||
NERDTree-r NERD_tree.txt /*NERDTree-r*
|
||||
NERDTree-t NERD_tree.txt /*NERDTree-t*
|
||||
NERDTree-tab NERD_tree.txt /*NERDTree-tab*
|
||||
NERDTree-u NERD_tree.txt /*NERDTree-u*
|
||||
NERDTree-x NERD_tree.txt /*NERDTree-x*
|
||||
NERDTreeAuthor NERD_tree.txt /*NERDTreeAuthor*
|
||||
NERDTreeAutoCenter NERD_tree.txt /*NERDTreeAutoCenter*
|
||||
NERDTreeAutoCenterThreshold NERD_tree.txt /*NERDTreeAutoCenterThreshold*
|
||||
NERDTreeBookmarkCommands NERD_tree.txt /*NERDTreeBookmarkCommands*
|
||||
NERDTreeBookmarkTable NERD_tree.txt /*NERDTreeBookmarkTable*
|
||||
NERDTreeBookmarks NERD_tree.txt /*NERDTreeBookmarks*
|
||||
NERDTreeBookmarksFile NERD_tree.txt /*NERDTreeBookmarksFile*
|
||||
NERDTreeCaseSensitiveSort NERD_tree.txt /*NERDTreeCaseSensitiveSort*
|
||||
NERDTreeChDirMode NERD_tree.txt /*NERDTreeChDirMode*
|
||||
NERDTreeChangelog NERD_tree.txt /*NERDTreeChangelog*
|
||||
NERDTreeCredits NERD_tree.txt /*NERDTreeCredits*
|
||||
NERDTreeFilesysMenu NERD_tree.txt /*NERDTreeFilesysMenu*
|
||||
NERDTreeFunctionality NERD_tree.txt /*NERDTreeFunctionality*
|
||||
NERDTreeGlobalCommands NERD_tree.txt /*NERDTreeGlobalCommands*
|
||||
NERDTreeHighlightCursorline NERD_tree.txt /*NERDTreeHighlightCursorline*
|
||||
NERDTreeIgnore NERD_tree.txt /*NERDTreeIgnore*
|
||||
NERDTreeInvalidBookmarks NERD_tree.txt /*NERDTreeInvalidBookmarks*
|
||||
NERDTreeLicense NERD_tree.txt /*NERDTreeLicense*
|
||||
NERDTreeMappings NERD_tree.txt /*NERDTreeMappings*
|
||||
NERDTreeMouseMode NERD_tree.txt /*NERDTreeMouseMode*
|
||||
NERDTreeOptionDetails NERD_tree.txt /*NERDTreeOptionDetails*
|
||||
NERDTreeOptionSummary NERD_tree.txt /*NERDTreeOptionSummary*
|
||||
NERDTreeOptions NERD_tree.txt /*NERDTreeOptions*
|
||||
NERDTreePublicFunctions NERD_tree.txt /*NERDTreePublicFunctions*
|
||||
NERDTreeQuitOnOpen NERD_tree.txt /*NERDTreeQuitOnOpen*
|
||||
NERDTreeShowBookmarks NERD_tree.txt /*NERDTreeShowBookmarks*
|
||||
NERDTreeShowFiles NERD_tree.txt /*NERDTreeShowFiles*
|
||||
NERDTreeShowHidden NERD_tree.txt /*NERDTreeShowHidden*
|
||||
NERDTreeShowLineNumbers NERD_tree.txt /*NERDTreeShowLineNumbers*
|
||||
NERDTreeSortOrder NERD_tree.txt /*NERDTreeSortOrder*
|
||||
NERDTreeTodo NERD_tree.txt /*NERDTreeTodo*
|
||||
NERDTreeWinPos NERD_tree.txt /*NERDTreeWinPos*
|
||||
NERDTreeWinSize NERD_tree.txt /*NERDTreeWinSize*
|
||||
NERD_tree.txt NERD_tree.txt /*NERD_tree.txt*
|
||||
Tlist_Get_Tag_Prototype_By_Line() taglist.txt /*Tlist_Get_Tag_Prototype_By_Line()*
|
||||
Tlist_Get_Tagname_By_Line() taglist.txt /*Tlist_Get_Tagname_By_Line()*
|
||||
Tlist_Set_App() taglist.txt /*Tlist_Set_App()*
|
||||
Tlist_Update_File_Tags() taglist.txt /*Tlist_Update_File_Tags()*
|
||||
basic-snippet snippets_emu.txt /*basic-snippet*
|
||||
creating-snippets snippets_emu.txt /*creating-snippets*
|
||||
loaded_nerd_tree NERD_tree.txt /*loaded_nerd_tree*
|
||||
named-tags snippets_emu.txt /*named-tags*
|
||||
snip-advanced-tag-commands snippets_emu.txt /*snip-advanced-tag-commands*
|
||||
snip-buffer-specific snippets_emu.txt /*snip-buffer-specific*
|
||||
snip-bundles snippets_emu.txt /*snip-bundles*
|
||||
snip-contact-details snippets_emu.txt /*snip-contact-details*
|
||||
snip-contributors snippets_emu.txt /*snip-contributors*
|
||||
snip-detailed-explanations snippets_emu.txt /*snip-detailed-explanations*
|
||||
snip-elem-delimiter snippets_emu.txt /*snip-elem-delimiter*
|
||||
snip-ftplugin snippets_emu.txt /*snip-ftplugin*
|
||||
snip-limitations snippets_emu.txt /*snip-limitations*
|
||||
snip-menu snippets_emu.txt /*snip-menu*
|
||||
snip-remap-key snippets_emu.txt /*snip-remap-key*
|
||||
snip-snippet-commands snippets_emu.txt /*snip-snippet-commands*
|
||||
snip-special-vars snippets_emu.txt /*snip-special-vars*
|
||||
snip-start-end-tags snippets_emu.txt /*snip-start-end-tags*
|
||||
snip-tag-name-syntax snippets_emu.txt /*snip-tag-name-syntax*
|
||||
snippet-commands snippets_emu.txt /*snippet-commands*
|
||||
snippets_emu-bugs snippets_emu.txt /*snippets_emu-bugs*
|
||||
snippets_emu-features snippets_emu.txt /*snippets_emu-features*
|
||||
snippets_emu-options snippets_emu.txt /*snippets_emu-options*
|
||||
snippets_emu-troubleshooting snippets_emu.txt /*snippets_emu-troubleshooting*
|
||||
snippets_emu.txt snippets_emu.txt /*snippets_emu.txt*
|
||||
taglist-commands taglist.txt /*taglist-commands*
|
||||
taglist-debug taglist.txt /*taglist-debug*
|
||||
taglist-extend taglist.txt /*taglist-extend*
|
||||
taglist-faq taglist.txt /*taglist-faq*
|
||||
taglist-functions taglist.txt /*taglist-functions*
|
||||
taglist-install taglist.txt /*taglist-install*
|
||||
taglist-internet taglist.txt /*taglist-internet*
|
||||
taglist-intro taglist.txt /*taglist-intro*
|
||||
taglist-keys taglist.txt /*taglist-keys*
|
||||
taglist-license taglist.txt /*taglist-license*
|
||||
taglist-menu taglist.txt /*taglist-menu*
|
||||
taglist-options taglist.txt /*taglist-options*
|
||||
taglist-requirements taglist.txt /*taglist-requirements*
|
||||
taglist-session taglist.txt /*taglist-session*
|
||||
taglist-todo taglist.txt /*taglist-todo*
|
||||
taglist-using taglist.txt /*taglist-using*
|
||||
taglist.txt taglist.txt /*taglist.txt*
|
||||
58
vim/ftplugin/python.vim
Normal file
58
vim/ftplugin/python.vim
Normal file
@@ -0,0 +1,58 @@
|
||||
python << EOF
|
||||
def SetBreakpoint():
|
||||
import re
|
||||
nLine = int( vim.eval( 'line(".")'))
|
||||
|
||||
strLine = vim.current.line
|
||||
strWhite = re.search( '^(\s*)', strLine).group(1)
|
||||
|
||||
vim.current.buffer.append(
|
||||
"%(space)spdb.set_trace() %(mark)s Breakpoint %(mark)s" %
|
||||
{'space':strWhite, 'mark': '#' * 30}, nLine - 1)
|
||||
|
||||
for strLine in vim.current.buffer:
|
||||
if strLine == "import pdb":
|
||||
break
|
||||
else:
|
||||
vim.current.buffer.append( 'import pdb', 0)
|
||||
vim.command( 'normal j1')
|
||||
|
||||
vim.command( 'map <f7> :py SetBreakpoint()<cr>')
|
||||
|
||||
def RemoveBreakpoints():
|
||||
import re
|
||||
|
||||
nCurrentLine = int( vim.eval( 'line(".")'))
|
||||
|
||||
nLines = []
|
||||
nLine = 1
|
||||
for strLine in vim.current.buffer:
|
||||
if strLine == 'import pdb' or strLine.lstrip()[:15] == 'pdb.set_trace()':
|
||||
nLines.append( nLine)
|
||||
nLine += 1
|
||||
|
||||
nLines.reverse()
|
||||
|
||||
for nLine in nLines:
|
||||
vim.command( 'normal %dG' % nLine)
|
||||
vim.command( 'normal dd')
|
||||
if nLine < nCurrentLine:
|
||||
nCurrentLine -= 1
|
||||
|
||||
vim.command( 'normal %dG' % nCurrentLine)
|
||||
|
||||
vim.command( 'map <s-f7> :py RemoveBreakpoints()<cr>')
|
||||
EOF
|
||||
|
||||
set makeprg=python\ -c\ \"import\ py_compile,sys;\ sys.stderr=sys.stdout;\ py_compile.compile(r'%')\"
|
||||
set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m
|
||||
|
||||
"PEP 8 Friendly
|
||||
setlocal tabstop=4
|
||||
setlocal softtabstop=4
|
||||
setlocal shiftwidth=4
|
||||
setlocal textwidth=80
|
||||
setlocal smarttab
|
||||
setlocal expandtab
|
||||
setlocal smartindent
|
||||
|
||||
3530
vim/plugin/NERD_tree.vim
Normal file
3530
vim/plugin/NERD_tree.vim
Normal file
File diff suppressed because it is too large
Load Diff
357
vim/syntax/python.vim
Normal file
357
vim/syntax/python.vim
Normal file
@@ -0,0 +1,357 @@
|
||||
" Vim syntax file
|
||||
" Language: Python
|
||||
" Maintainer: Dmitry Vasiliev <dima@hlabs.spb.ru>
|
||||
" URL: http://www.hlabs.spb.ru/vim/python3.0.vim
|
||||
" Last Change: 2008-12-07
|
||||
" Filenames: *.py
|
||||
" Version: 3.0.0
|
||||
"
|
||||
" Based on python.vim (from Vim 6.1 distribution)
|
||||
" by Neil Schemenauer <nas@python.ca>
|
||||
"
|
||||
" Thanks:
|
||||
"
|
||||
" Jeroen Ruigrok van der Werven
|
||||
" for the idea to highlight erroneous operators
|
||||
" Pedro Algarvio
|
||||
" for the patch to enable spell checking only for the right spots
|
||||
" (strings and comments)
|
||||
" John Eikenberry
|
||||
" for the patch fixing small typo
|
||||
|
||||
"
|
||||
" Options:
|
||||
"
|
||||
" For set option do: let OPTION_NAME = 1
|
||||
" For clear option do: let OPTION_NAME = 0
|
||||
"
|
||||
" Option names:
|
||||
"
|
||||
" For highlight builtin functions:
|
||||
" python_highlight_builtins
|
||||
"
|
||||
" For highlight standard exceptions:
|
||||
" python_highlight_exceptions
|
||||
"
|
||||
" For highlight string formatting:
|
||||
" python_highlight_string_formatting
|
||||
"
|
||||
" For highlight str.format syntax:
|
||||
" python_highlight_string_format
|
||||
"
|
||||
" For highlight string.Template syntax:
|
||||
" python_highlight_string_templates
|
||||
"
|
||||
" For highlight indentation errors:
|
||||
" python_highlight_indent_errors
|
||||
"
|
||||
" For highlight trailing spaces:
|
||||
" python_highlight_space_errors
|
||||
"
|
||||
" For highlight doc-tests:
|
||||
" python_highlight_doctests
|
||||
"
|
||||
" If you want all Python highlightings above:
|
||||
" python_highlight_all
|
||||
" (This option not override previously set options)
|
||||
"
|
||||
" For fast machines:
|
||||
" python_slow_sync
|
||||
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x: Quit when a syntax file was already loaded
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
if exists("python_highlight_all") && python_highlight_all != 0
|
||||
" Not override previously set options
|
||||
if !exists("python_highlight_builtins")
|
||||
let python_highlight_builtins = 1
|
||||
endif
|
||||
if !exists("python_highlight_exceptions")
|
||||
let python_highlight_exceptions = 1
|
||||
endif
|
||||
if !exists("python_highlight_string_formatting")
|
||||
let python_highlight_string_formatting = 1
|
||||
endif
|
||||
if !exists("python_highlight_string_format")
|
||||
let python_highlight_string_format = 1
|
||||
endif
|
||||
if !exists("python_highlight_string_templates")
|
||||
let python_highlight_string_templates = 1
|
||||
endif
|
||||
if !exists("python_highlight_indent_errors")
|
||||
let python_highlight_indent_errors = 1
|
||||
endif
|
||||
if !exists("python_highlight_space_errors")
|
||||
let python_highlight_space_errors = 1
|
||||
endif
|
||||
if !exists("python_highlight_doctests")
|
||||
let python_highlight_doctests = 1
|
||||
endif
|
||||
endif
|
||||
|
||||
" Keywords
|
||||
syn keyword pythonStatement break continue del
|
||||
syn keyword pythonStatement exec return as
|
||||
syn keyword pythonStatement pass raise
|
||||
syn keyword pythonStatement global assert
|
||||
syn keyword pythonStatement lambda yield
|
||||
syn keyword pythonStatement with nonlocal
|
||||
syn keyword pythonStatement False None True
|
||||
syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite
|
||||
syn match pythonFunction "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
|
||||
syn keyword pythonRepeat for while
|
||||
syn keyword pythonConditional if elif else
|
||||
syn keyword pythonImport import from
|
||||
syn keyword pythonException try except finally
|
||||
syn keyword pythonOperator and in is not or
|
||||
|
||||
" Decorators (new in Python 2.4)
|
||||
syn match pythonDecorator "@" display nextgroup=pythonFunction skipwhite
|
||||
|
||||
" Comments
|
||||
syn match pythonComment "#.*$" display contains=pythonTodo,@Spell
|
||||
syn match pythonRun "\%^#!.*$"
|
||||
syn match pythonCoding "\%^.*\%(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$"
|
||||
syn keyword pythonTodo TODO FIXME XXX contained
|
||||
|
||||
" Errors
|
||||
" syn match pythonError "\<\d\+\D\+\>" display
|
||||
syn match pythonError "[$?]" display
|
||||
syn match pythonError "[&|]\{2,}" display
|
||||
syn match pythonError "[=]\{3,}" display
|
||||
|
||||
syn match pythonError "^\s*def\s\+\w\+(.*)\s*$" display
|
||||
syn match pythonError "^\s*class\s\+\w\+(.*)\s*$" display
|
||||
syn match pythonError "^\s*for\s.*[^:]$" display
|
||||
syn match pythonError "^\s*except\s*$" display
|
||||
syn match pythonError "^\s*finally\s*$" display
|
||||
syn match pythonError "^\s*try\s*$" display
|
||||
syn match pythonError "^\s*else\s*$" display
|
||||
syn match pythonError "^\s*else\s*[^:].*" display
|
||||
syn match pythonError "^\s*if\s.*[^\:]$" display
|
||||
syn match pythonError "^\s*except\s.*[^\:]$" display
|
||||
syn match pythonError "[;]$" display
|
||||
syn keyword pythonError do
|
||||
|
||||
" TODO: Mixing spaces and tabs also may be used for pretty formatting multiline
|
||||
" statements. For now I don't know how to work around this.
|
||||
if exists("python_highlight_indent_errors") && python_highlight_indent_errors != 0
|
||||
syn match pythonIndentError "^\s*\%( \t\|\t \)\s*\S"me=e-1 display
|
||||
endif
|
||||
|
||||
" Trailing space errors
|
||||
if exists("python_highlight_space_errors") && python_highlight_space_errors != 0
|
||||
syn match pythonSpaceError "\s\+$" display
|
||||
endif
|
||||
|
||||
" Strings
|
||||
syn region pythonString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonEscape,pythonEscapeError,@Spell
|
||||
syn region pythonString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonEscape,pythonEscapeError,@Spell
|
||||
syn region pythonString start=+"""+ end=+"""+ keepend contains=pythonEscape,pythonEscapeError,pythonDocTest2,pythonSpaceError,@Spell
|
||||
syn region pythonString start=+'''+ end=+'''+ keepend contains=pythonEscape,pythonEscapeError,pythonDocTest,pythonSpaceError,@Spell
|
||||
|
||||
syn match pythonEscape +\\[abfnrtv'"\\]+ display contained
|
||||
syn match pythonEscape "\\\o\o\=\o\=" display contained
|
||||
syn match pythonEscapeError "\\\o\{,2}[89]" display contained
|
||||
syn match pythonEscape "\\x\x\{2}" display contained
|
||||
syn match pythonEscapeError "\\x\x\=\X" display contained
|
||||
syn match pythonEscape "\\$"
|
||||
syn match pythonEscape "\\u\x\{4}" display contained
|
||||
syn match pythonEscapeError "\\u\x\{,3}\X" display contained
|
||||
syn match pythonEscape "\\U\x\{8}" display contained
|
||||
syn match pythonEscapeError "\\U\x\{,7}\X" display contained
|
||||
syn match pythonEscape "\\N{[A-Z ]\+}" display contained
|
||||
syn match pythonEscapeError "\\N{[^A-Z ]\+}" display contained
|
||||
|
||||
" Raw strings
|
||||
syn region pythonRawString start=+[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
|
||||
syn region pythonRawString start=+[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
|
||||
syn region pythonRawString start=+[rR]"""+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
|
||||
syn region pythonRawString start=+[rR]'''+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
|
||||
|
||||
syn match pythonRawEscape +\\['"]+ display transparent contained
|
||||
|
||||
" Bytes
|
||||
syn region pythonBytes start=+[bB]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesContent,pythonBytesError,pythonBytesEscape,pythonBytesEscapeError,@Spell
|
||||
syn region pythonBytes start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesContent,pythonBytesError,pythonBytesEscape,pythonBytesEscapeError,@Spell
|
||||
syn region pythonBytes start=+[bB]"""+ end=+"""+ keepend contains=pythonBytesContent,pythonBytesError,pythonBytesEscape,pythonBytesEscapeError,pythonDocTest2,pythonSpaceError,@Spell
|
||||
syn region pythonBytes start=+[bB]'''+ end=+'''+ keepend contains=pythonBytesContent,pythonBytesError,pythonBytesEscape,pythonBytesEscapeError,pythonDocTest,pythonSpaceError,@Spell
|
||||
|
||||
syn match pythonBytesContent "[\u0001-\u007f]\+" display contained
|
||||
syn match pythonBytesError "[^\u0001-\u007f]\+" display contained
|
||||
|
||||
syn match pythonBytesEscape +\\[abfnrtv'"\\]+ display contained
|
||||
syn match pythonBytesEscape "\\\o\o\=\o\=" display contained
|
||||
syn match pythonBytesEscapeError "\\\o\{,2}[89]" display contained
|
||||
syn match pythonBytesEscape "\\x\x\{2}" display contained
|
||||
syn match pythonBytesEscapeError "\\x\x\=\X" display contained
|
||||
syn match pythonBytesEscape "\\$"
|
||||
|
||||
if exists("python_highlight_string_formatting") && python_highlight_string_formatting != 0
|
||||
" String formatting
|
||||
syn match pythonStrFormatting "%\%(([^)]\+)\)\=[-#0 +]*\d*\%(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonRawString
|
||||
syn match pythonStrFormatting "%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]" contained containedin=pythonString,pythonRawString
|
||||
endif
|
||||
|
||||
if exists("python_highlight_string_format") && python_highlight_string_format != 0
|
||||
" str.format syntax
|
||||
syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonRawString
|
||||
syn match pythonStrFormat "{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_*\)\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*\%(\.\d\+\)\=[bcdeEfFgGnoxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonRawString
|
||||
endif
|
||||
|
||||
if exists("python_highlight_string_templates") && python_highlight_string_templates != 0
|
||||
" String templates
|
||||
syn match pythonStrTemplate "\$\$" contained containedin=pythonString,pythonRawString
|
||||
syn match pythonStrTemplate "\${[a-zA-Z_][a-zA-Z0-9_]*}" contained containedin=pythonString,pythonRawString
|
||||
syn match pythonStrTemplate "\$[a-zA-Z_][a-zA-Z0-9_]*" contained containedin=pythonString,pythonRawString
|
||||
endif
|
||||
|
||||
if exists("python_highlight_doctests") && python_highlight_doctests != 0
|
||||
" DocTests
|
||||
syn region pythonDocTest start="^\s*>>>" end=+'''+he=s-1 end="^\s*$" contained
|
||||
syn region pythonDocTest2 start="^\s*>>>" end=+"""+he=s-1 end="^\s*$" contained
|
||||
endif
|
||||
|
||||
" Numbers (ints, longs, floats, complex)
|
||||
syn match pythonHexError "\<0[xX]\x*[g-zG-Z]\x*\>" display
|
||||
|
||||
syn match pythonHexNumber "\<0[xX]\x\+\>" display
|
||||
syn match pythonOctNumber "\<0[oO]\o\+\>" display
|
||||
syn match pythonBinNumber "\<0[bB][01]\+\>" display
|
||||
|
||||
syn match pythonNumber "\<\d\>" display
|
||||
syn match pythonNumber "\<[1-9]\d\+\>" display
|
||||
syn match pythonNumber "\<\d\+[jJ]\>" display
|
||||
syn match pythonNumberError "\<0\d\+\>" display
|
||||
|
||||
syn match pythonFloat "\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>" display
|
||||
syn match pythonFloat "\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display
|
||||
syn match pythonFloat "\<\d\+\.\d*\%([eE][+-]\=\d\+\)\=[jJ]\=" display
|
||||
|
||||
syn match pythonOctError "\<0[oO]\=\o*[8-9]\d*\>" display
|
||||
syn match pythonBinError "\<0[bB][01]*[2-9]\d*\>" display
|
||||
|
||||
if exists("python_highlight_builtins") && python_highlight_builtins != 0
|
||||
" Builtin functions, types and objects
|
||||
syn keyword pythonBuiltinObj Ellipsis NotImplemented
|
||||
syn keyword pythonBuiltinObj __debug__ __doc__ __file__ __name__ __package__
|
||||
|
||||
syn keyword pythonBuiltinFunc __import__ abs all any ascii
|
||||
syn keyword pythonBuiltinFunc bin bool bytearray bytes
|
||||
syn keyword pythonBuiltinFunc chr classmethod cmp compile complex
|
||||
syn keyword pythonBuiltinFunc delattr dict dir divmod enumerate eval
|
||||
syn keyword pythonBuiltinFunc exec filter float format frozenset getattr
|
||||
syn keyword pythonBuiltinFunc globals hasattr hash hex id
|
||||
syn keyword pythonBuiltinFunc input int isinstance
|
||||
syn keyword pythonBuiltinFunc issubclass iter len list locals map max
|
||||
syn keyword pythonBuiltinFunc memoryview min next object oct open ord
|
||||
syn keyword pythonBuiltinFunc pow print property range
|
||||
syn keyword pythonBuiltinFunc repr reversed round set setattr
|
||||
syn keyword pythonBuiltinFunc slice sorted staticmethod str sum super tuple
|
||||
syn keyword pythonBuiltinFunc type vars zip
|
||||
endif
|
||||
|
||||
if exists("python_highlight_exceptions") && python_highlight_exceptions != 0
|
||||
" Builtin exceptions and warnings
|
||||
syn keyword pythonExClass BaseException
|
||||
syn keyword pythonExClass Exception ArithmeticError
|
||||
syn keyword pythonExClass LookupError EnvironmentError
|
||||
|
||||
syn keyword pythonExClass AssertionError AttributeError BufferError EOFError
|
||||
syn keyword pythonExClass FloatingPointError GeneratorExit IOError
|
||||
syn keyword pythonExClass ImportError IndexError KeyError
|
||||
syn keyword pythonExClass KeyboardInterrupt MemoryError NameError
|
||||
syn keyword pythonExClass NotImplementedError OSError OverflowError
|
||||
syn keyword pythonExClass ReferenceError RuntimeError StopIteration
|
||||
syn keyword pythonExClass SyntaxError IndentationError TabError
|
||||
syn keyword pythonExClass SystemError SystemExit TypeError
|
||||
syn keyword pythonExClass UnboundLocalError UnicodeError
|
||||
syn keyword pythonExClass UnicodeEncodeError UnicodeDecodeError
|
||||
syn keyword pythonExClass UnicodeTranslateError ValueError VMSError
|
||||
syn keyword pythonExClass WindowsError ZeroDivisionError
|
||||
|
||||
syn keyword pythonExClass Warning UserWarning BytesWarning DeprecationWarning
|
||||
syn keyword pythonExClass PendingDepricationWarning SyntaxWarning
|
||||
syn keyword pythonExClass RuntimeWarning FutureWarning
|
||||
syn keyword pythonExClass ImportWarning UnicodeWarning
|
||||
endif
|
||||
|
||||
if exists("python_slow_sync") && python_slow_sync != 0
|
||||
syn sync minlines=2000
|
||||
else
|
||||
" This is fast but code inside triple quoted strings screws it up. It
|
||||
" is impossible to fix because the only way to know if you are inside a
|
||||
" triple quoted string is to start from the beginning of the file.
|
||||
syn sync match pythonSync grouphere NONE "):$"
|
||||
syn sync maxlines=200
|
||||
endif
|
||||
|
||||
if version >= 508 || !exists("did_python_syn_inits")
|
||||
if version <= 508
|
||||
let did_python_syn_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
|
||||
HiLink pythonStatement Statement
|
||||
HiLink pythonImport Statement
|
||||
HiLink pythonFunction Function
|
||||
HiLink pythonConditional Conditional
|
||||
HiLink pythonRepeat Repeat
|
||||
HiLink pythonException Exception
|
||||
HiLink pythonOperator Operator
|
||||
|
||||
HiLink pythonDecorator Define
|
||||
|
||||
HiLink pythonComment Comment
|
||||
HiLink pythonCoding Special
|
||||
HiLink pythonRun Special
|
||||
HiLink pythonTodo Todo
|
||||
|
||||
HiLink pythonError Error
|
||||
HiLink pythonIndentError Error
|
||||
HiLink pythonSpaceError Error
|
||||
|
||||
HiLink pythonString String
|
||||
HiLink pythonRawString String
|
||||
HiLink pythonEscape Special
|
||||
HiLink pythonEscapeError Error
|
||||
|
||||
HiLink pythonBytes String
|
||||
HiLink pythonBytesContent String
|
||||
HiLink pythonBytesError Error
|
||||
HiLink pythonBytesEscape Special
|
||||
HiLink pythonBytesEscapeError Error
|
||||
|
||||
HiLink pythonStrFormatting Special
|
||||
HiLink pythonStrFormat Special
|
||||
HiLink pythonStrTemplate Special
|
||||
|
||||
HiLink pythonDocTest Special
|
||||
HiLink pythonDocTest2 Special
|
||||
|
||||
HiLink pythonNumber Number
|
||||
HiLink pythonHexNumber Number
|
||||
HiLink pythonOctNumber Number
|
||||
HiLink pythonBinNumber Number
|
||||
HiLink pythonFloat Float
|
||||
HiLink pythonNumberError Error
|
||||
HiLink pythonOctError Error
|
||||
HiLink pythonHexError Error
|
||||
HiLink pythonBinError Error
|
||||
|
||||
HiLink pythonBuiltinObj Structure
|
||||
HiLink pythonBuiltinFunc Function
|
||||
|
||||
HiLink pythonExClass Structure
|
||||
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
let b:current_syntax = "python"
|
||||
216
vimrc
Normal file
216
vimrc
Normal file
@@ -0,0 +1,216 @@
|
||||
" .vimrc
|
||||
|
||||
" Use Vim not vi settings
|
||||
set nocompatible
|
||||
|
||||
" gui appearence
|
||||
if has("gui_running")
|
||||
colorscheme slate
|
||||
set guifont=Terminus\ 8
|
||||
endif
|
||||
|
||||
" term appearence
|
||||
set background=dark
|
||||
|
||||
" always show ruler
|
||||
set ruler
|
||||
|
||||
" search related settings
|
||||
|
||||
" show parial pattern matches in real time
|
||||
set incsearch
|
||||
" I like highlighted search pattern
|
||||
set hlsearch
|
||||
" search for upper and lowercase
|
||||
set ignorecase
|
||||
" but if user type uppercase - search exaclty
|
||||
set smartcase
|
||||
|
||||
" no backup, we got scm :)
|
||||
set nobackup
|
||||
|
||||
"use a scrollable menu for filename completions
|
||||
set wildmenu
|
||||
|
||||
"ignore class and object files
|
||||
set wildignore=*.class,*.o,*.bak,*.swp,*.pyc
|
||||
|
||||
"of course
|
||||
syntax on
|
||||
|
||||
" I work with buffers, when I open a buffer that is recently open in a window,
|
||||
" don't open this buffer twice: switch to the already open one! Nice for :make, :cn, ... ;-)
|
||||
set switchbuf=useopen
|
||||
" title
|
||||
set titlestring=%<%F\ %M%=%l/%L\ -\ %p%% titlelen=70
|
||||
|
||||
" display linenumber
|
||||
set number
|
||||
|
||||
if version >= 700
|
||||
" spelling files:
|
||||
" http://ftp.vim.org/pub/vim/runtime/spell/
|
||||
" move de.latin1.spl and de.latin1.sug to RUNTIME/spell
|
||||
set spelllang=de
|
||||
set sps=best,10
|
||||
set omnifunc=ccomplete#Complete
|
||||
map <S-h> gT
|
||||
map <S-l> gt
|
||||
else
|
||||
" spell check for the folloging files
|
||||
let spell_auto_type = "tex,mail,text,human"
|
||||
let spell_markup_ft = ",tex,mail,text,human"
|
||||
let spell_guess_language_ft = ""
|
||||
endif
|
||||
|
||||
"maximum mumber of undos
|
||||
set undolevels=1000
|
||||
|
||||
" indent stuff, tab stuff
|
||||
set autoindent
|
||||
set smartindent
|
||||
set tabstop=4
|
||||
set softtabstop=4
|
||||
set shiftwidth=4
|
||||
|
||||
" no swp file cluttering in workdir
|
||||
set directory=~/.vimswp
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" TEXT FORMATING
|
||||
|
||||
|
||||
|
||||
|
||||
if has("autocmd")
|
||||
|
||||
filetype on
|
||||
augroup filetype
|
||||
filetype plugin indent on
|
||||
autocmd BufNewFile,BufRead *.txt set filetype=human
|
||||
augroup END
|
||||
|
||||
"vim jumps always to the last edited line, if possible
|
||||
"autocmd BufRead *,.* :normal '"
|
||||
autocmd BufReadPost *
|
||||
\ if line("'\"") > 0 && line("'\"") <= line("$") |
|
||||
\ exe "normal g`\"" |
|
||||
\ endif
|
||||
|
||||
"in human-language files, automatically format everything at 78 chars:
|
||||
autocmd FileType mail,human
|
||||
\ set spelllang=de formatoptions+=t textwidth=78 nocindent dictionary=/usr/share/dict/words
|
||||
|
||||
|
||||
"LaTeX to the fullest! ...dislike overlong lines:
|
||||
autocmd FileType tex set formatoptions+=t textwidth=80 nocindent
|
||||
autocmd FileType tex set makeprg=pdflatex\ %
|
||||
|
||||
"for C-like programming, have automatic indentation:
|
||||
autocmd FileType slang set cindent tabstop=4 shiftwidth=4 tw=78
|
||||
|
||||
|
||||
"for actual C programming where comments have explicit end
|
||||
"characters, if starting a new line in the middle of a comment automatically
|
||||
"insert the comment leader characters:
|
||||
"for a more _weighty_ comments use: comments=sl:/*,mb:**,elx:*/
|
||||
autocmd FileType c,cpp set formatoptions+=ro dictionary=$HOME/.vim/c_dictionary
|
||||
\ tw=78 tabstop=4 shiftwidth=4 noexpandtab cindent
|
||||
|
||||
|
||||
" indent xml code
|
||||
augroup xml
|
||||
map ,mf !xmllint --format --recover - 2>/dev/null<CR>
|
||||
" au!
|
||||
" autocmd BufWrite *xml exe ":silent 1,$!xmllint --format --recover - 2>/dev/null"
|
||||
augroup END
|
||||
|
||||
"for both CSS and HTML, use genuine tab characters for indentation, to make
|
||||
"files a few bytes smaller:
|
||||
autocmd FileType html,css set noexpandtab tabstop=2
|
||||
|
||||
"in makefiles, don't expand tabs to spaces, since actual tab characters are
|
||||
"needed, and have indentation at 8 chars to be sure that all indents are tabs
|
||||
"(despite the mappings later):
|
||||
autocmd FileType make set noexpandtab shiftwidth=8
|
||||
autocmd FileType automake set noexpandtab shiftwidth=8
|
||||
|
||||
endif " has("autocmd")
|
||||
|
||||
|
||||
|
||||
"I need more information
|
||||
set statusline=%<%F%=\ [%1*%M%*%n%R%H%Y]\ \ %-25(%3l,%c%03V\ \ %P\ (%L)%)%12o'%03b''%03B'
|
||||
"always show statusline
|
||||
set laststatus=2
|
||||
|
||||
"modus (insert,visual ...)
|
||||
highlight modeMsg cterm=bold ctermfg=white ctermbg=blue
|
||||
"active statusLine
|
||||
highlight statusLine cterm=bold ctermfg=yellow ctermbg=red
|
||||
"inactive statusLine
|
||||
highlight statusLineNC cterm=bold ctermfg=black ctermbg=white
|
||||
"visual mode
|
||||
highlight visual cterm=bold ctermfg=yellow ctermbg=red
|
||||
"cursor colors
|
||||
highlight cursor cterm=bold
|
||||
"vertical line on split screen
|
||||
highlight VertSplit cterm=bold ctermfg=yellow ctermbg=yellow
|
||||
|
||||
" highlight spell errors
|
||||
highlight SpellErrors ctermfg=Red cterm=underline term=reverse
|
||||
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" MAPPINGS
|
||||
|
||||
"" Function Keys Sector
|
||||
|
||||
"write a changelog entry upon pressing F1
|
||||
"nnoremap <silent> <F1> :r !date<CR>Thomas Ruoff <ThomasRuoff@gmail.com><CR><CR>
|
||||
"F2 -> F4 == misc
|
||||
"search the current word under cursor in all files in working directory
|
||||
nnoremap <silent> <F2> vawy:! grep -n -H <C-R>" .* *<CR>
|
||||
|
||||
nnoremap <silent> <F3> :NERDTreeToggle<CR>
|
||||
|
||||
"compile, translate, ...
|
||||
map <F5> :make<CR>
|
||||
|
||||
" F9 F11 Shift-F11 and F12 are used in python mode
|
||||
|
||||
set pastetoggle=<F10>
|
||||
|
||||
"F11 -> F12 == resize window
|
||||
"map <F11> <ESC>:resize -5 <CR>
|
||||
"map <F12> <ESC>:resize +5 <CR>
|
||||
|
||||
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
|
||||
"use ctags
|
||||
set tags+=$HOME/.vim/tags/python.ctags
|
||||
"remap tag jumping
|
||||
map <silent><C-Left> <C-T>
|
||||
map <silent><C-Right> <C-]>
|
||||
"Code Completion for python
|
||||
autocmd FileType python set omnifunc=pythoncomplete#Complete
|
||||
"remap code complete to ctrl space
|
||||
inoremap <Nul> <C-x><C-o>
|
||||
"tab nav with alt left or right
|
||||
map <silent><A-Right> :tabnext<CR>
|
||||
map <silent><A-Left> :tabprevious<CR>
|
||||
filetype plugin indent on
|
||||
python << EOL
|
||||
import vim
|
||||
def EvaluateCurrentRange():
|
||||
eval(compile('\n'.join(vim.current.range),'','exec'),globals())
|
||||
EOL
|
||||
map <C-h> :py EvaluateCurrentRange()
|
||||
|
||||
" vim:set ts=2 tw=80:
|
||||
290
zsh/func/prompt_wunjo_setup
Normal file
290
zsh/func/prompt_wunjo_setup
Normal file
@@ -0,0 +1,290 @@
|
||||
# wunjo prompt theme
|
||||
|
||||
autoload -U zgitinit
|
||||
zgitinit
|
||||
|
||||
prompt_wunjo_help () {
|
||||
cat <<'EOF'
|
||||
|
||||
prompt wunjo
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
coloratom() {
|
||||
local off=$1 atom=$2
|
||||
if [[ $atom[1] == [[:upper:]] ]]; then
|
||||
off=$(( $off + 60 ))
|
||||
fi
|
||||
echo $(( $off + $colorcode[${(L)atom}] ))
|
||||
}
|
||||
colorword() {
|
||||
local fg=$1 bg=$2 att=$3
|
||||
local -a s
|
||||
|
||||
if [ -n "$fg" ]; then
|
||||
s+=$(coloratom 30 $fg)
|
||||
fi
|
||||
if [ -n "$bg" ]; then
|
||||
s+=$(coloratom 40 $bg)
|
||||
fi
|
||||
if [ -n "$att" ]; then
|
||||
s+=$attcode[$att]
|
||||
fi
|
||||
|
||||
echo "%{"$'\e['${(j:;:)s}m"%}"
|
||||
}
|
||||
|
||||
prompt_wunjo_setup() {
|
||||
local verbose
|
||||
if [[ $TERM == screen* ]] && [ -n "$STY" ]; then
|
||||
verbose=
|
||||
else
|
||||
verbose=1
|
||||
fi
|
||||
|
||||
typeset -A colorcode
|
||||
colorcode[black]=0
|
||||
colorcode[red]=1
|
||||
colorcode[green]=2
|
||||
colorcode[yellow]=3
|
||||
colorcode[blue]=4
|
||||
colorcode[magenta]=5
|
||||
colorcode[cyan]=6
|
||||
colorcode[white]=7
|
||||
colorcode[default]=9
|
||||
colorcode[k]=$colorcode[black]
|
||||
colorcode[r]=$colorcode[red]
|
||||
colorcode[g]=$colorcode[green]
|
||||
colorcode[y]=$colorcode[yellow]
|
||||
colorcode[b]=$colorcode[blue]
|
||||
colorcode[m]=$colorcode[magenta]
|
||||
colorcode[c]=$colorcode[cyan]
|
||||
colorcode[w]=$colorcode[white]
|
||||
colorcode[.]=$colorcode[default]
|
||||
|
||||
typeset -A attcode
|
||||
attcode[none]=00
|
||||
attcode[bold]=01
|
||||
attcode[faint]=02
|
||||
attcode[standout]=03
|
||||
attcode[underline]=04
|
||||
attcode[blink]=05
|
||||
attcode[reverse]=07
|
||||
attcode[conceal]=08
|
||||
attcode[normal]=22
|
||||
attcode[no-standout]=23
|
||||
attcode[no-underline]=24
|
||||
attcode[no-blink]=25
|
||||
attcode[no-reverse]=27
|
||||
attcode[no-conceal]=28
|
||||
|
||||
local -A pc
|
||||
pc[default]='default'
|
||||
pc[date]='cyan'
|
||||
pc[time]='Blue'
|
||||
pc[host]='Green'
|
||||
pc[user]='cyan'
|
||||
pc[punc]='yellow'
|
||||
pc[line]='magenta'
|
||||
pc[hist]='green'
|
||||
pc[path]='Cyan'
|
||||
pc[shortpath]='default'
|
||||
pc[rc]='red'
|
||||
pc[scm_branch]='Cyan'
|
||||
pc[scm_commitid]='Yellow'
|
||||
pc[scm_status_dirty]='Red'
|
||||
pc[scm_status_staged]='Green'
|
||||
pc[#]='Yellow'
|
||||
for cn in ${(k)pc}; do
|
||||
pc[${cn}]=$(colorword $pc[$cn])
|
||||
done
|
||||
pc[reset]=$(colorword . . 00)
|
||||
|
||||
typeset -Ag wunjo_prompt_colors
|
||||
wunjo_prompt_colors=(${(kv)pc})
|
||||
|
||||
local p_date p_line p_rc
|
||||
|
||||
p_date="$pc[date]%D{%Y-%m-%d} $pc[time]%D{%T}$pc[reset]"
|
||||
|
||||
p_line="$pc[line]%y$pc[reset]"
|
||||
|
||||
PROMPT=
|
||||
if [ $verbose ]; then
|
||||
PROMPT+="$pc[host]%m$pc[reset] "
|
||||
fi
|
||||
PROMPT+="$pc[path]%(2~.%~.%/)$pc[reset]"
|
||||
PROMPT+="\$(prompt_wunjo_scm_status)"
|
||||
PROMPT+="%(?.. $pc[rc]exited %1v$pc[reset])"
|
||||
PROMPT+="
|
||||
"
|
||||
PROMPT+="$pc[hist]%h$pc[reset] "
|
||||
PROMPT+="$pc[shortpath]%1~$pc[reset]"
|
||||
PROMPT+="\$(prompt_wunjo_scm_branch)"
|
||||
PROMPT+=" $pc[#]%#$pc[reset] "
|
||||
|
||||
RPROMPT=
|
||||
if [ $verbose ]; then
|
||||
RPROMPT+="$p_date "
|
||||
fi
|
||||
RPROMPT+="$pc[user]%n$pc[reset]"
|
||||
RPROMPT+=" $p_line"
|
||||
|
||||
export PROMPT RPROMPT
|
||||
precmd_functions+='prompt_wunjo_precmd'
|
||||
}
|
||||
|
||||
prompt_wunjo_precmd() {
|
||||
local ex=$?
|
||||
psvar=()
|
||||
|
||||
if [[ $ex -ge 128 ]]; then
|
||||
sig=$signals[$ex-127]
|
||||
psvar[1]="sig${(L)sig}"
|
||||
else
|
||||
psvar[1]="$ex"
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_wunjo_scm_status() {
|
||||
zgit_isgit || return
|
||||
local -A pc
|
||||
pc=(${(kv)wunjo_prompt_colors})
|
||||
|
||||
head=$(zgit_head)
|
||||
gitcommit=$(git describe --always $head 2>/dev/null)
|
||||
|
||||
local -a commits
|
||||
|
||||
if zgit_rebaseinfo; then
|
||||
orig_commit=$(git describe --always $zgit_info[rb_head])
|
||||
orig_name=$(git name-rev --name-only $zgit_info[rb_head])
|
||||
orig="$pc[scm_branch]$orig_name$pc[punc]($pc[scm_commitid]$orig_commit$pc[punc])"
|
||||
onto_commit=$(git describe --always $zgit_info[rb_onto])
|
||||
onto_name=$(git name-rev --name-only $zgit_info[rb_onto])
|
||||
onto="$pc[scm_branch]$onto_name$pc[punc]($pc[scm_commitid]$onto_commit$pc[punc])"
|
||||
|
||||
if [ -n "$zgit_info[rb_upstream]" ] && [ $zgit_info[rb_upstream] != $zgit_info[rb_onto] ]; then
|
||||
upstream_commit=$(git describe --always $zgit_info[rb_upstream])
|
||||
upstream_name=$(git name-rev --name-only $zgit_info[rb_upstream])
|
||||
upstream="$pc[scm_branch]$upstream_name$pc[punc]($pc[scm_commitid]$upstream_commit$pc[punc])"
|
||||
commits+="rebasing $upstream$pc[reset]..$orig$pc[reset] onto $onto$pc[reset]"
|
||||
else
|
||||
commits+="rebasing $onto$pc[reset]..$orig$pc[reset]"
|
||||
fi
|
||||
|
||||
local -a revs
|
||||
revs=($(git rev-list $zgit_info[rb_onto]..HEAD))
|
||||
if [ $#revs -gt 0 ]; then
|
||||
commits+="\n$#revs commits in"
|
||||
fi
|
||||
|
||||
if [ -f $zgit_info[dotest]/message ]; then
|
||||
mess=$(head -n1 $zgit_info[dotest]/message)
|
||||
commits+="on $mess"
|
||||
fi
|
||||
elif [ -n "$gitcommit" ]; then
|
||||
commits+="on $pc[scm_branch]$head$pc[punc]($pc[scm_commitid]$gitcommit$pc[punc])$pc[reset]"
|
||||
local track_merge=$(zgit_tracking_merge)
|
||||
if [ -n "$track_merge" ]; then
|
||||
if git rev-parse --verify -q $track_merge >/dev/null; then
|
||||
local track_remote=$(zgit_tracking_remote)
|
||||
local tracked=$(git describe --always $track_merge 2>/dev/null)
|
||||
|
||||
local -a revs
|
||||
revs=($(git rev-list --reverse $track_merge..HEAD))
|
||||
if [ $#revs -gt 0 ]; then
|
||||
local base=$(git describe --always $revs[1]~1)
|
||||
local base_name=$(git name-rev --name-only $base)
|
||||
local base_short=$(git describe --always $base)
|
||||
local word_commits
|
||||
if [ $#revs -gt 1 ]; then
|
||||
word_commits='commits'
|
||||
else
|
||||
word_commits='commit'
|
||||
fi
|
||||
|
||||
local conj="since"
|
||||
if [[ "$base" == "$tracked" ]]; then
|
||||
conj+=" tracked"
|
||||
tracked=
|
||||
fi
|
||||
commits+="$#revs $word_commits $conj $pc[scm_branch]$base_name$pc[punc]($pc[scm_commitid]$base_short$pc[punc])$pc[reset]"
|
||||
fi
|
||||
|
||||
if [ -n "$tracked" ]; then
|
||||
local track_name=$track_merge
|
||||
if [[ $track_remote == "." ]]; then
|
||||
track_name=${track_name##*/}
|
||||
fi
|
||||
tracked=$(git describe --always $tracked)
|
||||
commits+="tracking $pc[scm_branch]$track_name$pc[punc]"
|
||||
if [[ "$tracked" != "$gitcommit" ]]; then
|
||||
commits[$#commits]+="($pc[scm_commitid]$tracked$pc[punc])"
|
||||
fi
|
||||
commits[$#commits]+="$pc[reset]"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
gitsvn=$(git rev-parse --verify -q --short git-svn)
|
||||
if [ $? -eq 0 ]; then
|
||||
gitsvnrev=$(zgit_svnhead $gitsvn)
|
||||
gitsvn=$(git describe --always $gitsvn)
|
||||
if [ -n "$gitsvnrev" ]; then
|
||||
local svninfo=''
|
||||
local -a revs
|
||||
svninfo+="$pc[default]svn$pc[punc]:$pc[scm_branch]r$gitsvnrev"
|
||||
revs=($(git rev-list git-svn..HEAD))
|
||||
if [ $#revs -gt 0 ]; then
|
||||
svninfo+="$pc[punc]@$pc[default]HEAD~$#revs"
|
||||
svninfo+="$pc[punc]($pc[scm_commitid]$gitsvn$pc[punc])"
|
||||
fi
|
||||
commits+=$svninfo
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $#commits -gt 0 ]; then
|
||||
echo -n " ${(j: :)commits}"
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_wunjo_scm_branch() {
|
||||
zgit_isgit || return
|
||||
local -A pc
|
||||
pc=(${(kv)wunjo_prompt_colors})
|
||||
|
||||
echo -n "$pc[punc]:$pc[scm_branch]$(zgit_head)"
|
||||
|
||||
if zgit_inworktree; then
|
||||
if ! zgit_isindexclean; then
|
||||
echo -n "$pc[scm_status_staged]+"
|
||||
fi
|
||||
|
||||
local -a dirty
|
||||
if ! zgit_isworktreeclean; then
|
||||
dirty+='!'
|
||||
fi
|
||||
|
||||
if zgit_hasunmerged; then
|
||||
dirty+='*'
|
||||
fi
|
||||
|
||||
if zgit_hasuntracked; then
|
||||
dirty+='?'
|
||||
fi
|
||||
|
||||
if [ $#dirty -gt 0 ]; then
|
||||
echo -n "$pc[scm_status_dirty]${(j::)dirty}"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo $pc[reset]
|
||||
}
|
||||
|
||||
prompt_wunjo_setup "$@"
|
||||
|
||||
# vim:set ft=zsh:
|
||||
248
zsh/func/zgitinit
Normal file
248
zsh/func/zgitinit
Normal file
@@ -0,0 +1,248 @@
|
||||
##
|
||||
## Load with `autoload -U zgitinit; zgitinit'
|
||||
##
|
||||
|
||||
typeset -gA zgit_info
|
||||
zgit_info=()
|
||||
|
||||
zgit_chpwd_hook() {
|
||||
zgit_info_update
|
||||
}
|
||||
|
||||
zgit_preexec_hook() {
|
||||
if [[ $2 == git\ * ]] || [[ $2 == *\ git\ * ]]; then
|
||||
zgit_precmd_do_update=1
|
||||
fi
|
||||
}
|
||||
|
||||
zgit_precmd_hook() {
|
||||
if [ $zgit_precmd_do_update ]; then
|
||||
unset zgit_precmd_do_update
|
||||
zgit_info_update
|
||||
fi
|
||||
}
|
||||
|
||||
zgit_info_update() {
|
||||
zgit_info=()
|
||||
|
||||
local gitdir=$(git rev-parse --git-dir 2>/dev/null)
|
||||
if [ $? -ne 0 ] || [ -z "$gitdir" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
zgit_info[dir]=$gitdir
|
||||
zgit_info[bare]=$(git rev-parse --is-bare-repository)
|
||||
zgit_info[inwork]=$(git rev-parse --is-inside-work-tree)
|
||||
}
|
||||
|
||||
zgit_isgit() {
|
||||
if [ -z "$zgit_info[dir]" ]; then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
zgit_inworktree() {
|
||||
zgit_isgit || return
|
||||
if [ "$zgit_info[inwork]" = "true" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
zgit_isbare() {
|
||||
zgit_isgit || return
|
||||
if [ "$zgit_info[bare]" = "true" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
zgit_head() {
|
||||
zgit_isgit || return 1
|
||||
|
||||
if [ -z "$zgit_info[head]" ]; then
|
||||
local name=''
|
||||
name=$(git symbolic-ref -q HEAD)
|
||||
if [ $? -eq 0 ]; then
|
||||
if [[ $name == refs/(heads|tags)/* ]]; then
|
||||
name=${name#refs/(heads|tags)/}
|
||||
fi
|
||||
else
|
||||
name=$(git name-rev --name-only --no-undefined --always HEAD)
|
||||
if [ $? -ne 0 ]; then
|
||||
return 1
|
||||
elif [[ $name == remotes/* ]]; then
|
||||
name=${name#remotes/}
|
||||
fi
|
||||
fi
|
||||
zgit_info[head]=$name
|
||||
fi
|
||||
|
||||
echo $zgit_info[head]
|
||||
}
|
||||
|
||||
zgit_branch() {
|
||||
zgit_isgit || return 1
|
||||
zgit_isbare && return 1
|
||||
|
||||
if [ -z "$zgit_info[branch]" ]; then
|
||||
local branch=$(git symbolic-ref HEAD 2>/dev/null)
|
||||
if [ $? -eq 0 ]; then
|
||||
branch=${branch##*/}
|
||||
else
|
||||
branch=$(git name-rev --name-only --always HEAD)
|
||||
fi
|
||||
zgit_info[branch]=$branch
|
||||
fi
|
||||
|
||||
echo $zgit_info[branch]
|
||||
return 0
|
||||
}
|
||||
|
||||
zgit_tracking_remote() {
|
||||
zgit_isgit || return 1
|
||||
zgit_isbare && return 1
|
||||
|
||||
local branch
|
||||
if [ -n "$1" ]; then
|
||||
branch=$1
|
||||
elif [ -z "$zgit_info[branch]" ]; then
|
||||
branch=$(zgit_branch)
|
||||
[ $? -ne 0 ] && return 1
|
||||
else
|
||||
branch=$zgit_info[branch]
|
||||
fi
|
||||
|
||||
local k="tracking_$branch"
|
||||
local remote
|
||||
if [ -z "$zgit_info[$k]" ]; then
|
||||
remote=$(git config branch.$branch.remote)
|
||||
zgit_info[$k]=$remote
|
||||
fi
|
||||
|
||||
echo $zgit_info[$k]
|
||||
return 0
|
||||
}
|
||||
|
||||
zgit_tracking_merge() {
|
||||
zgit_isgit || return 1
|
||||
zgit_isbare && return 1
|
||||
|
||||
local branch
|
||||
if [ -z "$zgit_info[branch]" ]; then
|
||||
branch=$(zgit_branch)
|
||||
[ $? -ne 0 ] && return 1
|
||||
else
|
||||
branch=$zgit_info[branch]
|
||||
fi
|
||||
|
||||
local remote=$(zgit_tracking_remote $branch)
|
||||
[ $? -ne 0 ] && return 1
|
||||
if [ -n "$remote" ]; then # tracking branch
|
||||
local merge=$(git config branch.$branch.merge)
|
||||
if [ $remote != "." ]; then
|
||||
merge=$remote/$(basename $merge)
|
||||
fi
|
||||
echo $merge
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
zgit_isindexclean() {
|
||||
zgit_isgit || return 1
|
||||
if git diff --quiet --cached 2>/dev/null; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
zgit_isworktreeclean() {
|
||||
zgit_isgit || return 1
|
||||
if git diff --quiet 2>/dev/null; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
zgit_hasuntracked() {
|
||||
zgit_isgit || return 1
|
||||
local -a flist
|
||||
flist=($(git ls-files --others --exclude-standard))
|
||||
if [ $#flist -gt 0 ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
zgit_hasunmerged() {
|
||||
zgit_isgit || return 1
|
||||
local -a flist
|
||||
flist=($(git ls-files -u))
|
||||
if [ $#flist -gt 0 ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
zgit_svnhead() {
|
||||
zgit_isgit || return 1
|
||||
|
||||
local commit=$1
|
||||
if [ -z "$commit" ]; then
|
||||
commit='HEAD'
|
||||
fi
|
||||
|
||||
git show --raw $commit | \
|
||||
grep git-svn-id | \
|
||||
sed -re 's/^\s*git-svn-id: .*@([0-9]+).*$/\1/'
|
||||
}
|
||||
|
||||
zgit_rebaseinfo() {
|
||||
zgit_isgit || return 1
|
||||
if [ -d $zgit_info[dir]/rebase-merge ]; then
|
||||
dotest=$zgit_info[dir]/rebase-merge
|
||||
elif [ -d $zgit_info[dir]/.dotest-merge ]; then
|
||||
dotest=$zgit_info[dir]/.dotest-merge
|
||||
elif [ -d .dotest ]; then
|
||||
dotest=.dotest
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
|
||||
zgit_info[dotest]=$dotest
|
||||
|
||||
zgit_info[rb_onto]=$(cat "$dotest/onto")
|
||||
zgit_info[rb_upstream]=$(cat "$dotest/upstream")
|
||||
if [ -f "$dotest/orig-head" ]; then
|
||||
zgit_info[rb_head]=$(cat "$dotest/orig-head")
|
||||
elif [ -f "$dotest/head" ]; then
|
||||
zgit_info[rb_head]=$(cat "$dotest/head")
|
||||
fi
|
||||
zgit_info[rb_head_name]=$(cat "$dotest/head-name")
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
zgitinit() {
|
||||
typeset -ga chpwd_functions
|
||||
typeset -ga preexec_functions
|
||||
typeset -ga precmd_functions
|
||||
chpwd_functions+='zgit_chpwd_hook'
|
||||
preexec_functions+='zgit_preexec_hook'
|
||||
precmd_functions+='zgit_precmd_hook'
|
||||
}
|
||||
|
||||
zgitinit
|
||||
zgit_info_update
|
||||
|
||||
# vim:set ft=zsh:
|
||||
25
zshenv
Normal file
25
zshenv
Normal file
@@ -0,0 +1,25 @@
|
||||
# ignore globals because of bug
|
||||
# http://ubuntuforums.org/showthread.php?t=240782
|
||||
|
||||
setopt noglobalrcs
|
||||
|
||||
# copied from globals
|
||||
if [[ -z "$PATH" || "$PATH" == "/bin:/usr/bin" ]]
|
||||
then
|
||||
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
|
||||
fi
|
||||
|
||||
# own environment adjustments
|
||||
export PATH=$PATH:$HOME/bin
|
||||
|
||||
export EDITOR="/usr/bin/vim"
|
||||
export PAGER="/usr/bin/less"
|
||||
|
||||
# add texlive path, so no confilicts with install-info
|
||||
|
||||
PATH=/usr/local/texlive/2008/bin/i386-linux:$PATH; export PATH
|
||||
MANPATH=/usr/local/texlive/2008/texmf/doc/man:$MANPATH; export MANPATH
|
||||
INFOPATH=/usr/local/texlive/2008/texmf/doc/info:$INFOPATH; export INFOPATH
|
||||
|
||||
fpath=($fpath $HOME/.zsh/func)
|
||||
typeset -U fpath
|
||||
232
zshrc
Normal file
232
zshrc
Normal file
@@ -0,0 +1,232 @@
|
||||
# copied from globals, that will be ignored
|
||||
|
||||
if [[ "$TERM" != emacs ]]; then
|
||||
[[ -z "$terminfo[kdch1]" ]] || bindkey -M emacs "$terminfo[kdch1]" delete-char
|
||||
[[ -z "$terminfo[khome]" ]] || bindkey -M emacs "$terminfo[khome]" beginning-of-line
|
||||
[[ -z "$terminfo[kend]" ]] || bindkey -M emacs "$terminfo[kend]" end-of-line
|
||||
[[ -z "$terminfo[kich1]" ]] || bindkey -M emacs "$terminfo[kich1]" overwrite-mode
|
||||
[[ -z "$terminfo[kdch1]" ]] || bindkey -M vicmd "$terminfo[kdch1]" vi-delete-char
|
||||
[[ -z "$terminfo[khome]" ]] || bindkey -M vicmd "$terminfo[khome]" vi-beginning-of-line
|
||||
[[ -z "$terminfo[kend]" ]] || bindkey -M vicmd "$terminfo[kend]" vi-end-of-line
|
||||
[[ -z "$terminfo[kich1]" ]] || bindkey -M vicmd "$terminfo[kich1]" overwrite-mode
|
||||
|
||||
[[ -z "$terminfo[cuu1]" ]] || bindkey -M viins "$terminfo[cuu1]" vi-up-line-or-history
|
||||
[[ -z "$terminfo[cuf1]" ]] || bindkey -M viins "$terminfo[cuf1]" vi-forward-char
|
||||
[[ -z "$terminfo[kcuu1]" ]] || bindkey -M viins "$terminfo[kcuu1]" vi-up-line-or-history
|
||||
[[ -z "$terminfo[kcud1]" ]] || bindkey -M viins "$terminfo[kcud1]" vi-down-line-or-history
|
||||
[[ -z "$terminfo[kcuf1]" ]] || bindkey -M viins "$terminfo[kcuf1]" vi-forward-char
|
||||
[[ -z "$terminfo[kcub1]" ]] || bindkey -M viins "$terminfo[kcub1]" vi-backward-char
|
||||
|
||||
# ncurses fogyatekos
|
||||
#[[ "$terminfo[kcuu1]" == "O"* ]] && bindkey -M viins "${terminfo[kcuu1]/O/[}" vi-up-line-or-history
|
||||
[[ "$terminfo[kcud1]" == "O"* ]] && bindkey -M viins "${terminfo[kcud1]/O/[}" vi-down-line-or-history
|
||||
[[ "$terminfo[kcuf1]" == "O"* ]] && bindkey -M viins "${terminfo[kcuf1]/O/[}" vi-forward-char
|
||||
[[ "$terminfo[kcub1]" == "O"* ]] && bindkey -M viins "${terminfo[kcub1]/O/[}" vi-backward-char
|
||||
[[ "$terminfo[khome]" == "O"* ]] && bindkey -M viins "${terminfo[khome]/O/[}" beginning-of-line
|
||||
[[ "$terminfo[kend]" == "O"* ]] && bindkey -M viins "${terminfo[kend]/O/[}" end-of-line
|
||||
[[ "$terminfo[khome]" == "O"* ]] && bindkey -M emacs "${terminfo[khome]/O/[}" beginning-of-line
|
||||
[[ "$terminfo[kend]" == "O"* ]] && bindkey -M emacs "${terminfo[kend]/O/[}" end-of-line
|
||||
fi
|
||||
|
||||
zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin \
|
||||
/usr/sbin /usr/bin /sbin /bin /usr/X11R6/bin
|
||||
|
||||
autoload run-help
|
||||
|
||||
# If you don't want compinit called here, place the line
|
||||
# skip_global_compinit=1
|
||||
# in your $ZDOTDIR/.zshenv or $ZDOTDIR/.zprofice
|
||||
if [[ -z "$skip_global_compinit" ]]; then
|
||||
autoload -U compinit
|
||||
compinit
|
||||
fi
|
||||
|
||||
zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin \
|
||||
/usr/sbin /usr/bin /sbin /bin /usr/X11R6/bin
|
||||
|
||||
unalias run-help
|
||||
autoload run-help
|
||||
|
||||
# If you don't want compinit called here, place the line
|
||||
# skip_global_compinit=1
|
||||
# in your $ZDOTDIR/.zshenv or $ZDOTDIR/.zprofice
|
||||
if [[ -z "$skip_global_compinit" ]]; then
|
||||
autoload -U compinit
|
||||
compinit
|
||||
fi
|
||||
|
||||
##################################################################
|
||||
# my own confs
|
||||
|
||||
### check for DIST
|
||||
if [ -f /etc/redhat-release ]; then
|
||||
DIST="redhat"
|
||||
elif [ -f /etc/debian_version ]; then
|
||||
DIST="debian"
|
||||
elif [ -f /etc/gentoo-release ] || [ -f /usr/bin/emerge ]; then
|
||||
DIST="gentoo"
|
||||
elif [ -f /etc/arch-release ]; then
|
||||
DIST="arch"
|
||||
fi
|
||||
|
||||
### check for DOMAINNAME
|
||||
DOMAINNAME=$(dnsdomainname 2>/dev/null || hostname -d)
|
||||
case "${DOMAINNAME}" in
|
||||
|
||||
stratoserver.net*)
|
||||
;;
|
||||
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
### check for HOSTNAME
|
||||
HOSTNAME=$(hostname 2>/dev/null || hostname -f)
|
||||
case "${HOSTNAME}" in
|
||||
|
||||
h1450889.stratoserver.net*)
|
||||
;;
|
||||
igrats.de*)
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
|
||||
# vim keyset
|
||||
bindkey -v
|
||||
|
||||
## get keys working
|
||||
# found at http://maxime.ritter.eu.org/stuff/zshrc
|
||||
case $TERM in
|
||||
linux)
|
||||
bindkey "^[[2~" yank
|
||||
bindkey "^[[3~" delete-char
|
||||
bindkey "^[[5~" up-line-or-history ## PageUp
|
||||
bindkey "^[[6~" down-line-or-history ## PageDown
|
||||
bindkey "^[[1~" beginning-of-line
|
||||
bindkey "^[[4~" end-of-line
|
||||
bindkey "^[e" expand-cmd-path ## C-e for expanding path of typed command
|
||||
bindkey "^[[A" up-line-or-search ## up arrow for back-history-search
|
||||
bindkey "^[[B" down-line-or-search ## down arrow for fwd-history-search
|
||||
bindkey " " magic-space ## do history expansion on space
|
||||
;;
|
||||
*xterm*|rxvt|(dt|k|E)term)
|
||||
bindkey "^[[2~" yank
|
||||
bindkey "^[[3~" delete-char
|
||||
bindkey "^[[5~" up-line-or-history ## PageUp
|
||||
bindkey "^[[6~" down-line-or-history ## PageDown
|
||||
bindkey "^[[7~" beginning-of-line
|
||||
bindkey "^[[8~" end-of-line
|
||||
bindkey "^[e" expand-cmd-path ## C-e for expanding path of typed command
|
||||
bindkey "^[[A" up-line-or-search ## up arrow for back-history-search
|
||||
bindkey "^[[B" down-line-or-search ## down arrow for fwd-history-search
|
||||
bindkey " " magic-space ## do history expansion on space
|
||||
;;
|
||||
esac
|
||||
|
||||
# no freakin' beeeep
|
||||
unsetopt beep
|
||||
|
||||
# History
|
||||
HISTFILE=~/.histfile
|
||||
HISTSIZE=1000
|
||||
SAVEHIST=1000
|
||||
|
||||
setopt EXTENDED_HISTORY
|
||||
setopt HIST_IGNORE_ALL_DUPS
|
||||
setopt HIST_NO_FUNCTIONS
|
||||
setopt HIST_REDUCE_BLANKS
|
||||
|
||||
setopt INC_APPEND_HISTORY
|
||||
setopt SHARE_HISTORY
|
||||
|
||||
setopt HIST_VERIFY
|
||||
|
||||
# Alias
|
||||
alias ls="ls --color=auto -T 0"
|
||||
|
||||
# Completion
|
||||
zmodload -i zsh/complist
|
||||
|
||||
# display colored directory entries
|
||||
# display current dircolors with dircolors -p
|
||||
if [ -f ${HOME}/.dir_colors ]
|
||||
then
|
||||
eval $(dircolors -b ${HOME}/.dir_colors)
|
||||
elif [ -f /etc/DIR_COLORS ]
|
||||
then
|
||||
eval $(dircolors -b /etc/DIR_COLORS)
|
||||
fi
|
||||
|
||||
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
|
||||
zstyle ':completion:*:*:kill:*' list-colors '=%*=01;31'
|
||||
|
||||
# Load the completion system
|
||||
autoload -U compinit
|
||||
compinit
|
||||
zstyle ':completion:*:*:kill:*:jobs' verbose yes
|
||||
|
||||
autoload -U sched
|
||||
|
||||
|
||||
# From the zshwiki. Hide CVS files/directores from being completed.
|
||||
zstyle ':completion:*:(all-|)files' ignored-patterns '(|*/)CVS'
|
||||
zstyle ':completion:*:cd:*' ignored-patterns '(*/)#CVS'
|
||||
|
||||
# insert all expansions for expand completer
|
||||
zstyle ':completion:*:expand:*' tag-order all-expansions
|
||||
|
||||
# formatting and messages
|
||||
zstyle ':completion:*' verbose yes
|
||||
zstyle ':completion:*:descriptions' format '%B%d%b'
|
||||
zstyle ':completion:*:messages' format '%d'
|
||||
zstyle ':completion:*:warnings' format 'No matches for: %d'
|
||||
zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b'
|
||||
zstyle ':completion:*' group-name ''
|
||||
|
||||
# turns off spelling correction for commands
|
||||
setopt nocorrect
|
||||
# ORRECTALL option turns on spelling correction for all arguments
|
||||
setopt nocorrectall
|
||||
|
||||
setopt interactivecomments
|
||||
|
||||
|
||||
setopt extendedglob
|
||||
|
||||
setopt EXTENDEDGLOB # file globbing is awesome
|
||||
setopt AUTOMENU # Tab-completion should cycle.
|
||||
setopt AUTOLIST # ... and list the possibilities.
|
||||
setopt AUTO_PARAM_SLASH # Make directories pretty.
|
||||
setopt ALWAYS_TO_END # Push that cursor on completions.
|
||||
setopt AUTOCD # jump to the directory.
|
||||
setopt NO_BEEP # self explanatory
|
||||
setopt AUTO_NAME_DIRS # change directories to variable names
|
||||
setopt CHASE_LINKS # if you pwd from a symlink, you get the actual path
|
||||
setopt AUTO_CONTINUE # automatically sent a CONT signal by disown
|
||||
setopt LONG_LIST_JOBS # List jobs in the long format by default
|
||||
|
||||
|
||||
# prompt
|
||||
if test -z $SSH_TTY
|
||||
then
|
||||
PROMPT=$'%{\e[01;32m%}\%j,%{\e[01;36m%}%m.%l,%{\e[01;34m%}%?,%{\e[01;33m%}\%1~ %{\e[01;32m%}$%{\e[0m%} '
|
||||
[ $UID = 0 ] && export PROMPT=$'%{\e[0;31m%}[%{\e[0m%}%n%{\e[0;31m%}@%{\e[0m%}%m%{\e[0;31m%}:%{\e[0m%}%~%{\e[0;31m%}]%{\e[0m%}%# '
|
||||
else
|
||||
PROMPT=$'%{\e[01;32m%}\%j,%{\e[01;36m%}%m,%{\e[01;34m%}%?,%{\e[01;33m%}\%1~ %{\e[01;32m%}$%{\e[0m%} '
|
||||
[ $UID = 0 ] && export PROMPT=$'%{\e[0;31m%}[%{\e[0m%}%n%{\e[0;31m%}@%{\e[0m%}%m%{\e[0;31m%}:%{\e[0m%}%~%{\e[0;31m%}]%{\e[0m%}%# '
|
||||
fi
|
||||
|
||||
|
||||
# zgitinit and prompt_wunjo_setup must be somewhere in your $fpath, see README for more.
|
||||
|
||||
setopt promptsubst
|
||||
|
||||
# Load the prompt theme system
|
||||
autoload -U promptinit
|
||||
promptinit
|
||||
|
||||
# Use the wunjo prompt theme
|
||||
prompt wunjo
|
||||
Reference in New Issue
Block a user