Added some plugins and made some shortcuts in vimrc

This commit is contained in:
Ian 2012-06-01 15:49:20 -04:00
parent 04cf66751d
commit fb0350983f
11 changed files with 7809 additions and 82 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,79 +1,36 @@
'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'*
: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*
AN alternate.txt /*AN*
AS alternate.txt /*AS*
AT alternate.txt /*AT*
AV alternate.txt /*AV*
IH alternate.txt /*IH*
IHN alternate.txt /*IHN*
IHS alternate.txt /*IHS*
IHT alternate.txt /*IHT*
IHV alternate.txt /*IHV*
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()*
alternate alternate.txt /*alternate*
alternate-acknowledgments alternate.txt /*alternate-acknowledgments*
alternate-commands alternate.txt /*alternate-commands*
alternate-config alternate.txt /*alternate-config*
alternate-installation alternate.txt /*alternate-installation*
alternate-purpose alternate.txt /*alternate-purpose*
alternate-support alternate.txt /*alternate-support*
alternate.txt alternate.txt /*alternate.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*
:TComment tcomment.txt /*:TComment*
:TCommentAs tcomment.txt /*:TCommentAs*
:TCommentBlock tcomment.txt /*:TCommentBlock*
:TCommentInline tcomment.txt /*:TCommentInline*
:TCommentMaybeInline tcomment.txt /*:TCommentMaybeInline*
:TCommentRight tcomment.txt /*:TCommentRight*
g:tcomment#ignore_char_type tcomment.txt /*g:tcomment#ignore_char_type*
g:tcomment#syntax_substitute tcomment.txt /*g:tcomment#syntax_substitute*
g:tcommentBlankLines tcomment.txt /*g:tcommentBlankLines*
g:tcommentBlockC tcomment.txt /*g:tcommentBlockC*
g:tcommentBlockC2 tcomment.txt /*g:tcommentBlockC2*
g:tcommentBlockXML tcomment.txt /*g:tcommentBlockXML*
g:tcommentGuessFileType tcomment.txt /*g:tcommentGuessFileType*
g:tcommentGuessFileType_django tcomment.txt /*g:tcommentGuessFileType_django*
g:tcommentGuessFileType_dsl tcomment.txt /*g:tcommentGuessFileType_dsl*
g:tcommentGuessFileType_html tcomment.txt /*g:tcommentGuessFileType_html*
g:tcommentGuessFileType_php tcomment.txt /*g:tcommentGuessFileType_php*
g:tcommentGuessFileType_tskeleton tcomment.txt /*g:tcommentGuessFileType_tskeleton*
g:tcommentGuessFileType_vim tcomment.txt /*g:tcommentGuessFileType_vim*
g:tcommentIgnoreTypes_php tcomment.txt /*g:tcommentIgnoreTypes_php*
g:tcommentInlineC tcomment.txt /*g:tcommentInlineC*
g:tcommentInlineXML tcomment.txt /*g:tcommentInlineXML*
g:tcommentMapLeaderOp1 tcomment.txt /*g:tcommentMapLeaderOp1*
g:tcommentMapLeaderOp2 tcomment.txt /*g:tcommentMapLeaderOp2*
g:tcommentOpModeExtra tcomment.txt /*g:tcommentOpModeExtra*
g:tcommentOptions tcomment.txt /*g:tcommentOptions*
g:tcommentSyntaxMap tcomment.txt /*g:tcommentSyntaxMap*
tcomment#Comment() tcomment.txt /*tcomment#Comment()*
tcomment#CommentAs() tcomment.txt /*tcomment#CommentAs()*
tcomment#DefineType() tcomment.txt /*tcomment#DefineType()*
tcomment#Operator() tcomment.txt /*tcomment#Operator()*
tcomment#OperatorAnyway() tcomment.txt /*tcomment#OperatorAnyway()*
tcomment#OperatorLine() tcomment.txt /*tcomment#OperatorLine()*
tcomment#OperatorLineAnyway() tcomment.txt /*tcomment#OperatorLineAnyway()*
tcomment-maps tcomment.txt /*tcomment-maps*
tcomment.txt tcomment.txt /*tcomment.txt*

View File

@ -0,0 +1,359 @@
*tcomment.txt* An easily extensible & universal comment plugin
Author: Thomas Link, micathom AT gmail com?subject=vim
tcomment provides easy to use, file-type sensible comments for Vim. It
can handle embedded syntax.
TComment works like a toggle, i.e., it will comment out text that
contains uncommented lines, and it will remove comment markup for
already commented text (i.e. text that contains no uncommented lines).
If the file-type is properly defined, TComment will figure out which
comment string to use. Otherwise you use |tcomment#DefineType()| to
override the default choice.
TComment can properly handle an embedded syntax, e.g., ruby/python/perl
regions in vim scripts, HTML or JavaScript in php code etc.
Demo:
http://vimsomnia.blogspot.com/2010/11/tcomment-vim-plugin.html
*tcomment-maps*
Key bindings~
Most of the time the default toggle keys will do what you want (or to be
more precise: what I think you want it to do ;-).
*g:tcommentMapLeaderOp1*
*g:tcommentMapLeaderOp2*
As operator (the prefix can be customized via g:tcommentMapLeaderOp1
and g:tcommentMapLeaderOp2):
gc{motion} :: Toggle comments (for small comments within one line
the &filetype_inline style will be used, if
defined)
gcc :: Toggle comment for the current line
gC{motion} :: Comment region
gCc :: Comment the current line
By default the cursor stays put. If you want the cursor to the end of
the commented text, set |g:tcommentOpModeExtra| to '>' (but this may not
work properly with exclusive motions).
Primary key maps:
<c-_><c-_> :: :TComment
<c-_><space> :: :TComment <QUERY COMMENT-BEGIN ?COMMENT-END>
<c-_>b :: :TCommentBlock
<c-_>a :: :TCommentAs <QUERY COMMENT TYPE>
<c-_>n :: :TCommentAs &filetype <QUERY COUNT>
<c-_>s :: :TCommentAs &filetype_<QUERY COMMENT SUBTYPE>
<c-_>i :: :TCommentInline
<c-_>r :: :TCommentRight
<c-_>p :: Comment the current inner paragraph
A secondary set of key maps is defined for normal mode.
<Leader>__ :: :TComment
<Leader>_p :: Comment the current inner paragraph
<Leader>_<space> :: :TComment <QUERY COMMENT-BEGIN ?COMMENT-END>
<Leader>_i :: :TCommentInline
<Leader>_r :: :TCommentRight
<Leader>_b :: :TCommentBlock
<Leader>_a :: :TCommentAs <QUERY COMMENT TYPE>
<Leader>_n :: :TCommentAs &filetype <QUERY COUNT>
<Leader>_s :: :TCommentAs &filetype_<QUERY COMMENT SUBTYPE>
-----------------------------------------------------------------------
Install~
Edit the vba file and type: >
:so %
See :help vimball for details. If you have difficulties or use vim 7.0,
please make sure, you have the current version of vimball (vimscript
#1502) installed or update your runtime.
========================================================================
Contents~
:TComment ........................... |:TComment|
:TCommentAs ......................... |:TCommentAs|
:TCommentRight ...................... |:TCommentRight|
:TCommentBlock ...................... |:TCommentBlock|
:TCommentInline ..................... |:TCommentInline|
:TCommentMaybeInline ................ |:TCommentMaybeInline|
g:tcommentBlankLines ................ |g:tcommentBlankLines|
g:tcommentOpModeExtra ............... |g:tcommentOpModeExtra|
g:tcommentOptions ................... |g:tcommentOptions|
g:tcomment#ignore_char_type ......... |g:tcomment#ignore_char_type|
g:tcommentGuessFileType ............. |g:tcommentGuessFileType|
g:tcommentGuessFileType_dsl ......... |g:tcommentGuessFileType_dsl|
g:tcommentGuessFileType_php ......... |g:tcommentGuessFileType_php|
g:tcommentGuessFileType_html ........ |g:tcommentGuessFileType_html|
g:tcommentGuessFileType_tskeleton ... |g:tcommentGuessFileType_tskeleton|
g:tcommentGuessFileType_vim ......... |g:tcommentGuessFileType_vim|
g:tcommentGuessFileType_django ...... |g:tcommentGuessFileType_django|
g:tcommentIgnoreTypes_php ........... |g:tcommentIgnoreTypes_php|
g:tcomment#syntax_substitute ........ |g:tcomment#syntax_substitute|
g:tcommentSyntaxMap ................. |g:tcommentSyntaxMap|
g:tcommentBlockC .................... |g:tcommentBlockC|
g:tcommentBlockC2 ................... |g:tcommentBlockC2|
g:tcommentInlineC ................... |g:tcommentInlineC|
g:tcommentBlockXML .................. |g:tcommentBlockXML|
g:tcommentInlineXML ................. |g:tcommentInlineXML|
tcomment#DefineType ................. |tcomment#DefineType()|
tcomment#Comment .................... |tcomment#Comment()|
tcomment#Operator ................... |tcomment#Operator()|
tcomment#OperatorLine ............... |tcomment#OperatorLine()|
tcomment#OperatorAnyway ............. |tcomment#OperatorAnyway()|
tcomment#OperatorLineAnyway ......... |tcomment#OperatorLineAnyway()|
tcomment#CommentAs .................. |tcomment#CommentAs()|
========================================================================
plugin/tcomment.vim~
*:TComment*
:[range]TComment[!] ?ARGS...
If there is a visual selection that begins and ends in the same line,
then |:TCommentInline| is used instead.
The optional range defaults to the current line. With a bang '!',
always comment the line.
ARGS... are either (see also |tcomment#Comment()|):
1. a list of key=value pairs
2. 1-2 values for: ?commentBegin, ?commentEnd
*:TCommentAs*
:[range]TCommentAs[!] commenttype ?ARGS...
TCommentAs requires g:tcomment_{filetype} to be defined.
With a bang '!', always comment the line.
ARGS... are either (see also |tcomment#Comment()|):
1. a list of key=value pairs
2. 1-2 values for: ?commentBegin, ?commentEnd
*:TCommentRight*
:[range]TCommentRight[!] ?ARGS...
Comment the text to the right of the cursor. If a visual selection was
made (be it block-wise or not), all lines are commented out at from
the current cursor position downwards.
With a bang '!', always comment the line.
ARGS... are either (see also |tcomment#Comment()|):
1. a list of key=value pairs
2. 1-2 values for: ?commentBegin, ?commentEnd
*:TCommentBlock*
:[range]TCommentBlock[!] ?ARGS...
Comment as "block", e.g. use the {&ft}_block comment style. The
commented text isn't indented or reformated.
With a bang '!', always comment the line.
ARGS... are either (see also |tcomment#Comment()|):
1. a list of key=value pairs
2. 1-2 values for: ?commentBegin, ?commentEnd
*:TCommentInline*
:[range]TCommentInline[!] ?ARGS...
Use the {&ft}_inline comment style.
With a bang '!', always comment the line.
ARGS... are either (see also |tcomment#Comment()|):
1. a list of key=value pairs
2. 1-2 values for: ?commentBegin, ?commentEnd
*:TCommentMaybeInline*
:[range]TCommentMaybeInline[!] ?ARGS...
With a bang '!', always comment the line.
ARGS... are either (see also |tcomment#Comment()|):
1. a list of key=value pairs
2. 1-2 values for: ?commentBegin, ?commentEnd
========================================================================
autoload/tcomment.vim~
*g:tcommentBlankLines*
g:tcommentBlankLines (default: 1)
If true, comment blank lines too
*g:tcommentOpModeExtra*
g:tcommentOpModeExtra (default: '')
Modifies how the operator works.
> ... Move the cursor to the end of the comment
*g:tcommentOptions*
g:tcommentOptions (default: {})
Other key-value options used by |tcomment#Comment()|.
Example: If you want to put the opening comment marker always in
the first column regardless of the block's indentation, put this
into your |vimrc| file: >
let g:tcommentOptions = {'col': 1}
<
*g:tcomment#ignore_char_type*
g:tcomment#ignore_char_type (default: 1)
|text-objects| for use with |tcomment#Operator| can have different
types: line, block, char etc. Text objects like aB, it, at etc.
have type char but this may not work reliably. By default,
tcomment handles those text objects most often as if they were of
type line. Set this variable to 0 in order to change this
behaviour. Be prepared that the result may not always match your
intentions.
*g:tcommentGuessFileType*
g:tcommentGuessFileType (default: 0)
Guess the file type based on syntax names always or for some fileformat only
If non-zero, try to guess filetypes.
tcomment also checks g:tcommentGuessFileType_{&filetype} for
filetype specific values.
Values:
0 ... don't guess
1 ... guess
FILETYPE ... assume this filetype
*g:tcommentGuessFileType_dsl*
g:tcommentGuessFileType_dsl (default: 'xml')
For dsl documents, assumet filetype = xml.
*g:tcommentGuessFileType_php*
g:tcommentGuessFileType_php (default: 'html')
In php documents, the php part is usually marked as phpRegion. We
thus assume that the buffers default comment style isn't php but
html.
*g:tcommentGuessFileType_html*
g:tcommentGuessFileType_html (default: 1)
*g:tcommentGuessFileType_tskeleton*
g:tcommentGuessFileType_tskeleton (default: 1)
*g:tcommentGuessFileType_vim*
g:tcommentGuessFileType_vim (default: 1)
*g:tcommentGuessFileType_django*
g:tcommentGuessFileType_django (default: 1)
*g:tcommentIgnoreTypes_php*
g:tcommentIgnoreTypes_php (default: 'sql')
In php files, some syntax regions are wongly highlighted as sql
markup. We thus ignore sql syntax when guessing the filetype in
php files.
*g:tcomment#syntax_substitute*
g:tcomment#syntax_substitute (default: {...})
*g:tcommentSyntaxMap*
g:tcommentSyntaxMap (default: {...})
tcomment guesses filetypes based on the name of the current syntax
region. This works well if the syntax names match
/filetypeSomeName/. Other syntax names have to be explicitly
mapped onto the corresponding filetype.
*g:tcommentBlockC*
g:tcommentBlockC (default: {...})
Generic c-like block comments.
*g:tcommentBlockC2*
g:tcommentBlockC2 (default: {...})
Generic c-like block comments (alternative markup).
*g:tcommentInlineC*
g:tcommentInlineC (default: "/* %s */")
Generic c-like comments.
*g:tcommentBlockXML*
g:tcommentBlockXML (default: "<!--%s-->\n ")
Generic xml-like block comments.
*g:tcommentInlineXML*
g:tcommentInlineXML (default: "<!-- %s -->")
Generic xml-like comments.
*tcomment#DefineType()*
tcomment#DefineType(name, commentdef)
If you don't explicitly define a comment style, |:TComment| will use
'commentstring' instead. We override the default values here in order
to have a blank after the comment marker. Block comments work only if
we explicitly define the markup.
The comment definition can be either a string or a dictionary.
If it is a string:
The format for block comments is similar to 'commentstrings' with the
exception that the format strings for blocks can contain a second line
that defines how "middle lines" (see :h format-comments) should be
displayed.
If it is a dictionary:
See the help on the args argument of |tcomment#Comment|.
*tcomment#Comment()*
tcomment#Comment(beg, end, ...)
tcomment#Comment(line1, line2, ?commentMode, ?commentAnyway, ?args...)
args... are either:
1. a list of key=value pairs where known keys are (see also
|g:tcommentOptions|):
as=STRING ... Use a specific comment definition
col=N ... Start the comment at column N (in block
mode; must be smaller than |indent()|)
mode=STRING ... See the notes below on the "commentMode" argument
begin=STRING ... Comment prefix
end=STRING ... Comment postfix
middle=STRING ... Middle line comments in block mode
rxbeg=N ... Regexp to find the substring of "begin"
that should be multipied by "count"
rxend=N ... The above for "end"
rxmid=N ... The above for "middle"
commentstring_rx ... A regexp format string that matches
commented lines (no new groups may be
introduced, the |regexp| is |\V|; % have
to be doubled); "commentstring", "begin"
and optionally "end" must be defined or
deducible.
2. 1-2 values for: ?commentPrefix, ?commentPostfix
3. a dictionary (internal use only)
commentMode:
G ... guess the value of commentMode
B ... block (use extra lines for the comment markers)
i ... maybe inline, guess
I ... inline
R ... right (comment the line right of the cursor)
v ... visual
o ... operator
By default, each line in range will be commented by adding the comment
prefix and postfix.
*tcomment#Operator()*
tcomment#Operator(type, ...)
*tcomment#OperatorLine()*
tcomment#OperatorLine(type)
*tcomment#OperatorAnyway()*
tcomment#OperatorAnyway(type)
*tcomment#OperatorLineAnyway()*
tcomment#OperatorLineAnyway(type)
*tcomment#CommentAs()*
tcomment#CommentAs(beg, end, commentAnyway, filetype, ?args...)
Where args is either:
1. A count NUMBER
2. An args list (see the notes on the "args" argument of
|tcomment#Comment()|)
comment text as if it were of a specific filetype
vim:tw=78:fo=tcq2:isk=!-~,^*,^|,^":ts=8:ft=help:norl:

View File

@ -0,0 +1,41 @@
" ============================================================================
" 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

View File

@ -0,0 +1,224 @@
" ============================================================================
" 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 current node', 'shortcut': 'm', 'callback': 'NERDTreeMoveNode'})
call NERDTreeAddMenuItem({'text': '(d)elete the current node', 'shortcut': 'd', 'callback': 'NERDTreeDeleteNode'})
if has("gui_mac") || has("gui_macvim")
call NERDTreeAddMenuItem({'text': '(r)eveal in Finder the current node', 'shortcut': 'r', 'callback': 'NERDTreeRevealInFinder'})
call NERDTreeAddMenuItem({'text': '(o)pen the current node with system editor', 'shortcut': 'o', 'callback': 'NERDTreeExecuteFile'})
call NERDTreeAddMenuItem({'text': '(q)uicklook the current node', 'shortcut': 'q', 'callback': 'NERDTreeQuickLook'})
endif
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() . g:NERDTreePath.Slash(), "file")
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(), "file")
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(), "file")
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)
if !empty(newNode)
call NERDTreeRender()
call newNode.putCursorHere(0, 0)
endif
catch /^NERDTree/
call s:echoWarning("Could not copy node")
endtry
endif
else
call s:echo("Copy aborted.")
endif
redraw
endfunction
function! NERDTreeQuickLook()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode != {}
call system("qlmanage -p 2>/dev/null '" . treenode.path.str() . "'")
endif
endfunction
function! NERDTreeRevealInFinder()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode != {}
let x = system("open -R '" . treenode.path.str() . "'")
endif
endfunction
function! NERDTreeExecuteFile()
let treenode = g:NERDTreeFileNode.GetSelected()
if treenode != {}
let x = system("open '" . treenode.path.str() . "'")
endif
endfunction
" vim: set sw=4 sts=4 et fdm=marker:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,524 @@
" Buffet Plugin for VIM > 7.3 version 2.10
"
" A fast, simple and easy to use pluggin for switching and managing buffers.
"
" Usage:
"
" Copy the file buffet.vim to the plugins directory.
" The command to open the buffer list is
" :Bufferlist
"
" A horizontal window is opened with a list of buffer. the buffer numbers are
" also displayed along side. The user select a buffer by
"
" 1.Entering the buffer number using keyboard. Just start typing the number using keyboard.
" The plugin will search for the buffer with that number and will keep going to the matching
" buffers. Entered number will be shown at the top you can use backspace to edit it.When you
" are in the desired buffer, press enter or any control keys that are
" displayed at the bottom to execute any command available, on that buffer
"
" Available commands
"
" Enter(Replace current buffer)
" o - make window fill with selected buffer
" hh - (Horizontal Split)
" v - (Vertical Split)
" - - (Vertical Diff Split)
" g - (Go to buffer window if it is visible in any tab)
" d - (Delete selected buffer)
" x - (Close window)
" c - (Clear diff flags for all windows)
"
" 2.Move up or down using the navigation keys to reach the buffer line.
"
" 3.Doubleclick on a buffer line using the mouse. Will immediatly switch to
" that buffer
"
" To make this plugin really useful you have to assign a shortcut key for it,
" say you want F2 key to open the buffer list. you can add the following line in your .vimrc file.
"
" map <F2> :Bufferlist<CR>
"
" Last Change: 2012 Jan
" Maintainer: Sandeep.c.r<sandeepcr2@gmail.com>
"
"
function! s:open_new_window(dim)
exe s:currentposition. ' '.a:dim . 'new buflisttempbuffer412393'
set nonu
setlocal bt=nofile
setlocal modifiable
setlocal bt=nowrite
setlocal bufhidden=hide
setlocal noswapfile
setlocal nowrap
setlocal ft=buffet
return bufnr('%')
endfunction
function! s:open_new_vertical_window(dim)
exe a:dim . 'vnew'
set nonu
setlocal bt=nofile
setlocal bt=nowrite
setlocal bufhidden=hide
setlocal noswapfile
return bufnr('%')
endfunction
function! s:cursormove()
let s:lineonclose = line('.')
if(s:lineonclose >len(s:displayed)+1)
call cursor(2,3)
elseif(s:lineonclose ==1 )
call cursor(len(s:displayed)+1,3)
endif
endfunction
function! s:buffet_pathshorten(str)
if(s:detail == 1)
return a:str
else
return pathshorten(a:str)
endif
endfunction
function! s:display_buffer_list(gotolastbuffer)
let l:line = 2
let l:fg = synIDattr(hlID('Statement'),'fg','gui')
let l:bg = synIDattr(hlID('CursorLine'),'bg','gui')
call filter(s:bufrecent,'exists("s:bufferlistlite[v:val]") && v:val!=t:tlistbuf' )
let l:maxlen = 0
let l:headmaxlen = 0
for l:i in keys(s:bufferlistlite)
if(index(s:bufrecent,l:i)==-1)
call add(s:bufrecent,l:i)
endif
let l:temp = strlen(fnamemodify(s:bufferlistlite[l:i],':t'))
let l:headtemp = strlen(s:buffet_pathshorten(fnamemodify(s:bufferlistlite[l:i],':h')))
if(l:headtemp > l:headmaxlen)
let l:headmaxlen = l:headtemp
endif
if(l:temp > l:maxlen)
let l:maxlen = l:temp
endif
endfor
call setline(1,"Buffet-2.10 ( Enter Number to search for a buffer number )")
let s:displayed = []
let s:last_buffer_line = 0
for l:i in s:bufrecent
let l:thisbufno = str2nr(l:i)
let l:bufname = s:bufferlistlite[l:i]
let l:buftailname =fnamemodify(l:bufname,':t')
let l:bufheadlname =s:buffet_pathshorten(fnamemodify(l:bufname,':h'))
if(getbufvar(l:thisbufno,'&modified'))
let l:modifiedflag = " (+) "
else
let l:modifiedflag = " "
endif
let l:padlength = l:maxlen - strlen(l:buftailname) + 2
let l:padlengthhead= l:headmaxlen - strlen(l:bufheadlname) + 2
let l:short_file_name = repeat(' ',2-strlen(l:i)).l:i .' '. l:buftailname.repeat(' ',l:padlength) .l:modifiedflag. l:bufheadlname .repeat(' ',l:padlengthhead)
let l:padstring = repeat(' ',len(l:short_file_name))
if(exists("s:buftotabwindow[l:thisbufno]"))
let l:thistab = s:buftotabwindow[l:thisbufno][0][0]
let l:thiswindow = s:buftotabwindow[l:thisbufno][0][1]
let l:short_file_name = l:short_file_name ." Tab:".l:thistab." Window:".l:thiswindow
call add(s:displayed,[l:thisbufno,l:thistab,l:thiswindow])
if(l:thistab == s:sourcetab && l:thiswindow == s:sourcewindow)
let l:short_file_name = '>'.l:short_file_name ." <"
else
let l:short_file_name = ' '.l:short_file_name
endif
else
let l:short_file_name = ' '.l:short_file_name
call add(s:displayed,[l:thisbufno])
endif
call setline(l:line,l:short_file_name)
let l:subwindow = 1
while(exists("s:buftotabwindow[l:thisbufno][l:subwindow]"))
let l:thistab = s:buftotabwindow[l:thisbufno][l:subwindow][0]
let l:thiswindow = s:buftotabwindow[l:thisbufno][l:subwindow][1]
let l:line += 1
if(l:thistab == s:sourcetab && l:thiswindow == s:sourcewindow)
call setline(l:line,'> '.l:padstring."Tab:".l:thistab." window:".l:thiswindow." <")
else
call setline(l:line,' '.l:padstring."Tab:".l:thistab." window:".l:thiswindow)
endif
call add(s:displayed,[l:thisbufno,l:thistab,l:thiswindow])
let l:subwindow += 1
endwhile
if(s:last_buffer_line == 0)
let s:last_buffer_line = l:line+1
endif
let l:line += 1
endfor
exe "resize ".(len(s:displayed)+4)
call setline(l:line,"")
let l:line+=1
call setline(l:line,"Enter(Load buffer) | hh/v/-/c (Horizontal/Vertical/Vertical Diff Split/Clear Diff) | o(Maximize) | t(New tab) | m(Toggle detail) | g(Go to window) | d(Delete buffer) | x(Close window) ")
let l:fg = synIDattr(hlID('Statement'),'fg','Question')
exe 'highlight buffethelpline guibg=black'
exe 'highlight buffethelpline guifg=orange'
exe '2match buffethelpline /\%1l\|\%'.l:line.'l.\%>1c/'
if(a:gotolastbuffer==1)
call cursor(s:last_buffer_line,3)
else
if(s:lineonclose >len(s:displayed)+1)
let s:lineonclose -=1
endif
call cursor(s:lineonclose,3)
endif
endfunction
function! s:close()
if(exists("t:tlistbuf"))
unlet t:tlistbuf
let s:lineonclose = line('.')
:bdelete buflisttempbuffer412393
echo ''
exe s:sourcewindow. ' wincmd w'
endif
endfunction
function! s:place_sign()
setlocal cursorline
return
exec "sign unplace *"
exec "sign define lineh linehl=Search texthl=Search"
exec "sign place 10 name=lineh line=".line('.')." buffer=" . t:tlistbuf
endfunction
function! s:getallbuffers()
let l:buffers = filter(range(1,bufnr('$')), 'buflisted(v:val)')
let l:return = {}
for i in l:buffers
let l:bufname = bufname(i)
if(strlen(l:bufname)==0)
let l:bufname = "[No Name]"
endif
let l:return[i] = l:bufname
endfor
return l:return
endfunction
function! s:printmessage(msg)
setlocal modifiable
call setline(len(s:displayed)+2,a:msg)
setlocal nomodifiable
endfunction
function! s:press(num)
if(a:num==-1)
let s:keybuf = strpart(s:keybuf,0,len(s:keybuf)-1)
else
let s:keybuf = s:keybuf . a:num
endif
setlocal modifiable
call setline(1 ,'Buffet-2.10 - Searching for buffer:'.s:keybuf.' (Use backspace to edit)')
let l:index = 0
for l:i in s:displayed
if(l:i[0] == s:keybuf)
let l:index += 2
exe "normal "+l:index+ "gg"
break
endif
let l:index += 1
endfor
setlocal nomodifiable
endfunction
function! s:togglesw()
let s:currentposition = ''
call s:toggle(1)
endfunction
function! s:toggletop()
let s:currentposition = 'topleft'
call s:toggle(1)
endfunction
function! s:toggle(gotolastbuffer)
let s:keybuf = ''
if(exists("t:tlistbuf"))
call s:close()
return 0
endif
let s:bufferlistlite = s:getallbuffers()
let s:sourcebuffer = bufnr('%')
let s:sourcewindow = winnr()
let s:sourcetab = tabpagenr()
let s:buftotabwindow = {}
for l:i in range(tabpagenr('$'))
let l:windowno = 1
for l:bufno in tabpagebuflist(l:i + 1)
if(!exists("s:buftotabwindow[l:bufno]"))
let s:buftotabwindow[l:bufno] = []
endif
call add(s:buftotabwindow[l:bufno], [l:i+1,l:windowno])
let l:windowno += 1
endfor
endfor
let t:tlistbuf = s:open_new_window(len(s:bufrecent)+4)
set nodiff
set noscrollbind
let s:buflistwindow = winnr()
setlocal cursorline
call s:display_buffer_list(a:gotolastbuffer)
"call matchadd('String','[\/\\][^\/\\]*$')
setlocal nomodifiable
map <buffer> <silent> <2-leftrelease> :call <sid>loadbuffer(0)<cr>
nnoremap <buffer> <silent> <C-R> :call <sid>loadbuffer(0)<cr>
nnoremap <buffer> <silent> <C-M> :call <sid>loadbuffer(0)<cr>
nnoremap <buffer> <silent> x :call <sid>closewindow(0)<cr>
nnoremap <buffer> <silent> X :call <sid>closewindow(1)<cr>
nnoremap <buffer> <silent> c :call <sid>cleardiff()<cr>
nnoremap <buffer> <silent> C :call <sid>cleardiff()<cr>
nnoremap <buffer> <silent> d :call <sid>deletebuffer(0)<cr>
nnoremap <buffer> <silent> D :call <sid>deletebuffer(1)<cr>
nnoremap <buffer> <silent> o :call <sid>loadbuffer(1)<cr>
nnoremap <buffer> <silent> O :call <sid>loadbuffer(1)<cr>
nnoremap <buffer> <silent> g :call <sid>gotowindow()<cr>
nnoremap <buffer> <silent> G :call <sid>gotowindow()<cr>
nnoremap <buffer> <silent> s :call <sid>split('h')<cr>
nnoremap <buffer> <silent> S :call <sid>split('h')<cr>
nnoremap <buffer> <silent> t :call <sid>openintab()<cr>
nnoremap <buffer> <silent> T :call <sid>openintab()<cr>
nnoremap <buffer> <silent> hh :call <sid>split('h')<cr>
nnoremap <buffer> <silent> HH :call <sid>split('h')<cr>
nnoremap <buffer> <silent> v :call <sid>split('v')<cr>
nnoremap <buffer> <silent> V :call <sid>split('v')<cr>
nnoremap <buffer> <silent> r :call <sid>refresh()<cr>
nnoremap <buffer> <silent> 0 :call <sid>press(0)<cr>
nnoremap <buffer> <silent> 1 :call <sid>press(1)<cr>
nnoremap <buffer> <silent> 2 :call <sid>press(2)<cr>
nnoremap <buffer> <silent> 3 :call <sid>press(3)<cr>
nnoremap <buffer> <silent> 4 :call <sid>press(4)<cr>
nnoremap <buffer> <silent> 5 :call <sid>press(5)<cr>
nnoremap <buffer> <silent> 6 :call <sid>press(6)<cr>
nnoremap <buffer> <silent> 7 :call <sid>press(7)<cr>
nnoremap <buffer> <silent> 8 :call <sid>press(8)<cr>
nnoremap <buffer> <silent> 9 :call <sid>press(9)<cr>
nnoremap <buffer> <silent> - :call <sid>diff_split('v')<cr>
nnoremap <buffer> <silent> m :call <sid>toggle_detail()<cr>
nnoremap <buffer> <silent> M :call <sid>toggle_detail()<cr>
nnoremap <buffer> <silent> <BS> :call <sid>press(-1)<cr>
nnoremap <buffer> <silent> <Esc> :call <sid>close()<cr>
augroup Tlistaco1
autocmd!
au BufLeave <buffer> call <sid>close()
au CursorMoved <buffer> call <sid>cursormove()
augroup END
endfunction
function! s:toggle_detail()
let s:detail = !s:detail
setlocal modifiable
call s:display_buffer_list(0)
setlocal nomodifiable
endfunction
function! s:cleardiff()
for i in range(1,winnr('$'))
call setwinvar(i,"&diff",0)
call setwinvar(i,"&scrollbind",0)
endfor
endfunction
function! s:deletebuffer(force)
let l:llindex= line('.') - 2
if(exists("s:displayed[l:llindex]") )
let l:selectedbuffer = str2nr(s:displayed[l:llindex][0])
if(getbufvar(str2nr(l:selectedbuffer),'&modified') && a:force == 0 )
call s:printmessage("Buffer contents modified. Use 'D' to force delete.")
else
call s:toggle(0)
exe "bdelete! ".l:selectedbuffer
call s:toggle(0)
endif
else
call s:close()
endif
endfunction
function! s:openintab()
let l:llindex= line('.') - 2
if(exists("s:displayed[l:llindex]"))
exe s:buflistwindow . ' wincmd w'
let l:target = s:displayed[l:llindex][0]
call s:close()
exe "tabnew"
exe l:target. ' buf!'
else
call s:close()
endif
endfunction
function! s:closewindow(force)
let l:llindex= line('.') - 2
if(exists("s:displayed[l:llindex]"))
if(exists("s:displayed[l:llindex][1]"))
if(getbufvar(str2nr(s:displayed[l:llindex][0]),'&modified') && a:force == 0 )
call s:printmessage("Buffer contents modified. Use 'X' to force close.")
else
if(tabpagenr('$')==1 && winnr('$')==2)
call s:printmessage("Not closing last window of the last tab.")
else
exe s:buflistwindow . ' wincmd w'
call s:close()
exe "tabn" .s:displayed[l:llindex][1]
exe s:displayed[l:llindex][2]. ' wincmd w'
:q!
exe "tabn". s:sourcetab
call s:toggle(0)
endif
endif
else
call s:printmessage("Buffer not showing in any tab.")
endif
else
call s:close()
endif
endfunction
function! s:gotowindow()
let l:llindex= line('.') - 2
if(exists("s:displayed[l:llindex]"))
if(exists("s:displayed[l:llindex][1]"))
exe s:buflistwindow . ' wincmd w'
call s:close()
exe "tabn" .s:displayed[l:llindex][1]
exe s:displayed[l:llindex][2]. ' wincmd w'
else
call s:printmessage("Buffer not showing in any tab. Use Enter,v,hh,t or o to open buffer in a window.")
endif
else
call s:close()
endif
endfunction
function! s:loadbuffer(isonly)
let l:llindex= line('.') - 2
if(exists("s:displayed[l:llindex]"))
exe s:buflistwindow . ' wincmd w'
let l:target = s:displayed[l:llindex][0]
call s:close()
call s:switch_buffer(l:target)
if(a:isonly == 1 && winnr('$')>1)
exe 'only!'
endif
else
call s:close()
endif
endfunction
function! s:diff_split(mode)
let l:llindex= line('.') - 2
if(exists("s:displayed[l:llindex]"))
exe s:buflistwindow . ' wincmd w'
let l:target = s:displayed[l:llindex][0]
call s:close()
call s:diff_split_buffer(l:target,a:mode)
else
call s:close()
endif
endfunction
function! s:split(mode)
let l:llindex= line('.') - 2
if(exists("s:displayed[l:llindex]"))
exe s:buflistwindow . ' wincmd w'
let l:target = s:displayed[l:llindex][0]
call s:close()
call s:split_buffer(l:target,a:mode)
else
call s:close()
endif
endfunction
function! s:goto_buffer(bufferno)
if(exists("s:buftotabwindow[a:bufferno]"))
let l:tabno = s:buftotabwindow[a:bufferno][0]
let l:winno = s:buftotabwindow[a:bufferno][1]
exe "tabn" .l:tabno
exe l:winno. ' wincmd w'
endif
endfunction
function! s:removedifforsource()
if(exists("b:buffet_sourcewindowfordiff"))
call setwinvar(b:buffet_sourcewindowfordiff,"&diff",0)
call setwinvar(b:buffet_sourcewindowfordiff,"&scrollbind",0)
endif
endfunction
function! s:diff_split_buffer(bufferno,mode)
if(a:mode == 'v')
exe 'belowright vert '.a:bufferno. ' sbuf'
elseif(a:mode == 'h')
exe 'belowright ' .a:bufferno. ' sbuf'
endif
if(exists("s:buflinenos[a:bufferno]"))
exe "normal "+s:buflinenos[a:bufferno] + "gg"
endif
call setwinvar(s:sourcewindow,"&diff",1)
call setwinvar(s:sourcewindow,"&scrollbind",1)
let b:buffet_sourcewindowfordiff = s:sourcewindow
augroup Tlistaco2
autocmd!
au BufWinLeave <buffer> call <sid>removedifforsource()
augroup END
setlocal diff
setlocal scrollbind
endfunction
function! s:split_buffer(bufferno,mode)
if(a:mode == 'v')
exe 'belowright vert '.a:bufferno. ' sbuf'
elseif(a:mode == 'h')
exe 'belowright ' .a:bufferno. ' sbuf'
endif
if(exists("s:buflinenos[a:bufferno]"))
exe "normal "+s:buflinenos[a:bufferno] + "gg"
endif
set nodiff
set noscrollbind
endfunction
function! s:switch_buffer(bufferno)
exe a:bufferno. ' buf!'
set nodiff
set noscrollbind
if(exists("s:buflinenos[a:bufferno]"))
exe "normal "+s:buflinenos[a:bufferno] + "gg"
endif
endfunction
function! s:updaterecent()
let l:bufname = bufname("%")
let l:j = bufnr('%')
if(strlen(l:bufname) > 0 && getbufvar(l:j,'&modifiable') )
call filter(s:bufrecent, 'v:val !='. l:j)
call insert(s:bufrecent,l:j.'')
endif
endfunction
function! s:savelineno()
let s:buflinenos[bufnr('%')] = line('.')
endfunction
let s:bufrecent = []
let s:buflinenos = {}
let s:bufferlistlite = {}
let s:bufliststatus = 0
let s:keybuf = ''
let s:lineonclose = 3
let s:currentposition = ''
let s:firstrun = 1
let s:detail = 0
augroup Tlistacom
autocmd!
au BufEnter * call <sid>updaterecent()
au BufLeave * call <sid>savelineno()
augroup END
command! Bufferlist :call <sid>toggletop()
command! Bufferlistsw :call <sid>togglesw()

View File

@ -0,0 +1,142 @@
" tComment.vim -- An easily extensible & universal comment plugin
" @Author: Tom Link (micathom AT gmail com)
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 27-Dez-2004.
" @Last Change: 2011-05-26.
" @Revision: 720
" GetLatestVimScripts: 1173 1 tcomment.vim
if &cp || exists('loaded_tcomment')
finish
endif
let loaded_tcomment = 205
if !exists("g:tcommentMapLeader1")
" g:tcommentMapLeader1 should be a shortcut that can be used with
" map, imap, vmap.
let g:tcommentMapLeader1 = '<c-_>'
endif
if !exists("g:tcommentMapLeader2")
" g:tcommentMapLeader2 should be a shortcut that can be used with
" map, xmap.
let g:tcommentMapLeader2 = '<Leader>_'
endif
if !exists("g:tcommentMapLeaderOp1")
let g:tcommentMapLeaderOp1 = 'gc'
endif
if !exists("g:tcommentMapLeaderOp2")
let g:tcommentMapLeaderOp2 = 'gC'
endif
" :display: :[range]TComment[!] ?ARGS...
" If there is a visual selection that begins and ends in the same line,
" then |:TCommentInline| is used instead.
" The optional range defaults to the current line. With a bang '!',
" always comment the line.
"
" ARGS... are either (see also |tcomment#Comment()|):
" 1. a list of key=value pairs
" 2. 1-2 values for: ?commentBegin, ?commentEnd
command! -bang -range -nargs=* -complete=customlist,tcomment#CompleteArgs TComment
\ keepjumps call tcomment#Comment(<line1>, <line2>, 'G', "<bang>", <f-args>)
" :display: :[range]TCommentAs[!] commenttype ?ARGS...
" TCommentAs requires g:tcomment_{filetype} to be defined.
" With a bang '!', always comment the line.
"
" ARGS... are either (see also |tcomment#Comment()|):
" 1. a list of key=value pairs
" 2. 1-2 values for: ?commentBegin, ?commentEnd
command! -bang -complete=customlist,tcomment#Complete -range -nargs=+ TCommentAs
\ call tcomment#CommentAs(<line1>, <line2>, "<bang>", <f-args>)
" :display: :[range]TCommentRight[!] ?ARGS...
" Comment the text to the right of the cursor. If a visual selection was
" made (be it block-wise or not), all lines are commented out at from
" the current cursor position downwards.
" With a bang '!', always comment the line.
"
" ARGS... are either (see also |tcomment#Comment()|):
" 1. a list of key=value pairs
" 2. 1-2 values for: ?commentBegin, ?commentEnd
command! -bang -range -nargs=* -complete=customlist,tcomment#CompleteArgs TCommentRight
\ keepjumps call tcomment#Comment(<line1>, <line2>, 'R', "<bang>", <f-args>)
" :display: :[range]TCommentBlock[!] ?ARGS...
" Comment as "block", e.g. use the {&ft}_block comment style. The
" commented text isn't indented or reformated.
" With a bang '!', always comment the line.
"
" ARGS... are either (see also |tcomment#Comment()|):
" 1. a list of key=value pairs
" 2. 1-2 values for: ?commentBegin, ?commentEnd
command! -bang -range -nargs=* -complete=customlist,tcomment#CompleteArgs TCommentBlock
\ keepjumps call tcomment#Comment(<line1>, <line2>, 'B', "<bang>", <f-args>)
" :display: :[range]TCommentInline[!] ?ARGS...
" Use the {&ft}_inline comment style.
" With a bang '!', always comment the line.
"
" ARGS... are either (see also |tcomment#Comment()|):
" 1. a list of key=value pairs
" 2. 1-2 values for: ?commentBegin, ?commentEnd
command! -bang -range -nargs=* -complete=customlist,tcomment#CompleteArgs TCommentInline
\ keepjumps call tcomment#Comment(<line1>, <line2>, 'I', "<bang>", <f-args>)
" :display: :[range]TCommentMaybeInline[!] ?ARGS...
" With a bang '!', always comment the line.
"
" ARGS... are either (see also |tcomment#Comment()|):
" 1. a list of key=value pairs
" 2. 1-2 values for: ?commentBegin, ?commentEnd
command! -bang -range -nargs=* -complete=customlist,tcomment#CompleteArgs TCommentMaybeInline
\ keepjumps call tcomment#Comment(<line1>, <line2>, 'i', "<bang>", <f-args>)
if (g:tcommentMapLeader1 != '')
exec 'noremap <silent> '. g:tcommentMapLeader1 . g:tcommentMapLeader1 .' :TComment<cr>'
exec 'vnoremap <silent> '. g:tcommentMapLeader1 . g:tcommentMapLeader1 .' :TCommentMaybeInline<cr>'
exec 'inoremap <silent> '. g:tcommentMapLeader1 . g:tcommentMapLeader1 .' <c-o>:TComment<cr>'
exec 'noremap <silent> '. g:tcommentMapLeader1 .'p m`vip:TComment<cr>``'
exec 'inoremap <silent> '. g:tcommentMapLeader1 .'p <c-o>:norm! m`vip<cr>:TComment<cr><c-o>``'
exec 'noremap '. g:tcommentMapLeader1 .'<space> :TComment '
exec 'inoremap '. g:tcommentMapLeader1 .'<space> <c-o>:TComment '
exec 'inoremap <silent> '. g:tcommentMapLeader1 .'r <c-o>:TCommentRight<cr>'
exec 'noremap <silent> '. g:tcommentMapLeader1 .'r :TCommentRight<cr>'
exec 'vnoremap <silent> '. g:tcommentMapLeader1 .'i :TCommentInline<cr>'
exec 'vnoremap <silent> '. g:tcommentMapLeader1 .'r :TCommentRight<cr>'
exec 'noremap '. g:tcommentMapLeader1 .'b :TCommentBlock<cr>'
exec 'inoremap '. g:tcommentMapLeader1 .'b <c-o>:TCommentBlock<cr>'
exec 'noremap '. g:tcommentMapLeader1 .'a :TCommentAs '
exec 'inoremap '. g:tcommentMapLeader1 .'a <c-o>:TCommentAs '
exec 'noremap '. g:tcommentMapLeader1 .'n :TCommentAs <c-r>=&ft<cr> '
exec 'inoremap '. g:tcommentMapLeader1 .'n <c-o>:TCommentAs <c-r>=&ft<cr> '
exec 'noremap '. g:tcommentMapLeader1 .'s :TCommentAs <c-r>=&ft<cr>_'
exec 'inoremap '. g:tcommentMapLeader1 .'s <c-o>:TCommentAs <c-r>=&ft<cr>_'
endif
if (g:tcommentMapLeader2 != '')
exec 'noremap <silent> '. g:tcommentMapLeader2 .'_ :TComment<cr>'
exec 'xnoremap <silent> '. g:tcommentMapLeader2 .'_ :TCommentMaybeInline<cr>'
exec 'noremap <silent> '. g:tcommentMapLeader2 .'p vip:TComment<cr>'
exec 'noremap '. g:tcommentMapLeader2 .'<space> :TComment '
exec 'xnoremap <silent> '. g:tcommentMapLeader2 .'i :TCommentInline<cr>'
exec 'noremap <silent> '. g:tcommentMapLeader2 .'r :TCommentRight<cr>'
exec 'xnoremap <silent> '. g:tcommentMapLeader2 .'r :TCommentRight<cr>'
exec 'noremap '. g:tcommentMapLeader2 .'b :TCommentBlock<cr>'
exec 'noremap '. g:tcommentMapLeader2 .'a :TCommentAs '
exec 'noremap '. g:tcommentMapLeader2 .'n :TCommentAs <c-r>=&ft<cr> '
exec 'noremap '. g:tcommentMapLeader2 .'s :TCommentAs <c-r>=&ft<cr>_'
endif
if (g:tcommentMapLeaderOp1 != '')
exec 'nnoremap <silent> '. g:tcommentMapLeaderOp1 .' :let w:tcommentPos = getpos(".") \| set opfunc=tcomment#Operator<cr>g@'
exec 'nnoremap <silent> '. g:tcommentMapLeaderOp1 .'c :let w:tcommentPos = getpos(".") \| set opfunc=tcomment#OperatorLine<cr>g@$'
exec 'xnoremap <silent> '. g:tcommentMapLeaderOp1 .' :TCommentMaybeInline<cr>'
endif
if (g:tcommentMapLeaderOp2 != '')
exec 'nnoremap <silent> '. g:tcommentMapLeaderOp2 .' :let w:tcommentPos = getpos(".") \| set opfunc=tcomment#OperatorAnyway<cr>g@'
exec 'nnoremap <silent> '. g:tcommentMapLeaderOp2 .'c :let w:tcommentPos = getpos(".") \| set opfunc=tcomment#OperatorLineAnyway<cr>g@$'
exec 'xnoremap <silent> '. g:tcommentMapLeaderOp2 .' :TCommentMaybeInline<cr>'
endif

View File

@ -0,0 +1,88 @@
let s:tree_up_dir_line = '.. (up a dir)'
"NERDTreeFlags are syntax items that should be invisible, but give clues as to
"how things should be highlighted
syn match NERDTreeFlag #\~#
syn match NERDTreeFlag #\[RO\]#
"highlighting for the .. (up dir) line at the top of the tree
execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#"
"highlighting for the ~/+ symbols for the directory nodes
syn match NERDTreeClosable #\~\<#
syn match NERDTreeClosable #\~\.#
syn match NERDTreeOpenable #+\<#
syn match NERDTreeOpenable #+\.#he=e-1
"highlighting for the tree structural parts
syn match NERDTreePart #|#
syn match NERDTreePart #`#
syn match NERDTreePartFile #[|`]-#hs=s+1 contains=NERDTreePart
"quickhelp syntax elements
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*:#hs=s+2,he=e-1
syn match NERDTreeHelpKey #" \{1,2\}[^ ]*,#hs=s+2,he=e-1
syn match NERDTreeHelpTitle #" .*\~#hs=s+2,he=e-1 contains=NERDTreeFlag
syn match NERDTreeToggleOn #".*(on)#hs=e-2,he=e-1 contains=NERDTreeHelpKey
syn match NERDTreeToggleOff #".*(off)#hs=e-3,he=e-1 contains=NERDTreeHelpKey
syn match NERDTreeHelpCommand #" :.\{-}\>#hs=s+3
syn match NERDTreeHelp #^".*# contains=NERDTreeHelpKey,NERDTreeHelpTitle,NERDTreeFlag,NERDTreeToggleOff,NERDTreeToggleOn,NERDTreeHelpCommand
"highlighting for readonly files
syn match NERDTreeRO #.*\[RO\]#hs=s+2 contains=NERDTreeFlag,NERDTreeBookmark,NERDTreePart,NERDTreePartFile
"highlighting for sym links
syn match NERDTreeLink #[^-| `].* -> # contains=NERDTreeBookmark,NERDTreeOpenable,NERDTreeClosable,NERDTreeDirSlash
"highlighing for directory nodes and file nodes
syn match NERDTreeDirSlash #/#
syn match NERDTreeDir #[^-| `].*/# contains=NERDTreeLink,NERDTreeDirSlash,NERDTreeOpenable,NERDTreeClosable
syn match NERDTreeExecFile #[|` ].*\*\($\| \)# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark
syn match NERDTreeFile #|-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
syn match NERDTreeFile #`-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile
syn match NERDTreeCWD #^[</].*$#
"highlighting for bookmarks
syn match NERDTreeBookmark # {.*}#hs=s+1
"highlighting for the bookmarks table
syn match NERDTreeBookmarksLeader #^>#
syn match NERDTreeBookmarksHeader #^>-\+Bookmarks-\+$# contains=NERDTreeBookmarksLeader
syn match NERDTreeBookmarkName #^>.\{-} #he=e-1 contains=NERDTreeBookmarksLeader
syn match NERDTreeBookmark #^>.*$# contains=NERDTreeBookmarksLeader,NERDTreeBookmarkName,NERDTreeBookmarksHeader
if exists("g:NERDChristmasTree") && g:NERDChristmasTree
hi def link NERDTreePart Special
hi def link NERDTreePartFile Type
hi def link NERDTreeFile Normal
hi def link NERDTreeExecFile Title
hi def link NERDTreeDirSlash Identifier
hi def link NERDTreeClosable Type
else
hi def link NERDTreePart Normal
hi def link NERDTreePartFile Normal
hi def link NERDTreeFile Normal
hi def link NERDTreeClosable Title
endif
hi def link NERDTreeBookmarksHeader statement
hi def link NERDTreeBookmarksLeader ignore
hi def link NERDTreeBookmarkName Identifier
hi def link NERDTreeBookmark normal
hi def link NERDTreeHelp String
hi def link NERDTreeHelpKey Identifier
hi def link NERDTreeHelpCommand Identifier
hi def link NERDTreeHelpTitle Macro
hi def link NERDTreeToggleOn Question
hi def link NERDTreeToggleOff WarningMsg
hi def link NERDTreeDir Directory
hi def link NERDTreeUp Directory
hi def link NERDTreeCWD Statement
hi def link NERDTreeLink Macro
hi def link NERDTreeOpenable Title
hi def link NERDTreeFlag ignore
hi def link NERDTreeRO WarningMsg
hi def link NERDTreeBookmark Statement
hi def link NERDTreeCurrentNode Search

View File

@ -21,15 +21,20 @@ set hls
"Highlights the line the cursor is on
set cursorline
:hi CursorLine cterm=NONE ctermbg=darkred guibg=darkred guifg=white
"Toggle highlighting with \hr (highlight row)
nnoremap <Leader>hr :set cursorline!<CR>
"enable line numbers
set nu
"Toggle Line numbers with Ctrl+N double tap
nmap <C-N><C-N> :set invnumber<CR>
nmap <leader>ln :set invnumber<CR>
"Toggle line wrap with Ctrl+L double tap
nmap <C-L><C-L> :set wrap!<CR>
nmap <leader>lw :set wrap!<CR>
"Allows filetype detection
filetype on
@ -48,6 +53,12 @@ map <C-j> <C-w>j
map <C-l> <C-w>l
map <C-h> <C-w>h
" map Shift+U to redo
map <S-u> <C-r>
" Buffet shortcut
nnoremap <silent> <F2> :Bufferlist<CR>
"CTags List
nnoremap <silent> <F8> :TlistToggle<CR>
let Tlist_Exit_OnlyWindow=1
@ -64,10 +75,10 @@ inoremap <C-Space> <C-n>
inoremap <Nul> <C-n>
" Stupid shift key fixes
cmap W w
"cmap W w
cmap WQ wq
cmap wQ wq
cmap Q q
cmap Wq wq
"cmap Q q
"clearing highlighted search
nmap <silent> <leader>/ :nohlsearch<CR>