mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-20 03:02:29 +01:00
add setup resources
This commit is contained in:
parent
4cb266b7b5
commit
da8114758e
18 changed files with 12796 additions and 0 deletions
8
Setup.md
Normal file
8
Setup.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
* change ZSH_THEME and import git-prompt in ~/.zshrc
|
||||
* ZSH_THEME="my"
|
||||
* source $ZSH/git-prompt/zshrc.sh
|
||||
* copy these files from resources directory to home directory
|
||||
* .vimrc
|
||||
* .vim
|
||||
* .tmux.conf
|
||||
|
||||
54
resources/.tmux.conf
Normal file
54
resources/.tmux.conf
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# option
|
||||
set-option -g status-keys vi
|
||||
set-option -g status-utf8 on
|
||||
set-option -g default-terminal 'screen-256color'
|
||||
set-option -g default-shell '/bin/zsh'
|
||||
|
||||
set-option -g status-fg magenta
|
||||
set-option -g status-bg default
|
||||
set-option -g status-left-length 20
|
||||
set-option -g status-left ' #[fg=green]#(whoami)#[default]@#[fg=cyan]#h#[default]'
|
||||
set-option -g status-right "#[fg=yellow]#(date +'%a %m/%d %H:%M') "
|
||||
|
||||
set-option -g pane-border-bg white
|
||||
|
||||
# window-option
|
||||
set-window-option -g mode-keys vi
|
||||
set-window-option -g utf8 on
|
||||
set-window-option -g monitor-activity on
|
||||
set-window-option -g monitor-content '%alert%'
|
||||
set-window-option -g window-status-content-attr reverse
|
||||
set-window-option -g window-status-content-fg red
|
||||
set-window-option -g window-status-content-bg default
|
||||
|
||||
set-window-option -g window-status-current-attr bright
|
||||
set-window-option -g window-status-current-fg yellow
|
||||
set-window-option -g window-status-current-bg default
|
||||
set-window-option -g window-status-format '#I:#W[#P]#F'
|
||||
set-window-option -g window-status-current-format '#I:#W[#P]#F'
|
||||
|
||||
set-option -g pane-active-border-bg green
|
||||
|
||||
# bind key
|
||||
bind-key -n C-e command-prompt
|
||||
|
||||
unbind-key %
|
||||
bind-key | split-window -h
|
||||
bind-key - split-window -v
|
||||
|
||||
bind-key -n C-w choose-window
|
||||
|
||||
bind-key h select-pane -L
|
||||
bind-key j select-pane -D
|
||||
bind-key k select-pane -U
|
||||
unbind-key l
|
||||
bind-key l select-pane -R
|
||||
|
||||
bind-key -n C-o last-window
|
||||
|
||||
bind-key -n M-o run-shell "tmux swap-pane -U; tmux last-pane "
|
||||
|
||||
bind-key [ copy -u
|
||||
bind-key -n C-] paste
|
||||
|
||||
bind-key -t vi-copy Y copy-line
|
||||
5
resources/.vim/.netrwhist
Normal file
5
resources/.vim/.netrwhist
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
let g:netrw_dirhistmax =10
|
||||
let g:netrw_dirhist_cnt =3
|
||||
let g:netrw_dirhist_1='/Users/ri_eiyoku/Documents'
|
||||
let g:netrw_dirhist_2='/Users/ri_eiyoku/Documents/yy1441yy_backup'
|
||||
let g:netrw_dirhist_3='/Users/ri_eiyoku/Documents/yy1441yy_backup/server-configure'
|
||||
BIN
resources/.vim/bufexplorer.zip
Normal file
BIN
resources/.vim/bufexplorer.zip
Normal file
Binary file not shown.
513
resources/.vim/doc/bufexplorer.txt
Normal file
513
resources/.vim/doc/bufexplorer.txt
Normal file
|
|
@ -0,0 +1,513 @@
|
|||
*bufexplorer.txt* Buffer Explorer Last Change: 22 Oct 2010
|
||||
|
||||
Buffer Explorer *buffer-explorer* *bufexplorer*
|
||||
Version 7.2.8
|
||||
|
||||
Plugin for easily exploring (or browsing) Vim |:buffers|.
|
||||
|
||||
|bufexplorer-installation| Installation
|
||||
|bufexplorer-usage| Usage
|
||||
|bufexplorer-windowlayout| Window Layout
|
||||
|bufexplorer-customization| Customization
|
||||
|bufexplorer-changelog| Change Log
|
||||
|bufexplorer-todo| Todo
|
||||
|bufexplorer-credits| Credits
|
||||
|
||||
For Vim version 7.0 and above.
|
||||
This plugin is only available if 'compatible' is not set.
|
||||
|
||||
{Vi does not have any of this}
|
||||
|
||||
==============================================================================
|
||||
INSTALLATION *bufexplorer-installation*
|
||||
|
||||
To install:
|
||||
- Download the bufexplorer.zip.
|
||||
- Extract the zip archive into your runtime directory.
|
||||
The archive contains plugin/bufexplorer.vim, and doc/bufexplorer.txt.
|
||||
- Start Vim or goto an existing instance of Vim.
|
||||
- Execute the following command:
|
||||
>
|
||||
:helptag <your runtime directory>/doc
|
||||
<
|
||||
This will generate all the help tags for any file located in the doc
|
||||
directory.
|
||||
|
||||
==============================================================================
|
||||
USAGE *bufexplorer-usage*
|
||||
|
||||
To start exploring in the current window, use: >
|
||||
\be or :BufExplorer
|
||||
To start exploring in a newly split horizontal window, use: >
|
||||
\bs or :BufExplorerHorizontalSplit
|
||||
To start exploring in a newly split vertical window, use: >
|
||||
\bv or :BufExplorerVerticalSplit
|
||||
|
||||
If you would like to use something other than '\', you may simply change the
|
||||
leader (see |mapleader|).
|
||||
|
||||
Note: If the current buffer is modified when bufexplorer started, the current
|
||||
window is always split and the new bufexplorer is displayed in that new
|
||||
window.
|
||||
|
||||
Commands to use once exploring:
|
||||
|
||||
<F1> Toggle help information.
|
||||
<enter> Opens the buffer that is under the cursor into the current
|
||||
window.
|
||||
<leftmouse> Opens the buffer that is under the cursor into the current
|
||||
window.
|
||||
<shift-enter> Opens the buffer that is under the cursor in another tab.
|
||||
d |:delete|the buffer under the cursor from the list. The
|
||||
buffer's 'buflisted' is cleared. This allows for the buffer to
|
||||
be displayed again using the 'show unlisted' command.
|
||||
R Toggles relative path/absolute path.
|
||||
T Toggles to show only buffers for this tab or not.
|
||||
D |:wipeout|the buffer under the cursor from the list. When a
|
||||
buffers is wiped, it will not be shown when unlisted buffer are
|
||||
displayed.
|
||||
f Toggles whether you are taken to the active window when
|
||||
selecting a buffer or not.
|
||||
o Opens the buffer that is under the cursor into the current
|
||||
window.
|
||||
p Toggles the showing of a split filename/pathname.
|
||||
q Quit exploring.
|
||||
r Reverses the order the buffers are listed in.
|
||||
s Selects the order the buffers are listed in. Either by buffer
|
||||
number, file name, file extension, most recently used (MRU), or
|
||||
full path.
|
||||
t Opens the buffer that is under the cursor in another tab.
|
||||
u Toggles the showing of "unlisted" buffers.
|
||||
|
||||
Once invoked, Buffer Explorer displays a sorted list (MRU is the default
|
||||
sort method) of all the buffers that are currently opened. You are then
|
||||
able to move the cursor to the line containing the buffer's name you are
|
||||
wanting to act upon. Once you have selected the buffer you would like,
|
||||
you can then either open it, close it(delete), resort the list, reverse
|
||||
the sort, quit exploring and so on...
|
||||
|
||||
===============================================================================
|
||||
WINDOW LAYOUT *bufexplorer-windowlayout*
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
" Press <F1> for Help
|
||||
" Sorted by mru | Locate buffer | Absolute Split path
|
||||
"=
|
||||
01 %a bufexplorer.txt C:\Vim\vimfiles\doc line 87
|
||||
02 # bufexplorer.vim c:\Vim\vimfiles\plugin line 1
|
||||
-------------------------------------------------------------------------------
|
||||
| | | | |
|
||||
| | | | +-- Current Line #.
|
||||
| | | +-- Relative/Full Path
|
||||
| | +-- Buffer Name.
|
||||
| +-- Buffer Attributes. See|:buffers|for more information.
|
||||
+-- Buffer Number. See|:buffers|for more information.
|
||||
|
||||
===============================================================================
|
||||
CUSTOMIZATION *bufexplorer-customization*
|
||||
|
||||
*g:bufExplorerChgWin*
|
||||
If set, bufexplorer will bring up the selected buffer in the window specified
|
||||
by g:bufExplorerChgWin.
|
||||
|
||||
*g:bufExplorerDefaultHelp*
|
||||
To control whether the default help is displayed or not, use: >
|
||||
let g:bufExplorerDefaultHelp=0 " Do not show default help.
|
||||
let g:bufExplorerDefaultHelp=1 " Show default help.
|
||||
The default is to show the default help.
|
||||
|
||||
*g:bufExplorerDetailedHelp*
|
||||
To control whether detailed help is display by, use: >
|
||||
let g:bufExplorerDetailedHelp=0 " Do not show detailed help.
|
||||
let g:bufExplorerDetailedHelp=1 " Show detailed help.
|
||||
The default is NOT to show detailed help.
|
||||
|
||||
*g:bufExplorerFindActive*
|
||||
To control whether you are taken to the active window when selecting a buffer,
|
||||
use: >
|
||||
let g:bufExplorerFindActive=0 " Do not go to active window.
|
||||
let g:bufExplorerFindActive=1 " Go to active window.
|
||||
The default is to be taken to the active window.
|
||||
|
||||
*g:bufExplorerFuncRef*
|
||||
When a buffer is selected, the functions specified either singly or as a list
|
||||
will be called.
|
||||
|
||||
*g:bufExplorerReverseSort*
|
||||
To control whether to sort the buffer in reverse order or not, use: >
|
||||
let g:bufExplorerReverseSort=0 " Do not sort in reverse order.
|
||||
let g:bufExplorerReverseSort=1 " Sort in reverse order.
|
||||
The default is NOT to sort in reverse order.
|
||||
|
||||
*g:bufExplorerShowDirectories*
|
||||
Directories usually show up in the list from using a command like ":e .".
|
||||
To control whether to show directories in the buffer list or not, use: >
|
||||
let g:bufExplorerShowDirectories=1 " Show directories.
|
||||
let g:bufExplorerShowDirectories=0 " Don't show directories.
|
||||
The default is to show directories.
|
||||
|
||||
*g:bufExplorerShowRelativePath*
|
||||
To control whether to show absolute paths or relative to the current
|
||||
directory, use: >
|
||||
let g:bufExplorerShowRelativePath=0 " Show absolute paths.
|
||||
let g:bufExplorerShowRelativePath=1 " Show relative paths.
|
||||
The default is to show absolute paths.
|
||||
|
||||
*g:bufExplorerShowTabBuffer*
|
||||
To control weither or not to show buffers on for the specific tab or not, use: >
|
||||
let g:bufExplorerShowTabBuffer=0 " No.
|
||||
let g:bufExplorerShowTabBuffer=1 " Yes.
|
||||
The default is not to show.
|
||||
|
||||
*g:bufExplorerShowUnlisted*
|
||||
To control whether to show unlisted buffer or not, use: >
|
||||
let g:bufExplorerShowUnlisted=0 " Do not show unlisted buffers.
|
||||
let g:bufExplorerShowUnlisted=1 " Show unlisted buffers.
|
||||
The default is to NOT show unlisted buffers.
|
||||
|
||||
*g:bufExplorerSortBy*
|
||||
To control what field the buffers are sorted by, use: >
|
||||
let g:bufExplorerSortBy='extension' " Sort by file extension.
|
||||
let g:bufExplorerSortBy='fullpath' " Sort by full file path name.
|
||||
let g:bufExplorerSortBy='mru' " Sort by most recently used.
|
||||
let g:bufExplorerSortBy='name' " Sort by the buffer's name.
|
||||
let g:bufExplorerSortBy='number' " Sort by the buffer's number.
|
||||
The default is to sort by mru.
|
||||
|
||||
*g:bufExplorerSplitBelow*
|
||||
To control where the new split window will be placed above or below the
|
||||
current window, use: >
|
||||
let g:bufExplorerSplitBelow=1 " Split new window below current.
|
||||
let g:bufExplorerSplitBelow=0 " Split new window above current.
|
||||
The default is to use what ever is set by the global &splitbelow
|
||||
variable.
|
||||
|
||||
*g:bufExplorerSplitOutPathName*
|
||||
To control whether to split out the path and file name or not, use: >
|
||||
let g:bufExplorerSplitOutPathName=1 " Split the path and file name.
|
||||
let g:bufExplorerSplitOutPathName=0 " Don't split the path and file
|
||||
" name.
|
||||
The default is to split the path and file name.
|
||||
|
||||
*g:bufExplorerSplitRight*
|
||||
To control where the new vsplit window will be placed to the left or right of
|
||||
current window, use: >
|
||||
let g:bufExplorerSplitRight=0 " Split left.
|
||||
let g:bufExplorerSplitRight=1 " Split right.
|
||||
The default is to use the global &splitright.
|
||||
|
||||
===============================================================================
|
||||
CHANGE LOG *bufexplorer-changelog*
|
||||
|
||||
7.2.8 - Enhancements:
|
||||
* Thanks to Charles Campbell for integrating bufexplorer with GDBMGR.
|
||||
http://mysite.verizon.net/astronaut/vim/index.html#GDBMGR
|
||||
7.2.7 - Fix:
|
||||
* My 1st attempt to fix the "cache" issue where buffers information
|
||||
has changed but the cache/display does not reflect those changes.
|
||||
More work still needs to be done.
|
||||
7.2.6 - Fix:
|
||||
* Thanks to Michael Henry for pointing out that I totally forgot to
|
||||
update the inline help to reflect the previous change to the 'd'
|
||||
and 'D' keys. Opps!
|
||||
7.2.5 - Fix:
|
||||
* Philip Morant suggested switching the command (bwipe) associated
|
||||
with the 'd' key with the command (bdelete) associated with the 'D'
|
||||
key. This made sense since the 'd' key is more likely to be used
|
||||
compared to the 'D' key.
|
||||
7.2.4 - Fix:
|
||||
* I did not implement the patch provided by Godefroid Chapelle
|
||||
correctly. I missed one line which happened to be the most
|
||||
important one :)
|
||||
7.2.3 - Enhancements:
|
||||
* Thanks to David Fishburn for helping me out with a much needed
|
||||
code overhaul as well as some awesome performance enhancements.
|
||||
He also reworked the handling of tabs.
|
||||
* Thanks to Vladimir Dobriakov for making the suggestions on
|
||||
enhancing the documentation to include a better explaination of
|
||||
what is contained in the main bufexplorer window.
|
||||
* Thanks to Yuriy Ershov for added code that when the bufexplorer
|
||||
window is opened, the cursor is now positioned at the line with the
|
||||
active buffer (useful in non-MRU sort modes).
|
||||
* Yuriy also added the abiltiy to cycle through the sort fields in
|
||||
reverse order.
|
||||
Fixes:
|
||||
* Thanks to Michael Henry for supplying a patch that allows
|
||||
bufexplorer to be opened even when there is one buffer or less.
|
||||
* Thanks to Godefroid Chapelle for supplying a patch that fixed
|
||||
MRU sort order after loading a session.
|
||||
7.2.2 - Fixes:
|
||||
* Thanks to David L. Dight for spotting and fixing an issue when
|
||||
using ctrl^. bufexplorer would incorrectly handle the previous
|
||||
buffer so that when ctrl^ was pressed the incorrect file was opened.
|
||||
7.2.1 - Fixes:
|
||||
* Thanks to Dimitar for spotting and fixing a feature that was
|
||||
inadvertently left out of the previous version. The feature was
|
||||
when bufexplorer was used together with WinManager, you could use
|
||||
the tab key to open a buffer in a split window.
|
||||
7.2.0 - Enhancements:
|
||||
* For all those missing the \bs and \bv commands, these have now
|
||||
returned. Thanks to Phil O'Connell for asking for the return of
|
||||
these missing features and helping test out this version.
|
||||
Fixes:
|
||||
* Fixed problem with the bufExplorerFindActive code not working
|
||||
correctly.
|
||||
* Fixed an incompatibility between bufexplorer and netrw that caused
|
||||
buffers to be incorrectly removed from the MRU list.
|
||||
7.1.7 - Fixes:
|
||||
* TaCahiroy fixed several issues related to opening a buffer in a
|
||||
tab.
|
||||
7.1.6 - Fixes:
|
||||
* Removed ff=unix from modeline in bufexplorer.txt. Found by Bill
|
||||
McCarthy.
|
||||
7.1.5 - Fixes:
|
||||
* Could not open unnamed buffers. Fixed by TaCahiroy.
|
||||
7.1.4 - Fixes:
|
||||
* Sometimes when a file's path has 'white space' in it, extra buffers
|
||||
would be created containing each piece of the path. i.e:
|
||||
opening c:\document and settings\test.txt would create a buffer
|
||||
named "and" and a buffer named "Documents". This was reported and
|
||||
fixed by TaCa Yoss.
|
||||
7.1.3 - Fixes:
|
||||
* Added code to allow only one instance of the plugin to run at a
|
||||
time. Thanks Dennis Hostetler.
|
||||
7.1.2 - Fixes:
|
||||
* Fixed a jumplist issue spotted by JiangJun. I overlooked the
|
||||
'jumplist' and with a couple calls to 'keepjumps', everything is
|
||||
fine again.
|
||||
* Went back to just having a plugin file, no autoload file. By having
|
||||
the autoload, WinManager was no longer working and without really
|
||||
digging into the cause, it was easier to go back to using just a
|
||||
plugin file.
|
||||
7.1.1 - Fixes:
|
||||
* A problem spotted by Thomas Arendsen Hein.
|
||||
When running Vim (7.1.94), error E493 was being thrown.
|
||||
Enhancements:
|
||||
* Added 'D' for 'delete' buffer as the 'd' command was a 'wipe'
|
||||
buffer.
|
||||
7.1.0 - Another 'major' update, some by Dave Larson, some by me.
|
||||
* Making use of 'autoload' now to make the plugin load quicker.
|
||||
* Removed '\bs' and '\bv'. These are now controlled by the user. The
|
||||
user can issue a ':sp' or ':vs' to create a horizontal or vertical
|
||||
split window and then issue a '\be'
|
||||
* Added handling of tabs.
|
||||
7.0.17 - Fixed issue with 'drop' command.
|
||||
Various enhancements and improvements.
|
||||
7.0.16 - Fixed issue reported by Liu Jiaping on non Windows systems, which was
|
||||
...
|
||||
Open file1, open file2, modify file1, open bufexplorer, you get the
|
||||
following error:
|
||||
|
||||
--------8<--------
|
||||
Error detected while processing function
|
||||
<SNR>14_StartBufExplorer..<SNR>14_SplitOpen:
|
||||
line 4:
|
||||
E37: No write since last change (add ! to override)
|
||||
|
||||
But the worse thing is, when I want to save the current buffer and
|
||||
type ':w', I get another error message:
|
||||
E382: Cannot write, 'buftype' option is set
|
||||
--------8<--------
|
||||
|
||||
7.0.15 - Thanks to Mark Smithfield for suggesting bufexplorer needed to handle
|
||||
the ':args' command.
|
||||
7.0.14 - Thanks to Randall Hansen for removing the requirement of terminal
|
||||
versions to be recompiled with 'gui' support so the 'drop' command
|
||||
would work. The 'drop' command is really not needed in terminal
|
||||
versions.
|
||||
7.0.13 - Fixed integration with WinManager.
|
||||
Thanks to Dave Eggum for another update.
|
||||
- Fix: The detailed help didn't display the mapping for toggling
|
||||
the split type, even though the split type is displayed.
|
||||
- Fixed incorrect description in the detailed help for toggling
|
||||
relative or full paths.
|
||||
- Deprecated s:ExtractBufferNbr(). Vim's str2nr() does the same
|
||||
thing.
|
||||
- Created a s:Set() function that sets a variable only if it hasn't
|
||||
already been defined. It's useful for initializing all those
|
||||
default settings.
|
||||
- Removed checks for repetitive command definitions. They were
|
||||
unnecessary.
|
||||
- Made the help highlighting a little more fancy.
|
||||
- Minor reverse compatibility issue: Changed ambiguous setting
|
||||
names to be more descriptive of what they do (also makes the code
|
||||
easier to follow):
|
||||
Changed bufExplorerSortDirection to bufExplorerReverseSort
|
||||
Changed bufExplorerSplitType to bufExplorerSplitVertical
|
||||
Changed bufExplorerOpenMode to bufExplorerUseCurrentWindow
|
||||
- When the BufExplorer window closes, all the file-local marks are
|
||||
now deleted. This may have the benefit of cleaning up some of the
|
||||
jumplist.
|
||||
- Changed the name of the parameter for StartBufExplorer from
|
||||
"split" to "open". The parameter is a string which specifies how
|
||||
the buffer will be open, not if it is split or not.
|
||||
- Deprecated DoAnyMoreBuffersExist() - it is a one line function
|
||||
only used in one spot.
|
||||
- Created four functions (SplitOpen(), RebuildBufferList(),
|
||||
UpdateHelpStatus() and ReSortListing()) all with one purpose - to
|
||||
reduce repeated code.
|
||||
- Changed the name of AddHeader() to CreateHelp() to be more
|
||||
descriptive of what it does. It now returns an array instead of
|
||||
updating the window directly. This has the benefit of making the
|
||||
code more efficient since the text the function returns is used a
|
||||
little differently in the two places the function is called.
|
||||
- Other minor simplifications.
|
||||
7.0.12 - MAJOR Update.
|
||||
This version will ONLY run with Vim version 7.0 or greater.
|
||||
Dave Eggum has made some 'significant' updates to this latest
|
||||
version:
|
||||
- Added BufExplorerGetAltBuf() global function to be used in the
|
||||
user’s rulerformat.
|
||||
- Added g:bufExplorerSplitRight option.
|
||||
- Added g:bufExplorerShowRelativePath option with mapping.
|
||||
- Added current line highlighting.
|
||||
- The split type can now be changed whether bufexplorer is opened
|
||||
in split mode or not.
|
||||
- Various major and minor bug fixes and speed improvements.
|
||||
- Sort by extension.
|
||||
Other improvements/changes:
|
||||
- Changed the help key from '?' to <F1> to be more 'standard'.
|
||||
- Fixed splitting of vertical bufexplorer window.
|
||||
Hopefully I have not forgot something :)
|
||||
7.0.11 - Fixed a couple of highlighting bugs, reported by David Eggum. He also
|
||||
changed passive voice to active on a couple of warning messages.
|
||||
7.0.10 - Fixed bug report by Xiangjiang Ma. If the 'ssl' option is set,
|
||||
the slash character used when displaying the path was incorrect.
|
||||
7.0.9 - Martin Grenfell found and eliminated an annoying bug in the
|
||||
bufexplorer/winmanager integration. The bug was were an
|
||||
annoying message would be displayed when a window was split or
|
||||
a new file was opened in a new window. Thanks Martin!
|
||||
7.0.8 - Thanks to Mike Li for catching a bug in the WinManager integration.
|
||||
The bug was related to the incorrect displaying of the buffer
|
||||
explorer's window title.
|
||||
7.0.7 - Thanks to Jeremy Cowgar for adding a new enhancement. This
|
||||
enhancement allows the user to press 'S', that is capital S, which
|
||||
will open the buffer under the cursor in a newly created split
|
||||
window.
|
||||
7.0.6 - Thanks to Larry Zhang for finding a bug in the "split" buffer code.
|
||||
If you force set g:bufExplorerSplitType='v' in your vimrc, and if you
|
||||
tried to do a \bs to split the bufexplorer window, it would always
|
||||
split horizontal, not vertical. He also found that I had a typeo in
|
||||
that the variable g:bufExplorerSplitVertSize was all lower case in
|
||||
the documentation which was incorrect.
|
||||
7.0.5 - Thanks to Mun Johl for pointing out a bug that if a buffer was
|
||||
modified, the '+' was not showing up correctly.
|
||||
7.0.4 - Fixed a problem discovered first by Xiangjiang Ma. Well since I've
|
||||
been using vim 7.0 and not 6.3, I started using a function (getftype)
|
||||
that is not in 6.3. So for backward compatibility, I conditionaly use
|
||||
this function now. Thus, the g:bufExplorerShowDirectories feature is
|
||||
only available when using vim 7.0 and above.
|
||||
7.0.3 - Thanks to Erwin Waterlander for finding a problem when the last
|
||||
buffer was deleted. This issue got me to rewrite the buffer display
|
||||
logic (which I've wanted to do for sometime now).
|
||||
Also great thanks to Dave Eggum for coming up with idea for
|
||||
g:bufExplorerShowDirectories. Read the above information about this
|
||||
feature.
|
||||
7.0.2 - Thanks to Thomas Arendsen Hein for finding a problem when a user
|
||||
has the default help turned off and then brought up the explorer. An
|
||||
E493 would be displayed.
|
||||
7.0.1 - Thanks to Erwin Waterlander for finding a couple problems.
|
||||
The first problem allowed a modified buffer to be deleted. Opps! The
|
||||
second problem occurred when several files were opened, BufExplorer
|
||||
was started, the current buffer was deleted using the 'd' option, and
|
||||
then BufExplorer was exited. The deleted buffer was still visible
|
||||
while it is not in the buffers list. Opps again!
|
||||
7.0.0 - Thanks to Shankar R. for suggesting to add the ability to set
|
||||
the fixed width (g:bufExplorerSplitVertSize) of a new window
|
||||
when opening bufexplorer vertically and fixed height
|
||||
(g:bufExplorerSplitHorzSize) of a new window when opening
|
||||
bufexplorer horizontally. By default, the windows are normally
|
||||
split to use half the existing width or height.
|
||||
6.3.0 - Added keepjumps so that the jumps list would not get cluttered with
|
||||
bufexplorer related stuff.
|
||||
6.2.3 - Thanks to Jay Logan for finding a bug in the vertical split position
|
||||
of the code. When selecting that the window was to be split
|
||||
vertically by doing a '\bv', from then on, all splits, i.e. '\bs',
|
||||
were split vertically, even though g:bufExplorerSplitType was not set
|
||||
to 'v'.
|
||||
6.2.2 - Thanks to Patrik Modesto for adding a small improvement. For some
|
||||
reason his bufexplorer window was always showing up folded. He added
|
||||
'setlocal nofoldenable' and it was fixed.
|
||||
6.2.1 - Thanks goes out to Takashi Matsuo for added the 'fullPath' sorting
|
||||
logic and option.
|
||||
6.2.0 - Thanks goes out to Simon Johann-Ganter for spotting and fixing a
|
||||
problem in that the last search pattern is overridden by the search
|
||||
pattern for blank lines.
|
||||
6.1.6 - Thanks to Artem Chuprina for finding a pesky bug that has been around
|
||||
for sometime now. The <esc> key mapping was causing the buffer
|
||||
explored to close prematurely when vim was run in an xterm. The <esc>
|
||||
key mapping is now removed.
|
||||
6.1.5 - Thanks to Khorev Sergey. Added option to show default help or not.
|
||||
6.1.4 - Thanks goes out to Valery Kondakoff for suggesting the addition of
|
||||
setlocal nonumber and foldcolumn=0. This allows for line numbering
|
||||
and folding to be turned off temporarily while in the explorer.
|
||||
6.1.3 - Added folding. Did some code cleanup. Added the ability to force the
|
||||
newly split window to be temporarily vertical, which was suggested by
|
||||
Thomas Glanzmann.
|
||||
6.1.2 - Now pressing the <esc> key will quit, just like 'q'.
|
||||
Added folds to hide winmanager configuration.
|
||||
If anyone had the 'C' option in their cpoptions they would receive
|
||||
a E10 error on startup of BufExplorer. cpo is now saved, updated and
|
||||
restored. Thanks to Charles E Campbell, Jr.
|
||||
Attempted to make sure there can only be one BufExplorer window open
|
||||
at a time.
|
||||
6.1.1 - Thanks to Brian D. Goodwin for adding toupper to FileNameCmp. This
|
||||
way buffers sorted by name will be in the correct order regardless of
|
||||
case.
|
||||
6.0.16 - Thanks to Andre Pang for the original patch/idea to get bufexplorer
|
||||
to work in insertmode/modeless mode (evim). Added Initialize
|
||||
and Cleanup autocommands to handle commands that need to be
|
||||
performed when starting or leaving bufexplorer.
|
||||
6.0.15 - Srinath Avadhanulax added a patch for winmanager.vim.
|
||||
6.0.14 - Fix a few more bug that I thought I already had fixed. Thanks
|
||||
to Eric Bloodworth for adding 'Open Mode/Edit in Place'. Added
|
||||
vertical splitting.
|
||||
6.0.13 - Thanks to Charles E Campbell, Jr. for pointing out some embarrassing
|
||||
typos that I had in the documentation. I guess I need to run
|
||||
the spell checker more :o)
|
||||
6.0.12 - Thanks to Madoka Machitani, for the tip on adding the augroup command
|
||||
around the MRUList autocommands.
|
||||
6.0.11 - Fixed bug report by Xiangjiang Ma. '"=' was being added to the
|
||||
search history which messed up hlsearch.
|
||||
6.0.10 - Added the necessary hooks so that the Srinath Avadhanula's
|
||||
winmanager.vim script could more easily integrate with this script.
|
||||
Tried to improve performance.
|
||||
6.0.9 - Added MRU (Most Recently Used) sort ordering.
|
||||
6.0.8 - Was not resetting the showcmd command correctly.
|
||||
Added nifty help file.
|
||||
6.0.7 - Thanks to Brett Carlane for some great enhancements. Some are added,
|
||||
some are not, yet. Added highlighting of current and alternate
|
||||
filenames. Added splitting of path/filename toggle. Reworked
|
||||
ShowBuffers().
|
||||
Changed my email address.
|
||||
6.0.6 - Copyright notice added. Needed this so that it could be distributed
|
||||
with Debian Linux. Fixed problem with the SortListing() function
|
||||
failing when there was only one buffer to display.
|
||||
6.0.5 - Fixed problems reported by David Pascoe, in that you where unable to
|
||||
hit 'd' on a buffer that belonged to a files that no longer existed
|
||||
and that the 'yank' buffer was being overridden by the help text when
|
||||
the bufexplorer was opened.
|
||||
6.0.4 - Thanks to Charles Campbell, Jr. for making this plugin more plugin
|
||||
*compliant*, adding default keymappings of <Leader>be and <Leader>bs
|
||||
as well as fixing the 'w:sortDirLabel not being defined' bug.
|
||||
6.0.3 - Added sorting capabilities. Sort taken from explorer.vim.
|
||||
6.0.2 - Can't remember. (2001-07-25)
|
||||
6.0.1 - Initial release.
|
||||
|
||||
===============================================================================
|
||||
TODO *bufexplorer-todo*
|
||||
|
||||
- Nothing as of now, buf if you have any suggestions, drop me an email.
|
||||
|
||||
===============================================================================
|
||||
CREDITS *bufexplorer-credits*
|
||||
|
||||
Author: Jeff Lanzarotta <delux256-vim at yahoo dot com>
|
||||
|
||||
Credit must go out to Bram Moolenaar and all the Vim developers for
|
||||
making the world's best editor (IMHO). I also want to thank everyone who
|
||||
helped and gave me suggestions. I wouldn't want to leave anyone out so I
|
||||
won't list names.
|
||||
|
||||
===============================================================================
|
||||
vim:tw=78:noet:wrap:ts=8:ft=help:norl:
|
||||
1501
resources/.vim/doc/taglist.txt
Executable file
1501
resources/.vim/doc/taglist.txt
Executable file
File diff suppressed because it is too large
Load diff
110
resources/.vim/doc/tags
Normal file
110
resources/.vim/doc/tags
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
'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*
|
||||
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()*
|
||||
WinManagerFileEdit winmanager.txt /*WinManagerFileEdit*
|
||||
WinManagerForceReSize winmanager.txt /*WinManagerForceReSize*
|
||||
WinManagerResumeAUs winmanager.txt /*WinManagerResumeAUs*
|
||||
WinManagerSuspendAUs winmanager.txt /*WinManagerSuspendAUs*
|
||||
bufexplorer bufexplorer.txt /*bufexplorer*
|
||||
bufexplorer-changelog bufexplorer.txt /*bufexplorer-changelog*
|
||||
bufexplorer-credits bufexplorer.txt /*bufexplorer-credits*
|
||||
bufexplorer-customization bufexplorer.txt /*bufexplorer-customization*
|
||||
bufexplorer-installation bufexplorer.txt /*bufexplorer-installation*
|
||||
bufexplorer-todo bufexplorer.txt /*bufexplorer-todo*
|
||||
bufexplorer-usage bufexplorer.txt /*bufexplorer-usage*
|
||||
bufexplorer-windowlayout bufexplorer.txt /*bufexplorer-windowlayout*
|
||||
bufexplorer.txt bufexplorer.txt /*bufexplorer.txt*
|
||||
buffer-explorer bufexplorer.txt /*buffer-explorer*
|
||||
g:bufExplorerChgWin bufexplorer.txt /*g:bufExplorerChgWin*
|
||||
g:bufExplorerDefaultHelp bufexplorer.txt /*g:bufExplorerDefaultHelp*
|
||||
g:bufExplorerDetailedHelp bufexplorer.txt /*g:bufExplorerDetailedHelp*
|
||||
g:bufExplorerFindActive bufexplorer.txt /*g:bufExplorerFindActive*
|
||||
g:bufExplorerFuncRef bufexplorer.txt /*g:bufExplorerFuncRef*
|
||||
g:bufExplorerReverseSort bufexplorer.txt /*g:bufExplorerReverseSort*
|
||||
g:bufExplorerShowDirectories bufexplorer.txt /*g:bufExplorerShowDirectories*
|
||||
g:bufExplorerShowRelativePath bufexplorer.txt /*g:bufExplorerShowRelativePath*
|
||||
g:bufExplorerShowTabBuffer bufexplorer.txt /*g:bufExplorerShowTabBuffer*
|
||||
g:bufExplorerShowUnlisted bufexplorer.txt /*g:bufExplorerShowUnlisted*
|
||||
g:bufExplorerSortBy bufexplorer.txt /*g:bufExplorerSortBy*
|
||||
g:bufExplorerSplitBelow bufexplorer.txt /*g:bufExplorerSplitBelow*
|
||||
g:bufExplorerSplitOutPathName bufexplorer.txt /*g:bufExplorerSplitOutPathName*
|
||||
g:bufExplorerSplitRight bufexplorer.txt /*g:bufExplorerSplitRight*
|
||||
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*
|
||||
winmanager winmanager.txt /*winmanager*
|
||||
winmanager-adding winmanager.txt /*winmanager-adding*
|
||||
winmanager-bufexplorer-settings winmanager.txt /*winmanager-bufexplorer-settings*
|
||||
winmanager-bug winmanager.txt /*winmanager-bug*
|
||||
winmanager-commands winmanager.txt /*winmanager-commands*
|
||||
winmanager-customizing winmanager.txt /*winmanager-customizing*
|
||||
winmanager-details winmanager.txt /*winmanager-details*
|
||||
winmanager-fileexplorer-settings winmanager.txt /*winmanager-fileexplorer-settings*
|
||||
winmanager-hook-isvalid winmanager.txt /*winmanager-hook-isvalid*
|
||||
winmanager-hook-refresh winmanager.txt /*winmanager-hook-refresh*
|
||||
winmanager-hook-resize winmanager.txt /*winmanager-hook-resize*
|
||||
winmanager-hook-start winmanager.txt /*winmanager-hook-start*
|
||||
winmanager-hook-title winmanager.txt /*winmanager-hook-title*
|
||||
winmanager-hooks winmanager.txt /*winmanager-hooks*
|
||||
winmanager-installing winmanager.txt /*winmanager-installing*
|
||||
winmanager-overview winmanager.txt /*winmanager-overview*
|
||||
winmanager-plugin winmanager.txt /*winmanager-plugin*
|
||||
winmanager-settings winmanager.txt /*winmanager-settings*
|
||||
winmanager-thanks winmanager.txt /*winmanager-thanks*
|
||||
winmanager-updates winmanager.txt /*winmanager-updates*
|
||||
503
resources/.vim/doc/winmanager.txt
Normal file
503
resources/.vim/doc/winmanager.txt
Normal file
|
|
@ -0,0 +1,503 @@
|
|||
*winmanager* Plugin for a classical Windows style IDE for Vim 6.0
|
||||
For Vim version 6.0.
|
||||
Last Change: Sun Mar 31 11:00 PM 2002 PST
|
||||
|
||||
By Srinath Avadhanula
|
||||
(srinath@fastmail.fm)
|
||||
|
||||
*winmanager-plugin*
|
||||
|
||||
winmanager.vim is a plugin which implements a classical windows type IDE in
|
||||
Vim-6.0, where the directory and buffer browsers are displayed in 2 windows on
|
||||
the left and the current editing is done on the right. When you open up a new
|
||||
vim window, simply type in :WMToggle. This will start up winmanager.
|
||||
|
||||
Note This plugin is available only if 'compatible' is not set
|
||||
You can avoid loading this plugin by setting the "loaded_winmanager"
|
||||
variable >
|
||||
:let loaded_winmanager = 1
|
||||
|
||||
{Vi does not have any of this}
|
||||
===========================================================================
|
||||
OVERVIEW *winmanager-overview*
|
||||
|
||||
|winmanager-installing| Please follow these instructions for installing
|
||||
winmanager.
|
||||
|
||||
|winmanager-customizing| Describes ways of customizing the window layout, i.e
|
||||
how to club various explorers into groups, how to
|
||||
change their relative position, etc.
|
||||
|
||||
|winmanager-details| details of using winmanager. keyboard shortcuts
|
||||
and other usage details.
|
||||
|
||||
|winmanager-commands| commands provided to the user. its useful to
|
||||
set keyboard shortcuts to these commands.
|
||||
|
||||
|winmanager-settings| settings (typically made in ~/.vimrc) which
|
||||
affect the behavior of winmanager.
|
||||
|
||||
|winmanager-adding| one of the most important new features of this
|
||||
version is the creation of a framework whereby adding
|
||||
other plugins like explorer.vim or bufexplorer.vim to
|
||||
winmanager. This section describes briefly the
|
||||
implementation of winmanager and then describes how
|
||||
to add a new plugin to winmanager
|
||||
|
||||
|add-local-help| how to use this text file as a vim help file.
|
||||
|winmanager-bug| bug reports are welcome.
|
||||
|winmanager-thanks| thanks to the many people who helped!
|
||||
|
||||
===========================================================================
|
||||
UPDATES *winmanager-updates*
|
||||
|
||||
The official releases can be found at: >
|
||||
http://vim.sourceforge.net/scripts/script.php?script_id=95
|
||||
However, I will only update the vim.sf.net version of winmanager.zip in case
|
||||
of a major bug or new feature. For small (and not so bothersome) bug-fixes, I
|
||||
will put the latest version at: >
|
||||
http://robotics.eecs.berkeley.edu/~srinath/vim/winmanager-2.0.htm
|
||||
and also announce it in vim@vim.org when an update occurs.
|
||||
Therefore if you want to keep to be kept abreast of updates, you could
|
||||
check occassionally at vim@vim.org. (you can also use your mail server's
|
||||
filtering capability to effectively subscribe to the announcement).
|
||||
|
||||
============================================================================
|
||||
INSTALLING *winmanager-installing*
|
||||
|
||||
winmanager.vim should start working as soon as you restart vim after unzipping
|
||||
the .zip file you got this from into ~/.vim (unix) or ~\vimfiles (dos)
|
||||
|
||||
winmanager only recognizes plugins whose name appears in the global variable >
|
||||
g:winManagerWindowLayout
|
||||
<
|
||||
By default this global variable has the value >
|
||||
g:winManagerWindowLayout = 'FileExplorer,TagsExplorer|BufExplorer'
|
||||
<
|
||||
(which is the value which winmanager uses if its not set in the user's .vimrc)
|
||||
|
||||
This global variable is responsible for making winmanager recognize the
|
||||
existence of the explorers and simultaneously custome the window layout. See
|
||||
the next section for how to set this variable for various custom layouts of
|
||||
winmanager.
|
||||
|
||||
============================================================================
|
||||
CUSTOMIZING *winmanager-customizing*
|
||||
|
||||
The layout of winmanager is controlled by changing the value of the
|
||||
"g:winManagerWindowLayout" variable. The general form of this variable is
|
||||
>
|
||||
g:winManagerWindowLayout =
|
||||
'Group1_Member1,Group1_Member2|Group2_Member_1,Group2_Member_2'
|
||||
<
|
||||
i.e, explorer "groups" are seperated by the '|' character. Within each group,
|
||||
individual explorer plugin names are seperated by the comma (',') character.
|
||||
What winmanager does is display only 1 member from each group in a window. The
|
||||
user can go to a window and press <C-n> to display the next explorer belonging
|
||||
to that group. This ability to "group" windows is valuable to preserve screen
|
||||
real-estate by using them only as needed.
|
||||
|
||||
Thus for the default value of 'g:winManagerWindowLayout', winmanager will
|
||||
split the vim window as follows:
|
||||
+-----------+-------------------+
|
||||
| | |
|
||||
| File | |
|
||||
| explorer | File being |
|
||||
| | edited |
|
||||
| | |
|
||||
+-----------+ |
|
||||
| Buffer | |
|
||||
| explorer | |
|
||||
| | |
|
||||
+-----------+-------------------+
|
||||
|
||||
The user can go the [File List] window and press <C-n> to goto the
|
||||
'TagsExplorer' view.
|
||||
|
||||
Removing a plugin name from the 'g:winManagerWindowLayout' variable means
|
||||
winmanager no longer sees that variable.
|
||||
|
||||
============================================================================
|
||||
COMMANDS *winmanager-commands*
|
||||
|
||||
:WMToggle :toggles the visibility of winmanager. This can
|
||||
also be used to start winmanager for the first
|
||||
time. A handy mapping is: >
|
||||
:map <c-w><c-t> :WMToggle<cr>
|
||||
< mnemonic: window-toggle : <c-W><c-T>
|
||||
|
||||
:FirstExplorerWindow :directly takes you to the first explorer window
|
||||
from the top left corner which is visible. >
|
||||
:map <c-w><c-f> :FirstExplorerWindow<cr>
|
||||
< mnemonic: window-first : <c-W><c-F>
|
||||
|
||||
:BottomExplorerWindow :directly takes you to the last explorere window
|
||||
from the top-left which is visible. >
|
||||
:map <c-w><c-b> :BottomExplorerWindow<cr>
|
||||
< mnemonic: window-last : <c-W><c-B>
|
||||
|
||||
NOTE: winmanager does not provide any mappings by default. These have to set
|
||||
in the user's .vimrc if you want to use mappings.
|
||||
|
||||
============================================================================
|
||||
SETTINGS *winmanager-settings*
|
||||
|
||||
The values of the following global variables should be set in your .vimrc
|
||||
file if you want a different value than the default:
|
||||
|
||||
g:persistentBehaviour: if set to 0, then as soon as you quit all the files
|
||||
and only the explorer windows are the ones left, vim will quit. the
|
||||
default is 1, which means that the explorer windows persist even if
|
||||
they are the only ones visible.
|
||||
|
||||
g:winManagerWidth: the width of the explorer areas.
|
||||
(default 25)
|
||||
|
||||
g:defaultExplorer: If you want winmanager to assume the functioning of the
|
||||
default explorer.vim which ships with vim, set this variable to 0.
|
||||
(default 1). If this variable is set to 1, then winmanager will behave as
|
||||
follows:
|
||||
. if the user starts off vim with a command such as
|
||||
":vim some/dir/" then winmanager starts off the window layout with
|
||||
FileExplorer at the top left window. as of now it changes the
|
||||
g:windowLayout variable so that file explorer appears in the top left
|
||||
window.
|
||||
. if on the other hand the user does ":e some/dir/" while _inside_ vim,
|
||||
then the behavior is consistent with the original behavior of the
|
||||
explorer.vim plugin which ships with vim, i.e, the directory is opened
|
||||
in a buffer and the user can use that to open a file in that window.
|
||||
Note that the commands ":Explore" and ":Sexplore" are still available if
|
||||
you set this variable to 1.
|
||||
winfileexplorer.vim, the modification of explorer.vim which ships with
|
||||
this version is different from the standard explorer.vim in that it has
|
||||
display caching. i.e, the directory is read and sorted only the first
|
||||
time. From the second time on, the directory list is cached in a script
|
||||
variable so display is faster.
|
||||
|
||||
*winmanager-fileexplorer-settings*
|
||||
See |explorer| for details.
|
||||
NOTE: Some of the settings used in explorer.vim are not utlized in
|
||||
winmanager.
|
||||
*winmanager-bufexplorer-settings*
|
||||
g:bufExplorerMaxHeight: the buffer list window dynamicall rescales itself to
|
||||
occupy only the minimum space required to display all the windows. you
|
||||
can set a maximum number of lines for this window. (defualt 15)
|
||||
See |bufexplorer| for details on additional options.
|
||||
NOTE: Some of the settings used in bufexplorer.vim are not utlized in
|
||||
winmanager.
|
||||
|
||||
=============================================================================
|
||||
DETAILED HELP *winmanager-details*
|
||||
|
||||
When winmanager starts up, it divides up the whole vim window into 2
|
||||
"regions". The region on the left is the "explorer area" where the various
|
||||
explorer plugins are displayed. The region on the right is the "file editing
|
||||
area", where the user works on his current editing session.
|
||||
|
||||
+--------+-------------------+
|
||||
| | |
|
||||
| | 2(i) |
|
||||
| 1(i) | |
|
||||
| +-------------------+
|
||||
| | |
|
||||
+--------+ 2(ii) |
|
||||
| 1(ii) | |
|
||||
+--------+-------------------+
|
||||
|
||||
The explorer area (area 1) might contain multiple windows each of which might
|
||||
contain multiple explorers. In the default configuration (for
|
||||
g:winManagerWindowLayout = 'FileExplorer,TagsExplorer|BufExplorer'), the first
|
||||
window can be thought of as containing 2 explorers, the file explorer plugin
|
||||
and the tags explorer plugin, while the bottom window contains bufexplorer by
|
||||
itself.
|
||||
|
||||
When a window contains multiple explorers, then the user can cycle between
|
||||
them by pressing <c-n> (mnemonic: next) or <c-p> (mnemonic: previous).
|
||||
|
||||
This section describes the various keyboard shortcuts for the 3 plugins which
|
||||
are used with winmanager by default.
|
||||
NOTE: Other plugins might be distributed as add-ins to winmanager. In that
|
||||
case, please refer to the help which ships with that plugin.
|
||||
|
||||
1. File Explorer plugin
|
||||
This plugin displays the current directory. Its a modification of the standard
|
||||
explorer.vim which ships with vim6.0. The following keyboard shortcuts are
|
||||
available with this plugin:
|
||||
<enter> if on a directory, enters it and displays it in the same
|
||||
area. If on a file, then opens it in the File Editing Area.
|
||||
Attempts to open in the same window as the one visited
|
||||
before, otherwise split open a new window horizontally. if
|
||||
this sounds a bit confusing, it isnt. its the most intuitive
|
||||
behaviour that one expects.
|
||||
<2-leftmouse> (doubleclick) the same as <enter>
|
||||
<tab> open the file or directory in a new window in the FileEditing
|
||||
area.
|
||||
c change the pwd to the directory currently displayed
|
||||
C change the currently displayed directory to pwd (converse of
|
||||
c) this helps in changing to different drives in windows.
|
||||
i.e, if you are currently on the c: drive and you want to
|
||||
change to the d: drive, you will have to do
|
||||
cd d:\
|
||||
and then press 'C' in the file explorer area.
|
||||
s select sort field (size, date, name)
|
||||
r reverse direction of sort
|
||||
f add current directory to list of favorites.
|
||||
R rename file
|
||||
D delete file (or range of files in visual mode)
|
||||
- move up one level
|
||||
<F5> refresh the file list
|
||||
|
||||
2. Buffer Explorer plugin
|
||||
See |bufexplorer-usage| for details.
|
||||
NOTE: In addition to those shortcuts, winmanager adds the following:
|
||||
<tab> Opens the buffer under the cursor in a split window even if
|
||||
the current buffer is not modified.
|
||||
|
||||
This window is dynamically rescaled and re-displayed. i.e, when a new window
|
||||
opens somehwere, the buffer list is automatically updated. also, it tries to
|
||||
occupy the minimum possible space required to display the files.
|
||||
|
||||
3. File Editing Area
|
||||
The area where normal editing takes place. The commands in the File Explorer
|
||||
and Buffer Explorer shouldnt affect the layout of the windows here. Some
|
||||
mappings which I find useful (which should be placed in your .vimrc if you
|
||||
plan on using WManager often) is
|
||||
>
|
||||
map <c-w><c-b> :BottomExplorerWindow<cr>
|
||||
map <c-w><c-f> :FirstExplorerWindow<cr>
|
||||
map <c-w><c-t> :WMToggle<cr>
|
||||
|
||||
Pressing CTRL-W-B should then take you directly to the last explorer window
|
||||
Similarly pressing CTRL-W-F should take you to the first explorer window.
|
||||
CTRL-W-T will toggle between the winmanager visible and invisible.
|
||||
|
||||
=============================================================================
|
||||
ADDING NEW PLUGINS *winmanager-adding*
|
||||
|
||||
This section is of interest only to people who might want to extend winmanager
|
||||
by adding other plugins to it. The casual user can skip it.
|
||||
|
||||
One of the most important new features of winmanager2.x is the ability to let
|
||||
other users add IDE type plugins to winmanager.vim with a minimum of effort.
|
||||
The way winmanager ships, it usually contains the following plugins:
|
||||
>
|
||||
(FileExplorer, TagsExplorer)
|
||||
(BufExplorer)
|
||||
|
||||
i.e, FileExplorer and TagsExplorer occupy one window as a single group, while
|
||||
BufExplorer occupies another window. "Adding" a plugin means that you will be
|
||||
able to add a seperate IDE plugin, (call it "YourPlugin" henceforth) either to
|
||||
one of these groups or seperately by itself. This section describes how to
|
||||
accomplish this. Although the section is somewhat lengthy, please rest assured
|
||||
that its really quite simple to do. Have a look at |wintagexplorer|.vim for a
|
||||
small plugin which accomplishes this.
|
||||
|
||||
To better understand the process, its helpful to give a short description of
|
||||
the workings of winmanager. When a user wants to use your plugin, he
|
||||
"registers" it with winmanager, i.e he adds the "name" of the plugin to the
|
||||
variable g:winManagerWindowLayout in his .vimrc as:
|
||||
|
||||
" this line goes in the user's .vimrc
|
||||
let g:winManagerWindowLayout = "FileExplorer,TagsExplorer|YourPlugin"
|
||||
|
||||
When winmanager starts up, it remembers the string "YourPlugin" internally as
|
||||
the plugins "name". (The reason for making this a part of the user's .vimrc
|
||||
is that that way, he can customize the window layout according to his
|
||||
preferences).
|
||||
|
||||
In addition to registering, the plugin itself initializes a variable called
|
||||
the "title" which starts with the name, such as: >
|
||||
|
||||
" this line goes in your script file.
|
||||
let g:YourPlugin_title = "[My Plugin Title]"
|
||||
|
||||
<
|
||||
NOTE: Just like the rest of the hooks provided by your plugin, this global
|
||||
variable name is formed according the rule: g:<YourPluginName>_title.
|
||||
|
||||
When winmanager starts up, it performs the following 2 actions:
|
||||
1. It opens a new file with the "title" provided by the plugin. This
|
||||
automatically ensures that the same buffer is opened for multiple
|
||||
invokations of the plugin.
|
||||
NOTE: It is very important for this reason that the plugin's name be
|
||||
distinct so that there is a low (ideally zero) probability of a file
|
||||
with the same name existing on a user's system.
|
||||
2. It modifies the "name" string (in this case "YourPlugin") to form
|
||||
"call YourPlugin_Start()" and then |exec|s this string. Thus winmanager
|
||||
communicates with your plugin by using a number of such "hooks" or
|
||||
global functions which all start with the string "YourPlugin" which are
|
||||
defined in the script file you create.
|
||||
|
||||
In order to enable the dynamic nature of winmanager, where you can have your
|
||||
plugin change its display every time a |BufEnter| or |BufDelete| event occurs,
|
||||
it is necessary to provide a few other hooks. Every time a BufEnter or
|
||||
BufDelete event occurs, winmanager makes a loop over all the visible buffers.
|
||||
Then it "refreshes" the display of that plugin if it is "invalid". The
|
||||
following paragraphs describe the hooks that have to be provided to enable
|
||||
this.
|
||||
|
||||
*winmanager-hooks*
|
||||
|
||||
The following is a list of hooks which should be provided. A few of them are
|
||||
optional. Consider the case where you want to add a plugin which you have
|
||||
named "YourPlugin". In the following discussion, a "hook" simply refers to a
|
||||
globally visible function which is formed according to the rule that it start
|
||||
with the string "YourPlugin_", where "YourPlugin" is the name of your plugin.
|
||||
|
||||
*winmanager-hook-start*
|
||||
YourPlugin_Start() This function is called during initialization. It
|
||||
{Mandatory} can be assumed (and _should_ be) that the focus is
|
||||
already in the buffer where stuff needs to be
|
||||
displayed. i.e, the plugin shouldnt open some other
|
||||
buffer during this function. (i.e, commands such as
|
||||
":e", ":vsplit", ":wincmd h" etc in this stage are
|
||||
bad. If however, you absolutely need to switch
|
||||
buffers or something which will cause |BufEnter| or
|
||||
|BufDelete| events, then you need to temporarily
|
||||
switch winmanager off by using
|
||||
|WinManagerSuspendAUs|)
|
||||
|
||||
*winmanager-hook-isvalid*
|
||||
YourPlugin_IsValid() winmanager is dynamic in the sense that it allows the
|
||||
{Mandatory} plugins to change their displays when a BufEnter event
|
||||
occurs. At each BufEnter event, winmanager will cycle
|
||||
through all the visible explorers asking them if
|
||||
their display is "valid". If it isn't, then they will
|
||||
be redrawn by calling the next function.
|
||||
|
||||
For plugins such as bufexplorer which change with
|
||||
every BufEnter, it is sufficient to make this always
|
||||
return 1. For plugins such as fileexplorer, the
|
||||
display never changes with the BufEnter even. hence
|
||||
in its case, it will always return 0.
|
||||
|
||||
*winmanager-hook-refresh*
|
||||
YourPlugin_Refresh() If the YourPlugin_IsValid() function returns 0, then
|
||||
{Optional} this function is called to update the display. if the
|
||||
first function always returns 1, then this function
|
||||
need not be defined.
|
||||
NOTE: It is not clear at this time whether this
|
||||
function is really necessary. It might be obsoleted
|
||||
in the future. Future versions might call the
|
||||
_Start() function instead.
|
||||
NOTE: It has been obsoleted as of version 2.1
|
||||
|
||||
*winmanager-hook-resize*
|
||||
YourPlugin_ReSize() The plugins can also be dynamically resizable. (the
|
||||
{Optional} current bufexplorer which ships with the winmanager
|
||||
exhibits this behavior). If a plugin creates such a
|
||||
function, then it will be called after its Refresh()
|
||||
function. The reason for not letting the plugin make
|
||||
this a part of its Refresh() function is that
|
||||
sometimes resizing is not allowed, such as in
|
||||
instances where there is no window above or below the
|
||||
plugin to take the slack of a resize.
|
||||
|
||||
|
||||
In addition, the plugin should also initialize the following global variable
|
||||
|
||||
*winmanager-hook-title*
|
||||
g:YourPlugin_title This is the name of the buffer associated with
|
||||
this plugin. The reason for a title in addition to a
|
||||
name is that the name should be such that a global
|
||||
function of that name can be defined. However, the
|
||||
title can be more descriptive and contain spaces
|
||||
etc. For example, the present distribution of
|
||||
FileExplorer has the title "[File List]". Also,
|
||||
winmanager opens a file with this name (using an
|
||||
equivalent of ":e g:YourPlugin_title"), which
|
||||
automatically ensures that new buffers are not eaten
|
||||
up in multiple invokations of winmanager, toggling
|
||||
visibility of buffers, etc.
|
||||
NOTE: It is very important for this reason that the
|
||||
plugin's name be distinct so that there is a low
|
||||
(ideally zero) probability of a file with the same
|
||||
name existing on a user's system.
|
||||
|
||||
In addition to YourPlugin providing winmanager with hooks, winmanager also
|
||||
provides the following hooks for use by YourPlugin:
|
||||
|
||||
*WinManagerFileEdit*
|
||||
WinManagerFileEdit({filename}, {split})
|
||||
This function _must_ be used when the plugin wants
|
||||
to open a new file in the file editing area for
|
||||
editing. Its not sufficient to do something like
|
||||
":wincmd p" and then ":e filename", because first of
|
||||
all the ":wincmd p" command gets screwed
|
||||
(unfortunately) in the presence of winmanager
|
||||
because of the (sometimes) large movement winmanager
|
||||
does over all visible windows to maintain the
|
||||
dynamic nature. Secondly, doing a simple ":e
|
||||
filename" will not preserve the @# and the @%
|
||||
registers properly, causing handy commands such as
|
||||
|CTRL-^| to totally mis-behave.
|
||||
|
||||
The first argument should be (preferably) the
|
||||
(complete) name of the file to be opened (including
|
||||
the full path to it if possible). The second
|
||||
argument decides whether winmanager should attempt
|
||||
to open the file in the same window as the last
|
||||
window or to split a new window to open the file.
|
||||
|
||||
*WinManagerSuspendAUs*
|
||||
WinManagerSuspendAUs() This makes winmanager stop responding to the
|
||||
|BufEnter| or |BufDelete| autocommands like it
|
||||
normally does. Please use this function with care.
|
||||
You will need to use this when you are performing
|
||||
some action which causes these events but you dont
|
||||
want to have winmanager go through the whole
|
||||
isvalid/refresh cycle. NOTE: Take care to definitely
|
||||
reset the behavior by using the next function.
|
||||
|
||||
*WinManagerResumeAUs*
|
||||
WinManagerResumeAUs() This is the converse of |WinManagerSuspendAUs()|. It
|
||||
makes winmanager start responding to events with the
|
||||
usual isvalid/refresh cycle.
|
||||
|
||||
*WinManagerForceReSize*
|
||||
WinManagerForceReSize() Normally, winmanager calls the YourPlugin_ReSize()
|
||||
function after the YourPlugin_Refresh(). However,
|
||||
this happens only every |BufEnter| event. When the
|
||||
plugin performs some function which requires it to
|
||||
resize even when there was no |BufEnter| or
|
||||
|BufDelete| event, use this function. Please avoid
|
||||
making a call to YourPlugin_ReSize() because a
|
||||
number of safety checks have to be performed before
|
||||
a resizing is "legal".
|
||||
|
||||
Finally, if you do plan on making an addin to winmanager, feel free to contact
|
||||
me for help/comments/suggestions. You might also want to take a look at: >
|
||||
http://robotics.eecs.berkeley.edu/~srinath/vim/explorerSample.vim
|
||||
for a simple template of an add-in plugin.
|
||||
|
||||
=============================================================================
|
||||
BUGS *winmanager-bug*
|
||||
|
||||
Please send any comments for improvements or bug-reports to >
|
||||
srinath@fastmail.fm
|
||||
If the bug is repeatable, then it will be of great help if a short description
|
||||
of the events leading to the bug are also given.
|
||||
|
||||
Note "I dont like winmanager" is not a bug report, only an opinion ;-)
|
||||
|
||||
=============================================================================
|
||||
THANKS *winmanager-thanks*
|
||||
|
||||
I am really grateful to all those who emailed me with bug-reports and comments
|
||||
for improvement. Most of all, a huge thanks to Xiangjiang Ma for his enormous
|
||||
support and extremeley helpful QA.
|
||||
|
||||
Other people who helped greatly:
|
||||
Madoka Machitani: fixed a couple of typos and gave some ideas for making
|
||||
things more robust.
|
||||
Colin Dearing: gave many useful suggestions for improvement which lead to
|
||||
the fast redraw capability of winmanager
|
||||
Jeff Lanzarotta: for agreeing to make changes to bufexplorer.vim so that
|
||||
bufexplorer.vim would be compatible with the latest version of
|
||||
winmanager.vim
|
||||
|
||||
and finally all the great support I got from vim@vim.org and comp.editors
|
||||
helped a lot.
|
||||
|
||||
|
||||
vim:tw=78:et:ts=4:ft=help:norl:
|
||||
1162
resources/.vim/plugin/bufexplorer.vim
Normal file
1162
resources/.vim/plugin/bufexplorer.vim
Normal file
File diff suppressed because it is too large
Load diff
665
resources/.vim/plugin/ipy.vim
Normal file
665
resources/.vim/plugin/ipy.vim
Normal file
|
|
@ -0,0 +1,665 @@
|
|||
" Vim integration with IPython 0.11+
|
||||
"
|
||||
" A two-way integration between Vim and IPython.
|
||||
"
|
||||
" Using this plugin, you can send lines or whole files for IPython to execute,
|
||||
" and also get back object introspection and word completions in Vim, like
|
||||
" what you get with: object?<enter> object.<tab> in IPython
|
||||
"
|
||||
" -----------------
|
||||
" Quickstart Guide:
|
||||
" -----------------
|
||||
" Start ipython qtconsole and copy the connection string.
|
||||
" Source this file, which provides new IPython command
|
||||
" :source ipy.vim
|
||||
" :IPythonClipboard
|
||||
" (or :IPythonXSelection if you're using X11 without having to copy)
|
||||
"
|
||||
" written by Paul Ivanov (http://pirsquared.org)
|
||||
"
|
||||
if !has('python')
|
||||
" exit if python is not available.
|
||||
finish
|
||||
endif
|
||||
|
||||
" Allow custom mappings.
|
||||
if !exists('g:ipy_perform_mappings')
|
||||
let g:ipy_perform_mappings = 1
|
||||
endif
|
||||
|
||||
" Register IPython completefunc
|
||||
" 'global' -- for all of vim (default).
|
||||
" 'local' -- only for the current buffer.
|
||||
" otherwise -- don't register it at all.
|
||||
"
|
||||
" you can later set it using ':set completefunc=CompleteIPython', which will
|
||||
" correspond to the 'global' behavior, or with ':setl ...' to get the 'local'
|
||||
" behavior
|
||||
if !exists('g:ipy_completefunc')
|
||||
let g:ipy_completefunc = 'global'
|
||||
endif
|
||||
|
||||
python << EOF
|
||||
reselect = False # reselect lines after sending from Visual mode
|
||||
show_execution_count = True # wait to get numbers for In[43]: feedback?
|
||||
monitor_subchannel = True # update vim-ipython 'shell' on every send?
|
||||
run_flags= "-i" # flags to for IPython's run magic when using <F5>
|
||||
current_line = ''
|
||||
|
||||
import vim
|
||||
import sys
|
||||
|
||||
# get around unicode problems when interfacing with vim
|
||||
vim_encoding=vim.eval('&encoding') or 'utf-8'
|
||||
|
||||
try:
|
||||
sys.stdout.flush
|
||||
except AttributeError:
|
||||
# IPython complains if stderr and stdout don't have flush
|
||||
# this is fixed in newer version of Vim
|
||||
class WithFlush(object):
|
||||
def __init__(self,noflush):
|
||||
self.write=noflush.write
|
||||
self.writelines=noflush.writelines
|
||||
def flush(self):pass
|
||||
sys.stdout = WithFlush(sys.stdout)
|
||||
sys.stderr = WithFlush(sys.stderr)
|
||||
|
||||
|
||||
|
||||
ip = '127.0.0.1'
|
||||
try:
|
||||
km
|
||||
except NameError:
|
||||
km = None
|
||||
try:
|
||||
pid
|
||||
except NameError:
|
||||
pid = None
|
||||
|
||||
def km_from_string(s=''):
|
||||
"""create kernel manager from IPKernelApp string
|
||||
such as '--shell=47378 --iopub=39859 --stdin=36778 --hb=52668' for IPython 0.11
|
||||
or just 'kernel-12345.json' for IPython 0.12
|
||||
"""
|
||||
from os.path import join as pjoin
|
||||
from IPython.zmq.blockingkernelmanager import BlockingKernelManager, Empty
|
||||
from IPython.config.loader import KeyValueConfigLoader
|
||||
from IPython.zmq.kernelapp import kernel_aliases
|
||||
global km,send,Empty
|
||||
|
||||
s = s.replace('--existing', '')
|
||||
if 'connection_file' in BlockingKernelManager.class_trait_names():
|
||||
from IPython.lib.kernel import find_connection_file
|
||||
# 0.12 uses files instead of a collection of ports
|
||||
# include default IPython search path
|
||||
# filefind also allows for absolute paths, in which case the search
|
||||
# is ignored
|
||||
try:
|
||||
# XXX: the following approach will be brittle, depending on what
|
||||
# connection strings will end up looking like in the future, and
|
||||
# whether or not they are allowed to have spaces. I'll have to sync
|
||||
# up with the IPython team to address these issues -pi
|
||||
if '--profile' in s:
|
||||
k,p = s.split('--profile')
|
||||
k = k.lstrip().rstrip() # kernel part of the string
|
||||
p = p.lstrip().rstrip() # profile part of the string
|
||||
fullpath = find_connection_file(k,p)
|
||||
else:
|
||||
fullpath = find_connection_file(s.lstrip().rstrip())
|
||||
except IOError,e:
|
||||
echo(":IPython " + s + " failed", "Info")
|
||||
echo("^-- failed '" + s + "' not found", "Error")
|
||||
return
|
||||
km = BlockingKernelManager(connection_file = fullpath)
|
||||
km.load_connection_file()
|
||||
else:
|
||||
if s == '':
|
||||
echo(":IPython 0.11 requires the full connection string")
|
||||
return
|
||||
loader = KeyValueConfigLoader(s.split(), aliases=kernel_aliases)
|
||||
cfg = loader.load_config()['KernelApp']
|
||||
try:
|
||||
km = BlockingKernelManager(
|
||||
shell_address=(ip, cfg['shell_port']),
|
||||
sub_address=(ip, cfg['iopub_port']),
|
||||
stdin_address=(ip, cfg['stdin_port']),
|
||||
hb_address=(ip, cfg['hb_port']))
|
||||
except KeyError,e:
|
||||
echo(":IPython " +s + " failed", "Info")
|
||||
echo("^-- failed --"+e.message.replace('_port','')+" not specified", "Error")
|
||||
return
|
||||
km.start_channels()
|
||||
send = km.shell_channel.execute
|
||||
|
||||
# now that we're connect to an ipython kernel, activate completion
|
||||
# machinery, but do so only for the local buffer if the user added the
|
||||
# following line the vimrc:
|
||||
# let g:ipy_completefunc = 'local'
|
||||
vim.command("""
|
||||
if g:ipy_completefunc == 'global'
|
||||
set completefunc=CompleteIPython
|
||||
elseif g:ipy_completefunc == 'local'
|
||||
setl completefunc=CompleteIPython
|
||||
endif
|
||||
""")
|
||||
# also activate GUI doc balloons if in gvim
|
||||
vim.command("""
|
||||
if has('balloon_eval')
|
||||
set bexpr=IPythonBalloonExpr()
|
||||
set ballooneval
|
||||
endif
|
||||
""")
|
||||
set_pid()
|
||||
return km
|
||||
|
||||
def echo(arg,style="Question"):
|
||||
try:
|
||||
vim.command("echohl %s" % style)
|
||||
vim.command("echom \"%s\"" % arg.replace('\"','\\\"'))
|
||||
vim.command("echohl None")
|
||||
except vim.error:
|
||||
print "-- %s" % arg
|
||||
|
||||
def disconnect():
|
||||
"disconnect kernel manager"
|
||||
# XXX: make a prompt here if this km owns the kernel
|
||||
pass
|
||||
|
||||
def get_doc(word):
|
||||
if km is None:
|
||||
return ["Not connected to IPython, cannot query: %s" % word]
|
||||
msg_id = km.shell_channel.object_info(word)
|
||||
doc = get_doc_msg(msg_id)
|
||||
# get around unicode problems when interfacing with vim
|
||||
return [d.encode(vim_encoding) for d in doc]
|
||||
|
||||
import re
|
||||
# from http://serverfault.com/questions/71285/in-centos-4-4-how-can-i-strip-escape-sequences-from-a-text-file
|
||||
strip = re.compile('\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]')
|
||||
def strip_color_escapes(s):
|
||||
return strip.sub('',s)
|
||||
|
||||
def get_doc_msg(msg_id):
|
||||
n = 13 # longest field name (empirically)
|
||||
b=[]
|
||||
try:
|
||||
content = get_child_msg(msg_id)['content']
|
||||
except Empty:
|
||||
# timeout occurred
|
||||
return ["no reply from IPython kernel"]
|
||||
|
||||
if not content['found']:
|
||||
return b
|
||||
|
||||
for field in ['type_name','base_class','string_form','namespace',
|
||||
'file','length','definition','source','docstring']:
|
||||
c = content.get(field,None)
|
||||
if c:
|
||||
if field in ['definition']:
|
||||
c = strip_color_escapes(c).rstrip()
|
||||
s = field.replace('_',' ').title()+':'
|
||||
s = s.ljust(n)
|
||||
if c.find('\n')==-1:
|
||||
b.append(s+c)
|
||||
else:
|
||||
b.append(s)
|
||||
b.extend(c.splitlines())
|
||||
return b
|
||||
|
||||
def get_doc_buffer(level=0):
|
||||
# empty string in case vim.eval return None
|
||||
word = vim.eval('expand("<cfile>")') or ''
|
||||
doc = get_doc(word)
|
||||
if len(doc) ==0:
|
||||
echo(repr(word)+" not found","Error")
|
||||
return
|
||||
# documentation buffer name is same as the query made to ipython
|
||||
vim.command('new '+word)
|
||||
vim.command('setlocal modifiable noro')
|
||||
# doc window quick quit keys: 'q' and 'escape'
|
||||
vim.command('map <buffer> q :q<CR>')
|
||||
# Known issue: to enable the use of arrow keys inside the terminal when
|
||||
# viewing the documentation, comment out the next line
|
||||
vim.command('map <buffer> <Esc> :q<CR>')
|
||||
# and uncomment this line (which will work if you have a timoutlen set)
|
||||
#vim.command('map <buffer> <Esc><Esc> :q<CR>')
|
||||
b = vim.current.buffer
|
||||
b[:] = None
|
||||
b[:] = doc
|
||||
vim.command('setlocal nomodified bufhidden=wipe')
|
||||
#vim.command('setlocal previewwindow nomodifiable nomodified ro')
|
||||
#vim.command('set previewheight=%d'%len(b))# go to previous window
|
||||
vim.command('resize %d'%len(b))
|
||||
#vim.command('pcl')
|
||||
#vim.command('pedit doc')
|
||||
#vim.command('normal ') # go to previous window
|
||||
# use the ReST formatting that ships with stock vim
|
||||
vim.command('setlocal syntax=rst')
|
||||
|
||||
def vim_ipython_is_open():
|
||||
"""
|
||||
Helper function to let us know if the vim-ipython shell is currently
|
||||
visible
|
||||
"""
|
||||
for w in vim.windows:
|
||||
if w.buffer.name is not None and w.buffer.name.endswith("vim-ipython"):
|
||||
return True
|
||||
return False
|
||||
|
||||
def update_subchannel_msgs(debug=False, force=False):
|
||||
"""
|
||||
Grab any pending messages and place them inside the vim-ipython shell.
|
||||
This function will do nothing if the vim-ipython shell is not visible,
|
||||
unless force=True argument is passed.
|
||||
"""
|
||||
if km is None or (not vim_ipython_is_open() and not force):
|
||||
return False
|
||||
msgs = km.sub_channel.get_msgs()
|
||||
if debug:
|
||||
#try:
|
||||
# vim.command("b debug_msgs")
|
||||
#except vim.error:
|
||||
# vim.command("new debug_msgs")
|
||||
#finally:
|
||||
db = vim.current.buffer
|
||||
else:
|
||||
db = []
|
||||
b = vim.current.buffer
|
||||
startedin_vimipython = vim.eval('@%')=='vim-ipython'
|
||||
if not startedin_vimipython:
|
||||
# switch to preview window
|
||||
vim.command(
|
||||
"try"
|
||||
"|silent! wincmd P"
|
||||
"|catch /^Vim\%((\a\+)\)\=:E441/"
|
||||
"|silent pedit +set\ ma vim-ipython"
|
||||
"|silent! wincmd P"
|
||||
"|endtry")
|
||||
# if the current window is called 'vim-ipython'
|
||||
if vim.eval('@%')=='vim-ipython':
|
||||
# set the preview window height to the current height
|
||||
vim.command("set pvh=" + vim.eval('winheight(0)'))
|
||||
else:
|
||||
# close preview window, it was something other than 'vim-ipython'
|
||||
vim.command("pcl")
|
||||
vim.command("silent pedit +set\ ma vim-ipython")
|
||||
vim.command("wincmd P") #switch to preview window
|
||||
# subchannel window quick quit key 'q'
|
||||
vim.command('map <buffer> q :q<CR>')
|
||||
vim.command("set bufhidden=hide buftype=nofile ft=python")
|
||||
# make shift-enter and control-enter in insert mode behave same as in ipython notebook
|
||||
# shift-enter send the current line, control-enter send the line
|
||||
# but keeps it around for further editing.
|
||||
vim.command("imap <buffer> <s-Enter> <esc>dd:python run_command('''<C-r>\"''')<CR>i")
|
||||
# pkddA: paste, go up one line which is blank after run_command,
|
||||
# delete it, and then back to insert mode
|
||||
vim.command("imap <buffer> <c-Enter> <esc>dd:python run_command('''<C-r>\"''')<CR>pkddA")
|
||||
# ctrl-C gets sent to the IPython process as a signal on POSIX
|
||||
vim.command("map <buffer> :IPythonInterrupt<cr>")
|
||||
|
||||
#syntax highlighting for python prompt
|
||||
# QtConsole In[] is blue, but I prefer the oldschool green
|
||||
# since it makes the vim-ipython 'shell' look like the holidays!
|
||||
#vim.command("hi Blue ctermfg=Blue guifg=Blue")
|
||||
vim.command("hi Green ctermfg=Green guifg=Green")
|
||||
vim.command("hi Red ctermfg=Red guifg=Red")
|
||||
vim.command("syn keyword Green 'In\ []:'")
|
||||
vim.command("syn match Green /^In \[[0-9]*\]\:/")
|
||||
vim.command("syn match Red /^Out\[[0-9]*\]\:/")
|
||||
b = vim.current.buffer
|
||||
update_occured = False
|
||||
for m in msgs:
|
||||
#db.append(str(m).splitlines())
|
||||
s = ''
|
||||
if 'msg_type' not in m['header']:
|
||||
# debug information
|
||||
#echo('skipping a message on sub_channel','WarningMsg')
|
||||
#echo(str(m))
|
||||
continue
|
||||
elif m['header']['msg_type'] == 'status':
|
||||
continue
|
||||
elif m['header']['msg_type'] == 'stream':
|
||||
s = strip_color_escapes(m['content']['data'])
|
||||
elif m['header']['msg_type'] == 'pyout':
|
||||
s = "Out[%d]: " % m['content']['execution_count']
|
||||
s += m['content']['data']['text/plain']
|
||||
elif m['header']['msg_type'] == 'pyin':
|
||||
# TODO: the next line allows us to resend a line to ipython if
|
||||
# %doctest_mode is on. In the future, IPython will send the
|
||||
# execution_count on subchannel, so this will need to be updated
|
||||
# once that happens
|
||||
if 'execution_count' in m['content']:
|
||||
s = "\nIn [%d]: "% m['content']['execution_count']
|
||||
else:
|
||||
s = "\nIn [00]: "
|
||||
s += m['content']['code'].strip()
|
||||
elif m['header']['msg_type'] == 'pyerr':
|
||||
c = m['content']
|
||||
s = "\n".join(map(strip_color_escapes,c['traceback']))
|
||||
s += c['ename'] + ":" + c['evalue']
|
||||
if s.find('\n') == -1:
|
||||
# somewhat ugly unicode workaround from
|
||||
# http://vim.1045645.n5.nabble.com/Limitations-of-vim-python-interface-with-respect-to-character-encodings-td1223881.html
|
||||
if isinstance(s,unicode):
|
||||
s=s.encode(vim_encoding)
|
||||
b.append(s)
|
||||
else:
|
||||
try:
|
||||
b.append(s.splitlines())
|
||||
except:
|
||||
b.append([l.encode(vim_encoding) for l in s.splitlines()])
|
||||
update_occured = True
|
||||
# make a newline so we can just start typing there
|
||||
if b[-1] != '':
|
||||
b.append([''])
|
||||
vim.command('normal G') # go to the end of the file
|
||||
if not startedin_vimipython:
|
||||
vim.command('normal p') # go back to where you were
|
||||
return update_occured
|
||||
|
||||
def get_child_msg(msg_id):
|
||||
# XXX: message handling should be split into its own process in the future
|
||||
while True:
|
||||
# get_msg will raise with Empty exception if no messages arrive in 1 second
|
||||
m= km.shell_channel.get_msg(timeout=1)
|
||||
if m['parent_header']['msg_id'] == msg_id:
|
||||
break
|
||||
else:
|
||||
#got a message, but not the one we were looking for
|
||||
echo('skipping a message on shell_channel','WarningMsg')
|
||||
return m
|
||||
|
||||
def print_prompt(prompt,msg_id=None):
|
||||
"""Print In[] or In[42] style messages"""
|
||||
global show_execution_count
|
||||
if show_execution_count and msg_id:
|
||||
# wait to get message back from kernel
|
||||
try:
|
||||
child = get_child_msg(msg_id)
|
||||
count = child['content']['execution_count']
|
||||
echo("In[%d]: %s" %(count,prompt))
|
||||
except Empty:
|
||||
echo("In[]: %s (no reply from IPython kernel)" % prompt)
|
||||
else:
|
||||
echo("In[]: %s" % prompt)
|
||||
|
||||
def with_subchannel(f,*args):
|
||||
"conditionally monitor subchannel"
|
||||
def f_with_update(*args):
|
||||
try:
|
||||
f(*args)
|
||||
if monitor_subchannel:
|
||||
update_subchannel_msgs()
|
||||
except AttributeError: #if km is None
|
||||
echo("not connected to IPython", 'Error')
|
||||
return f_with_update
|
||||
|
||||
@with_subchannel
|
||||
def run_this_file():
|
||||
msg_id = send('run %s %s' % (run_flags, repr(vim.current.buffer.name),))
|
||||
print_prompt("In[]: run %s %s" % (run_flags, repr(vim.current.buffer.name)),msg_id)
|
||||
|
||||
@with_subchannel
|
||||
def run_this_line():
|
||||
msg_id = send(vim.current.line)
|
||||
print_prompt(vim.current.line, msg_id)
|
||||
|
||||
@with_subchannel
|
||||
def run_command(cmd):
|
||||
msg_id = send(cmd)
|
||||
print_prompt(cmd, msg_id)
|
||||
|
||||
@with_subchannel
|
||||
def run_these_lines():
|
||||
r = vim.current.range
|
||||
lines = "\n".join(vim.current.buffer[r.start:r.end+1])
|
||||
msg_id = send(lines)
|
||||
#alternative way of doing this in more recent versions of ipython
|
||||
#but %paste only works on the local machine
|
||||
#vim.command("\"*yy")
|
||||
#send("'%paste')")
|
||||
#reselect the previously highlighted block
|
||||
vim.command("normal gv")
|
||||
if not reselect:
|
||||
vim.command("normal ")
|
||||
|
||||
#vim lines start with 1
|
||||
#print "lines %d-%d sent to ipython"% (r.start+1,r.end+1)
|
||||
prompt = "lines %d-%d "% (r.start+1,r.end+1)
|
||||
print_prompt(prompt,msg_id)
|
||||
|
||||
|
||||
def set_pid():
|
||||
"""
|
||||
Explicitly ask the ipython kernel for its pid
|
||||
"""
|
||||
global km, pid
|
||||
lines = '\n'.join(['import os', '_pid = os.getpid()'])
|
||||
msg_id = send(lines, silent=True, user_variables=['_pid'])
|
||||
|
||||
# wait to get message back from kernel
|
||||
try:
|
||||
child = get_child_msg(msg_id)
|
||||
except Empty:
|
||||
echo("no reply from IPython kernel")
|
||||
return
|
||||
|
||||
pid = int(child['content']['user_variables']['_pid'])
|
||||
return pid
|
||||
|
||||
|
||||
def interrupt_kernel_hack():
|
||||
"""
|
||||
Sends the interrupt signal to the remote kernel. This side steps the
|
||||
(non-functional) ipython interrupt mechanisms.
|
||||
Only works on posix.
|
||||
"""
|
||||
global pid
|
||||
import signal
|
||||
import os
|
||||
if pid is None:
|
||||
# Avoid errors if we couldn't get pid originally,
|
||||
# by trying to obtain it now
|
||||
pid = set_pid()
|
||||
|
||||
if pid is None:
|
||||
echo("cannot get kernel PID, Ctrl-C will not be supported")
|
||||
return
|
||||
echo("KeyboardInterrupt (sent to ipython: pid " +
|
||||
"%i with signal %i)" % (pid, signal.SIGINT),"Operator")
|
||||
try:
|
||||
os.kill(pid, signal.SIGINT)
|
||||
except OSError:
|
||||
echo("unable to kill pid %d" % pid)
|
||||
pid = None
|
||||
|
||||
def dedent_run_this_line():
|
||||
vim.command("left")
|
||||
run_this_line()
|
||||
vim.command("silent undo")
|
||||
|
||||
def dedent_run_these_lines():
|
||||
r = vim.current.range
|
||||
shiftwidth = vim.eval('&shiftwidth')
|
||||
count = int(vim.eval('indent(%d+1)/%s' % (r.start,shiftwidth)))
|
||||
vim.command("'<,'>" + "<"*count)
|
||||
run_these_lines()
|
||||
vim.command("silent undo")
|
||||
|
||||
#def set_this_line():
|
||||
# # not sure if there's a way to do this, since we have multiple clients
|
||||
# send("get_ipython().shell.set_next_input(\'%s\')" % vim.current.line.replace("\'","\\\'"))
|
||||
# #print "line \'%s\' set at ipython prompt"% vim.current.line
|
||||
# echo("line \'%s\' set at ipython prompt"% vim.current.line,'Statement')
|
||||
|
||||
|
||||
def toggle_reselect():
|
||||
global reselect
|
||||
reselect=not reselect
|
||||
print "F9 will%sreselect lines after sending to ipython"% (reselect and " " or " not ")
|
||||
|
||||
#def set_breakpoint():
|
||||
# send("__IP.InteractiveTB.pdb.set_break('%s',%d)" % (vim.current.buffer.name,
|
||||
# vim.current.window.cursor[0]))
|
||||
# print "set breakpoint in %s:%d"% (vim.current.buffer.name,
|
||||
# vim.current.window.cursor[0])
|
||||
#
|
||||
#def clear_breakpoint():
|
||||
# send("__IP.InteractiveTB.pdb.clear_break('%s',%d)" % (vim.current.buffer.name,
|
||||
# vim.current.window.cursor[0]))
|
||||
# print "clearing breakpoint in %s:%d" % (vim.current.buffer.name,
|
||||
# vim.current.window.cursor[0])
|
||||
#
|
||||
#def clear_all_breakpoints():
|
||||
# send("__IP.InteractiveTB.pdb.clear_all_breaks()");
|
||||
# print "clearing all breakpoints"
|
||||
#
|
||||
#def run_this_file_pdb():
|
||||
# send(' __IP.InteractiveTB.pdb.run(\'execfile("%s")\')' % (vim.current.buffer.name,))
|
||||
# #send('run -d %s' % (vim.current.buffer.name,))
|
||||
# echo("In[]: run -d %s (using pdb)" % vim.current.buffer.name)
|
||||
|
||||
EOF
|
||||
|
||||
fun! <SID>toggle_send_on_save()
|
||||
if exists("s:ssos") && s:ssos == 0
|
||||
let s:ssos = 1
|
||||
au BufWritePost *.py :py run_this_file()
|
||||
echo "Autosend On"
|
||||
else
|
||||
let s:ssos = 0
|
||||
au! BufWritePost *.py
|
||||
echo "Autosend Off"
|
||||
endif
|
||||
endfun
|
||||
|
||||
" Update the vim-ipython shell when the cursor is not moving.
|
||||
" You can change how quickly this happens after you stop moving the cursor by
|
||||
" setting 'updatetime' (in milliseconds). For example, to have this event
|
||||
" trigger after 1 second:
|
||||
"
|
||||
" :set updatetime 1000
|
||||
"
|
||||
" NOTE: This will only be triggered once, after the first 'updatetime'
|
||||
" milliseconds, *not* every 'updatetime' milliseconds. see :help CursorHold
|
||||
" for more info.
|
||||
"
|
||||
" TODO: Make this easily configurable on the fly, so that an introspection
|
||||
" buffer we may have opened up doesn't get closed just because of an idle
|
||||
" event (i.e. user pressed \d and then left the buffer that popped up, but
|
||||
" expects it to stay there).
|
||||
au CursorHold *.*,vim-ipython :python if update_subchannel_msgs(): echo("vim-ipython shell updated (on idle)",'Operator')
|
||||
|
||||
" XXX: broken - cursor hold update for insert mode moves the cursor one
|
||||
" character to the left of the last character (update_subchannel_msgs must be
|
||||
" doing this)
|
||||
"au CursorHoldI *.* :python if update_subchannel_msgs(): echo("vim-ipython shell updated (on idle)",'Operator')
|
||||
|
||||
" Same as above, but on regaining window focus (mostly for GUIs)
|
||||
au FocusGained *.*,vim-ipython :python if update_subchannel_msgs(): echo("vim-ipython shell updated (on input focus)",'Operator')
|
||||
|
||||
" Update vim-ipython buffer when we move the cursor there. A message is only
|
||||
" displayed if vim-ipython buffer has been updated.
|
||||
au BufEnter vim-ipython :python if update_subchannel_msgs(): echo("vim-ipython shell updated (on buffer enter)",'Operator')
|
||||
|
||||
if g:ipy_perform_mappings != 0
|
||||
map <silent> <F5> :python run_this_file()<CR>
|
||||
map <silent> <S-F5> :python run_this_line()<CR>
|
||||
map <silent> <F9> :python run_these_lines()<CR>
|
||||
map <silent> <leader>d :py get_doc_buffer()<CR>
|
||||
map <silent> <leader>s :py if update_subchannel_msgs(force=True): echo("vim-ipython shell updated",'Operator')<CR>
|
||||
map <silent> <S-F9> :python toggle_reselect()<CR>
|
||||
"map <silent> <C-F6> :python send('%pdb')<CR>
|
||||
"map <silent> <F6> :python set_breakpoint()<CR>
|
||||
"map <silent> <s-F6> :python clear_breakpoint()<CR>
|
||||
"map <silent> <F7> :python run_this_file_pdb()<CR>
|
||||
"map <silent> <s-F7> :python clear_all_breaks()<CR>
|
||||
imap <C-F5> <C-O><F5>
|
||||
imap <S-F5> <C-O><S-F5>
|
||||
imap <silent> <F5> <C-O><F5>
|
||||
map <C-F5> :call <SID>toggle_send_on_save()<CR>
|
||||
"" Example of how to quickly clear the current plot with a keystroke
|
||||
"map <silent> <F12> :python run_command("plt.clf()")<cr>
|
||||
"" Example of how to quickly close all figures with a keystroke
|
||||
"map <silent> <F11> :python run_command("plt.close('all')")<cr>
|
||||
|
||||
"pi custom
|
||||
map <silent> <C-Return> :python run_this_file()<CR>
|
||||
map <silent> <C-s> :python run_this_line()<CR>
|
||||
imap <silent> <C-s> <C-O>:python run_this_line()<CR>
|
||||
map <silent> <M-s> :python dedent_run_this_line()<CR>
|
||||
vmap <silent> <C-S> :python run_these_lines()<CR>
|
||||
vmap <silent> <M-s> :python dedent_run_these_lines()<CR>
|
||||
map <silent> <M-c> I#<ESC>
|
||||
vmap <silent> <M-c> I#<ESC>
|
||||
map <silent> <M-C> :s/^\([ \t]*\)#/\1/<CR>
|
||||
vmap <silent> <M-C> :s/^\([ \t]*\)#/\1/<CR>
|
||||
endif
|
||||
|
||||
command! -nargs=* IPython :py km_from_string("<args>")
|
||||
command! -nargs=0 IPythonClipboard :py km_from_string(vim.eval('@+'))
|
||||
command! -nargs=0 IPythonXSelection :py km_from_string(vim.eval('@*'))
|
||||
command! -nargs=0 IPythonInterrupt :py interrupt_kernel_hack()
|
||||
|
||||
function! IPythonBalloonExpr()
|
||||
python << endpython
|
||||
word = vim.eval('v:beval_text')
|
||||
reply = get_doc(word)
|
||||
vim.command("let l:doc = %s"% reply)
|
||||
endpython
|
||||
return l:doc
|
||||
endfunction
|
||||
|
||||
fun! CompleteIPython(findstart, base)
|
||||
if a:findstart
|
||||
" locate the start of the word
|
||||
let line = getline('.')
|
||||
let start = col('.') - 1
|
||||
while start > 0 && line[start-1] =~ '\k\|\.' "keyword
|
||||
let start -= 1
|
||||
endwhile
|
||||
echo start
|
||||
python << endpython
|
||||
current_line = vim.current.line
|
||||
endpython
|
||||
return start
|
||||
else
|
||||
" find months matching with "a:base"
|
||||
let res = []
|
||||
python << endpython
|
||||
base = vim.eval("a:base")
|
||||
findstart = vim.eval("a:findstart")
|
||||
msg_id = km.shell_channel.complete(base, current_line, vim.eval("col('.')"))
|
||||
try:
|
||||
m = get_child_msg(msg_id)
|
||||
matches = m['content']['matches']
|
||||
matches.insert(0,base) # the "no completion" version
|
||||
# we need to be careful with unicode, because we can have unicode
|
||||
# completions for filenames (for the %run magic, for example). So the next
|
||||
# line will fail on those:
|
||||
#completions= [str(u) for u in matches]
|
||||
# because str() won't work for non-ascii characters
|
||||
# and we also have problems with unicode in vim, hence the following:
|
||||
completions = [s.encode(vim_encoding) for s in matches]
|
||||
except Empty:
|
||||
echo("no reply from IPython kernel")
|
||||
completions=['']
|
||||
## Additionally, we have no good way of communicating lists to vim, so we have
|
||||
## to turn in into one long string, which can be problematic if e.g. the
|
||||
## completions contain quotes. The next line will not work if some filenames
|
||||
## contain quotes - but if that's the case, the user's just asking for
|
||||
## it, right?
|
||||
#completions = '["'+ '", "'.join(completions)+'"]'
|
||||
#vim.command("let completions = %s" % completions)
|
||||
## An alternative for the above, which will insert matches one at a time, so
|
||||
## if there's a problem with turning a match into a string, it'll just not
|
||||
## include the problematic match, instead of not including anything. There's a
|
||||
## bit more indirection here, but I think it's worth it
|
||||
for c in completions:
|
||||
vim.command('call add(res,"'+c+'")')
|
||||
endpython
|
||||
"call extend(res,completions)
|
||||
return res
|
||||
endif
|
||||
endfun
|
||||
4545
resources/.vim/plugin/taglist.vim
Normal file
4545
resources/.vim/plugin/taglist.vim
Normal file
File diff suppressed because it is too large
Load diff
1490
resources/.vim/plugin/winfileexplorer.vim
Normal file
1490
resources/.vim/plugin/winfileexplorer.vim
Normal file
File diff suppressed because it is too large
Load diff
1328
resources/.vim/plugin/winmanager.vim
Normal file
1328
resources/.vim/plugin/winmanager.vim
Normal file
File diff suppressed because it is too large
Load diff
510
resources/.vim/plugin/wintagexplorer.vim
Normal file
510
resources/.vim/plugin/wintagexplorer.vim
Normal file
|
|
@ -0,0 +1,510 @@
|
|||
"=============================================================================
|
||||
" File: wintagexplorer.vim
|
||||
" Author: Srinath Avadhanula (srinath@eecs.berkeley.edu)
|
||||
" Last Change: Wed Apr 03 05:00 PM 2002 PST
|
||||
" Help: This file provides a simple interface to a tags file. The tags
|
||||
" are grouped according to the file they belong to and the user can
|
||||
" press <enter> while on a tag to open the tag in an adjacent
|
||||
" window.
|
||||
"
|
||||
" This file shows the implementation of an explorer plugin add-in
|
||||
" to winmanager.vim. As explained in |winmanager-adding|, this
|
||||
" function basically has to expose various functions which
|
||||
" winmanager calls during its refresh-diplay cycle. In turn, it
|
||||
" uses the function WinManagerRileEdit() supplied by
|
||||
" winmanager.vim.
|
||||
|
||||
" See ":help winmanager" for additional details.
|
||||
" ============================================================================
|
||||
|
||||
|
||||
" "TagsExplorer" is the "name" under which this plugin "registers" itself.
|
||||
" Registration means including a line like:
|
||||
" RegisterExplorers "TagsExplorer"
|
||||
" in the .vimrc. Registration provides a way to let the user customize the
|
||||
" layout of the various windows. When a explorer is released, the user needs
|
||||
" to know this "name" to register the plugin.
|
||||
"
|
||||
" The first thing this plugin does is decide upon a "title" for itself. This is
|
||||
" the name of the buffer which winmanager will open for displaying the
|
||||
" contents of this plugin. Note that this variable has to be of the form:
|
||||
" g:<ExplorerName>_title
|
||||
" where <ExplorerName> = "TagsExplorer" for this plugin.
|
||||
let g:TagsExplorer_title = "[Tag List]"
|
||||
|
||||
" variables to remember the last position of the user within the file.
|
||||
let s:savedCursorRow = 1
|
||||
let s:savedCursorCol = 1
|
||||
|
||||
" skip display the error message if no tags file in current directory.
|
||||
if !exists('g:TagsExplorerSkipError')
|
||||
let g:TagsExplorerSkipError = 0
|
||||
end
|
||||
if !exists('g:saveTagsDisplay')
|
||||
let g:saveTagsDisplay = 1
|
||||
end
|
||||
|
||||
function! TagsExplorer_IsPossible()
|
||||
if glob('tags') == '' && g:TagsExplorerSkipError && !exists('s:tagsDisplay')
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
" This is the function which winmanager calls the first time this plugin is
|
||||
" displayed. Again, the rule for the name of this function is:
|
||||
" <ExplorerName>_Start()
|
||||
"
|
||||
function! TagsExplorer_Start()
|
||||
let _showcmd = &showcmd
|
||||
|
||||
setlocal bufhidden=delete
|
||||
setlocal buftype=nofile
|
||||
setlocal modifiable
|
||||
setlocal noswapfile
|
||||
setlocal nowrap
|
||||
setlocal nobuflisted
|
||||
|
||||
set noshowcmd
|
||||
|
||||
" set up some _really_ elementary syntax highlighting.
|
||||
if has("syntax") && !has("syntax_items") && exists("g:syntax_on")
|
||||
syn match TagsExplorerFileName '^\S*$'
|
||||
syn match TagsExplorerTagName '^ \S*'
|
||||
syn match TagsExplorerError '^"\s\+Error:'
|
||||
syn match TagsExplorerVariable 'g:TagsExplorerSkipError'
|
||||
syn match TagsExplorerIgnore '"$'
|
||||
|
||||
hi def link TagsExplorerFileName Special
|
||||
hi def link TagsExplorerTagName String
|
||||
hi def link TagsExplorerError Error
|
||||
hi def link TagsExplorerVariable Comment
|
||||
hi def link TagsExplorerIgnore Ignore
|
||||
end
|
||||
|
||||
" set up the maps.
|
||||
nnoremap <buffer> <silent> <c-]> :call <SID>OpenTag(0)<cr>
|
||||
nnoremap <buffer> <silent> <cr> :call <SID>OpenTag(0)<cr>
|
||||
nnoremap <buffer> <silent> <tab> :call <SID>OpenTag(1)<cr>
|
||||
nnoremap <buffer> <silent> <2-leftmouse> :call <SID>OpenTag(0)<cr>
|
||||
nnoremap <buffer> <silent> <space> za
|
||||
nnoremap <buffer> <silent> <c-^> <Nop>
|
||||
nnoremap <buffer> <silent> <F5> :call <SID>DisplayTagsFile()<cr>
|
||||
|
||||
call <SID>StartTagsFileDisplay()
|
||||
|
||||
" clean up.
|
||||
setlocal nomodified
|
||||
let &showcmd = _showcmd
|
||||
unlet! _showcmd
|
||||
endfunction
|
||||
|
||||
function! <SID>StartTagsFileDisplay()
|
||||
|
||||
" if the tags were previously displayed, then they would have been saved
|
||||
" in this script variable. Therefore, just paste the contents of that
|
||||
" variable and quit.
|
||||
" instead of using just one variable, create a hash from the complete path
|
||||
" of the tags file so that tag files from multiple directories can be
|
||||
" displayed and there is caching for each of them.
|
||||
let presHash = substitute(fnamemodify('tags', ':p'), '[^a-zA-Z0-9]', '_', 'g')
|
||||
let taghash = ''
|
||||
if exists('s:tagHash_'.presHash)
|
||||
let taghash = 's:tagHash_'.presHash
|
||||
let dirhash = 's:dirHash_'.presHash
|
||||
let viewhash = 's:viewHash_'.presHash
|
||||
|
||||
let s:lastHash = presHash
|
||||
elseif glob('tags') == '' && exists('s:lastHash')
|
||||
let taghash = 's:tagHash_'.s:lastHash
|
||||
let dirhash = 's:dirHash_'.s:lastHash
|
||||
let viewhash = 's:viewHash_'.s:lastHash
|
||||
end
|
||||
|
||||
if taghash != ''
|
||||
|
||||
setlocal modifiable
|
||||
1,$d_
|
||||
exe 'put='.taghash
|
||||
1d_
|
||||
setlocal nomodified
|
||||
setlocal nomodifiable
|
||||
|
||||
" revert to the last saved view.
|
||||
exe 'call s:LoadView('.viewhash.')'
|
||||
exe 'let s:TagsDirectory = '.dirhash
|
||||
|
||||
let s:lastHash = presHash
|
||||
return
|
||||
|
||||
end
|
||||
|
||||
if glob('.vimtagsdisplay') != '' && g:saveTagsDisplay
|
||||
|
||||
|
||||
let presHash = substitute(getcwd().'\tags', '[^a-zA-Z0-9]', '_', 'g')
|
||||
let taghash = 's:tagHash_'.presHash
|
||||
let dirhash = 's:dirHash_'.presHash
|
||||
let viewhash = 's:viewHash_'.presHash
|
||||
|
||||
setlocal modifiable
|
||||
1,$ d_
|
||||
read .vimtagsdisplay
|
||||
let _a = @a
|
||||
0
|
||||
call search('^\S')
|
||||
1,.-1 d_
|
||||
normal! ggVG"ay
|
||||
exe 'let '.taghash.' = @a'
|
||||
let @a = _a
|
||||
call s:FoldTags()
|
||||
0
|
||||
setlocal nomodified
|
||||
setlocal nomodifiable
|
||||
|
||||
exe 'let s:TagsDirectory = getcwd()'
|
||||
exe 'let '.dirhash.' = getcwd()'
|
||||
exe 'let '.viewhash.' = s:MkViewNoNestedFolds()'
|
||||
let s:lastHash = presHash
|
||||
|
||||
return
|
||||
|
||||
elseif glob('tags') != ''
|
||||
|
||||
|
||||
let s:lastHash = substitute(fnamemodify('tags', ':p'), '[^a-zA-Z0-9]', '_', 'g')
|
||||
|
||||
call <SID>DisplayTagsFile()
|
||||
|
||||
else
|
||||
|
||||
call <SID>DisplayError()
|
||||
" setting this variable results in the next invokations of
|
||||
" TagsExplorer_IsPossible() to return 0. this makes
|
||||
" EditNextVisibleExplorer() skip displaying the tags file the next time
|
||||
" <C-n> is pressed.
|
||||
let g:TagsExplorerSkipError = 1
|
||||
return
|
||||
|
||||
end
|
||||
|
||||
endfunction
|
||||
|
||||
|
||||
function! <SID>DisplayTagsFile()
|
||||
|
||||
let _showcmd = &showcmd
|
||||
let _report = &report
|
||||
set noshowcmd
|
||||
set report=10000
|
||||
setlocal modifiable
|
||||
|
||||
if glob('tags') == ''
|
||||
return
|
||||
end
|
||||
|
||||
1,$ d_
|
||||
silent! read tags
|
||||
|
||||
" remove the leading comment lines.
|
||||
silent! % g/^!_/de
|
||||
" delete the first blank line which happens because of read
|
||||
0 d
|
||||
" if this is an empty tags file, then quit.
|
||||
if line('$') < 1 || getline(1) =~ '^\s*$'
|
||||
return
|
||||
end
|
||||
|
||||
let startTime = localtime()
|
||||
% call s:GroupTags()
|
||||
let sortEndTime = localtime()
|
||||
|
||||
call s:FoldTags()
|
||||
0
|
||||
let foldEndTime = localtime()
|
||||
|
||||
let presHash = substitute(fnamemodify('tags', ':p'), '[^a-zA-Z0-9]', '_', 'g')
|
||||
let taghash = 's:tagHash_'.presHash
|
||||
let dirhash = 's:dirHash_'.presHash
|
||||
let viewhash = 's:viewHash_'.presHash
|
||||
|
||||
" for fast redraw if this plugin is closed and reopened...
|
||||
let _a = @a
|
||||
normal! ggVG"ay
|
||||
exe 'let '.taghash.' = @a'
|
||||
let s:tagsDisplay = @a
|
||||
|
||||
if g:saveTagsDisplay
|
||||
if glob('.vimtagsdisplay') != ''
|
||||
silent! redir! > .vimtagsdisplay
|
||||
else
|
||||
silent! redir > .vimtagsdisplay
|
||||
end
|
||||
silent! echo @a
|
||||
redir END
|
||||
end
|
||||
|
||||
let @a = _a
|
||||
|
||||
" store the directory of the current tags file location.
|
||||
exe 'let '.dirhash.' = getcwd()'
|
||||
exe 'let s:TagsDirectory = '.dirhash
|
||||
exe 'let '.viewhash.' = s:MkViewNoNestedFolds()'
|
||||
|
||||
setlocal nomodified
|
||||
setlocal nomodifiable
|
||||
let &showcmd = _showcmd
|
||||
let &report = _report
|
||||
|
||||
endfunction
|
||||
|
||||
function! <SID>DisplayError()
|
||||
|
||||
setlocal modifiable
|
||||
|
||||
1,$ d_
|
||||
|
||||
put='Error:'
|
||||
put=''
|
||||
put='No Tags File Found in the current directory. Try reopening WManager in a'
|
||||
put='directory which contains a tags file.'
|
||||
put=''
|
||||
put='An easy way to do this is to switch to the file explorer plugin (using <c-n>),'
|
||||
put='navigate to that directory, press \"c\" while there in order to set the pwd, and'
|
||||
put='then switch back to this view using <c-n>.'
|
||||
put=''
|
||||
put='This error message will not be shown for the remainder of this vim session.'
|
||||
put='To have it not appear at all, set g:TagsExplorerSkipError to 1 in your .vimrc'
|
||||
|
||||
1d
|
||||
let _tw= &tw
|
||||
let &tw = g:winManagerWidth - 2
|
||||
normal! ggVGgq
|
||||
% s/$/"/g
|
||||
0
|
||||
|
||||
let &tw = _tw
|
||||
|
||||
setlocal nomodifiable
|
||||
setlocal nomodified
|
||||
|
||||
endfunction
|
||||
|
||||
function! TagsExplorer_WrapUp()
|
||||
if !exists('s:lastHash')
|
||||
return
|
||||
end
|
||||
|
||||
let viewhash = 's:viewHash_'.s:lastHash
|
||||
exe 'let '.viewhash.' = s:MkViewNoNestedFolds()'
|
||||
endfunction
|
||||
|
||||
function! TagsExplorer_IsValid()
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! <SID>OpenTag(split)
|
||||
let line = getline('.')
|
||||
" if ther is a quote at the end of the line, it means we are still
|
||||
" displaying the error message.
|
||||
if match(line, '"$') != -1
|
||||
return
|
||||
end
|
||||
|
||||
normal! 0
|
||||
" this is a tag, because it starts with a space.
|
||||
let tag = ''
|
||||
if line =~ '^\s'
|
||||
let tag = matchstr(getline('.'), ' \zs.*\ze')
|
||||
" go back and extract the file name
|
||||
let num = line('.')
|
||||
?^\S
|
||||
normal! 0
|
||||
let fname = getline('.')
|
||||
exe num
|
||||
else
|
||||
let fname = getline('.')
|
||||
end
|
||||
let _pwd = getcwd()
|
||||
exe 'cd '.s:TagsDirectory
|
||||
call WinManagerFileEdit(fnamemodify(fname, ':p'), a:split)
|
||||
exe 'cd '._pwd
|
||||
|
||||
if tag != ''
|
||||
exe 'silent! tag '.tag
|
||||
end
|
||||
endfunction
|
||||
|
||||
" function to group tags according to which file they belong to...
|
||||
" does not use the "% g" command. does the %g command introduce a O(n^2)
|
||||
" nature into the algo?
|
||||
function! <SID>GroupTags() range
|
||||
" get the first file
|
||||
let numfiles = 0
|
||||
|
||||
let linenum = a:firstline
|
||||
|
||||
while linenum <= a:lastline
|
||||
|
||||
" extract the filename and the tag name from this line. this is
|
||||
" another potential speed killer.
|
||||
let tagname = matchstr(getline(linenum), '^[^\t]*\t\@=')
|
||||
let fname = matchstr(getline(linenum), '\t\zs[^\t]*\ze')
|
||||
|
||||
" create a hash with this name.
|
||||
" this is the costliest operation in this loop. if the file names are
|
||||
" fully qualified and some 50 characters long, this might take very
|
||||
" long. however, every line _has_ to be processed and therefore
|
||||
" something has to be done with the filename. the only question is,
|
||||
" how clever can we get with that operation?
|
||||
let fhashname = substitute(fname, '[^a-zA-Z0-9_]', '_', 'g')
|
||||
|
||||
if !exists('hash_'.fhashname)
|
||||
exe 'let hash_'.fhashname.' = ""'
|
||||
let numfiles = numfiles + 1
|
||||
exe 'let filehash_'.numfiles.' = fhashname'
|
||||
exe 'let filename_'.numfiles.' = fname'
|
||||
end
|
||||
" append this tag to the tag list corresponding to this file name.
|
||||
exe 'let hash_'.fhashname.' = hash_'.fhashname.'." ".tagname."\n"'
|
||||
|
||||
let linenum = linenum + 1
|
||||
endwhile
|
||||
0
|
||||
1,$ d_
|
||||
|
||||
let i = 1
|
||||
while i <= numfiles
|
||||
$
|
||||
exe 'let hashname = filehash_'.i
|
||||
exe 'let tagsf = hash_'.hashname
|
||||
exe 'let filename = filename_'.i
|
||||
let disp = filename."\n".tagsf
|
||||
|
||||
put=disp
|
||||
|
||||
let i = i + 1
|
||||
endwhile
|
||||
0 d_
|
||||
endfunction
|
||||
|
||||
function! <SID>FoldTags()
|
||||
|
||||
setlocal foldmethod=manual
|
||||
1
|
||||
let lastLine = 1
|
||||
while 1
|
||||
if search('^\S', 'W')
|
||||
normal! k
|
||||
let presLine = line('.')
|
||||
else
|
||||
break
|
||||
end
|
||||
exe lastLine.','.presLine.' fold'
|
||||
normal! j
|
||||
let lastLine = line('.')
|
||||
endwhile
|
||||
exe lastLine.',$ fold'
|
||||
endfunction
|
||||
|
||||
function! TE_ShowVariableValue(...)
|
||||
let i = 1
|
||||
while i <= a:0
|
||||
exe 'let arg = a:'.i
|
||||
if exists('s:'.arg) ||
|
||||
\ exists('*s:'.arg)
|
||||
exe 'let val = s:'.arg
|
||||
echomsg 's:'.arg.' = '.val
|
||||
end
|
||||
let i = i + 1
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
" Synopsis: let foldInfo = s:MkViewNoNestedFolds()
|
||||
" Description: returns the view information. This function is to be used when
|
||||
" it is known that there are no nested folds in the file (i.e folds with
|
||||
" depth > 1). when there are nested folds, this function silently ignores
|
||||
" them.
|
||||
function! s:MkViewNoNestedFolds()
|
||||
let row = line('.')
|
||||
let col = virtcol('.')
|
||||
let viewInfo = row.'#'.col.'#'
|
||||
let openInfo = ''
|
||||
|
||||
let i = 1
|
||||
while i <= line('$')
|
||||
if foldlevel(i) > 0
|
||||
let unfold = 0
|
||||
if foldclosedend(i) < 0
|
||||
exe i
|
||||
normal! zc
|
||||
let unfold = 1
|
||||
let openInfo = openInfo.0.','
|
||||
else
|
||||
let openInfo = openInfo.1.','
|
||||
end
|
||||
let j = foldclosedend(i)
|
||||
let viewInfo = viewInfo.i.','.j.'|'
|
||||
if unfold
|
||||
exe i
|
||||
normal! zo
|
||||
end
|
||||
let i = j + 1
|
||||
continue
|
||||
end
|
||||
let i = i + 1
|
||||
endwhile
|
||||
|
||||
let viewInfo = viewInfo.'#'.openInfo
|
||||
let viewInfo = substitute(viewInfo, '|#', '#', '')
|
||||
let viewInfo = substitute(viewInfo, ',$', '', '')
|
||||
|
||||
exe row
|
||||
exe 'normal! '.col.'|'
|
||||
|
||||
return viewInfo
|
||||
endfunction
|
||||
|
||||
" Synopsis: call s:LoadView(foldInfo)
|
||||
" Description: This function restores the view defined in the argument
|
||||
" foldInfo. See the description of MkView() for the format of this
|
||||
" argument. This function should only be used when the foldmethod of the
|
||||
" file is manual. There is no error-checking done in this function, so it
|
||||
" needs to be used responsibly.
|
||||
function! s:LoadView(foldInfo)
|
||||
let row = s:Strntok(a:foldInfo, '#', 1)
|
||||
let col = s:Strntok(a:foldInfo, '#', 2)
|
||||
let folds = s:Strntok(a:foldInfo, '#', 3)
|
||||
let fclosedinfo = s:Strntok(a:foldInfo, '#', 4)
|
||||
|
||||
normal! zE
|
||||
|
||||
let i = 1
|
||||
let foldi = s:Strntok(folds, '|', i)
|
||||
let isclosed = s:Strntok(fclosedinfo, ',', i)
|
||||
|
||||
while foldi != ''
|
||||
let n1 = s:Strntok(foldi, ',', 1)
|
||||
let n2 = s:Strntok(foldi, ',', 2)
|
||||
exe n1.','.n2.' fold'
|
||||
|
||||
if !isclosed
|
||||
exe n1
|
||||
normal! zo
|
||||
end
|
||||
|
||||
let i = i + 1
|
||||
let foldi = s:Strntok(folds, '|', i)
|
||||
let isclosed = s:Strntok(fclosedinfo, ',', i)
|
||||
endwhile
|
||||
|
||||
exe row
|
||||
exe 'normal! '.col.'|'
|
||||
endfunction
|
||||
|
||||
" Strntok:
|
||||
" extract the n^th token from s seperated by tok.
|
||||
" example: Strntok('1,23,3', ',', 2) = 23
|
||||
fun! <SID>Strntok(s, tok, n)
|
||||
return matchstr( a:s.a:tok[0], '\v(\zs([^'.a:tok.']*)\ze['.a:tok.']){'.a:n.'}')
|
||||
endfun
|
||||
BIN
resources/.vim/taglist_45.zip
Normal file
BIN
resources/.vim/taglist_45.zip
Normal file
Binary file not shown.
BIN
resources/.vim/winmanager.zip
Normal file
BIN
resources/.vim/winmanager.zip
Normal file
Binary file not shown.
321
resources/.vimrc
Normal file
321
resources/.vimrc
Normal file
|
|
@ -0,0 +1,321 @@
|
|||
""""""""""""""""""""""""""""""
|
||||
" Functions
|
||||
""""""""""""""""""""""""""""""
|
||||
function! AutoSave()
|
||||
if filewritable(expand('%')) && &modified
|
||||
write
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ToggleIgnorecase()
|
||||
if g:ignorecase
|
||||
set noignorecase
|
||||
let g:ignorecase = 0
|
||||
else
|
||||
set ignorecase
|
||||
let g:ignorecase = 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! TogglePaste()
|
||||
if g:paste
|
||||
set nopaste
|
||||
set number
|
||||
let g:paste = 0
|
||||
else
|
||||
set paste
|
||||
set nonumber
|
||||
let g:paste = 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
""""""""""""""""""""""""""""""
|
||||
" global setting
|
||||
""""""""""""""""""""""""""""""
|
||||
if exists(':DiffOrig')
|
||||
delcommand DiffOrig
|
||||
endif
|
||||
source $VIMRUNTIME/vimrc_example.vim
|
||||
" Disable vim's mouse support
|
||||
set mouse=""
|
||||
" Don't break a longer line
|
||||
setlocal textwidth=0
|
||||
|
||||
colorscheme desert
|
||||
syntax enable
|
||||
|
||||
highlight ColorColumn ctermbg=Red
|
||||
"highlight CursorLine ctermbg=Blue
|
||||
highlight CursorColumn ctermbg=Blue
|
||||
|
||||
"set cursorline
|
||||
set cursorcolumn
|
||||
set colorcolumn=79
|
||||
set nobackup
|
||||
set number
|
||||
set showmatch
|
||||
set formatoptions+=mM
|
||||
set ignorecase
|
||||
set cindent
|
||||
set autoindent
|
||||
set shiftwidth=4
|
||||
set tabstop=4
|
||||
set expandtab
|
||||
set list
|
||||
set listchars=nbsp:-,tab:>-,trail:-
|
||||
set encoding=utf-8 fileencodings=utf-8,euc-jp,GBK,cp936
|
||||
|
||||
" CursorHold : 100 millisecond
|
||||
set updatetime=100
|
||||
|
||||
" statusline
|
||||
set laststatus=2
|
||||
set statusline=%<%f%m%r%h%y%{'['.(&fileencoding!=''?&fileencoding:&encoding).']['.&fileformat.']'.strftime('%a\ %b/%d\ %R')}%=%v[%b]\ %l/%L
|
||||
|
||||
" globle variables
|
||||
let g:ignorecase = 0
|
||||
let g:paste = 0
|
||||
|
||||
let mapleader = ","
|
||||
|
||||
|
||||
""""""""""""""""""""""""""""""
|
||||
" window setting
|
||||
""""""""""""""""""""""""""""""
|
||||
set splitright
|
||||
set splitbelow
|
||||
nnoremap w <c-w>
|
||||
nnoremap <leader>j z.:split<cr>z.
|
||||
nnoremap <leader>l z.:vsplit<cr>z.
|
||||
nnoremap <leader>o <c-w>o
|
||||
nnoremap = <c-w>=
|
||||
nnoremap - <c-w>_
|
||||
|
||||
|
||||
""""""""""""""""""""""""""""""
|
||||
" Git setting
|
||||
""""""""""""""""""""""""""""""
|
||||
nnoremap <leader>gf :!git log --follow %<cr>
|
||||
|
||||
|
||||
""""""""""""""""""""""""""""""
|
||||
" other setting
|
||||
""""""""""""""""""""""""""""""
|
||||
nnoremap <space> i
|
||||
nnoremap <tab> <esc>
|
||||
vnoremap <tab> <esc>gV
|
||||
onoremap <tab> <esc>
|
||||
inoremap <tab> <esc>`^
|
||||
inoremap <leader><tab> <tab>
|
||||
|
||||
nnoremap vv hebve
|
||||
vnoremap <leader>s "ay/<c-r>a<cr>
|
||||
nnoremap p "0p
|
||||
noremap x "0x
|
||||
nnoremap Q /~!@#$%^&*(<cr>
|
||||
nmap gd vv,sN
|
||||
vnoremap E $h
|
||||
vnoremap B ^
|
||||
|
||||
nnoremap ma :mark A<cr>
|
||||
nnoremap ga g'A
|
||||
nnoremap mb :mark B<cr>
|
||||
nnoremap gb g'B
|
||||
nnoremap mc :mark C<cr>
|
||||
nnoremap gc g'C
|
||||
|
||||
nnoremap gp g'P
|
||||
|
||||
nnoremap s :e#<cr>
|
||||
nnoremap <leader>f :echo getcwd() . ' */* ' . expand('%')<cr>
|
||||
|
||||
" display motion
|
||||
nnoremap <c-j> gj
|
||||
nnoremap <c-k> gk
|
||||
nnoremap <c-h> I<esc>
|
||||
nnoremap <c-l> A<esc>
|
||||
|
||||
" write & quit
|
||||
nnoremap <leader>w :w<cr>
|
||||
nnoremap <leader>q :q<cr>
|
||||
nnoremap <leader>qq :q!<cr>
|
||||
nnoremap <leader>wq :wq<cr>
|
||||
nnoremap <leader>qa :qa<cr>
|
||||
nnoremap <leader>qqa :qa!<cr>
|
||||
|
||||
nnoremap <leader>rr :edit %<cr>
|
||||
nnoremap <leader>ee :edit ~/.vimrc<cr>
|
||||
nnoremap <leader>ss :source ~/.vimrc<cr>:echo 'reload .vimrc!'<cr>
|
||||
|
||||
nnoremap <silent> <leader>ic :call ToggleIgnorecase()<cr>
|
||||
nnoremap <silent> <leader>pp :call TogglePaste()<cr>
|
||||
|
||||
nnoremap <leader>fc :<c-x><c-f>
|
||||
inoremap <c-]> <c-x><c-]>
|
||||
inoremap <c-f> <c-x><c-f>
|
||||
inoremap <c-d> <c-x><c-d>
|
||||
inoremap <c-l> <c-x><c-l>
|
||||
|
||||
|
||||
function! Dumper()
|
||||
let l:_filetype = expand('%:e')
|
||||
if l:_filetype == 'pl'
|
||||
owarn "\n---dump at here---\n";<cr>use Data::Dumper qw/Dumper/;<cr>warn Dumper $;<esc>i
|
||||
elseif l:_filetype == 'py'
|
||||
ofrom pprint import pprint<cr>pprint(locals())<esc>
|
||||
endif
|
||||
endfunction
|
||||
"nnoremap <leader>dd :call Dumper()<cr><cr>
|
||||
nnoremap <leader>dd ofrom pprint import pprint<cr>pprint(locals())<esc>
|
||||
|
||||
""""""""""""""""""""""""""""""
|
||||
" perl setting
|
||||
""""""""""""""""""""""""""""""
|
||||
nnoremap <leader>pl i#!/usr/bin/perl<cr><esc>xause strict;<cr><esc>xause warnings;<cr><cr>
|
||||
|
||||
|
||||
""""""""""""""""""""""""""""""
|
||||
" python setting
|
||||
""""""""""""""""""""""""""""""
|
||||
nnoremap <leader>py i#!/usr/bin/env python<cr># coding: utf8<cr><cr>#<<import>><cr>###standard###<cr>import sys<cr>###related###<cr>###local###<cr><cr>#<<global>><cr><cr>def main(args):<cr>pass<cr><cr>if __name__ == '__main__':<cr>main(sys.argv[1:])<cr><esc>
|
||||
|
||||
|
||||
""""""""""""""""""""""""""""""
|
||||
" netrw setting
|
||||
""""""""""""""""""""""""""""""
|
||||
let g:netrw_winsize = 30
|
||||
nnoremap <leader>sp :Sexplore!<cr>:wincmd p<cr>:q<cr>:wincmd p<cr>
|
||||
|
||||
|
||||
""""""""""""""""""""""""""""""
|
||||
" Taglist setting
|
||||
" http://www.vim.org/scripts/script.php?script_id=273
|
||||
""""""""""""""""""""""""""""""
|
||||
" ctags --list-kinds
|
||||
highlight MyTagListTagName ctermfg=Green
|
||||
let Tlist_Show_One_File = 1
|
||||
let Tlist_Exit_OnlyWindow = 1
|
||||
" Improvement: in ~/.vim/plugin/taglist.vim
|
||||
" 255 "autocmd BufEnter * call s:Tlist_Refresh()
|
||||
" 256 autocmd CursorHold * call s:Tlist_Refresh()
|
||||
let Tlist_Process_File_Always = 1
|
||||
let Tlist_Ctags_Cmd = 'ctags'
|
||||
\.' --regex-python='
|
||||
\."'"
|
||||
\.'/if\s+__name__\s*==\s*(.+):/{\1}/f/'
|
||||
\."'"
|
||||
\.' --regex-perl='
|
||||
\."'"
|
||||
\.'/use (\w+(::\w+)*)/<<\1>>/p/'
|
||||
\."'"
|
||||
\.' --regex-perl='
|
||||
\."'"
|
||||
\.'/([_a-zA-Z]+)\s*=>\s*sub\s*\{/sub\{\1\}/l/'
|
||||
\."'"
|
||||
\.' --regex-perl='
|
||||
\."'"
|
||||
\.'/^(__\w+__)$/\1/l/'
|
||||
\."'"
|
||||
\.' --regex-perl='
|
||||
\."'"
|
||||
\.'/^subtest\s+(.*)\s*=>\s*sub\s*\{$/s:\1/s/'
|
||||
\."'"
|
||||
" python language
|
||||
let tlist_python_settings = 'python;i:import;c:class;m:member;f:function;v:variable'
|
||||
" perl language
|
||||
let tlist_perl_settings = 'perl;p:package;s:subroutine;c:constant;f:format;l:label;d:declaration'
|
||||
" javascript language
|
||||
let tlist_javascript_settings = 'javascript;f:function;c:class;m:method;p:property;v:variable'
|
||||
|
||||
|
||||
""""""""""""""""""""""""""""""
|
||||
" BufExplorer setting
|
||||
" http://www.vim.org/scripts/script.php?script_id=42
|
||||
" cd $HOME/.vim
|
||||
" wget http://www.vim.org/scripts/download_script.php?src_id=14208 -O bufexplorer.zip
|
||||
" unzip bufexplorer.zip
|
||||
" :helptags ~/.vim/doc
|
||||
"
|
||||
" Bug: in ~/.vim/plugin/bufexplorer.vim
|
||||
" 346 "call s:BEError("Escaped")
|
||||
""""""""""""""""""""""""""""""
|
||||
let g:bufExplorerShowRelativePath=1 " Show relative paths.
|
||||
|
||||
|
||||
""""""""""""""""""""""""""""""
|
||||
" winManager setting
|
||||
" http://www.vim.org/scripts/script.php?script_id=95
|
||||
" cd $HOME/.vim
|
||||
" wget http://www.vim.org/scripts/download_script.php?src_id=754 -O winmanager.zip
|
||||
" unzip winmanager.zip
|
||||
" vim -c "helptags ~/.vim/doc" -c "q"
|
||||
""""""""""""""""""""""""""""""
|
||||
let g:winManagerWindowLayout = "TagList"
|
||||
let g:winManagerWidth = 30
|
||||
let g:defaultExplorer = 1
|
||||
|
||||
" Improvement: in ~/.vim/plugin/winmanager.vim
|
||||
" Append:
|
||||
"if exists('g:AutoOpenWinManager') && g:AutoOpenWinManager
|
||||
" if filewritable(expand('%')) && exists('g:AutoOpenFiletype')
|
||||
" for _filetype in g:AutoOpenFiletype
|
||||
" if expand('%:e') == _filetype
|
||||
" autocmd VimEnter * nested call s:StartWindowsManager()
|
||||
" break
|
||||
" endif
|
||||
" endfor
|
||||
" endif
|
||||
"endif
|
||||
"let g:AutoOpenFiletype = ['pl', 'pm', 't', 'py', 'js']
|
||||
let g:AutoOpenWinManager = 1
|
||||
|
||||
nnoremap <leader>wm :WMToggle<cr>
|
||||
nnoremap <leader>wf ::FirstExplorerWindow<cr>
|
||||
|
||||
|
||||
""""""""""""""""""""""""""""""
|
||||
" autocmd setting
|
||||
""""""""""""""""""""""""""""""
|
||||
augroup GCursor
|
||||
autocmd!
|
||||
autocmd CursorHold * call AutoSave()
|
||||
|
||||
autocmd CursorHold __Tag_List__ mark `
|
||||
autocmd CursorHold __Tag_List__ normal p``
|
||||
augroup END
|
||||
|
||||
augroup GSwap
|
||||
autocmd!
|
||||
autocmd SwapExists * let v:swapchoice = 'e'
|
||||
augroup END
|
||||
|
||||
augroup GBuf
|
||||
autocmd!
|
||||
autocmd BufEnter *.t setfiletype perl
|
||||
autocmd BufReadPost *.p[lm],*.t setlocal iskeyword+=:
|
||||
autocmd BufReadPost *.coffee setlocal shiftwidth=2
|
||||
|
||||
autocmd BufReadPost * nnoremap <buffer> c ^i#<esc>j
|
||||
autocmd BufReadPost *.vim* nnoremap <buffer> c ^i"<esc>j
|
||||
augroup END
|
||||
|
||||
augroup GWin
|
||||
autocmd!
|
||||
autocmd BufWinEnter \[Buf\ List\] setlocal nonumber
|
||||
augroup END
|
||||
|
||||
augroup GVim
|
||||
autocmd!
|
||||
"autocmd VimEnter * if filereadable('.session.vim')
|
||||
"autocmd VimEnter * source .session.vim
|
||||
"autocmd VimEnter * endif
|
||||
"autocmd VimEnter * if filereadable('.viminfo')
|
||||
"autocmd VimEnter * rviminfo .viminfo
|
||||
"autocmd VimEnter * endif
|
||||
|
||||
"autocmd VimLeave * if expand('%:t') !=# 'COMMIT_EDITMSG'
|
||||
"autocmd VimLeave * mksession .session.vim
|
||||
"autocmd VimLeave * wviminfo .viminfo
|
||||
"autocmd VimLeave * endif
|
||||
augroup END
|
||||
81
resources/.zshrc
Normal file
81
resources/.zshrc
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
# Path to your oh-my-zsh installation.
|
||||
export ZSH=$HOME/.oh-my-zsh
|
||||
|
||||
# Set name of the theme to load.
|
||||
# Look in ~/.oh-my-zsh/themes/
|
||||
# Optionally, if you set this to "random", it'll load a random theme each
|
||||
# time that oh-my-zsh is loaded.
|
||||
ZSH_THEME="my"
|
||||
|
||||
# Uncomment the following line to use case-sensitive completion.
|
||||
# CASE_SENSITIVE="true"
|
||||
|
||||
# Uncomment the following line to disable bi-weekly auto-update checks.
|
||||
# DISABLE_AUTO_UPDATE="true"
|
||||
|
||||
# Uncomment the following line to change how often to auto-update (in days).
|
||||
# export UPDATE_ZSH_DAYS=13
|
||||
|
||||
# Uncomment the following line to disable colors in ls.
|
||||
# DISABLE_LS_COLORS="true"
|
||||
|
||||
# Uncomment the following line to disable auto-setting terminal title.
|
||||
# DISABLE_AUTO_TITLE="true"
|
||||
|
||||
# Uncomment the following line to enable command auto-correction.
|
||||
# ENABLE_CORRECTION="true"
|
||||
|
||||
# Uncomment the following line to display red dots whilst waiting for completion.
|
||||
# COMPLETION_WAITING_DOTS="true"
|
||||
|
||||
# Uncomment the following line if you want to disable marking untracked files
|
||||
# under VCS as dirty. This makes repository status check for large repositories
|
||||
# much, much faster.
|
||||
# DISABLE_UNTRACKED_FILES_DIRTY="true"
|
||||
|
||||
# Uncomment the following line if you want to change the command execution time
|
||||
# stamp shown in the history command output.
|
||||
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
|
||||
# HIST_STAMPS="mm/dd/yyyy"
|
||||
|
||||
# Would you like to use another custom folder than $ZSH/custom?
|
||||
# ZSH_CUSTOM=/path/to/new-custom-folder
|
||||
|
||||
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
|
||||
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
|
||||
# Example format: plugins=(rails git textmate ruby lighthouse)
|
||||
# Add wisely, as too many plugins slow down shell startup.
|
||||
plugins=(git)
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
source $ZSH/git-prompt/zshrc.sh
|
||||
|
||||
# User configuration
|
||||
|
||||
export PATH="# for homebrew:/usr/local/bin:# original order:/usr/bin:/bin:/usr/sbin:/sbin:# /usr/local/bin"
|
||||
# export MANPATH="/usr/local/man:$MANPATH"
|
||||
|
||||
# You may need to manually set your language environment
|
||||
# export LANG=en_US.UTF-8
|
||||
|
||||
# Preferred editor for local and remote sessions
|
||||
# if [[ -n $SSH_CONNECTION ]]; then
|
||||
# export EDITOR='vim'
|
||||
# else
|
||||
# export EDITOR='mvim'
|
||||
# fi
|
||||
|
||||
# Compilation flags
|
||||
# export ARCHFLAGS="-arch x86_64"
|
||||
|
||||
# ssh
|
||||
# export SSH_KEY_PATH="~/.ssh/dsa_id"
|
||||
|
||||
# Set personal aliases, overriding those provided by oh-my-zsh libs,
|
||||
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
|
||||
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
|
||||
# For a full list of active aliases, run `alias`.
|
||||
#
|
||||
# Example aliases
|
||||
# alias zshconfig="mate ~/.zshrc"
|
||||
# alias ohmyzsh="mate ~/.oh-my-zsh"
|
||||
Loading…
Add table
Add a link
Reference in a new issue