Reconfigure bundles to be submodules
This commit is contained in:
parent
7c7aaf6a6d
commit
e17a37c58d
166 changed files with 48 additions and 40038 deletions
36
.gitmodules
vendored
Normal file
36
.gitmodules
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
[submodule ".vim/bundle/calendar.vim--Matsumoto"]
|
||||
path = .vim/bundle/calendar.vim--Matsumoto
|
||||
url = git://github.com/vim-scripts/calendar.vim--Matsumoto.git
|
||||
[submodule ".vim/bundle/vim-less"]
|
||||
path = .vim/bundle/vim-less
|
||||
url = git://github.com/lunaru/vim-less.git
|
||||
[submodule ".vim/bundle/vim-unimpaired"]
|
||||
path = .vim/bundle/vim-unimpaired
|
||||
url = git://github.com/tpope/vim-unimpaired.git
|
||||
[submodule ".vim/bundle/vim-fugitive"]
|
||||
path = .vim/bundle/vim-fugitive
|
||||
url = git://github.com/tpope/vim-fugitive.git
|
||||
[submodule ".vim/bundle/NrrwRgn"]
|
||||
path = .vim/bundle/NrrwRgn
|
||||
url = git://github.com/chrisbra/NrrwRgn.git
|
||||
[submodule ".vim/bundle/sparkup"]
|
||||
path = .vim/bundle/sparkup
|
||||
url = git://github.com/rstacruz/sparkup.git
|
||||
[submodule ".vim/bundle/ack.vim"]
|
||||
path = .vim/bundle/ack.vim
|
||||
url = git://github.com/mileszs/ack.vim.git
|
||||
[submodule ".vim/bundle/VimOrganizer"]
|
||||
path = .vim/bundle/VimOrganizer
|
||||
url = git://github.com/hsitz/VimOrganizer.git
|
||||
[submodule ".vim/bundle/lusty"]
|
||||
path = .vim/bundle/lusty
|
||||
url = git://github.com/sjbach/lusty.git
|
||||
[submodule ".vim/bundle/vim-coffee-script"]
|
||||
path = .vim/bundle/vim-coffee-script
|
||||
url = git://github.com/kchmck/vim-coffee-script.git
|
||||
[submodule ".vim/bundle/nerdtree"]
|
||||
path = .vim/bundle/nerdtree
|
||||
url = git://github.com/scrooloose/nerdtree.git
|
||||
[submodule ".vim/bundle/nerdcommenter"]
|
||||
path = .vim/bundle/nerdcommenter
|
||||
url = git://github.com/scrooloose/nerdcommenter.git
|
||||
1
.vim/bundle/NrrwRgn
Submodule
1
.vim/bundle/NrrwRgn
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 6ae95ae6ca2260a88eba8b9c5ce1f423ebdfe491
|
||||
8
.vim/bundle/NrrwRgn/.gitignore
vendored
8
.vim/bundle/NrrwRgn/.gitignore
vendored
|
|
@ -1,8 +0,0 @@
|
|||
post.pl
|
||||
vim_passfile
|
||||
.*.un~
|
||||
.*.sw*
|
||||
# ignore vimballs
|
||||
*.vba
|
||||
# ignore *.orig files
|
||||
*.orig
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
SCRIPT=$(wildcard plugin/*.vim)
|
||||
AUTOL =$(wildcard autoload/*.vim)
|
||||
DOC=$(wildcard doc/*.txt)
|
||||
PLUGIN=$(shell basename "$$PWD")
|
||||
VERSION=$(shell sed -n '/Version:/{s/^.*\(\S\.\S\+\)$$/\1/;p}' $(SCRIPT))
|
||||
|
||||
.PHONY: $(PLUGIN).vmb README
|
||||
|
||||
all: uninstall vimball install README
|
||||
|
||||
vimball: $(PLUGIN).vmb
|
||||
|
||||
clean:
|
||||
find . -type f \( -name "*.vba" -o -name "*.orig" -o -name "*.~*" \
|
||||
-o -name ".VimballRecord" -o -name ".*.un~" -o -name "*.sw*" -o \
|
||||
-name tags -o -name "*.vmb" \) -delete
|
||||
|
||||
dist-clean: clean
|
||||
|
||||
install:
|
||||
vim -N -c':so %' -c':q!' $(PLUGIN)-$(VERSION).vmb
|
||||
|
||||
uninstall:
|
||||
vim -N -c':RmVimball' -c':q!' $(PLUGIN)-$(VERSION).vmb
|
||||
|
||||
undo:
|
||||
for i in */*.orig; do mv -f "$$i" "$${i%.*}"; done
|
||||
|
||||
README:
|
||||
cp -f $(DOC) README
|
||||
|
||||
$(PLUGIN).vmb:
|
||||
rm -f $(PLUGIN)-$(VERSION).vmb
|
||||
vim -N -c 'ru! vimballPlugin.vim' -c ':call append("0", [ "$(SCRIPT)", "$(AUTOL)", "$(DOC)"])' -c '$$d' -c ":%MkVimball $(PLUGIN)-$(VERSION) ." -c':q!'
|
||||
ln -f $(PLUGIN)-$(VERSION).vmb $(PLUGIN).vmb
|
||||
|
||||
release: version all
|
||||
|
||||
version:
|
||||
perl -i.orig -pne 'if (/Version:/) {s/\.(\d*)/sprintf(".%d", 1+$$1)/e}' ${SCRIPT} ${AUTOL}
|
||||
perl -i -pne 'if (/GetLatestVimScripts:/) {s/(\d+)\s+:AutoInstall:/sprintf("%d :AutoInstall:", 1+$$1)/e}' ${SCRIPT} ${AUTOL}
|
||||
#perl -i -pne 'if (/Last Change:/) {s/\d+\.\d+\.\d\+$$/sprintf("%s", `date -R`)/e}' ${SCRIPT}
|
||||
perl -i -pne 'if (/Last Change:/) {s/(:\s+).*\n/sprintf(": %s", `date -R`)/e}' ${SCRIPT} ${AUTOL}
|
||||
perl -i.orig -pne 'if (/Version:/) {s/\.(\d+).*\n/sprintf(".%d %s", 1+$$1, `date -R`)/e}' ${DOC}
|
||||
VERSION=$(shell sed -n '/Version:/{s/^.*\(\S\.\S\+\)$$/\1/;p}' $(SCRIPT))
|
||||
|
|
@ -1,474 +0,0 @@
|
|||
*NrrwRgn.txt* A Narrow Region Plugin (similar to Emacs)
|
||||
|
||||
Author: Christian Brabandt <cb@256bit.org>
|
||||
Version: 0.26 Mon, 02 Jan 2012 21:33:50 +0100
|
||||
|
||||
Copyright: (c) 2009, 2010 by Christian Brabandt
|
||||
The VIM LICENSE applies to NrrwRgnPlugin.vim and NrrwRgnPlugin.txt
|
||||
(see |copyright|) except use NrrwRgnPlugin instead of "Vim".
|
||||
NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK.
|
||||
|
||||
|
||||
==============================================================================
|
||||
1. Contents *NarrowRegion* *NrrwRgnPlugin*
|
||||
|
||||
1. Contents.....................................: |NrrwRgnPlugin|
|
||||
2. NrrwRgn Manual...............................: |NrrwRgn-manual|
|
||||
2.1 NrrwRgn Howto..............................: |NR-HowTo|
|
||||
2.2 NrrwRgn Multi..............................: |NR-multi-example|
|
||||
2.3 NrrwRgn Configuration......................: |NrrwRgn-config|
|
||||
3. NrrwRgn Feedback.............................: |NrrwRgn-feedback|
|
||||
4. NrrwRgn History..............................: |NrrwRgn-history|
|
||||
|
||||
==============================================================================
|
||||
2. NrrwRgn Manual *NrrwRgn-manual*
|
||||
|
||||
Functionality
|
||||
|
||||
This plugin is based on a discussion in comp.editors (see the thread at
|
||||
http://groups.google.com/group/comp.editors/browse_frm/thread/0f562d97f80dde13)
|
||||
|
||||
Narrowing means focussing on a region and making the rest inaccessible. You
|
||||
simply select the region, call |:NarrowRegion| and the selected part will open
|
||||
in a new scratch buffer. The rest of the file will be protected, so you won't
|
||||
accidentally modify that buffer. In the new buffer, you can do a global
|
||||
replace, search or anything else to modify that part. When you are finished,
|
||||
simply write that buffer (e.g. by |:w|) and your modifications will be put in
|
||||
the original buffer making it accessible again.
|
||||
|
||||
NrrwRgn allows you to either select a line based selection using an Ex-command
|
||||
or you can simply use any visual selected region and press your preferred key
|
||||
combination to open that selection in a new buffer.
|
||||
|
||||
This plugin defines the following commands:
|
||||
|
||||
*:NarrowRegion* *:NR*
|
||||
:[range]NR
|
||||
:[range]NarrowRegion When [range] is omitted, select only the current
|
||||
line, else use the lines in the range given and
|
||||
open it in a new Scratch Window.
|
||||
Whenever you are finished modifying that region
|
||||
simply write the buffer.
|
||||
|
||||
*:NarrowWindow* *:NW*
|
||||
:NW
|
||||
:NarrowWindow Select only the range that is visible the current
|
||||
window and open it in a new Scratch Window.
|
||||
Whenever you are finished modifying that region
|
||||
simply write the buffer.
|
||||
|
||||
*:WidenRegion*
|
||||
:WidenRegion[!] This command is only available in the narrowed
|
||||
scratch window. If the buffer has been modified,
|
||||
the contents will be put back on the original
|
||||
buffer. If ! is specified, the window will be
|
||||
closed, otherwise it will remain open.
|
||||
|
||||
*:NRV*
|
||||
:NRV Opened the narrowed window for the region that was
|
||||
last selected in visual mode
|
||||
|
||||
*:NUD*
|
||||
|
||||
:NUD When viewing unified diffs, this command opens
|
||||
the current chunk in 2 Narrowed Windows in
|
||||
|diff-mode| The current chunk is determined as the
|
||||
one, that the cursor is at. This command does not
|
||||
make sense if editing a different file format (or
|
||||
even different diff format)
|
||||
|
||||
*:NRPrepare*
|
||||
:[range]NRPrepare
|
||||
:[range]NRP You can use this command, to mark several lines
|
||||
that will later be put into a Narrowed Window
|
||||
using |:NRM|.
|
||||
|
||||
*:NRMulti*
|
||||
:NRMulti
|
||||
:NRM This command takes all lines, that have been
|
||||
marked by |:NRP| and puts them together in a new
|
||||
narrowed buffer.
|
||||
When you write your changes back, all separate
|
||||
lines will be put back at their origin.
|
||||
This command also clears the list of marked lines,
|
||||
that was created with |NRP|.
|
||||
See also |NR-multi-example|.
|
||||
|
||||
*:NRSyncOnWrite* *:NRS*
|
||||
:NRSyncOnWrite
|
||||
:NRS Enable synching the buffer content back to the
|
||||
original buffer when writing.
|
||||
(this is the default).
|
||||
|
||||
*:NRNoSyncOnWrite* *:NRN*
|
||||
:NRNoSyncOnWrite
|
||||
:NRN Disable synching the buffer content back to the
|
||||
original buffer when writing. When set, the
|
||||
narrowed buffer behaves like an ordinary buffer
|
||||
that you can write in the filesystem.
|
||||
(this is the default).
|
||||
|
||||
2.1 NrrwRgn HowTo *NR-HowTo*
|
||||
-----------------
|
||||
|
||||
Use the commands provided above to select a certain region to narrow. You can
|
||||
also start visual mode and have the selected region being narrowed. In this
|
||||
mode, NarrowRegion allows you to block select |CTRL-V| , character select |v|
|
||||
or linewise select |V| a region. Then press <Leader>nr where <Leader> by
|
||||
default is set to '\', unless you have set it to something different (see
|
||||
|<Leader>| for information how to change this) and the selected range will
|
||||
open in a new scratch buffer. This key combination only works in |Visual-mode|
|
||||
|
||||
When finished, simply write that Narrowed Region window, from which you want
|
||||
to take the modifications in your original file.
|
||||
|
||||
It is possible, to recursively open a Narrowed Window on top of an already
|
||||
narrowed window. This sounds a little bit silly, but this makes it possible,
|
||||
to have several narrowed windows, which you can use for several different
|
||||
things, e.g. If you have 2 different buffers opened and you want to diff a
|
||||
certain region of each of those 2 buffers, simply open a Narrowed Window for
|
||||
each buffer, and execute |:diffthis| in each narrowed window.
|
||||
|
||||
You can then interactively merge those 2 windows. And when you are finished,
|
||||
simply write the narrowed window and the changes will be taken back into the
|
||||
original buffer.
|
||||
|
||||
When viewing unified diffs, you can use the provided |:NUD| command to open 2
|
||||
Narrowed Windows side by side viewing the current chunk in |diff-mode|. Those
|
||||
2 Narrowed windows will be marked 'modified', since there was some post
|
||||
processing involved when opening the narrowed windows. Be careful, when
|
||||
quitting the windows, not to write unwanted changes into your patch file! In
|
||||
the window that contains the unified buffer, you can move to a different
|
||||
chunk, run |:NUD| and the 2 Narrowed Windows in diff mode will update.
|
||||
|
||||
2.2 NrrwRgn Multi *NR-multi-example*
|
||||
-----------------
|
||||
|
||||
Using the commands |:NRP| and |:NRM| allows to select a range of lines, that
|
||||
will be put into a narrowed buffer together. This might sound confusing, but
|
||||
this allows to apply a filter before making changes. For example before
|
||||
editing your config file, you decide to strip all comments for making big
|
||||
changes but when you write your changes back, these comments will stay in your
|
||||
file. You would do it like this: >
|
||||
:v/^#/NRP
|
||||
:NRMulti
|
||||
<
|
||||
Now a Narrowed Window will open, that contains only the configuration lines.
|
||||
Each block of independent region will be separated by a string like
|
||||
|
||||
# Start NarrowRegion1
|
||||
.....
|
||||
# End NarrowRegion1
|
||||
|
||||
This is needed, so the plugin later knows, which region belongs where in the
|
||||
original place. Blocks you don't want to change, you can safely delete, they
|
||||
won't be written back into your original file. But other than that, you
|
||||
shouldn't change those separating lines.
|
||||
|
||||
When you are finished, simply write your changes back.
|
||||
|
||||
==============================================================================
|
||||
|
||||
2.3 NrrwRgn Configuration *NrrwRgn-config*
|
||||
-------------------------
|
||||
|
||||
NarrowRegion can be customized by setting some global variables. If you'd
|
||||
like to open the narrowed window as a vertical split buffer, simply set the
|
||||
variable g:nrrw_rgn_vert to 1 in your |.vimrc| >
|
||||
|
||||
let g:nrrw_rgn_vert = 1
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
If you'd like to specify a certain width/height for you scratch buffer, then
|
||||
set the variable g:nrrw_rgn_wdth in your |.vimrc| . This variable defines the
|
||||
width or the nr of columns, if you have also set g:nrrw_rgn_vert. >
|
||||
|
||||
let g:nrrw_rgn_wdth = 30
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
By default, NarrowRegion highlights the region that has been selected
|
||||
using the WildMenu highlighting (see |hl-WildMenu|). If you'd like to use a
|
||||
different highlighting, set the variable g:nrrw_rgn_hl to your preferred
|
||||
highlighting Group. For example to have the region highlighted like a search
|
||||
result, you could put that in your |.vimrc| >
|
||||
|
||||
let g:nrrw_rgn_hl = 'Search'
|
||||
<
|
||||
If you want to turn off the highlighting (because this can be distracting), you
|
||||
can set the global variable g:nrrw_rgn_nohl to 1 in your |.vimrc| >
|
||||
|
||||
let g:nrrw_rgn_nohl = 1
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
If you'd like to change the key combination that starts the Narrowed Window
|
||||
for your selected range, you could put this in your |.vimrc| >
|
||||
|
||||
xmap <F3> <Plug>NrrwrgnDo
|
||||
<
|
||||
This will let <F3> open the Narrow-Window, but only if you have pressed it in
|
||||
Visual Mode. It doesn't really make sense to map this combination to any other
|
||||
mode, unless you want it to Narrow your last visually selected range.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
If you'd like to specify the options that you want to have set for the
|
||||
narrowed window, you can set the g:nrrw_custom_options setting, in your
|
||||
|.vimrc| e.g. >
|
||||
|
||||
let g:nrrw_custom_options={}
|
||||
let g:nrrw_custom_options['filetype'] = 'python'
|
||||
>
|
||||
This will only apply those options to the narrowed buffer. You need to take
|
||||
care that all options you need will apply.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
If you don't like that your narrowed window opens above the current window,
|
||||
define the g:nrrw_topbot_leftright variable to your taste, e.g. >
|
||||
|
||||
let g:nrrw_topbot_leftright = 'botright'
|
||||
<
|
||||
Now, all narrowed windows will appear below the original window. If not
|
||||
specified, the narrowed window will appear above/left of the original window.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
If you want to use several independent narrowed regions of the same buffer
|
||||
that you want to write at the same time, protecting the original buffer is not
|
||||
really useful. Therefore, set the g:nrrw_rgn_protect variable, e.g. in your
|
||||
|.vimrc| >
|
||||
|
||||
let g:nrrw_rgn_protect = 'n'
|
||||
<
|
||||
This can be useful if you diff different regions of the same file, and want
|
||||
to be able to put back the changes at different positions. Please note that
|
||||
you should take care not to change any part that will later be influenced
|
||||
when writing the narrowed region back.
|
||||
|
||||
Note: Don't use overlapping regions! Your changes will probably not be put
|
||||
back correctly and there is no guard against losing data accidentally. NrrwRgn
|
||||
tries hard to adjust the highlighting and regions as you write your changes
|
||||
back into the original buffer, but it can't guarantee that this will work and
|
||||
might fail silently. Therefore, this feature is experimental!
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NR-hooks*
|
||||
|
||||
NarrowRegion can execute certain commands, when creating the narrowed window
|
||||
and when closing the narrowed window. For this, you can set 2 buffer-local
|
||||
variables that specify what commands to execute, which will hook into the
|
||||
execution of the Narrow Region plugin.
|
||||
|
||||
For example, suppose you have a file, containing columns separated data (CSV
|
||||
format) which you want to modify and you also have the CSV filetype plugin
|
||||
(http://www.vim.org/scripts/script.php?script_id=2830) installed and you want
|
||||
to modify the CSV data which should be visually arranged like a table in the
|
||||
narrowed window.
|
||||
|
||||
Therefore you want the command |:ArrangeColumn| to be executed in the new
|
||||
narrowed window upon entering it, and when writing the changes back, you want
|
||||
the command |:UnArrangeColumn| to be executed just before putting the
|
||||
changes back. So you set those two variables in your original buffer: >
|
||||
|
||||
let b:nrrw_aucmd_create = "set ft=csv|%ArrangeCol"
|
||||
let b:nrrw_aucmd_close = "%UnArrangeColumn"
|
||||
<
|
||||
This will execute the commands in the narrowed window: >
|
||||
|
||||
:set ft=csv
|
||||
:%ArrangeCol
|
||||
|
||||
and before writing the changes back, it'll execute: >
|
||||
|
||||
:%UnArrangeCol
|
||||
|
||||
==============================================================================
|
||||
3. NrrwRgn Feedback *NrrwRgn-feedback*
|
||||
|
||||
Feedback is always welcome. If you like the plugin, please rate it at the
|
||||
vim-page:
|
||||
http://www.vim.org/scripts/script.php?script_id=3075
|
||||
|
||||
You can also follow the development of the plugin at github:
|
||||
http://github.com/chrisbra/NrrwRgn
|
||||
|
||||
Please don't hesitate to report any bugs to the maintainer, mentioned in the
|
||||
third line of this document.
|
||||
|
||||
==============================================================================
|
||||
4. NrrwRgn History *NrrwRgn-history*
|
||||
|
||||
|
||||
0.26: Jan 02, 2012 {{{1
|
||||
|
||||
- Fix issue https://github.com/chrisbra/NrrwRgn/issues/7
|
||||
(reported by Alessio B., thanks!)
|
||||
|
||||
|
||||
0.25: Nov 08, 2011 {{{1
|
||||
|
||||
- updated documentation (patch by Jean, thanks!)
|
||||
- make it possible, to not sync the narrowed buffer back by disabling
|
||||
it using |:NRSyncOnWrite| |:NRNoSyncOnWrite|
|
||||
|
||||
0.24: Oct 24, 2011 {{{1
|
||||
|
||||
- error on vim.org page, reuploaded version 0.22 as 0.24
|
||||
|
||||
0.23: Oct 24, 2011 {{{1
|
||||
|
||||
- (wrongly uploaded to vim.org)
|
||||
|
||||
0.22: Oct 24, 2011 {{{1
|
||||
|
||||
- Allow customization via the use of hooks (|NR-hooks|)
|
||||
|
||||
0.21: July 26, 2011 {{{1
|
||||
|
||||
- Fix undefined variable adjust_line_numbers
|
||||
https://github.com/chrisbra/NrrwRgn/issues/5 (reported by jmcantrell,
|
||||
thanks!)
|
||||
|
||||
0.20: July 25, 2011 {{{1
|
||||
- allow customization via the g:nrrw_topbot_leftright variable (Thanks Herbert
|
||||
Sitz!)
|
||||
- allow what options will be applied using the g:nrrw_custom_options dict
|
||||
(suggested by Herbert Sitz. Thanks!)
|
||||
- NRV didn't hightlight the region that was selected (reported by Herbert
|
||||
Sitz, thanks!)
|
||||
- use the g:nrrw_rgn_protect variable, to prevent that the original buffer
|
||||
will be protected. This is useful, if you narrow several regions of the same
|
||||
buffer and want to write those changes indepentently (reported by kolyuchiy
|
||||
in https://github.com/chrisbra/NrrwRgn/issues/3, Thanks!)
|
||||
- fix an error with not correctly deleting the highlighted region, that was
|
||||
discovered when reporting issue 3 (see above). (Reported by kolyuchiy,
|
||||
thanks!)
|
||||
- Catch errors, when setting window local options. (Patch by Sung Pae,
|
||||
Thanks!)
|
||||
|
||||
0.19: May 22, 2011 {{{1
|
||||
- fix issue 2 from github https://github.com/chrisbra/NrrwRgn/issues/2
|
||||
(Widening does not work, if the narrowed windows have been moved to a new
|
||||
tabspace). Reported by vanschelven, thanks!
|
||||
|
||||
0.18: December 10, 2010 {{{1
|
||||
- experimental feature: Allow to Narrow several different regions at once
|
||||
using :g/pattern/NRP and afterwards calling :NRM
|
||||
(This only works linewise. Should that be made possible for any reagion?)
|
||||
- disable folds, before writing changes back, otherwise chances are, you'll
|
||||
lose more data then wanted
|
||||
- code cleanup
|
||||
|
||||
0.17: November 23, 2010 {{{1
|
||||
- cache the options, that will be set (instead of parsing
|
||||
$VIMRUNTIME/doc/options.txt every time) in the Narrowed Window
|
||||
- getting the options didn't work, when using an autocommand like this:
|
||||
autocmd BufEnter * cd %:p:h
|
||||
(reported by Xu Hong, Thanks!)
|
||||
- :q didn't clean up the Narrowed Buffer correctly. Fix this
|
||||
- some code cleanup
|
||||
|
||||
0.16: November 16, 2010 {{{1
|
||||
- Bugfix: copy all local options to the narrowed window (reported by Xu Hong,
|
||||
Thanks!)
|
||||
|
||||
0.15: August 26, 2010 {{{1
|
||||
- Bugfix: minor documentation update (reported by Hong Xu, Thanks!)
|
||||
|
||||
0.14: August 26, 2010 {{{1
|
||||
- Bugfix: :only in the original buffer resulted in errors (reported by Adam
|
||||
Monsen, Thanks!)
|
||||
|
||||
0.13: August 22, 2010 {{{1
|
||||
- Unified Diff Handling (experimental feature)
|
||||
|
||||
0.12: July 29, 2010 {{{1
|
||||
|
||||
- Version 0.11, wasn't packaged correctly and the vimball file
|
||||
contained some garbage. (Thanks Dennis Hostetler!)
|
||||
|
||||
0.11: July 28, 2010 {{{1
|
||||
|
||||
- Don't set 'winfixwidth' and 'winfixheight' (suggested by Charles Campbell)
|
||||
|
||||
0.10: May 20, 2010 {{{1
|
||||
|
||||
- Restore cursor position using winrestview() and winsaveview()
|
||||
- fix a bug, that prevented the use of visual narrowing
|
||||
- Make sure when closing the narrowed buffer, the content will be written to
|
||||
the right original region
|
||||
- use topleft for opening the Narrowed window
|
||||
- check, that the original buffer is still available
|
||||
- If you Narrow the complete buffer using :NRV and write the changes back, an
|
||||
additional trailing line is inserted. Remove that line.
|
||||
- When writing the changes back, update the highlighting.
|
||||
|
||||
0.9: May 20, 2010 {{{1
|
||||
|
||||
- It is now possible to Narrow a window recursively. This allows to have
|
||||
several narrowed windows, and allows for example to only diff certain
|
||||
regions (as was suggested in a recent thread at the vim_use mailinglist:
|
||||
http://groups.google.com/group/vim_use/msg/05d7fd9bd1556f0e) therefore, the
|
||||
use for the g:nrrw_rgn_sepwin variable isn't necessary anymore.
|
||||
- Small documentation updates
|
||||
|
||||
0.8: May 18, 2010 {{{1
|
||||
|
||||
- the g:nrrw_rgn_sepwin variable can be used to force separate Narrowed
|
||||
Windows, so you could easily diff those windows.
|
||||
- make the separating of several windows a little bit safer (look at the
|
||||
bufnr(), so it should work without problems for several buffers)
|
||||
- switch from script local variables to buffer local variables, so narrowing
|
||||
for several buffers should work.
|
||||
- set 'winfixheight' for narrowed window
|
||||
- Added command :NRV (suggested by Charles Campbell, thanks!)
|
||||
- added error handling, in case :NRV is called, without a selected region
|
||||
- take care of beeps, when calling :NRV
|
||||
- output WarningMsg
|
||||
|
||||
0.7: May 17, 2010 {{{1
|
||||
|
||||
- really use the black hole register for deleting the old buffer contents in
|
||||
the narrowed buffer (suggestion by esquifit in
|
||||
http://groups.google.com/group/comp.editors/msg/3eb3e3a7c68597db)
|
||||
- make autocommand nesting, so the highlighting will be removed when writing
|
||||
the buffer contents.
|
||||
- Use g:nrrw_rgn_nohl variable to disable highlighting (as this can be
|
||||
disturbing).
|
||||
|
||||
0.6: May 04, 2010 {{{1
|
||||
|
||||
- the previous version had problems restoring the orig buffer, this version
|
||||
fixes it (highlighting and setl ma did not work correctly)
|
||||
|
||||
0.5: May 04, 2010 {{{1
|
||||
|
||||
- The mapping that allows for narrowing a visually selected range, did not
|
||||
work. (Fixed!)
|
||||
- Make :WidenRegion work as expected (close the widened window) (unreleased)
|
||||
|
||||
0.4: Apr 28, 2010 {{{1
|
||||
|
||||
- Highlight narrowed region in the original buffer
|
||||
- Save and Restore search-register
|
||||
- Provide shortcut commands |:NR|
|
||||
- Provide command |:NW| and |:NarrowWindow|
|
||||
- Make plugin autoloadable
|
||||
- Enable GLVS (see |:GLVS|)
|
||||
- Provide Documenation (:h NarrowRegion)
|
||||
- Distribute Plugin as vimball |pi_vimball.txt|
|
||||
|
||||
0.3: Apr 28, 2010 {{{1
|
||||
|
||||
- Initial upload
|
||||
- development versions are available at the github repository
|
||||
- put plugin on a public repository (http://github.com/chrisbra/NrrwRgn)
|
||||
|
||||
}}}
|
||||
|
||||
==============================================================================
|
||||
Modeline:
|
||||
vim:tw=78:ts=8:ft=help:et:fdm=marker:fdl=0:norl
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,474 +0,0 @@
|
|||
*NrrwRgn.txt* A Narrow Region Plugin (similar to Emacs)
|
||||
|
||||
Author: Christian Brabandt <cb@256bit.org>
|
||||
Version: 0.26 Mon, 02 Jan 2012 21:33:50 +0100
|
||||
|
||||
Copyright: (c) 2009, 2010 by Christian Brabandt
|
||||
The VIM LICENSE applies to NrrwRgnPlugin.vim and NrrwRgnPlugin.txt
|
||||
(see |copyright|) except use NrrwRgnPlugin instead of "Vim".
|
||||
NO WARRANTY, EXPRESS OR IMPLIED. USE AT-YOUR-OWN-RISK.
|
||||
|
||||
|
||||
==============================================================================
|
||||
1. Contents *NarrowRegion* *NrrwRgnPlugin*
|
||||
|
||||
1. Contents.....................................: |NrrwRgnPlugin|
|
||||
2. NrrwRgn Manual...............................: |NrrwRgn-manual|
|
||||
2.1 NrrwRgn Howto..............................: |NR-HowTo|
|
||||
2.2 NrrwRgn Multi..............................: |NR-multi-example|
|
||||
2.3 NrrwRgn Configuration......................: |NrrwRgn-config|
|
||||
3. NrrwRgn Feedback.............................: |NrrwRgn-feedback|
|
||||
4. NrrwRgn History..............................: |NrrwRgn-history|
|
||||
|
||||
==============================================================================
|
||||
2. NrrwRgn Manual *NrrwRgn-manual*
|
||||
|
||||
Functionality
|
||||
|
||||
This plugin is based on a discussion in comp.editors (see the thread at
|
||||
http://groups.google.com/group/comp.editors/browse_frm/thread/0f562d97f80dde13)
|
||||
|
||||
Narrowing means focussing on a region and making the rest inaccessible. You
|
||||
simply select the region, call |:NarrowRegion| and the selected part will open
|
||||
in a new scratch buffer. The rest of the file will be protected, so you won't
|
||||
accidentally modify that buffer. In the new buffer, you can do a global
|
||||
replace, search or anything else to modify that part. When you are finished,
|
||||
simply write that buffer (e.g. by |:w|) and your modifications will be put in
|
||||
the original buffer making it accessible again.
|
||||
|
||||
NrrwRgn allows you to either select a line based selection using an Ex-command
|
||||
or you can simply use any visual selected region and press your preferred key
|
||||
combination to open that selection in a new buffer.
|
||||
|
||||
This plugin defines the following commands:
|
||||
|
||||
*:NarrowRegion* *:NR*
|
||||
:[range]NR
|
||||
:[range]NarrowRegion When [range] is omitted, select only the current
|
||||
line, else use the lines in the range given and
|
||||
open it in a new Scratch Window.
|
||||
Whenever you are finished modifying that region
|
||||
simply write the buffer.
|
||||
|
||||
*:NarrowWindow* *:NW*
|
||||
:NW
|
||||
:NarrowWindow Select only the range that is visible the current
|
||||
window and open it in a new Scratch Window.
|
||||
Whenever you are finished modifying that region
|
||||
simply write the buffer.
|
||||
|
||||
*:WidenRegion*
|
||||
:WidenRegion[!] This command is only available in the narrowed
|
||||
scratch window. If the buffer has been modified,
|
||||
the contents will be put back on the original
|
||||
buffer. If ! is specified, the window will be
|
||||
closed, otherwise it will remain open.
|
||||
|
||||
*:NRV*
|
||||
:NRV Opened the narrowed window for the region that was
|
||||
last selected in visual mode
|
||||
|
||||
*:NUD*
|
||||
|
||||
:NUD When viewing unified diffs, this command opens
|
||||
the current chunk in 2 Narrowed Windows in
|
||||
|diff-mode| The current chunk is determined as the
|
||||
one, that the cursor is at. This command does not
|
||||
make sense if editing a different file format (or
|
||||
even different diff format)
|
||||
|
||||
*:NRPrepare*
|
||||
:[range]NRPrepare
|
||||
:[range]NRP You can use this command, to mark several lines
|
||||
that will later be put into a Narrowed Window
|
||||
using |:NRM|.
|
||||
|
||||
*:NRMulti*
|
||||
:NRMulti
|
||||
:NRM This command takes all lines, that have been
|
||||
marked by |:NRP| and puts them together in a new
|
||||
narrowed buffer.
|
||||
When you write your changes back, all separate
|
||||
lines will be put back at their origin.
|
||||
This command also clears the list of marked lines,
|
||||
that was created with |NRP|.
|
||||
See also |NR-multi-example|.
|
||||
|
||||
*:NRSyncOnWrite* *:NRS*
|
||||
:NRSyncOnWrite
|
||||
:NRS Enable synching the buffer content back to the
|
||||
original buffer when writing.
|
||||
(this is the default).
|
||||
|
||||
*:NRNoSyncOnWrite* *:NRN*
|
||||
:NRNoSyncOnWrite
|
||||
:NRN Disable synching the buffer content back to the
|
||||
original buffer when writing. When set, the
|
||||
narrowed buffer behaves like an ordinary buffer
|
||||
that you can write in the filesystem.
|
||||
(this is the default).
|
||||
|
||||
2.1 NrrwRgn HowTo *NR-HowTo*
|
||||
-----------------
|
||||
|
||||
Use the commands provided above to select a certain region to narrow. You can
|
||||
also start visual mode and have the selected region being narrowed. In this
|
||||
mode, NarrowRegion allows you to block select |CTRL-V| , character select |v|
|
||||
or linewise select |V| a region. Then press <Leader>nr where <Leader> by
|
||||
default is set to '\', unless you have set it to something different (see
|
||||
|<Leader>| for information how to change this) and the selected range will
|
||||
open in a new scratch buffer. This key combination only works in |Visual-mode|
|
||||
|
||||
When finished, simply write that Narrowed Region window, from which you want
|
||||
to take the modifications in your original file.
|
||||
|
||||
It is possible, to recursively open a Narrowed Window on top of an already
|
||||
narrowed window. This sounds a little bit silly, but this makes it possible,
|
||||
to have several narrowed windows, which you can use for several different
|
||||
things, e.g. If you have 2 different buffers opened and you want to diff a
|
||||
certain region of each of those 2 buffers, simply open a Narrowed Window for
|
||||
each buffer, and execute |:diffthis| in each narrowed window.
|
||||
|
||||
You can then interactively merge those 2 windows. And when you are finished,
|
||||
simply write the narrowed window and the changes will be taken back into the
|
||||
original buffer.
|
||||
|
||||
When viewing unified diffs, you can use the provided |:NUD| command to open 2
|
||||
Narrowed Windows side by side viewing the current chunk in |diff-mode|. Those
|
||||
2 Narrowed windows will be marked 'modified', since there was some post
|
||||
processing involved when opening the narrowed windows. Be careful, when
|
||||
quitting the windows, not to write unwanted changes into your patch file! In
|
||||
the window that contains the unified buffer, you can move to a different
|
||||
chunk, run |:NUD| and the 2 Narrowed Windows in diff mode will update.
|
||||
|
||||
2.2 NrrwRgn Multi *NR-multi-example*
|
||||
-----------------
|
||||
|
||||
Using the commands |:NRP| and |:NRM| allows to select a range of lines, that
|
||||
will be put into a narrowed buffer together. This might sound confusing, but
|
||||
this allows to apply a filter before making changes. For example before
|
||||
editing your config file, you decide to strip all comments for making big
|
||||
changes but when you write your changes back, these comments will stay in your
|
||||
file. You would do it like this: >
|
||||
:v/^#/NRP
|
||||
:NRMulti
|
||||
<
|
||||
Now a Narrowed Window will open, that contains only the configuration lines.
|
||||
Each block of independent region will be separated by a string like
|
||||
|
||||
# Start NarrowRegion1
|
||||
.....
|
||||
# End NarrowRegion1
|
||||
|
||||
This is needed, so the plugin later knows, which region belongs where in the
|
||||
original place. Blocks you don't want to change, you can safely delete, they
|
||||
won't be written back into your original file. But other than that, you
|
||||
shouldn't change those separating lines.
|
||||
|
||||
When you are finished, simply write your changes back.
|
||||
|
||||
==============================================================================
|
||||
|
||||
2.3 NrrwRgn Configuration *NrrwRgn-config*
|
||||
-------------------------
|
||||
|
||||
NarrowRegion can be customized by setting some global variables. If you'd
|
||||
like to open the narrowed window as a vertical split buffer, simply set the
|
||||
variable g:nrrw_rgn_vert to 1 in your |.vimrc| >
|
||||
|
||||
let g:nrrw_rgn_vert = 1
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
If you'd like to specify a certain width/height for you scratch buffer, then
|
||||
set the variable g:nrrw_rgn_wdth in your |.vimrc| . This variable defines the
|
||||
width or the nr of columns, if you have also set g:nrrw_rgn_vert. >
|
||||
|
||||
let g:nrrw_rgn_wdth = 30
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
By default, NarrowRegion highlights the region that has been selected
|
||||
using the WildMenu highlighting (see |hl-WildMenu|). If you'd like to use a
|
||||
different highlighting, set the variable g:nrrw_rgn_hl to your preferred
|
||||
highlighting Group. For example to have the region highlighted like a search
|
||||
result, you could put that in your |.vimrc| >
|
||||
|
||||
let g:nrrw_rgn_hl = 'Search'
|
||||
<
|
||||
If you want to turn off the highlighting (because this can be distracting), you
|
||||
can set the global variable g:nrrw_rgn_nohl to 1 in your |.vimrc| >
|
||||
|
||||
let g:nrrw_rgn_nohl = 1
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
If you'd like to change the key combination that starts the Narrowed Window
|
||||
for your selected range, you could put this in your |.vimrc| >
|
||||
|
||||
xmap <F3> <Plug>NrrwrgnDo
|
||||
<
|
||||
This will let <F3> open the Narrow-Window, but only if you have pressed it in
|
||||
Visual Mode. It doesn't really make sense to map this combination to any other
|
||||
mode, unless you want it to Narrow your last visually selected range.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
If you'd like to specify the options that you want to have set for the
|
||||
narrowed window, you can set the g:nrrw_custom_options setting, in your
|
||||
|.vimrc| e.g. >
|
||||
|
||||
let g:nrrw_custom_options={}
|
||||
let g:nrrw_custom_options['filetype'] = 'python'
|
||||
>
|
||||
This will only apply those options to the narrowed buffer. You need to take
|
||||
care that all options you need will apply.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
If you don't like that your narrowed window opens above the current window,
|
||||
define the g:nrrw_topbot_leftright variable to your taste, e.g. >
|
||||
|
||||
let g:nrrw_topbot_leftright = 'botright'
|
||||
<
|
||||
Now, all narrowed windows will appear below the original window. If not
|
||||
specified, the narrowed window will appear above/left of the original window.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
If you want to use several independent narrowed regions of the same buffer
|
||||
that you want to write at the same time, protecting the original buffer is not
|
||||
really useful. Therefore, set the g:nrrw_rgn_protect variable, e.g. in your
|
||||
|.vimrc| >
|
||||
|
||||
let g:nrrw_rgn_protect = 'n'
|
||||
<
|
||||
This can be useful if you diff different regions of the same file, and want
|
||||
to be able to put back the changes at different positions. Please note that
|
||||
you should take care not to change any part that will later be influenced
|
||||
when writing the narrowed region back.
|
||||
|
||||
Note: Don't use overlapping regions! Your changes will probably not be put
|
||||
back correctly and there is no guard against losing data accidentally. NrrwRgn
|
||||
tries hard to adjust the highlighting and regions as you write your changes
|
||||
back into the original buffer, but it can't guarantee that this will work and
|
||||
might fail silently. Therefore, this feature is experimental!
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*NR-hooks*
|
||||
|
||||
NarrowRegion can execute certain commands, when creating the narrowed window
|
||||
and when closing the narrowed window. For this, you can set 2 buffer-local
|
||||
variables that specify what commands to execute, which will hook into the
|
||||
execution of the Narrow Region plugin.
|
||||
|
||||
For example, suppose you have a file, containing columns separated data (CSV
|
||||
format) which you want to modify and you also have the CSV filetype plugin
|
||||
(http://www.vim.org/scripts/script.php?script_id=2830) installed and you want
|
||||
to modify the CSV data which should be visually arranged like a table in the
|
||||
narrowed window.
|
||||
|
||||
Therefore you want the command |:ArrangeColumn| to be executed in the new
|
||||
narrowed window upon entering it, and when writing the changes back, you want
|
||||
the command |:UnArrangeColumn| to be executed just before putting the
|
||||
changes back. So you set those two variables in your original buffer: >
|
||||
|
||||
let b:nrrw_aucmd_create = "set ft=csv|%ArrangeCol"
|
||||
let b:nrrw_aucmd_close = "%UnArrangeColumn"
|
||||
<
|
||||
This will execute the commands in the narrowed window: >
|
||||
|
||||
:set ft=csv
|
||||
:%ArrangeCol
|
||||
|
||||
and before writing the changes back, it'll execute: >
|
||||
|
||||
:%UnArrangeCol
|
||||
|
||||
==============================================================================
|
||||
3. NrrwRgn Feedback *NrrwRgn-feedback*
|
||||
|
||||
Feedback is always welcome. If you like the plugin, please rate it at the
|
||||
vim-page:
|
||||
http://www.vim.org/scripts/script.php?script_id=3075
|
||||
|
||||
You can also follow the development of the plugin at github:
|
||||
http://github.com/chrisbra/NrrwRgn
|
||||
|
||||
Please don't hesitate to report any bugs to the maintainer, mentioned in the
|
||||
third line of this document.
|
||||
|
||||
==============================================================================
|
||||
4. NrrwRgn History *NrrwRgn-history*
|
||||
|
||||
|
||||
0.26: Jan 02, 2012 {{{1
|
||||
|
||||
- Fix issue https://github.com/chrisbra/NrrwRgn/issues/7
|
||||
(reported by Alessio B., thanks!)
|
||||
|
||||
|
||||
0.25: Nov 08, 2011 {{{1
|
||||
|
||||
- updated documentation (patch by Jean, thanks!)
|
||||
- make it possible, to not sync the narrowed buffer back by disabling
|
||||
it using |:NRSyncOnWrite| |:NRNoSyncOnWrite|
|
||||
|
||||
0.24: Oct 24, 2011 {{{1
|
||||
|
||||
- error on vim.org page, reuploaded version 0.22 as 0.24
|
||||
|
||||
0.23: Oct 24, 2011 {{{1
|
||||
|
||||
- (wrongly uploaded to vim.org)
|
||||
|
||||
0.22: Oct 24, 2011 {{{1
|
||||
|
||||
- Allow customization via the use of hooks (|NR-hooks|)
|
||||
|
||||
0.21: July 26, 2011 {{{1
|
||||
|
||||
- Fix undefined variable adjust_line_numbers
|
||||
https://github.com/chrisbra/NrrwRgn/issues/5 (reported by jmcantrell,
|
||||
thanks!)
|
||||
|
||||
0.20: July 25, 2011 {{{1
|
||||
- allow customization via the g:nrrw_topbot_leftright variable (Thanks Herbert
|
||||
Sitz!)
|
||||
- allow what options will be applied using the g:nrrw_custom_options dict
|
||||
(suggested by Herbert Sitz. Thanks!)
|
||||
- NRV didn't hightlight the region that was selected (reported by Herbert
|
||||
Sitz, thanks!)
|
||||
- use the g:nrrw_rgn_protect variable, to prevent that the original buffer
|
||||
will be protected. This is useful, if you narrow several regions of the same
|
||||
buffer and want to write those changes indepentently (reported by kolyuchiy
|
||||
in https://github.com/chrisbra/NrrwRgn/issues/3, Thanks!)
|
||||
- fix an error with not correctly deleting the highlighted region, that was
|
||||
discovered when reporting issue 3 (see above). (Reported by kolyuchiy,
|
||||
thanks!)
|
||||
- Catch errors, when setting window local options. (Patch by Sung Pae,
|
||||
Thanks!)
|
||||
|
||||
0.19: May 22, 2011 {{{1
|
||||
- fix issue 2 from github https://github.com/chrisbra/NrrwRgn/issues/2
|
||||
(Widening does not work, if the narrowed windows have been moved to a new
|
||||
tabspace). Reported by vanschelven, thanks!
|
||||
|
||||
0.18: December 10, 2010 {{{1
|
||||
- experimental feature: Allow to Narrow several different regions at once
|
||||
using :g/pattern/NRP and afterwards calling :NRM
|
||||
(This only works linewise. Should that be made possible for any reagion?)
|
||||
- disable folds, before writing changes back, otherwise chances are, you'll
|
||||
lose more data then wanted
|
||||
- code cleanup
|
||||
|
||||
0.17: November 23, 2010 {{{1
|
||||
- cache the options, that will be set (instead of parsing
|
||||
$VIMRUNTIME/doc/options.txt every time) in the Narrowed Window
|
||||
- getting the options didn't work, when using an autocommand like this:
|
||||
autocmd BufEnter * cd %:p:h
|
||||
(reported by Xu Hong, Thanks!)
|
||||
- :q didn't clean up the Narrowed Buffer correctly. Fix this
|
||||
- some code cleanup
|
||||
|
||||
0.16: November 16, 2010 {{{1
|
||||
- Bugfix: copy all local options to the narrowed window (reported by Xu Hong,
|
||||
Thanks!)
|
||||
|
||||
0.15: August 26, 2010 {{{1
|
||||
- Bugfix: minor documentation update (reported by Hong Xu, Thanks!)
|
||||
|
||||
0.14: August 26, 2010 {{{1
|
||||
- Bugfix: :only in the original buffer resulted in errors (reported by Adam
|
||||
Monsen, Thanks!)
|
||||
|
||||
0.13: August 22, 2010 {{{1
|
||||
- Unified Diff Handling (experimental feature)
|
||||
|
||||
0.12: July 29, 2010 {{{1
|
||||
|
||||
- Version 0.11, wasn't packaged correctly and the vimball file
|
||||
contained some garbage. (Thanks Dennis Hostetler!)
|
||||
|
||||
0.11: July 28, 2010 {{{1
|
||||
|
||||
- Don't set 'winfixwidth' and 'winfixheight' (suggested by Charles Campbell)
|
||||
|
||||
0.10: May 20, 2010 {{{1
|
||||
|
||||
- Restore cursor position using winrestview() and winsaveview()
|
||||
- fix a bug, that prevented the use of visual narrowing
|
||||
- Make sure when closing the narrowed buffer, the content will be written to
|
||||
the right original region
|
||||
- use topleft for opening the Narrowed window
|
||||
- check, that the original buffer is still available
|
||||
- If you Narrow the complete buffer using :NRV and write the changes back, an
|
||||
additional trailing line is inserted. Remove that line.
|
||||
- When writing the changes back, update the highlighting.
|
||||
|
||||
0.9: May 20, 2010 {{{1
|
||||
|
||||
- It is now possible to Narrow a window recursively. This allows to have
|
||||
several narrowed windows, and allows for example to only diff certain
|
||||
regions (as was suggested in a recent thread at the vim_use mailinglist:
|
||||
http://groups.google.com/group/vim_use/msg/05d7fd9bd1556f0e) therefore, the
|
||||
use for the g:nrrw_rgn_sepwin variable isn't necessary anymore.
|
||||
- Small documentation updates
|
||||
|
||||
0.8: May 18, 2010 {{{1
|
||||
|
||||
- the g:nrrw_rgn_sepwin variable can be used to force separate Narrowed
|
||||
Windows, so you could easily diff those windows.
|
||||
- make the separating of several windows a little bit safer (look at the
|
||||
bufnr(), so it should work without problems for several buffers)
|
||||
- switch from script local variables to buffer local variables, so narrowing
|
||||
for several buffers should work.
|
||||
- set 'winfixheight' for narrowed window
|
||||
- Added command :NRV (suggested by Charles Campbell, thanks!)
|
||||
- added error handling, in case :NRV is called, without a selected region
|
||||
- take care of beeps, when calling :NRV
|
||||
- output WarningMsg
|
||||
|
||||
0.7: May 17, 2010 {{{1
|
||||
|
||||
- really use the black hole register for deleting the old buffer contents in
|
||||
the narrowed buffer (suggestion by esquifit in
|
||||
http://groups.google.com/group/comp.editors/msg/3eb3e3a7c68597db)
|
||||
- make autocommand nesting, so the highlighting will be removed when writing
|
||||
the buffer contents.
|
||||
- Use g:nrrw_rgn_nohl variable to disable highlighting (as this can be
|
||||
disturbing).
|
||||
|
||||
0.6: May 04, 2010 {{{1
|
||||
|
||||
- the previous version had problems restoring the orig buffer, this version
|
||||
fixes it (highlighting and setl ma did not work correctly)
|
||||
|
||||
0.5: May 04, 2010 {{{1
|
||||
|
||||
- The mapping that allows for narrowing a visually selected range, did not
|
||||
work. (Fixed!)
|
||||
- Make :WidenRegion work as expected (close the widened window) (unreleased)
|
||||
|
||||
0.4: Apr 28, 2010 {{{1
|
||||
|
||||
- Highlight narrowed region in the original buffer
|
||||
- Save and Restore search-register
|
||||
- Provide shortcut commands |:NR|
|
||||
- Provide command |:NW| and |:NarrowWindow|
|
||||
- Make plugin autoloadable
|
||||
- Enable GLVS (see |:GLVS|)
|
||||
- Provide Documenation (:h NarrowRegion)
|
||||
- Distribute Plugin as vimball |pi_vimball.txt|
|
||||
|
||||
0.3: Apr 28, 2010 {{{1
|
||||
|
||||
- Initial upload
|
||||
- development versions are available at the github repository
|
||||
- put plugin on a public repository (http://github.com/chrisbra/NrrwRgn)
|
||||
|
||||
}}}
|
||||
|
||||
==============================================================================
|
||||
Modeline:
|
||||
vim:tw=78:ts=8:ft=help:et:fdm=marker:fdl=0:norl
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
" NrrwRgn.vim - Narrow Region plugin for Vim
|
||||
" -------------------------------------------------------------
|
||||
" Version: 0.26
|
||||
" Maintainer: Christian Brabandt <cb@256bit.org>
|
||||
" Last Change: Mon, 02 Jan 2012 21:33:50 +0100
|
||||
"
|
||||
" Script: http://www.vim.org/scripts/script.php?script_id=3075
|
||||
" Copyright: (c) 2009, 2010 by Christian Brabandt
|
||||
" The VIM LICENSE applies to histwin.vim
|
||||
" (see |copyright|) except use "NrrwRgn.vim"
|
||||
" instead of "Vim".
|
||||
" No warranty, express or implied.
|
||||
" *** *** Use At-Your-Own-Risk! *** ***
|
||||
" GetLatestVimScripts: 3075 26 :AutoInstall: NrrwRgn.vim
|
||||
"
|
||||
" Init: {{{1
|
||||
let s:cpo= &cpo
|
||||
if exists("g:loaded_nrrw_rgn") || &cp
|
||||
finish
|
||||
endif
|
||||
set cpo&vim
|
||||
let g:loaded_nrrw_rgn = 1
|
||||
|
||||
" Debug Setting
|
||||
let s:debug=0
|
||||
if s:debug
|
||||
call nrrwrgn#Debug(1)
|
||||
endif
|
||||
|
||||
" ----------------------------------------------------------------------------
|
||||
" Public Interface: {{{1
|
||||
|
||||
" Define the Command aliases "{{{2
|
||||
com! -range NRPrepare :<line1>,<line2>NRP
|
||||
com! -range NarrowRegion :<line1>,<line2>NR
|
||||
com! NRMulti :NRM
|
||||
com! NarrowWindow :NW
|
||||
|
||||
" Define the actual Commands "{{{2
|
||||
com! -range NR :<line1>, <line2>call nrrwrgn#NrrwRgn()
|
||||
com! -range NRP :exe ":" . <line1> . ',' . <line2> . "call nrrwrgn#Prepare()"
|
||||
com! NRV :call nrrwrgn#VisualNrrwRgn(visualmode())
|
||||
com! NUD :call nrrwrgn#UnifiedDiff()
|
||||
com! NW :exe ":" . line('w0') . ',' . line('w$') . "call nrrwrgn#NrrwRgn()"
|
||||
com! NRM :call nrrwrgn#NrrwRgnDoPrepare()
|
||||
|
||||
" Define the Mapping: "{{{2
|
||||
if !hasmapto('<Plug>NrrwrgnDo')
|
||||
xmap <unique> <Leader>nr <Plug>NrrwrgnDo
|
||||
endif
|
||||
xnoremap <unique> <script> <Plug>NrrwrgnDo <sid>VisualNrrwRgn
|
||||
xnoremap <sid>VisualNrrwRgn :<c-u>call nrrwrgn#VisualNrrwRgn(visualmode())<cr>
|
||||
|
||||
" Restore: "{{{1
|
||||
let &cpo=s:cpo
|
||||
unlet s:cpo
|
||||
" vim: ts=4 sts=4 fdm=marker com+=l\:\"
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use WWW::Mechanize;
|
||||
|
||||
sub GetPassword() {
|
||||
my $i=0;
|
||||
my @pass;
|
||||
my $passfile="./vim_passfile"; # line1: username, line2: password
|
||||
open(PASS, '<',$passfile) or die "Can't open passwordfile: $passfile\n";
|
||||
while(<PASS>){
|
||||
chomp;
|
||||
$pass[$i++] = $_;
|
||||
}
|
||||
close(PASS);
|
||||
return @pass;
|
||||
}
|
||||
|
||||
my $sid=3075;
|
||||
my $file;
|
||||
my @files=glob('*.vmb');
|
||||
#my $scriptversion=shift @ARGV;
|
||||
my $scriptversion = 0;
|
||||
my $versioncomment=shift @ARGV;
|
||||
unless ($versioncomment){
|
||||
print "Please enter comment!\n";
|
||||
exit;
|
||||
}
|
||||
$versioncomment.="\n(automatically uploaded)";
|
||||
|
||||
|
||||
my @userpasswordpair = GetPassword();
|
||||
for (@files) {
|
||||
my $f = $_ if [ -f $_ ] && $_ =~ /\w+-[^.]+\.(\d+)\.vmb/;
|
||||
if ($1 > $scriptversion) {
|
||||
$scriptversion=$1;
|
||||
$file = $f;
|
||||
}
|
||||
}
|
||||
|
||||
my $mech=WWW::Mechanize->new(autocheck => 1);
|
||||
$mech->get("http://www.vim.org/login.php");
|
||||
$mech->submit_form(
|
||||
form_name => "login",
|
||||
with_fields => {
|
||||
userName => $userpasswordpair[0],
|
||||
password => $userpasswordpair[1],
|
||||
},
|
||||
);
|
||||
$mech->get("http://www.vim.org/scripts/script.php?script_id=$sid");
|
||||
$mech->follow_link(text => 'upload new version');
|
||||
$mech->form_name("script");
|
||||
$mech->field(script_file => $file);
|
||||
$mech->field(vim_version => 7.3);
|
||||
$mech->field(script_version => $scriptversion);
|
||||
$mech->field(version_comment => $versioncomment);
|
||||
$mech->click_button(value => "upload");
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
- When disabling Narrowing using :NRN and one quits the buffer,
|
||||
should the highlighting be removed? (it doesn't yet)
|
||||
|
||||
- I really need some tests, like:
|
||||
* Visual Narrowing
|
||||
* Narrowing 1 Region
|
||||
* Narrowing several independent regions with setting the g:nrrw_rgn_protect
|
||||
variable
|
||||
* Multi line narrowing
|
||||
1
.vim/bundle/VimOrganizer
Submodule
1
.vim/bundle/VimOrganizer
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 23d5df0ecebfa19e436ca8570c6586207e2922e1
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
Installation instructions for VimOrganizer v. 0.30, November 2011
|
||||
=================================================================
|
||||
|
||||
1. Install VimOrganizer files as you would any other ftplugin, with downloaded
|
||||
files going in their respective directories under your .vim (Linux/Mac)
|
||||
or vimfiles (Windows) directory.
|
||||
|
||||
2. Run helptags on the help file in the /doc directory, vimorg.txt,
|
||||
so help items can be accessed using the Vim help system.
|
||||
|
||||
3. Make sure your vimrc has these lines:
|
||||
-------------------------------------
|
||||
filetype plugin indent on
|
||||
|
||||
[...and then somewhere below that:]
|
||||
|
||||
au! BufRead,BufWrite,BufWritePost,BufNewFile *.org
|
||||
au BufEnter *.org call org#SetOrgFileType()
|
||||
------------------------------------
|
||||
|
||||
If you use VimOrganizer much you will also want to configure variables
|
||||
and/or functions in your vimrc. A sample vimrc has been included
|
||||
in the download.
|
||||
|
||||
ALSO, you will want to install the plugins listed below. VimOrganizer
|
||||
will work without them, but some functionality will be unavailable:
|
||||
|
||||
4. Make sure you have Calendar.vim installed.
|
||||
(Calendar.vim comes included in the /plugin/ directory as part of
|
||||
the Vim runtime in some Vim installs, otherwise available at:
|
||||
http://www.vim.org/scripts/script.php?script_id=52)
|
||||
|
||||
Second, here are two plugins that you will want to download to
|
||||
take advantage of Org-mode-like narrowing and link features that have been built
|
||||
into VimOrganizer:
|
||||
|
||||
5. Christian Brabandt's NarrowRegion plugin. Find and install it from here:
|
||||
http://www.vim.org/scripts/script.php?script_id=3075
|
||||
6. The Utl "Universal Text Linking" plugin. Find and install it from here:
|
||||
http://www.vim.org/scripts/script.php?script_id=293
|
||||
|
||||
If you are running on Windows another plugin will be useful:
|
||||
|
||||
7. If you're running on Windows then you may want to get Peter Rodding's
|
||||
shell.vim plugin. It's not necessary, but if you have installed
|
||||
it VimOrganizer will use it to ensure that you don't see
|
||||
the annoying Windows command prompt window pop up when VimOrganizer
|
||||
calls out to Emacs/Org-mode.
|
||||
http://www.vim.org/scripts/script.php?script_id=3123
|
||||
|
||||
8. FINALLY, install Emacs. Not necessary for basic outlining, agenda
|
||||
searches, and other basic stuff, but it is necessary to do exports
|
||||
to html and PDF (which you will definitely want) as well as other
|
||||
advanced stuff. Don't be afraid, install is simply and configuration
|
||||
is not hard. Find Emacs here:
|
||||
http://www.gnu.org/software/emacs/
|
||||
|
||||
Vimorg uses a variable, g:org_command_for_emacsclient, to hold the
|
||||
command that will start the emacsclient on your system. If you are
|
||||
not on Linux or OSX you will need to set this explicitly in your
|
||||
vimrc file.
|
||||
|
||||
Also, please note that emacsclient works slightly differently on
|
||||
Windows and Linux/OSX systems. You must manually start
|
||||
Emacs on Linux/OSX or calls to emacsclient will not work. Please see
|
||||
:h vimorg-emacs-setup
|
||||
|
||||
For Emacs you should also install a hook function in the .emacs file,
|
||||
which will automatically make minor conversions when you export and/or
|
||||
open a VimOrganizer .org file in Emacs. You can find the text for that
|
||||
function in the VimOrganizer help file:
|
||||
:h vimorg-orgmode-conversion
|
||||
|
||||
If you're scared of Emacs, don't worry. You don't ever need to edit
|
||||
a document using Emacs. The most you will need to do is open up
|
||||
the .emacs configuration file (in Vim) to make some configuration
|
||||
changes, and that is required only if you're doing more advanced stuff.
|
||||
Having said, that, if there are problems it can sometimes be easiest to
|
||||
open Emacs and diagnose an issue there. Still, you don't ever need
|
||||
to edit a document in Emacs, just think of Emacs as your "application
|
||||
server".
|
||||
|
||||
|
|
@ -1,116 +0,0 @@
|
|||
* VimOrganizer CheatSheet
|
||||
** TODO Outline Navigation
|
||||
:home:work:
|
||||
abc
|
||||
TAB cycle visibilty of single headline/subtree
|
||||
|
||||
Shift-TAB cycle visibility of entire outline
|
||||
|
||||
,1 show level 1 heads only
|
||||
|
||||
,2 show up to level 2 headings
|
||||
|
||||
...
|
||||
|
||||
,,3 show up to level 3 heads for current heading only
|
||||
|
||||
,,5 show up to level 5 heads for current heading only
|
||||
. . .
|
||||
|
||||
** Basic Outline Editing
|
||||
Name your file with a '.org' extension and then just start adding
|
||||
headings with asterisks to indicate heading level. NOTE: asterisks must
|
||||
be in the leftmost column and must be separated from heading text by a
|
||||
space. This document is an example showing headings, subheadings,
|
||||
and text underneath each.
|
||||
|
||||
*** Adding new headlines
|
||||
|
||||
**** TODO Enter, shift+Enter
|
||||
add another headline of same level
|
||||
<enter> works only in normal mode
|
||||
|
||||
*** Another thing
|
||||
This is how this works. You take notes and the rest happens for you
|
||||
** TODO Time Stamps/Date-time prompt
|
||||
The following commands may be issued anywhere within a headline and will
|
||||
enter or edit the corresponding date for the headline. One date of
|
||||
each type may be defined per headline (i.e, 'deadline', 'scheduled',
|
||||
'closed', and 'regular'. You can enter more dates anywhere you want, but
|
||||
this editing mechanism is currently restricted to dealing with only these
|
||||
"primary" dates.
|
||||
|
||||
enter DEADLINE date for headline ,dd
|
||||
enter SCHEDULED date for headline ,ds
|
||||
enter CLOSED date for headline ,dc
|
||||
enter regular date TIMESTAMP (i.e., no indicator) for headline
|
||||
,dt
|
||||
enter timestamp into text ,dg
|
||||
|
||||
The command-line prompt and calendar that appear when you enter a ,d<x>
|
||||
command operate nearly the same as the date-time prompt in Emacs'
|
||||
Org-mode. A few options are not yet implemented (e.g., the 'w'eek
|
||||
options), but most should work just the same. For excellent documentation
|
||||
on Org-mode's date-time prompt see:
|
||||
:http://orgmode.org/manual/The-date_002ftime-prompt.html#The-date_002ftime-prompt
|
||||
** Agenda Dashboard
|
||||
Type ,ag to bring up the Agenda Dashboard, which allows you to launch
|
||||
some searches.
|
||||
**
|
||||
** Set Agenda Files
|
||||
Agenda files are held in a list: g:agenda_files. You can enter values for
|
||||
g:agenda_files in your vimrc, e.g.,
|
||||
|
||||
:let g:agenda_files = ['myfile.org','c:/path/myfile.org']
|
||||
|
||||
You can also use Vimscript to assign multiple files at a time to
|
||||
g:agenda_files. For example, putting the line below in your vimrc would
|
||||
put all .org files in the org_files directory into g:agenda_files:
|
||||
|
||||
:let g:agenda_files = split(glob("~\desktop\org_files\*.org"),"\n")
|
||||
|
||||
User Interface for runtime editing of g:agenda_files:
|
||||
|
||||
There is a also a bare-bones agenda-editing mechanism that works like this:
|
||||
(1) Put your .org working directories in list g:agenda_dirs. Mine is in my
|
||||
vimrc and looks like this:
|
||||
|
||||
:let g:agenda_dirs=["c:/users/herbert/documents/my\ dropbox","c:/users/herbert/desktop/org_Files"]
|
||||
|
||||
(2) Then to edit your agenda files issue this command
|
||||
|
||||
:call EditAgendaFiles()
|
||||
|
||||
This will open a new tab and show your current agenda files along with a list
|
||||
of all org files in your agenda dirs. Simply copy or move lines from the
|
||||
agenda dirs list to the top and when done press :W (that's a capital 'W').
|
||||
Order of agenda files is sometimes important, e.g., it is used when ordering
|
||||
some agenda results.
|
||||
|
||||
** Tags
|
||||
Tags for a file are defined using the SetupTags(<tag-setup-string>) function. There is an
|
||||
example in the project's vimrc file. General structure of the
|
||||
tag-setup-string is: (1) tags followed by the single-key access in parens,
|
||||
(2) curly brackets (i.e., {} ) around sets of tags that are mutually exclusive.
|
||||
For now you must place the single-key-access parens with character after the
|
||||
tag, no letter is automatically assigned. The tags set up by SetupTags() are
|
||||
used in the menu accessed by ,et .
|
||||
|
||||
edit tags -- ,et
|
||||
view items with tag in agenda -- double-click tag,
|
||||
|
||||
(Note: The 'RunSearch' searches below can all be entered now
|
||||
by accessing Agenda Dashboard (,ag) and pressing 'm')
|
||||
view entries having both tag1 and tag2:
|
||||
:call RunSearch('+tag1+tag2')
|
||||
view entries having tag1 but not tag2:
|
||||
:call RunSearch('+tag1-tag2')
|
||||
view entries having tag1 or tag2:
|
||||
:call RunSearch('+tag1|tag2')
|
||||
view entries having tag1 that are also TODO:
|
||||
:call RunSearch('+TODO+tag1')
|
||||
view entries having tag1 that are also DONE:
|
||||
:call RunSearch('+DONE+tag1')
|
||||
view entries having tag1 that have any todo:
|
||||
:call RunSearch('+ANY_TODO+tag1')
|
||||
|
||||
|
|
@ -1,179 +0,0 @@
|
|||
" This is an example vimrc that should work for testing purposes.
|
||||
" Integrate the VimOrganizer specific sections into your own
|
||||
" vimrc if you wish to use VimOrganizer on a regular basis. . .
|
||||
|
||||
"===================================================================
|
||||
" THE NECESSARY STUFF
|
||||
" The three lines below are necessary for VimOrganizer to work right
|
||||
" ==================================================================
|
||||
let g:ft_ignore_pat = '\.org'
|
||||
filetype plugin indent on
|
||||
" and then put these lines in vimrc somewhere after the line above
|
||||
au! BufRead,BufWrite,BufWritePost,BufNewFile *.org
|
||||
au BufEnter *.org call org#SetOrgFileType()
|
||||
" let g:org_capture_file = '~/org_files/mycaptures.org'
|
||||
command! OrgCapture :call org#CaptureBuffer()
|
||||
command! OrgCaptureFile :call org#OpenCaptureFile()
|
||||
|
||||
"==============================================================
|
||||
" THE UNNECESSARY STUFF
|
||||
"==============================================================
|
||||
" Everything below here is a customization. None are needed.
|
||||
"==============================================================
|
||||
|
||||
" The variables below are used to define the default Todo list and
|
||||
" default Tag list. Both of these can also be defined
|
||||
" on a document-specific basis by config lines in a file.
|
||||
" See :h vimorg-todo-metadata and/or :h vimorg-tag-metadata
|
||||
" 'TODO | DONE' is the default, so not really necessary to define it at all
|
||||
let g:org_todo_setup='TODO | DONE'
|
||||
" OR, e.g.,:
|
||||
"let g:org_todo_setup='TODO NEXT STARTED | DONE CANCELED'
|
||||
|
||||
" include a tags setup string if you want:
|
||||
let g:org_tags_alist='{@home(h) @work(w) @tennisclub(t)} {easy(e) hard(d)} {computer(c) phone(p)}'
|
||||
"
|
||||
" g:org_agenda_dirs specify directories that, along with
|
||||
" their subtrees, are searched for list of .org files when
|
||||
" accessing EditAgendaFiles(). Specify your own here, otherwise
|
||||
" default will be for g:org_agenda_dirs to hold single
|
||||
" directory which is directory of the first .org file opened
|
||||
" in current Vim instance:
|
||||
" Below is line I use in my Windows install:
|
||||
" NOTE: case sensitive even on windows.
|
||||
let g:org_agenda_select_dirs=["~/desktop/org_files"]
|
||||
let g:org_agenda_files = split(glob("~/desktop/org_files/org-mod*.org"),"\n")
|
||||
|
||||
" ----------------------
|
||||
" Emacs setup
|
||||
" ----------------------
|
||||
" To use Emacs you will need to define the client. On
|
||||
" Linux/OSX this is typically simple, just:
|
||||
"let g:org_command_for_emacsclient = 'emacsclient'
|
||||
"
|
||||
" On Windows it is more complicated, and probably involves creating
|
||||
" a 'soft link' to the emacsclient executable (which is 'emacsclientw')
|
||||
" See :h vimorg-emacs-setup
|
||||
"let g:org_command_for_emacsclient = 'c:\users\herbert\emacsclientw.exe'
|
||||
|
||||
" ----------------------
|
||||
" Custom Agenda Searches
|
||||
" ----------------------
|
||||
" The assignment to g:org_custom_searches below defines searches that a
|
||||
" a user can then easily access from the Org menu or the Agenda Dashboard.
|
||||
" (Still need to add help on how to define them, assignment below
|
||||
" is hopefully illustrative for now. . . . )
|
||||
let g:org_custom_searches = [
|
||||
\ { 'name':"Next week's agenda", 'type':'agenda',
|
||||
\ 'agenda_date':'+1w', 'agenda_duration':'w' }
|
||||
\, { 'name':"Next week's TODOS", 'type':'agenda',
|
||||
\ 'agenda_date':'+1w', 'agenda_duration':'w',
|
||||
\ 'spec':'+UNFINISHED_TODOS' }
|
||||
\, { 'name':'Home tags', 'type':'heading_list', 'spec':'+HOME' }
|
||||
\, { 'name':'Home tags', 'type':'sparse_tree', 'spec':'+HOME' }
|
||||
\ ]
|
||||
|
||||
" --------------------------------
|
||||
" Custom colors
|
||||
" --------------------------------"
|
||||
" OrgCustomColors() allows a user to set highlighting for particular items
|
||||
function! OrgCustomColors()
|
||||
" Various text item 'highlightings' below
|
||||
" are the defaults. Uncomment and change a line if you
|
||||
" want different highlighting for the element.
|
||||
"
|
||||
" Below are defaults for any TODOS you define. TODOS that
|
||||
" come before the | in a definition will use 'NOTDONETODO'
|
||||
" and those that come after are DONETODO
|
||||
"hi! DONETODO guifg=green ctermfg=green
|
||||
"hi! NOTDONETODO guifg=red ctermfg=lightred
|
||||
|
||||
" Heading level highlighting is done in pairs, one for the
|
||||
" heading when unfolded and one for folded. Default is to make
|
||||
" them the same except for the folded version being bold:
|
||||
" assign OL1 pair for level 1, OL2 pair for level 2, etc.
|
||||
"hi! OL1 guifg=somecolor guibg=somecolor
|
||||
"hi! OL1Folded guifg=somecolor guibg=somecolor gui=bold
|
||||
|
||||
|
||||
" Tags are lines below headings that have :colon:separated:tags:
|
||||
"hi! Org_Tag guifg=lightgreen ctermfg=blue
|
||||
|
||||
" Lines that begin with '#+' in column 0 are config lines
|
||||
"hi! Org_Config_Line guifg=darkgray ctermfg=magenta
|
||||
|
||||
" Drawers are :PROPERTIES: and :LOGBOOK: lines and their associated
|
||||
" :END: lines
|
||||
"hi! Org_Drawer guifg=pink ctermfg=magenta
|
||||
"hi! Org_Drawer_Folded guifg=pink ctermfg=magenta gui=bold cterm=bold
|
||||
|
||||
" This applies to value names in :PROPERTIES: blocks
|
||||
"hi! Org_Property_Value guifg=pink ctermfg=magenta
|
||||
|
||||
" Three lines below apply to different kinds of blocks
|
||||
"hi! Org_Block guifg=#555555 ctermfg=magenta
|
||||
"hi! Org_Src_Block guifg=#555555 ctermfg=magenta
|
||||
"hi! Org_Table guifg=#888888 guibg=#333333 ctermfg=magenta
|
||||
|
||||
" Dates are date specs between angle brackets (<>) or square brackets ([])
|
||||
"hi! Org_Date guifg=magenta ctermfg=magenta gui=underline cterm=underline
|
||||
|
||||
" Org_Star is used to "hide" initial asterisks in a heading
|
||||
"hi! Org_Star guifg=#444444 ctermfg=darkgray
|
||||
|
||||
"hi! Props guifg=#ffa0a0 ctermfg=gray
|
||||
|
||||
" Bold, italics, underline, and code are highlights applied
|
||||
" to character formatting
|
||||
"hi! Org_Code guifg=darkgray gui=bold ctermfg=14
|
||||
"hi! Org_Itals gui=italic guifg=#aaaaaa ctermfg=lightgray
|
||||
"hi! Org_Bold gui=bold guifg=#aaaaaa ctermfg=lightgray
|
||||
"hi! Org_Underline gui=underline guifg=#aaaaaa ctermfg=lightgray
|
||||
"hi! Org_Lnumber guifg=#999999 ctermfg=gray
|
||||
|
||||
" These lines apply to links: [[link]], and [[link][link desc]]
|
||||
"if has("conceal")
|
||||
" hi! default linkends guifg=blue ctermfg=blue
|
||||
"endif
|
||||
"hi! Org_Full_Link guifg=cyan gui=underline ctermfg=lightblue cterm=underline
|
||||
"hi! Org_Half_Link guifg=cyan gui=underline ctermfg=lightblue cterm=underline
|
||||
|
||||
" Applies to the Heading line that can be displayed in column view
|
||||
"highlight OrgColumnHeadings guibg=#444444 guifg=#aaaaaa gui=underline
|
||||
|
||||
" Use g:org_todo_custom_highlights to set up highlighting for individual
|
||||
" TODO items. Without this all todos that designate an unfinished state
|
||||
" will be highlighted using NOTDONETODO highlight (see above)
|
||||
" and all todos that designate a finished state will be highlighted using
|
||||
" the DONETODO highlight (see above).
|
||||
let g:org_todo_custom_highlights =
|
||||
\ { 'NEXT': { 'guifg':'#888888', 'guibg':'#222222',
|
||||
\ 'ctermfg':'gray', 'ctermbg':'darkgray'},
|
||||
\ 'WAITING': { 'guifg':'#aa3388',
|
||||
\ 'ctermfg':'red' } }
|
||||
|
||||
endfunction
|
||||
|
||||
" Below are two examples of Org-mode "hook" functions
|
||||
" These present opportunities for end-user customization
|
||||
" of how VimOrganizer works. For more info see the
|
||||
" documentation for hooks in Emacs' Org-mode documentation:
|
||||
" http://orgmode.org/worg/org-configs/org-hooks.php#sec-1_40
|
||||
"
|
||||
" These two hooks are currently the only ones enabled in
|
||||
" the VimOrganizer codebase, but they are easy to add so if
|
||||
" there's a particular hook you want go ahead and request it
|
||||
" or look for where these hooks are implemented in
|
||||
" /ftplugin/org.vim and use them as example for placing your
|
||||
" own hooks in VimOrganizer:
|
||||
function! Org_property_changed_functions(line,key, val)
|
||||
"call confirm("prop changed: ".a:line."--key:".a:key." val:".a:val)
|
||||
endfunction
|
||||
function! Org_after_todo_state_change_hook(line,state1, state2)
|
||||
"call confirm("changed: ".a:line."--key:".a:state1." val:".a:state2)
|
||||
"call OrgConfirmDrawer("LOGBOOK")
|
||||
"let str = ": - State: " . org#Pad(a:state2,10) . " from: " . Pad(a:state1,10) .
|
||||
" \ ' [' . org#Timestamp() . ']'
|
||||
"call append(line("."), repeat(' ',len(matchstr(getline(line(".")),'^\s*'))) . str)
|
||||
endfunction
|
||||
|
||||
|
|
@ -1,172 +0,0 @@
|
|||
" calutil.vim: some calendar utilities
|
||||
" Author: Charles E. Campbell, Jr.
|
||||
" with modifications by Herbert Sitz for VimOrganizer
|
||||
" Date: Oct 08, 2008
|
||||
" Version: 3b ASTRO-ONLY
|
||||
" ---------------------------------------------------------------------
|
||||
if exists("loaded_calutil")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_calutil= "v3b"
|
||||
if v:version < 700
|
||||
echohl WarningMsg
|
||||
echo "***warning*** this version of calutil needs vim 7.0"
|
||||
echohl Normal
|
||||
finish
|
||||
endif
|
||||
|
||||
function! calutil#dayname(date)
|
||||
return calutil#DayOfWeek(split(a:date,'-')[0],split(a:date,'-')[1],split(a:date,'-')[2],2)
|
||||
endfunction
|
||||
function! calutil#dow(date)
|
||||
return calutil#DayOfWeek(split(a:date,'-')[0],split(a:date,'-')[1],split(a:date,'-')[2],1)
|
||||
endfunction
|
||||
|
||||
function! calutil#jul(date)
|
||||
return calutil#Cal2Jul(split(a:date,'-')[0],split(a:date,'-')[1],split(a:date,'-')[2])
|
||||
endfunction
|
||||
|
||||
function! calutil#cal(julian)
|
||||
return calutil#Jul2Cal(a:julian)
|
||||
endfunction
|
||||
" ---------------------------------------------------------------------
|
||||
" DayOfWeek: {{{1
|
||||
" Usage : call calutil#DayOfWeek(y,m,d,[0|1|2])
|
||||
" g:CalUtilDayOfWeek: if 0-> integer (default)
|
||||
" 1-> 3-letter English abbreviation for name of day
|
||||
" 2-> English name of day
|
||||
" Returns
|
||||
" g:CalUtilDayOfWeek
|
||||
" ---------
|
||||
" 1 : 0 1 2 3 4 5 6
|
||||
" 2 : Mon Tue Wed Thu Fri Sat Sun
|
||||
" 3 : Monday Tuesday Wednesday Thursday Friday Saturday Sunday
|
||||
fun! calutil#DayOfWeek(y,m,d,...)
|
||||
if a:0 > 0
|
||||
let g:CalUtilDayOfWeek= a:1
|
||||
endif
|
||||
|
||||
let z = calutil#Cal2Jul(a:y,a:m,a:d)
|
||||
if z >= 0
|
||||
let z= z%7
|
||||
else
|
||||
let z= 7 - (-z%7)
|
||||
endif
|
||||
|
||||
if exists("g:CalUtilDayOfWeek")
|
||||
if g:CalUtilDayOfWeek == 2
|
||||
let dow0="Mon"
|
||||
let dow1="Tue"
|
||||
let dow2="Wed"
|
||||
let dow3="Thu"
|
||||
let dow4="Fri"
|
||||
let dow5="Sat"
|
||||
let dow6="Sun"
|
||||
return dow{z}
|
||||
elseif g:CalUtilDayOfWeek == 3
|
||||
let dow0="Monday"
|
||||
let dow1="Tuesday"
|
||||
let dow2="Wednesday"
|
||||
let dow3="Thursday"
|
||||
let dow4="Friday"
|
||||
let dow5="Saturday"
|
||||
let dow6="Sunday"
|
||||
return dow{z}
|
||||
endif
|
||||
endif
|
||||
return z
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" calutil#Cal2Jul: convert a (after 9/14/1752) Gregorian calendar date to Julian day {{{1
|
||||
" (on,before " ) Julian calendar date to Julian day
|
||||
" (proleptic)
|
||||
fun! calutil#Cal2Jul(y,m,d)
|
||||
let year = a:y
|
||||
let month= a:m
|
||||
let day = a:d
|
||||
|
||||
" there is no year zero
|
||||
if year == 0
|
||||
let year= -1
|
||||
elseif year < 0
|
||||
let year= year + 1
|
||||
endif
|
||||
|
||||
let julday= day - 32075 +
|
||||
\ 1461*(year + 4800 + (month - 14)/12)/4 +
|
||||
\ 367*(month - 2 - ((month - 14)/12)*12)/12 -
|
||||
\ 3*((year + 4900 + (month - 14)/12)/100)/4
|
||||
|
||||
" 2361221 == Sep 2, 1752, which was followed immediately by
|
||||
" Sep 14, 1752 (in England). Various countries
|
||||
" adopted the Gregorian calendar at different times.
|
||||
if julday <= 2361221
|
||||
let a = (14-month)/12
|
||||
let y = year + 4800 - a
|
||||
let m = month + 12*a - 3
|
||||
let julday = day + (153*m + 2)/5 + y*365 + y/4 - 32083
|
||||
endif
|
||||
return julday
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" calutil#Jul2Cal: convert a Julian day to a date: {{{1
|
||||
" Default year/month/day
|
||||
" julday,1 julday,"ymd" year/month/day
|
||||
" julday,2 julday,"mdy" month/day/year
|
||||
" julday,3 julday,"dmy" day/month/year
|
||||
fun! calutil#Jul2Cal(julday,...)
|
||||
let julday= a:julday
|
||||
|
||||
if julday <= 2361221
|
||||
" Proleptic Julian Calendar:
|
||||
" 2361210 == Sep 2, 1752, which was followed immediately by Sep 14, 1752
|
||||
" in England
|
||||
let c = julday + 32082
|
||||
let d = (4*c + 3)/1461
|
||||
let e = c - (1461*d)/4
|
||||
let m = (5*e + 2)/153
|
||||
let day = e - (153*m + 2)/5 + 1
|
||||
let month = m + 3 - 12*(m/10)
|
||||
let year = d - 4800 + m/10
|
||||
if year <= 0
|
||||
" proleptic Julian Calendar: there *is* no year 0!
|
||||
let year= year - 1
|
||||
endif
|
||||
|
||||
else
|
||||
" Gregorian calendar
|
||||
let t1 = julday + 68569
|
||||
let t2 = 4*t1/146097
|
||||
let t1 = t1 - (146097*t2 + 3)/4
|
||||
let yr = 4000*(t1 + 1)/1461001
|
||||
let t1 = t1 - (1461*yr/4 - 31)
|
||||
let mo = 80*t1/2447
|
||||
let day = (t1 - 2447*mo/80)
|
||||
let t1 = mo/11
|
||||
let month = (mo + 2 - 12*t1)
|
||||
let year = (100*(t2 - 49) + yr + t1)
|
||||
endif
|
||||
|
||||
let month = (month<10) ? '0' . month : month
|
||||
let day = (day < 10) ? '0' . day : day
|
||||
|
||||
if a:0 > 0
|
||||
if a:1 == 1 || a:1 =~ "ymd"
|
||||
return year."-".month."/".day
|
||||
elseif a:1 == 2 || a:1 =~ "mdy"
|
||||
return month."-".day."/".year
|
||||
elseif a:1 == 3 || a:1 =~ "dmy"
|
||||
return day."-".month."/".year
|
||||
else
|
||||
return year."-".month."/".day
|
||||
endif
|
||||
else
|
||||
return year."-".month."-".day
|
||||
endif
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" vim: ts=4 fdm=marker
|
||||
|
||||
|
|
@ -1,217 +0,0 @@
|
|||
" org.vim - VimOrganizer plugin for Vim
|
||||
" -------------------------------------------------------------
|
||||
" Version: 0.30
|
||||
" Maintainer: Herbert Sitz <hesitz@gmail.com>
|
||||
" Last Change: 2011 Nov 02
|
||||
"
|
||||
" Script: http://www.vim.org/scripts/script.php?script_id=3342
|
||||
" Github page: http://github.com/hsitz/VimOrganizer
|
||||
" Copyright: (c) 2010, 2011 by Herbert Sitz
|
||||
" The VIM LICENSE applies to all files in the
|
||||
" VimOrganizer plugin.
|
||||
" (See the Vim copyright except read "VimOrganizer"
|
||||
" in places where that copyright refers to "Vim".)
|
||||
" http://vimdoc.sourceforge.net/htmldoc/uganda.html#license
|
||||
" No warranty, express or implied.
|
||||
" *** *** Use At-Your-Own-Risk *** ***
|
||||
|
||||
if exists("g:org_autoload_funcs")
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:org_autoload_funcs=1
|
||||
|
||||
function! org#SetOrgFileType()
|
||||
"if expand("%:e") == 'org'
|
||||
if &filetype != 'org'
|
||||
execute "set filetype=org"
|
||||
|
||||
" if !exists('g:org_todo_setup')
|
||||
" let g:org_todo_setup = 'TODO | DONE'
|
||||
" endif
|
||||
" if !exists('g:org_tag_setup')
|
||||
" let g:org_tag_setup = '{home(h) work(w)}'
|
||||
" endif
|
||||
"
|
||||
" call OrgProcessConfigLines()
|
||||
" exec "syntax match DONETODO '" . b:v.todoDoneMatch . "' containedin=OL1,OL2,OL3,OL4,OL5,OL6"
|
||||
" exec "syntax match NOTDONETODO '" . b:v.todoNotDoneMatch . "' containedin=OL1,OL2,OL3,OL4,OL5,OL6"
|
||||
|
||||
endif
|
||||
"endif
|
||||
endfunction
|
||||
|
||||
function! org#Pad(s,amt)
|
||||
return a:s . repeat(' ',a:amt - len(a:s))
|
||||
endfunction
|
||||
|
||||
function! org#Timestamp()
|
||||
return strftime("%Y-%m-%d %a %H:%M")
|
||||
endfunction
|
||||
|
||||
function! org#redir(command)
|
||||
let save_a = @a
|
||||
try
|
||||
silent! redir @a
|
||||
silent! exe a:command
|
||||
redir END
|
||||
finally
|
||||
"let res = split(@a,"\n")
|
||||
let res = @a
|
||||
|
||||
" restore register
|
||||
let @a = save_a
|
||||
return res
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! org#GetGroupHighlight(group)
|
||||
" this code was copied and modified from code posted on StackOverflow
|
||||
" http://stackoverflow.com/questions/1331213/how-to-modify-existing-highlight-group-in-vim
|
||||
" Redirect the output of the "hi" command into a variable
|
||||
" and find the highlighting
|
||||
redir => GroupDetails
|
||||
try
|
||||
exe "silent hi " . a:group
|
||||
catch
|
||||
" skip error message if no such group exists
|
||||
endtry
|
||||
redir END
|
||||
|
||||
" Resolve linked groups to find the root highlighting scheme
|
||||
while GroupDetails =~ "links to"
|
||||
let index = stridx(GroupDetails, "links to") + len("links to")
|
||||
let LinkedGroup = strpart(GroupDetails, index + 1)
|
||||
redir => GroupDetails
|
||||
exe "silent hi " . LinkedGroup
|
||||
redir END
|
||||
endwhile
|
||||
|
||||
if GroupDetails ># ''
|
||||
" Extract the highlighting details (the bit after "xxx")
|
||||
let MatchGroups = matchlist(GroupDetails, '\<xxx\>\s\+\(.*\)')
|
||||
let ExistingHighlight = MatchGroups[1] !~? 'cleared' ? MatchGroups[1] : ''
|
||||
else
|
||||
" Group does not exist
|
||||
let ExistingHighlight = ''
|
||||
endif
|
||||
|
||||
return ExistingHighlight
|
||||
|
||||
endfunction
|
||||
|
||||
function! org#ISODateToYWD(date)
|
||||
"returns y,w,d which are iso week spec for date
|
||||
let date = a:date
|
||||
"let d = 1 + ((calutil#dow(date) + 4) % 7)
|
||||
let d = 1 + calutil#dow(date)
|
||||
let jul_nThur = calutil#jul(date) + 4 - d
|
||||
let y = calutil#cal(jul_nThur)[0:3]
|
||||
let julJan1 = calutil#jul(date[0:3] . '-01-01')
|
||||
let w = 1 + ((jul_nThur - julJan1) / 7)
|
||||
return [y,w,d]
|
||||
endfunction
|
||||
|
||||
function! org#LocateFile(filename)
|
||||
let filename = a:filename
|
||||
|
||||
if bufwinnr(filename) >= 0
|
||||
silent execute bufwinnr(filename)."wincmd w"
|
||||
else
|
||||
if org#redir('tabs') =~ fnamemodify(filename, ':t')
|
||||
" proceed on assumption that file is open
|
||||
" if match found in tablist
|
||||
let this_tab = tabpagenr()
|
||||
let last_tab = tabpagenr('$')
|
||||
for i in range(1 , last_tab)
|
||||
exec i . 'tabn'
|
||||
if bufwinnr(filename) >= 0
|
||||
silent execute bufwinnr(filename)."wincmd w"
|
||||
break
|
||||
" if file not found then use tab drop to open new file
|
||||
elseif i == last_tab
|
||||
execute 'tab drop ' . filename
|
||||
if (&ft != 'org') && (filename != '__Agenda__')
|
||||
call org#SetOrgFileType()
|
||||
endif
|
||||
endif
|
||||
tabn
|
||||
endfor
|
||||
else
|
||||
exe 'tabn ' . tabpagenr('$')
|
||||
execute 'tab drop ' . filename
|
||||
if (&ft != 'org') && (filename != '__Agenda__')
|
||||
call org#SetOrgFileType()
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
if (&fdm != 'expr') && !exists('g:in_agenda_search')
|
||||
set fdm=expr
|
||||
set foldlevel=1
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
function! org#SaveLocation()
|
||||
let file_loc = bufname('%') ==? '__Agenda__' ? '__Agenda__' : expand('%:p')
|
||||
let g:location = [ file_loc , getpos('.') ]
|
||||
endfunction
|
||||
function! org#RestoreLocation()
|
||||
if expand('%:p') != g:location[0]
|
||||
call org#LocateFile( g:location[0] )
|
||||
endif
|
||||
call setpos( '.', g:location[1] )
|
||||
endfunction
|
||||
|
||||
|
||||
function! org#OpenCaptureFile()
|
||||
call org#LocateFile(g:org_capture_file)
|
||||
endfunction
|
||||
|
||||
function! org#CaptureBuffer()
|
||||
if !exists('g:org_capture_file') || empty(g:org_capture_file)
|
||||
echo 'Capture is not set up. Please read docs at :h vimorg-capture.'
|
||||
return
|
||||
endif
|
||||
if bufnr('_Org_Capture_') > 0
|
||||
exec 'bwipeout! ' . bufnr('_Org_Capture_')
|
||||
endif
|
||||
sp _Org_Capture_
|
||||
autocmd BufWriteCmd <buffer> :call <SID>ProcessCapture()
|
||||
"autocmd BufLeave <buffer> :bwipeout
|
||||
autocmd BufUnload <buffer> :set nomodified
|
||||
set nobuflisted
|
||||
set ft=org
|
||||
setlocal buftype=acwrite
|
||||
setlocal noswapfile
|
||||
command! -buffer W :call <SID>ProcessCapture()
|
||||
" below is the basic template
|
||||
" a first level head with date timestamp
|
||||
normal ggVGd
|
||||
normal i*
|
||||
silent exec "normal o:<".org#Timestamp().">"
|
||||
normal gg
|
||||
set nomodified
|
||||
startinsert!
|
||||
|
||||
endfunction
|
||||
function! s:ProcessCapture()
|
||||
"normal ggVG"xy
|
||||
let curbufnr = bufnr(g:org_capture_file)
|
||||
" check if capture file is already open or not
|
||||
if curbufnr == -1
|
||||
exe '1,$write >> ' . g:org_capture_file
|
||||
bw! _Org_Capture_
|
||||
else
|
||||
normal ggVG"xy
|
||||
bw! _Org_Capture_
|
||||
call org#SaveLocation()
|
||||
call org#LocateFile(g:org_capture_file)
|
||||
normal G"xp
|
||||
silent write
|
||||
call org#RestoreLocation()
|
||||
endif
|
||||
exe 'bwipeout! ' . g:org_capture_file
|
||||
|
||||
endfunction
|
||||
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,19 +0,0 @@
|
|||
The vim73 patch in this directory does two things:
|
||||
|
||||
1. Enables level-dependent fold highlighting in Vim73.
|
||||
2. Enables separate TODO highlighting in folded headings
|
||||
in VimOrganizer, so TODO's stand out even when a
|
||||
heading is folded.
|
||||
|
||||
Two versions of the Vim73 patch are included. The _46 version
|
||||
is for source code downloaded from Vim.org. The _390 version
|
||||
works for the Mercurial repo version as of Dec. 31, 2011.
|
||||
|
||||
The vim72 patch is old and only does (1) above.
|
||||
|
||||
If someone is using a version of Windows and wants to avoid
|
||||
recompiling process you can contact me and I will send you an
|
||||
executable you should be able to use on your system.
|
||||
|
||||
Herbert Sitz
|
||||
hesitz@gmail.com
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
=== (+2,-1) src/eval.c ===
|
||||
@@ -355,6 +355,7 @@
|
||||
{VV_NAME("operator", VAR_STRING), VV_RO},
|
||||
{VV_NAME("searchforward", VAR_NUMBER), 0},
|
||||
{VV_NAME("oldfiles", VAR_LIST), 0},
|
||||
+ {VV_NAME("foldhighlight", VAR_NUMBER), 0},
|
||||
};
|
||||
|
||||
/* shorthand */
|
||||
=== (+18,-9) src/screen.c ===
|
||||
@@ -2179,9 +2179,17 @@
|
||||
# define RL_MEMSET(p, v, l) for (ri = 0; ri < l; ++ri) \
|
||||
ScreenAttrs[off + (p) + ri] = v
|
||||
#endif
|
||||
+ /*
|
||||
+ * 4. Compose the folded-line string with 'foldtext', if set.
|
||||
+ */
|
||||
+ text = get_foldtext(wp, lnum, lnume, foldinfo, buf);
|
||||
+
|
||||
+ txtcol = col; /* remember where text starts */
|
||||
|
||||
/* Set all attributes of the 'number' column and the text */
|
||||
- RL_MEMSET(col, hl_attr(HLF_FL), W_WIDTH(wp) - col);
|
||||
+ //RL_MEMSET(col, hl_attr(HLF_FL), W_WIDTH(wp) - col);
|
||||
+ RL_MEMSET(col, hl_attr(get_vim_var_nr(VV_FOLDHIGHLIGHT)), W_WIDTH(wp) - col);
|
||||
+
|
||||
|
||||
#ifdef FEAT_SIGNS
|
||||
/* If signs are being displayed, add two spaces. */
|
||||
@@ -2196,10 +2204,11 @@
|
||||
if (wp->w_p_rl)
|
||||
/* the line number isn't reversed */
|
||||
copy_text_attr(off + W_WIDTH(wp) - len - col,
|
||||
- (char_u *)" ", len, hl_attr(HLF_FL));
|
||||
+ (char_u *)" ", len, hl_attr(get_vim_var_nr(VV_FOLDHIGHLIGHT)));
|
||||
+
|
||||
else
|
||||
# endif
|
||||
- copy_text_attr(off + col, (char_u *)" ", len, hl_attr(HLF_FL));
|
||||
+ copy_text_attr(off + col, (char_u *)" ", len, hl_attr(get_vim_var_nr(VV_FOLDHIGHLIGHT)));
|
||||
col += len;
|
||||
}
|
||||
}
|
||||
@@ -2222,10 +2231,10 @@
|
||||
if (wp->w_p_rl)
|
||||
/* the line number isn't reversed */
|
||||
copy_text_attr(off + W_WIDTH(wp) - len - col, buf, len,
|
||||
- hl_attr(HLF_FL));
|
||||
+ hl_attr(get_vim_var_nr(VV_FOLDHIGHLIGHT)));
|
||||
else
|
||||
#endif
|
||||
- copy_text_attr(off + col, buf, len, hl_attr(HLF_FL));
|
||||
+ copy_text_attr(off + col, buf, len, hl_attr(get_vim_var_nr(VV_FOLDHIGHLIGHT)));
|
||||
col += len;
|
||||
}
|
||||
}
|
||||
@@ -2233,9 +2242,9 @@
|
||||
/*
|
||||
* 4. Compose the folded-line string with 'foldtext', if set.
|
||||
*/
|
||||
- text = get_foldtext(wp, lnum, lnume, foldinfo, buf);
|
||||
-
|
||||
- txtcol = col; /* remember where text starts */
|
||||
+ //text = get_foldtext(wp, lnum, lnume, foldinfo, buf);
|
||||
+// moved up above to heappen earlier h.s.
|
||||
+ // txtcol = col; /* remember where text starts */
|
||||
|
||||
/*
|
||||
* 5. move the text to current_ScreenLine. Fill up with "fill_fold".
|
||||
=== (+3,-2) src/vim.h ===
|
||||
@@ -1767,7 +1767,8 @@
|
||||
#define VV_OP 52
|
||||
#define VV_SEARCHFORWARD 53
|
||||
#define VV_OLDFILES 54
|
||||
-#define VV_LEN 55 /* number of v: vars */
|
||||
+#define VV_FOLDHIGHLIGHT 55
|
||||
+#define VV_LEN 56 /* number of v: vars */
|
||||
|
||||
#ifdef FEAT_CLIPBOARD
|
||||
|
|
@ -1,120 +0,0 @@
|
|||
Common subdirectories: src/auto and patched_src/auto
|
||||
diff -u src/eval.c patched_src/eval.c
|
||||
--- src/eval.c 2012-01-01 16:30:50.421710297 +0100
|
||||
+++ patched_src/eval.c 2012-01-01 17:12:53.261832394 +0100
|
||||
@@ -360,6 +360,8 @@
|
||||
{VV_NAME("searchforward", VAR_NUMBER), 0},
|
||||
{VV_NAME("oldfiles", VAR_LIST), 0},
|
||||
{VV_NAME("windowid", VAR_NUMBER), VV_RO},
|
||||
+ {VV_NAME("foldhighlight", VAR_NUMBER), 0},
|
||||
+ {VV_NAME("todohighlight", VAR_NUMBER), 0},
|
||||
};
|
||||
|
||||
/* shorthand */
|
||||
Common subdirectories: src/GvimExt and patched_src/GvimExt
|
||||
Common subdirectories: src/os_mac_rsrc and patched_src/os_mac_rsrc
|
||||
Common subdirectories: src/po and patched_src/po
|
||||
Common subdirectories: src/proto and patched_src/proto
|
||||
diff -u src/screen.c patched_src/screen.c
|
||||
--- src/screen.c 2012-01-01 16:41:32.945741392 +0100
|
||||
+++ patched_src/screen.c 2012-01-01 17:17:33.209845943 +0100
|
||||
@@ -2214,6 +2214,9 @@
|
||||
* 4. Compose the text
|
||||
* 5. Add the text
|
||||
* 6. set highlighting for the Visual area an other text
|
||||
+ * NOTE: in patch for VimOrganizer step 4, composing text
|
||||
+ * is moved up to happen as part of step 2.
|
||||
+
|
||||
*/
|
||||
col = 0;
|
||||
|
||||
@@ -2271,11 +2274,16 @@
|
||||
# define RL_MEMSET(p, v, l) for (ri = 0; ri < l; ++ri) \
|
||||
ScreenAttrs[off + (p) + ri] = v
|
||||
#endif
|
||||
-
|
||||
- /* Set all attributes of the 'number' or 'relativenumber' column and the
|
||||
- * text */
|
||||
- RL_MEMSET(col, hl_attr(HLF_FL), W_WIDTH(wp) - col);
|
||||
-
|
||||
+ /*
|
||||
+ * 4. Compose the folded-line string with 'foldtext', if set.
|
||||
+ */
|
||||
+ text = get_foldtext(wp, lnum, lnume, foldinfo, buf);
|
||||
+
|
||||
+ txtcol = col; /* remember where text starts */
|
||||
+
|
||||
+ /* Set all attributes of the 'number' column and the text */
|
||||
+ RL_MEMSET(col, syn_id2attr(get_vim_var_nr(VV_FOLDHIGHLIGHT)), W_WIDTH(wp) - col);
|
||||
+
|
||||
#ifdef FEAT_SIGNS
|
||||
/* If signs are being displayed, add two spaces. */
|
||||
if (draw_signcolumn(wp))
|
||||
@@ -2289,10 +2297,10 @@
|
||||
if (wp->w_p_rl)
|
||||
/* the line number isn't reversed */
|
||||
copy_text_attr(off + W_WIDTH(wp) - len - col,
|
||||
- (char_u *)" ", len, hl_attr(HLF_FL));
|
||||
+ (char_u *)" ", len, hl_attr(HLF_SC));
|
||||
else
|
||||
# endif
|
||||
- copy_text_attr(off + col, (char_u *)" ", len, hl_attr(HLF_FL));
|
||||
+ copy_text_attr(off + col, (char_u *)" ", len, hl_attr(HLF_SC));
|
||||
col += len;
|
||||
}
|
||||
}
|
||||
@@ -2324,20 +2332,31 @@
|
||||
if (wp->w_p_rl)
|
||||
/* the line number isn't reversed */
|
||||
copy_text_attr(off + W_WIDTH(wp) - len - col, buf, len,
|
||||
- hl_attr(HLF_FL));
|
||||
+ hl_attr(HLF_N));
|
||||
else
|
||||
#endif
|
||||
- copy_text_attr(off + col, buf, len, hl_attr(HLF_FL));
|
||||
+ copy_text_attr(off + col, buf, len, hl_attr(HLF_N));
|
||||
col += len;
|
||||
}
|
||||
}
|
||||
+ /* now set attributes for vimorganizer todo word in headline, if any */
|
||||
+ /* v:todohighlight is set in user's OrgFoldText() function. . . */
|
||||
+ if (get_vim_var_nr(VV_TODOHIGHLIGHT) > 0 )
|
||||
+ {
|
||||
+ int start=0, end;
|
||||
+
|
||||
+ while( *(text + start) == ' ' )
|
||||
+ start++;
|
||||
+ end = start;
|
||||
+ while( *(text + end) != ' ' )
|
||||
+ end++;
|
||||
+ RL_MEMSET(start+col, syn_id2attr(get_vim_var_nr(VV_TODOHIGHLIGHT)), end - start);
|
||||
+ }
|
||||
|
||||
/*
|
||||
* 4. Compose the folded-line string with 'foldtext', if set.
|
||||
*/
|
||||
- text = get_foldtext(wp, lnum, lnume, foldinfo, buf);
|
||||
-
|
||||
- txtcol = col; /* remember where text starts */
|
||||
+ // moved up above to happen earlier h.s.
|
||||
|
||||
/*
|
||||
* 5. move the text to current_ScreenLine. Fill up with "fill_fold".
|
||||
Common subdirectories: src/tee and patched_src/tee
|
||||
Common subdirectories: src/testdir and patched_src/testdir
|
||||
diff -u src/vim.h patched_src/vim.h
|
||||
--- src/vim.h 2012-01-01 16:30:51.025710325 +0100
|
||||
+++ patched_src/vim.h 2012-01-01 17:18:31.933848785 +0100
|
||||
@@ -1860,7 +1860,9 @@
|
||||
#define VV_SEARCHFORWARD 53
|
||||
#define VV_OLDFILES 54
|
||||
#define VV_WINDOWID 55
|
||||
-#define VV_LEN 56 /* number of v: vars */
|
||||
+#define VV_FOLDHIGHLIGHT 56
|
||||
+#define VV_TODOHIGHLIGHT 57
|
||||
+#define VV_LEN 58 /* number of v: vars */
|
||||
|
||||
#ifdef FEAT_CLIPBOARD
|
||||
|
||||
Common subdirectories: src/VisVim and patched_src/VisVim
|
||||
Common subdirectories: src/xxd and patched_src/xxd
|
||||
|
|
@ -1,113 +0,0 @@
|
|||
diff -u ./src/eval.c ./patched_src/eval.c
|
||||
--- ./src/eval.c 2010-08-09 13:12:14.000000000 -0700
|
||||
+++ ./patched_src/eval.c 2011-08-24 12:45:30.990183200 -0700
|
||||
@@ -362,6 +362,8 @@
|
||||
{VV_NAME("operator", VAR_STRING), VV_RO},
|
||||
{VV_NAME("searchforward", VAR_NUMBER), 0},
|
||||
{VV_NAME("oldfiles", VAR_LIST), 0},
|
||||
+ {VV_NAME("foldhighlight", VAR_NUMBER), 0},
|
||||
+ {VV_NAME("todohighlight", VAR_NUMBER), 0},
|
||||
};
|
||||
|
||||
/* shorthand */
|
||||
diff -u ./src/screen.c ./patched_src/screen.c
|
||||
--- ./src/screen.c 2010-08-13 06:21:27.000000000 -0700
|
||||
+++ ./patched_src/screen.c 2011-10-15 04:01:17.947926300 -0700
|
||||
@@ -2214,6 +2214,8 @@
|
||||
* 4. Compose the text
|
||||
* 5. Add the text
|
||||
* 6. set highlighting for the Visual area an other text
|
||||
+ * NOTE: in patch for VimOrganizer step 4, composing text
|
||||
+ * is moved up to happen as part of step 2.
|
||||
*/
|
||||
col = 0;
|
||||
|
||||
@@ -2271,10 +2273,16 @@
|
||||
# define RL_MEMSET(p, v, l) for (ri = 0; ri < l; ++ri) \
|
||||
ScreenAttrs[off + (p) + ri] = v
|
||||
#endif
|
||||
+ /*
|
||||
+ * 4. Compose the folded-line string with 'foldtext', if set.
|
||||
+ */
|
||||
+ text = get_foldtext(wp, lnum, lnume, foldinfo, buf);
|
||||
+
|
||||
+ txtcol = col; /* remember where text starts */
|
||||
+
|
||||
+ /* Set all attributes of the 'number' column and the text */
|
||||
+ RL_MEMSET(col, syn_id2attr(get_vim_var_nr(VV_FOLDHIGHLIGHT)), W_WIDTH(wp) - col);
|
||||
|
||||
- /* Set all attributes of the 'number' or 'relativenumber' column and the
|
||||
- * text */
|
||||
- RL_MEMSET(col, hl_attr(HLF_FL), W_WIDTH(wp) - col);
|
||||
|
||||
#ifdef FEAT_SIGNS
|
||||
/* If signs are being displayed, add two spaces. */
|
||||
@@ -2289,10 +2297,11 @@
|
||||
if (wp->w_p_rl)
|
||||
/* the line number isn't reversed */
|
||||
copy_text_attr(off + W_WIDTH(wp) - len - col,
|
||||
- (char_u *)" ", len, hl_attr(HLF_FL));
|
||||
+ (char_u *)" ", len, hl_attr(HLF_SC));
|
||||
else
|
||||
# endif
|
||||
- copy_text_attr(off + col, (char_u *)" ", len, hl_attr(HLF_FL));
|
||||
+ copy_text_attr(off + col, (char_u *)" ", len, hl_attr(HLF_SC));
|
||||
+
|
||||
col += len;
|
||||
}
|
||||
}
|
||||
@@ -2324,20 +2333,35 @@
|
||||
if (wp->w_p_rl)
|
||||
/* the line number isn't reversed */
|
||||
copy_text_attr(off + W_WIDTH(wp) - len - col, buf, len,
|
||||
- hl_attr(HLF_FL));
|
||||
+ hl_attr(HLF_N));
|
||||
+ //syn_id2attr(get_vim_var_nr(VV_FOLDHIGHLIGHT)));
|
||||
+
|
||||
else
|
||||
#endif
|
||||
- copy_text_attr(off + col, buf, len, hl_attr(HLF_FL));
|
||||
+ copy_text_attr(off + col, buf, len, hl_attr(HLF_N));
|
||||
+ //copy_text_attr(off + col, buf, len, syn_id2attr(get_vim_var_nr(VV_FOLDHIGHLIGHT)));
|
||||
+
|
||||
col += len;
|
||||
}
|
||||
}
|
||||
|
||||
+ /* now set attributes for vimorganizer todo word in headline, if any */
|
||||
+ /* v:todohighlight is set in user's OrgFoldText() function. . . */
|
||||
+ if (get_vim_var_nr(VV_TODOHIGHLIGHT) > 0 )
|
||||
+ {
|
||||
+ int start=0, end;
|
||||
+
|
||||
+ while( *(text + start) == ' ' )
|
||||
+ start++;
|
||||
+ end = start;
|
||||
+ while( *(text + end) != ' ' )
|
||||
+ end++;
|
||||
+ RL_MEMSET(start+col, syn_id2attr(get_vim_var_nr(VV_TODOHIGHLIGHT)), end - start);
|
||||
+ }
|
||||
/*
|
||||
* 4. Compose the folded-line string with 'foldtext', if set.
|
||||
*/
|
||||
- text = get_foldtext(wp, lnum, lnume, foldinfo, buf);
|
||||
-
|
||||
- txtcol = col; /* remember where text starts */
|
||||
+ // moved up above to happen earlier h.s.
|
||||
|
||||
/*
|
||||
* 5. move the text to current_ScreenLine. Fill up with "fill_fold".
|
||||
diff -u ./src/vim.h ./patched_src/vim.h
|
||||
--- ./src/vim.h 2010-07-29 11:46:39.000000000 -0700
|
||||
+++ ./patched_src/vim.h 2011-08-11 14:22:52.525545700 -0700
|
||||
@@ -1842,7 +1842,9 @@
|
||||
#define VV_OP 52
|
||||
#define VV_SEARCHFORWARD 53
|
||||
#define VV_OLDFILES 54
|
||||
-#define VV_LEN 55 /* number of v: vars */
|
||||
+#define VV_FOLDHIGHLIGHT 55
|
||||
+#define VV_TODOHIGHLIGHT 56
|
||||
+#define VV_LEN 57 /* number of v: vars */
|
||||
|
||||
#ifdef FEAT_CLIPBOARD
|
||||
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,75 +0,0 @@
|
|||
" org.vim - VimOrganizer plugin for Vim
|
||||
" -------------------------------------------------------------
|
||||
" Version: 0.30
|
||||
" Maintainer: Herbert Sitz <hesitz@gmail.com>
|
||||
" Last Change: 2011 Nov 02
|
||||
"
|
||||
" Script: http://www.vim.org/scripts/script.php?script_id=3342
|
||||
" Github page: http://github.com/hsitz/VimOrganizer
|
||||
" Copyright: (c) 2010, 2011 by Herbert Sitz
|
||||
" The VIM LICENSE applies to all files in the
|
||||
" VimOrganizer plugin.
|
||||
" (See the Vim copyright except read "VimOrganizer"
|
||||
" in places where that copyright refers to "Vim".)
|
||||
" http://vimdoc.sourceforge.net/htmldoc/uganda.html#license
|
||||
" No warranty, express or implied.
|
||||
" *** *** Use At-Your-Own-Risk *** ***
|
||||
let mysid='<SNR>' . g:org_sid . '_'
|
||||
nnoremap <silent> <buffer> <localleader>ag :call OrgAgendaDashboard()<cr>
|
||||
nnoremap <silent> <buffer> <localleader>et :call OrgTagsEdit()<cr>
|
||||
nnoremap <silent> <buffer> <localleader>ci :call OrgClockIn()<cr>
|
||||
nnoremap <silent> <buffer> <localleader>co :call OrgClockOut()<cr>
|
||||
nnoremap <silent> <buffer> <localleader>d :call OrgDateDashboard()<cr>
|
||||
nnoremap <silent> <buffer> <localleader>t :call OrgTodoDashboard()<cr>
|
||||
nnoremap <silent> <buffer> <localleader>a :call DoRefile(['_archive'],[line('.')])<cr>
|
||||
"nnoremap <silent> <buffer> <localleader><tab> :call {mysid}ToFromAgenda()<cr>
|
||||
nnoremap <silent> <buffer> <localleader><tab> :call {mysid}ToFromAgenda()<cr>
|
||||
"nnoremap <silent> <buffer> q :sign unplace * | quit<cr>
|
||||
nnoremap <silent> <buffer> q :call OrgQuitAgenda()<cr>
|
||||
|
||||
nmap <buffer> <silent> <s-CR> :call {mysid}AgendaReplaceTodo()<CR>
|
||||
nmap <silent> <buffer> <c-CR> :MyAgendaToBuf<CR>
|
||||
nmap <silent> <buffer> <CR> :AgendaMoveToBuf<CR>
|
||||
nmap <silent> <buffer> ,r :call OrgRunCustom({'redo_num': line('.'), 'type':'tags-todo', 'spec': g:org_search_spec})<CR>
|
||||
nmap <silent> <buffer> >> :call OrgAgendaDateInc('++1d')<CR>
|
||||
nmap <silent> <buffer> << :call OrgAgendaDateInc('--1d')<CR>
|
||||
nmap <silent> <buffer> <localleader>t :call OrgTodoDashboard()<CR>
|
||||
nmap <silent> <buffer> <s-right> :silent call {mysid}AgendaReplaceTodo()<CR>
|
||||
|
||||
nmap <silent> <buffer> <s-left> :silent call {mysid}AgendaReplaceTodo('todo-bkwd')<CR>
|
||||
nmap <silent> <buffer> <space> :call {mysid}ToggleHeadingMark(line('.'))<CR>
|
||||
nmap <silent> <buffer> <c-space> :call {mysid}DeleteHeadingMarks()<CR>
|
||||
nmap <silent> <buffer> ,R :call OrgRefileDashboard()<CR>
|
||||
nmap <silent> <buffer> <tab> :call {mysid}OrgAgendaTab()<CR>
|
||||
|
||||
"if a:search_type ==? 'agenda_todo'
|
||||
" nmap <buffer> r :call OrgRunSearch(g:org_search_spec,'agenda_todo')<cr>
|
||||
"endif
|
||||
|
||||
" lines below are from date searches
|
||||
nmap <silent> <buffer> v. :call OrgRunCustom({'redo_num': line('.'), 'type':'agenda', 'agenda_date': strftime("%Y-%m-%d"), 'agenda_duration':'d', 'spec': g:org_search_spec})<CR>
|
||||
nmap <silent> <buffer> vd :call OrgRunCustom({'redo_num': line('.'), 'type':'agenda', 'agenda_date': g:agenda_startdate, 'agenda_duration':'d', 'spec': g:org_search_spec})<CR>
|
||||
nmap <silent> <buffer> vw :call OrgRunCustom({'redo_num': line('.'), 'type':'agenda', 'agenda_date': g:agenda_startdate, 'agenda_duration':'w', 'spec': g:org_search_spec})<CR>
|
||||
nmap <silent> <buffer> vm :call OrgRunCustom({'redo_num': line('.'), 'type':'agenda', 'agenda_date': g:agenda_startdate, 'agenda_duration':'m', 'spec': g:org_search_spec})<CR>
|
||||
nmap <silent> <buffer> vy :call OrgRunCustom({'redo_num': line('.'), 'type':'agenda', 'agenda_date': g:agenda_startdate, 'agenda_duration':'y', 'spec': g:org_search_spec})<CR>
|
||||
nmap <silent> <buffer> f :<C-U>call OrgAgendaMove('forward',v:count1)<cr>
|
||||
nmap <silent> <buffer> b :<C-U>call OrgAgendaMove('backward',v:count1)<cr>
|
||||
|
||||
nmap <buffer> <silent> <tab> :call {mysid}OrgAgendaTab()<CR>
|
||||
"nmap <silent> <buffer> <s-CR> :call OrgAgendaGetText(1)<CR>
|
||||
nmap <silent> <buffer> r :call OrgRefreshCalendarAgenda()<CR>
|
||||
|
||||
|
||||
function! OrgQuitAgenda()
|
||||
sign unplace *
|
||||
bw
|
||||
call clearmatches()
|
||||
let b:v.chosen_agenda_heading = 0
|
||||
if bufnr('ColHeadBuffer') > -1
|
||||
"main window has column headings window that
|
||||
"is now showing a blank buffer line, push back up . . .
|
||||
resize 100
|
||||
endif
|
||||
"quit
|
||||
endfunction
|
||||
|
||||
|
|
@ -1,215 +0,0 @@
|
|||
" org.vim - VimOrganizer plugin for Vim
|
||||
" -------------------------------------------------------------
|
||||
" Version: 0.30
|
||||
" Maintainer: Herbert Sitz <hesitz@gmail.com>
|
||||
" Last Change: 2011 Nov 02
|
||||
"
|
||||
" Script: http://www.vim.org/scripts/script.php?script_id=3342
|
||||
" Github page: http://github.com/hsitz/VimOrganizer
|
||||
" Copyright: (c) 2010, 2011 by Herbert Sitz
|
||||
" The VIM LICENSE applies to all files in the
|
||||
" VimOrganizer plugin.
|
||||
" (See the Vim copyright except read "VimOrganizer"
|
||||
" in places where that copyright refers to "Vim".)
|
||||
" http://vimdoc.sourceforge.net/htmldoc/uganda.html#license
|
||||
" No warranty, express or implied.
|
||||
" *** *** Use At-Your-Own-Risk *** ***
|
||||
"
|
||||
"Section Mappings and Endstuff
|
||||
" below block of 10 or 15 maps are ones collected
|
||||
" from body of doc that weren't getting assigned for docs
|
||||
" oepened after initial org filetype doc
|
||||
let mysid = '<SNR>' . g:org_sid . '_'
|
||||
nnoremap <silent> <buffer> <tab> :call OrgCycle()<cr>
|
||||
nnoremap <silent> <buffer> <s-tab> :call OrgGlobalCycle()<cr>
|
||||
nnoremap <silent> <buffer> <localleader>ci :call OrgClockIn(line("."))<cr>
|
||||
nnoremap <silent> <buffer> <localleader>co :call OrgClockOut()<cr>
|
||||
"cnoremap <space> <C-\>e(<SID>OrgDateEdit())<CR>
|
||||
" dl is for the date on the current line
|
||||
noremap <buffer> <localleader>x :call OrgExportDashboard()<cr>
|
||||
noremap <buffer> <localleader>d :call OrgDateDashboard()<cr>
|
||||
noremap <buffer> <localleader>b :call OrgTableDashboard()<cr>
|
||||
"for char in split('fnbptd12345','\zs')
|
||||
" exec 'noremap <silent> <buffer> <localleader>t' . char . ' :call OrgTodoDashboard("' . char . '")<cr>'
|
||||
"endfor
|
||||
"for char in split('dsctg','\zs')
|
||||
" exec 'noremap <silent> <buffer> <localleader>d' . char . ' :call OrgDateDashboard("' . char . '")<cr>'
|
||||
"endfor
|
||||
"for char in split('hlt12345','\zs')
|
||||
" exec 'noremap <silent> <buffer> <localleader>m' . char . ' :call OrgColumnsDashboard("' . char . '")<cr>'
|
||||
"endfor
|
||||
"noremap <silent> <buffer> <localleader>dg :call OrgGenericDateEdit()<cr>
|
||||
"noremap <silent> <buffer> <localleader>dt :call OrgDateEdit('TIMESTAMP')<cr>
|
||||
"noremap <silent> <buffer> <localleader>dd :call OrgDateEdit('DEADLINE')<cr>
|
||||
"noremap <silent> <buffer> <localleader>dc :call OrgDateEdit('CLOSED')<cr>
|
||||
"noremap <silent> <buffer> <localleader>ds :call OrgDateEdit('SCHEDULED')<cr>
|
||||
noremap <silent> <buffer> <localleader>a* :call OrgRunAgenda(strftime("%Y-%m-%d"),'w,'')<cr>
|
||||
noremap <silent> <buffer> <localleader>aa :call OrgRunAgenda(strftime("%Y-%m-%d"),'w,'+ANY_TODO')<cr>
|
||||
noremap <silent> <buffer> <localleader>at :call OrgRunAgenda(strftime("%Y-%m-%d"),'w,'+UNFINISHED_TODOS')<cr>
|
||||
noremap <silent> <buffer> <localleader>ad :call OrgRunAgenda(strftime("%Y-%m-%d"),'w,'+FINISHED_TODOS')<cr>
|
||||
noremap <silent> <buffer> <localleader>ag :call OrgAgendaDashboard()<cr>
|
||||
noremap <silent> <buffer> <localleader>af :call OrgAgendaFilesDashboard()<cr>
|
||||
noremap <silent> <buffer> <localleader>ac :call OrgCustomSearchMenu()<cr>
|
||||
"command! -nargs=0 Agenda :call OrgAgendaDashboard()
|
||||
nnoremap <silent> <buffer> <s-up> :call OrgDateInc(1)<CR>
|
||||
nnoremap <silent> <buffer> <s-down> :call OrgDateInc(-1)<CR>
|
||||
nnoremap <silent> <buffer> <2-LeftMouse> :call OrgMouseDate()<CR>
|
||||
nnoremap <localleader>pl :call s:MyPopup()<cr>
|
||||
"map <silent> <localleader>b :call ShowBottomCal()<cr>
|
||||
|
||||
nnoremap <silent> <buffer> <localleader>et :call OrgTagsEdit()<cr>
|
||||
|
||||
" clear search matching
|
||||
nnoremap <silent> <buffer> <localleader>cs :let @/=''<cr>
|
||||
|
||||
noremap <buffer> <localleader>r :call OrgRefileDashboard()<cr>
|
||||
noremap <buffer> <localleader>g :call {mysid}OrgGatherDashboard()<cr>
|
||||
"noremap <silent> <buffer> <localleader>rh :call OrgRefile(line('.'))<cr>
|
||||
"noremap <silent> <buffer> <localleader>rj :call OrgJumpToRefilePoint()<cr>
|
||||
"noremap <silent> <buffer> <localleader>rx :call OrgJumpToRefilePointPersistent()<cr>
|
||||
"noremap <silent> <buffer> <localleader>rs :call OrgSetRefilePoint()<cr>
|
||||
"noremap <silent> <buffer> <localleader>rp :call OrgRefileToPermPoint(line('.'))<cr>
|
||||
noremap <silent> <buffer> <localleader>v :silent call OrgEval()<cr>
|
||||
|
||||
noremap <buffer> <C-K> <C-]>
|
||||
noremap <buffer> <C-N> <C-T>
|
||||
noremap <silent> <buffer> <localleader>0 :call OrgExpandWithoutText(99999)<CR>
|
||||
noremap <silent> <buffer> <localleader>9 :call OrgExpandWithoutText(9)<CR>
|
||||
noremap <silent> <buffer> <localleader>8 :call OrgExpandWithoutText(8)<CR>
|
||||
noremap <silent> <buffer> <localleader>7 :call OrgExpandWithoutText(7)<CR>
|
||||
noremap <silent> <buffer> <localleader>6 :call OrgExpandWithoutText(6)<CR>
|
||||
noremap <silent> <buffer> <localleader>5 :call OrgExpandWithoutText(5)<CR>
|
||||
noremap <silent> <buffer> <localleader>4 :call OrgExpandWithoutText(4)<CR>
|
||||
noremap <silent> <buffer> <localleader>3 :call OrgExpandWithoutText(3)<CR>
|
||||
noremap <silent> <buffer> <localleader>2 :call OrgExpandWithoutText(2)<CR>
|
||||
noremap <silent> <buffer> <localleader>1 :call OrgExpandWithoutText(1)<CR>
|
||||
"noremap <silent> <buffer> <localleader><space> :call OrgExpandWithoutText(1)<CR>
|
||||
"noremap <silent> <buffer> <localleader>/ :let @/='exec call OrgExpandWithoutText(1)<CR>
|
||||
"noremap <silent> <buffer> <localleader>/ :let @a='/^\*\{1,' . &foldlevel . '\} .*'|call LevSearch()<cr>
|
||||
nnoremap <buffer> <expr> <localleader>/ '/^\*\{1,' . &foldlevel . '\} .*'
|
||||
nnoremap <buffer> <expr> <localleader>? '?^\*\{1,' . &foldlevel . '\} .*'
|
||||
|
||||
" set reasonable max limit of 12 for '0' command below, because it iterates
|
||||
" each for each level, just assume 12 is max. . .
|
||||
noremap <silent> <buffer> <localleader>,0 :call OrgShowSubs(12,0)<CR>
|
||||
noremap <silent> <buffer> <localleader>,9 :call OrgShowSubs(9,0)<CR>
|
||||
noremap <silent> <buffer> <localleader>,8 :call OrgShowSubs(8,0)<CR>
|
||||
noremap <silent> <buffer> <localleader>,7 :call OrgShowSubs(7,0)<CR>
|
||||
noremap <silent> <buffer> <localleader>,6 :call OrgShowSubs(6,0)<CR>
|
||||
noremap <silent> <buffer> <localleader>,5 :call OrgShowSubs(5,0)<CR>
|
||||
noremap <silent> <buffer> <localleader>,4 :call OrgShowSubs(4,0)<CR>
|
||||
noremap <silent> <buffer> <localleader>,3 :call OrgShowSubs(3,0)<CR>
|
||||
noremap <silent> <buffer> <localleader>,2 :call OrgShowSubs(2,0)<CR>
|
||||
noremap <silent> <buffer> <localleader>,1 :call OrgShowSubs(1,0)<CR>
|
||||
noremap <silent> <buffer> <localleader>,; :call OrgShowSubs(1,0)<CR>
|
||||
|
||||
|
||||
"nnoremap <silent> <buffer> <localleader>no :call NarrowOutline(line('.'))<cr>
|
||||
"nnoremap <silent> <buffer> <localleader>ns :call NarrowOutline(line('.'))<cr>
|
||||
"nnoremap <silent> <buffer> <localleader>nc :call NarrowCodeBlock(line('.'))<cr>
|
||||
nnoremap <silent> <buffer> <localleader>na :call NarrowCodeBlock(line('.'))<cr>
|
||||
nnoremap <silent> <buffer> <localleader>m :call OrgColumnsDashboard()<cr>
|
||||
" ----------------------------------------
|
||||
" table commands
|
||||
au InsertEnter *.org :call org#tbl#reset_tw(line("."))
|
||||
au InsertLeave *.org :call org#tbl#format(line("."))
|
||||
command! -buffer -nargs=* OrgTable call org#tbl#create(<f-args>)
|
||||
"nnoremap <silent> <buffer> <localleader>bc :call org#tbl#create()<cr>
|
||||
command! -buffer OrgTableAlignQ call org#tbl#align_or_cmd('gqq')
|
||||
command! -buffer OrgTableAlignW call org#tbl#align_or_cmd('gww')
|
||||
command! -buffer OrgTableMoveColumnLeft call org#tbl#move_column_left()
|
||||
"nnoremap <silent> <buffer> <localleader>bl :call org#tbl#move_column_left()<cr>
|
||||
command! -buffer OrgTableMoveColumnRight call org#tbl#move_column_right()
|
||||
"nnoremap <silent> <buffer> <localleader>br :call org#tbl#move_column_right()<cr>
|
||||
|
||||
" table function mappings
|
||||
inoremap <buffer> <expr> <CR> org#tbl#kbd_cr()
|
||||
inoremap <expr> <buffer> <Tab> org#tbl#kbd_tab()
|
||||
inoremap <expr> <buffer> <S-Tab> org#tbl#kbd_shift_tab()
|
||||
nnoremap <buffer> gqq :OrgTableAlignQ<CR>
|
||||
nnoremap <buffer> gww :OrgTableAlignW<CR>
|
||||
"nnoremap <silent><buffer> <A-Left> <Plug>OrgTableMoveColumnLeft
|
||||
nnoremap <silent><script><buffer>
|
||||
\ <Plug>OrgTableMoveColumnLeft :OrgTableMoveColumnLeft<CR>
|
||||
"nnoremap <silent><buffer> <A-Right> <Plug>OrgTableMoveColumnRight
|
||||
nnoremap <silent><script><buffer>
|
||||
\ <Plug>OrgTableMoveColumnRight :OrgTableMoveColumnRight<CR>
|
||||
" -------------------------------------
|
||||
|
||||
imap <silent> <buffer> <s-c-CR> <c-r>=OrgNewHead('levelup',1)<CR>
|
||||
imap <silent> <buffer> <c-CR> <c-r>=OrgNewHead('leveldown',1)<CR>
|
||||
imap <silent> <buffer> <s-CR> <c-r>=OrgNewHead('same',1)<CR>
|
||||
nnoremap <silent> <buffer> <s-c-CR> :call OrgNewHead('levelup')<CR>
|
||||
nnoremap <silent> <buffer> <c-CR> :call OrgNewHead('leveldown')<CR>
|
||||
nnoremap <silent> <buffer> <CR> :call OrgEnterFunc()<CR>
|
||||
nnoremap <silent> <buffer> <c-left> :call OrgShowLess(line("."))<CR>
|
||||
nnoremap <silent> <buffer> <c-right> :call OrgShowMore(line("."))<CR>
|
||||
nnoremap <silent> <buffer> <c-a-left> :call OrgMoveLevel(line("."),'left')<CR>
|
||||
nnoremap <silent> <buffer> <c-a-right> :call OrgMoveLevel(line("."),'right')<CR>
|
||||
nnoremap <silent> <buffer> <c-a-up> :<C-U>call OrgMoveLevel(line("."),'up',v:count1)<CR>
|
||||
nnoremap <silent> <buffer> <c-a-down> :<C-U>call OrgMoveLevel(line("."),'down',v:count1)<CR>
|
||||
nnoremap <silent> <buffer> <a-end> :call OrgNavigateLevels("end")<CR>
|
||||
nnoremap <silent> <buffer> <a-home> :call OrgNavigateLevels("home")<CR>
|
||||
nnoremap <silent> <buffer> <a-up> :call OrgNavigateLevels("up")<CR>
|
||||
nnoremap <silent> <buffer> <a-down> :call OrgNavigateLevels("down")<CR>
|
||||
nnoremap <silent> <buffer> <a-left> :call OrgNavigateLevels("left")<CR>
|
||||
nnoremap <silent> <buffer> <a-right> :call OrgNavigateLevels("right")<CR>
|
||||
nnoremap <silent> <buffer> <localleader>le :call EditLink()<cr>
|
||||
nnoremap <silent> <buffer> <localleader>lf :call FollowLink(OrgGetLink())<cr>
|
||||
nnoremap <silent> <buffer> <localleader>ln :/]]<cr>
|
||||
nnoremap <silent> <buffer> <localleader>lp :?]]<cr>
|
||||
nnoremap <silent> <buffer> <localleader>lc :set conceallevel=3\|set concealcursor=nc<cr>
|
||||
nnoremap <silent> <buffer> <localleader>la :set conceallevel=3\|set concealcursor=c<cr>
|
||||
nnoremap <silent> <buffer> <localleader>lx :set conceallevel=0<cr>
|
||||
"nnoremap <silent> <buffer> <localleader>,e :call OrgSingleHeadingText("expand")<CR>
|
||||
"nnoremap <silent> <buffer> <localleader>,E :call OrgBodyTextOperation(1,line("$"),"expand")<CR>
|
||||
"nnoremap <silent> <buffer> <localleader>,C :call OrgBodyTextOperation(1,line("$"),"collapse")<CR>
|
||||
"nnoremap <silent> <buffer> <localleader>,c :call OrgSingleHeadingText("collapse")<CR>
|
||||
nnoremap <silent> <buffer> zc :call OrgDoSingleFold(line("."))<CR>
|
||||
nnoremap <silent> <buffer> <localleader><tab> :call {mysid}ToFromAgenda()<cr>
|
||||
|
||||
function! OrgIndent()
|
||||
if getline(line('.')) =~ b:v.headMatch
|
||||
call OrgMoveLevel(line("."),'right')
|
||||
else
|
||||
normal! >>
|
||||
endif
|
||||
endfunction
|
||||
function! OrgReverseIndent()
|
||||
if getline(line('.')) =~ b:v.headMatch
|
||||
call OrgMoveLevel(line("."),'left')
|
||||
else
|
||||
normal! <<
|
||||
endif
|
||||
endfunction
|
||||
function! OrgNaviMap(keys)
|
||||
let keys = a:keys
|
||||
let dir_dict = {'gj':'down', 'gk':'up', 'gh':'left','gl':'right'}
|
||||
if getline(line('.')) =~ b:v.headMatch
|
||||
call OrgNavigateLevels(dir_dict[keys])
|
||||
else
|
||||
exe 'normal! ' . keys
|
||||
endif
|
||||
|
||||
endfunction
|
||||
" below are alternate mappings for terminals, which
|
||||
" don't support some of the above key combinations
|
||||
"nnoremap <silent> <buffer> ,<tab> :call OrgGlobalCycle()<cr>
|
||||
nnoremap <silent> <buffer> gk :call OrgNaviMap("gk")<CR>
|
||||
nnoremap <silent> <buffer> gj :call OrgNaviMap("gj")<CR>
|
||||
nnoremap <silent> <buffer> gh :call OrgNaviMap("gh")<CR>
|
||||
nnoremap <silent> <buffer> gl :call OrgNaviMap("gl")<CR>
|
||||
nnoremap <silent> <buffer> <localleader>zu :call OrgNavigateLevels("up")<CR>
|
||||
nnoremap <silent> <buffer> <localleader>zd :call OrgNavigateLevels("down")<CR>
|
||||
nnoremap <silent> <buffer> <localleader>zl :call OrgNavigateLevels("left")<CR>
|
||||
nnoremap <silent> <buffer> <localleader>zr :call OrgNavigateLevels("right")<CR>
|
||||
nnoremap <silent> <buffer> >> :call OrgIndent()<CR>
|
||||
nnoremap <silent> <buffer> << :call OrgReverseIndent()<CR>
|
||||
nnoremap <silent> <buffer> <localleader>zL :call OrgMoveLevel(line("."),'left')<CR>
|
||||
nnoremap <silent> <buffer> <localleader>zR :call OrgMoveLevel(line("."),'right')<CR>
|
||||
nnoremap <silent> <buffer> <, :<c-u>call OrgMoveLevel(line("."),'up',v:count1)<CR>
|
||||
nnoremap <silent> <buffer> >. :<c-u>call OrgMoveLevel(line("."),'down',v:count1)<CR>
|
||||
nnoremap <silent> <buffer> <localleader>k :<c-u>call OrgMoveLevel(line("."),'up',v:count1)<CR>
|
||||
nnoremap <silent> <buffer> <localleader>j :<c-u>call OrgMoveLevel(line("."),'down',v:count1)<CR>
|
||||
nnoremap <silent> <buffer> <localleader>np :call OrgNewHead('levelup')<CR>
|
||||
nnoremap <silent> <buffer> <localleader>ns :call OrgNewHead('leveldown')<CR>
|
||||
|
|
@ -1,262 +0,0 @@
|
|||
" org.vim - VimOrganizer plugin for Vim
|
||||
" -------------------------------------------------------------
|
||||
" Version: 0.30
|
||||
" Maintainer: Herbert Sitz <hesitz@gmail.com>
|
||||
" Last Change: 2011 Nov 02
|
||||
"
|
||||
" Script: http://www.vim.org/scripts/script.php?script_id=3342
|
||||
" Github page: http://github.com/hsitz/VimOrganizer
|
||||
" Copyright: (c) 2010, 2011 by Herbert Sitz
|
||||
" The VIM LICENSE applies to all files in the
|
||||
" VimOrganizer plugin.
|
||||
" (See the Vim copyright except read "VimOrganizer"
|
||||
" in places where that copyright refers to "Vim".)
|
||||
" http://vimdoc.sourceforge.net/htmldoc/uganda.html#license
|
||||
" No warranty, express or implied.
|
||||
" *** *** Use At-Your-Own-Risk *** ***
|
||||
|
||||
" set indent of text lines beyond heading's left column
|
||||
" 0 -- have text lines flush with their heading's left col
|
||||
if !exists("g:org_indent_from_head")
|
||||
let g:org_indent_from_head = 0
|
||||
|
||||
endif
|
||||
|
||||
if exists("b:did_indent") | finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
|
||||
setlocal indentexpr=GetOrgIndent()
|
||||
setlocal nolisp
|
||||
setlocal nosmartindent
|
||||
setlocal autoindent
|
||||
"setlocal indentkeys+=},=\\item,=\\bibitem
|
||||
|
||||
|
||||
" Only define the function once
|
||||
"if exists("GetOrgIndent") | finish
|
||||
"endif
|
||||
|
||||
|
||||
|
||||
function! GetOrgIndent(...)
|
||||
" Find a non-blank line above the current line.
|
||||
"let lnum = prevnonblank(v:lnum - 1)
|
||||
let lnum = PrevNonBlank(v:lnum - 1)
|
||||
|
||||
" At the start of the file use zero indent.
|
||||
if lnum == 0 | return 0
|
||||
endif
|
||||
|
||||
let curline = getline(v:lnum) " current line
|
||||
"let lminusone = getline(v:lnum-1)
|
||||
"if b:v.last_lnum > 0) && (curline !~ '^\s*$')
|
||||
" let lnum = b:v.last_lnum
|
||||
" let b:v.last_lnum = 0
|
||||
" endif
|
||||
let ind = indent(lnum)
|
||||
|
||||
if b:v.suppress_list_indent == 1
|
||||
let prevline = getline(lnum) " previous line
|
||||
else
|
||||
let prevline = getline(prevnonblank(v:lnum-1))
|
||||
endif
|
||||
|
||||
if (curline =~ '^\s*$') && (b:v.suppress_list_indent == 1)
|
||||
let b:v.suppress_list_indent = 0
|
||||
let b:v.org_list_offset=0
|
||||
endif
|
||||
|
||||
if (curline =~ '^\*\+ ')
|
||||
let ind = 0
|
||||
" below lines are failsafes, hopefully redundant
|
||||
let b:v.suppress_list_indent=0
|
||||
let b:v.suppress_indent=0
|
||||
elseif curline =~ '#+begin_'
|
||||
let b:v.suppress_indent=1
|
||||
let ind = 0
|
||||
elseif curline =~ '#+end_'
|
||||
let b:v.suppress_indent=0
|
||||
let ind = 0
|
||||
elseif curline =~ '^#+'
|
||||
let ind = 0
|
||||
"elseif (curline =~ '^\s*$') && (b:v.suppress_list_indent == 1)
|
||||
" \ && (len(synstack(v:lnum-1,1))>0)
|
||||
" \ && (synIDattr(synstack(v:lnum-1,1)[0],'name') == 'orgList')
|
||||
" let b:v.suppress_list_indent = 0
|
||||
elseif b:v.suppress_indent == 1
|
||||
return indent(curline)
|
||||
elseif b:v.suppress_list_indent == 1
|
||||
return len(matchstr(curline,'^\s*')) + b:v.org_list_offset
|
||||
elseif (curline =~ '^\s*\(\d\+[.):]\|[-+] \)')
|
||||
let before_ind = len(matchstr(curline,'^\s*'))
|
||||
"let ind= ind
|
||||
let b:v.org_list_offset = ind - before_ind
|
||||
let b:v.suppress_list_indent = 1
|
||||
elseif (curline =~'^\s*\d\+[).:]\s\+\S') || (curline =~'^\s*[-+\*]\s\+\S')
|
||||
" if len(curline)>0
|
||||
let ind = indent(curline)
|
||||
" endif
|
||||
elseif prevline =~ '^\*\+ '
|
||||
let ind = len(matchstr(prevline,'^\*\+ ')) + g:org_indent_from_head
|
||||
elseif prevline =~ '^\s*\d\+[).\]:]\s\+\S'
|
||||
let ind = ind + len(matchstr(prevline,'^\s*\zs\d\+[).\]:]\s\+\ze\S'))
|
||||
elseif prevline =~ '^\s*[-+\*]\s\+\S'
|
||||
let ind = ind + len(matchstr(prevline,'^\s*\zs[-+\*]\s\+\ze\S'))
|
||||
elseif (len(synstack(v:lnum,1))>0) && (synIDattr(synstack(v:lnum,1)[0],'name') == 'orgList')
|
||||
let ind = len(matchstr(getline(v:lnum-1),'^\s*'))
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfunction
|
||||
|
||||
function! PrevNonBlank(line)
|
||||
let line = prevnonblank(a:line)
|
||||
|
||||
if (len(synstack(line,1))>0) && (synIDattr(synstack(line,1)[0],'name') == 'orgLisp')
|
||||
execute line + 1
|
||||
let line = search('^#+begin_src','nb')-1
|
||||
elseif (len(synstack(line-1,1))>0) && (synIDattr(synstack(line-1,1)[0],'name') == 'orgList')
|
||||
execute line - 1
|
||||
let line = search('^\s*$','nb')-1
|
||||
|
||||
endif
|
||||
return prevnonblank(line)
|
||||
endfunction
|
||||
|
||||
function! GetTestIndent2(lnum)
|
||||
" Find a non-blank line above the current line.
|
||||
"let lnum = prevnonblank(a:lnum - 1)
|
||||
let lnum = PrevNonBlank(a:lnum - 1)
|
||||
|
||||
" At the start of the file use zero indent.
|
||||
if lnum == 0 | return 0
|
||||
endif
|
||||
|
||||
let curline = getline(a:lnum) " current line
|
||||
"let lminusone = getline(a:lnum-1)
|
||||
"if b:v.last_lnum > 0) && (curline !~ '^\s*$')
|
||||
" let lnum = b:v.last_lnum
|
||||
" let b:v.last_lnum = 0
|
||||
" endif
|
||||
let ind = indent(lnum)
|
||||
|
||||
if b:v.suppress_list_indent == 1
|
||||
let prevline = getline(lnum) " previous line
|
||||
else
|
||||
let prevline = getline(prevnonblank(a:lnum-1))
|
||||
endif
|
||||
|
||||
if (curline =~ '^\s*$') && (b:v.suppress_list_indent == 1)
|
||||
let b:v.suppress_list_indent = 0
|
||||
let b:v.org_list_offset=0
|
||||
endif
|
||||
|
||||
if (curline =~ '^\*\+ ')
|
||||
let ind = 0
|
||||
" below lines are failsafes, hopefully redundant
|
||||
let b:v.suppress_list_indent=0
|
||||
let b:v.suppress_indent=0
|
||||
elseif curline =~ '#+begin_'
|
||||
let b:v.suppress_indent=1
|
||||
let ind = 0
|
||||
elseif curline =~ '#+end_'
|
||||
let b:v.suppress_indent=0
|
||||
let ind = 0
|
||||
"elseif (curline =~ '^\s*$') && (b:v.suppress_list_indent == 1)
|
||||
" \ && (len(synstack(a:lnum-1,1))>0)
|
||||
" \ && (synIDattr(synstack(a:lnum-1,1)[0],'name') == 'orgList')
|
||||
" let b:v.suppress_list_indent = 0
|
||||
elseif b:v.suppress_indent == 1
|
||||
return indent(curline)
|
||||
elseif b:v.suppress_list_indent == 1
|
||||
return len(matchstr(curline,'^\s*')) + b:v.org_list_offset
|
||||
elseif (curline =~ '^\s*\(\d\+[.):]\|[-+] \)')
|
||||
let before_ind = len(matchstr(curline,'^\s*'))
|
||||
"let ind= ind
|
||||
let b:v.org_list_offset = ind - before_ind
|
||||
let b:v.suppress_list_indent = 1
|
||||
elseif (curline =~'^\s*\d\+[).:]\s\+\S') || (curline =~'^\s*[-+\*]\s\+\S')
|
||||
" if len(curline)>0
|
||||
let ind = indent(curline)
|
||||
" endif
|
||||
elseif prevline =~ '^\*\+ '
|
||||
let ind = len(matchstr(prevline,'^\*\+ ')) + g:org_indent_from_head
|
||||
elseif prevline =~ '^\s*\d\+[).\]:]\s\+\S'
|
||||
let ind = ind + len(matchstr(prevline,'^\s*\zs\d\+[).\]:]\s\+\ze\S'))
|
||||
elseif prevline =~ '^\s*[-+\*]\s\+\S'
|
||||
let ind = ind + len(matchstr(prevline,'^\s*\zs[-+\*]\s\+\ze\S'))
|
||||
elseif (len(synstack(a:lnum,1))>0) && (synIDattr(synstack(a:lnum,1)[0],'name') == 'orgList')
|
||||
let ind = len(matchstr(getline(a:lnum-1),'^\s*'))
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfunction
|
||||
|
||||
function! GetTestIndent(lnum)
|
||||
" Find a non-blank line above the current line.
|
||||
"let lnum = prevnonblank(a:lnum - 1)
|
||||
let lnum = PrevNonBlank(a:lnum - 1)
|
||||
|
||||
" At the start of the file use zero indent.
|
||||
if lnum == 0 | return 0
|
||||
endif
|
||||
|
||||
let curline = getline(a:lnum) " current line
|
||||
"let lminusone = getline(a:lnum-1)
|
||||
"if b:v.last_lnum > 0) && (curline !~ '^\s*$')
|
||||
" let lnum = b:v.last_lnum
|
||||
" let b:v.last_lnum = 0
|
||||
" endif
|
||||
let ind = indent(lnum)
|
||||
if b:v.suppress_list_indent == 1
|
||||
let prevline = getline(lnum) " previous line
|
||||
else
|
||||
let prevline = getline(prevnonblank(v:lnum-1))
|
||||
endif
|
||||
|
||||
if (curline =~ '^\s*$') && (b:v.suppress_list_indent == 1)
|
||||
let b:v.suppress_list_indent = 0
|
||||
let b:v.org_list_offset=0
|
||||
endif
|
||||
|
||||
if (curline =~ '^\*\+ ')
|
||||
let ind = 0
|
||||
" below lines are failsafes, hopefully redundant
|
||||
let b:v.suppress_list_indent=0
|
||||
let b:v.suppress_indent=0
|
||||
elseif curline =~ '#+begin_'
|
||||
let b:v.suppress_indent=1
|
||||
let ind = 0
|
||||
elseif curline =~ '#+end_'
|
||||
let b:v.suppress_indent=0
|
||||
let ind = 0
|
||||
"elseif (curline =~ '^\s*$') && (b:v.suppress_list_indent == 1)
|
||||
" \ && (len(synstack(a:lnum-1,1))>0)
|
||||
" \ && (synIDattr(synstack(a:lnum-1,1)[0],'name') == 'orgList')
|
||||
" let b:v.suppress_list_indent = 0
|
||||
elseif b:v.suppress_indent == 1
|
||||
return indent(curline)
|
||||
elseif b:v.suppress_list_indent == 1
|
||||
return len(matchstr(curline,'^\s*')) + b:v.org_list_offset
|
||||
elseif (curline =~ '^\s*\(\d\+[.):]\|[-+] \)')
|
||||
let before_ind = len(matchstr(curline,'^\s*'))
|
||||
"let ind= ind
|
||||
let b:v.org_list_offset = ind - before_ind
|
||||
let b:v.suppress_list_indent = 1
|
||||
elseif (curline =~'^\s*\d\+[).:]\s\+\S') || (curline =~'^\s*[-+\*]\s\+\S')
|
||||
" if len(curline)>0
|
||||
let ind = indent(curline)
|
||||
" endif
|
||||
elseif prevline =~ '^\*\+ '
|
||||
let ind = len(matchstr(prevline,'^\*\+ ')) + g:org_indent_from_head
|
||||
elseif prevline =~ '^\s*\d\+[).\]:]\s\+\S'
|
||||
let ind = ind + len(matchstr(prevline,'^\s*\zs\d\+[).\]:]\s\+\ze\S'))
|
||||
elseif prevline =~ '^\s*[-+\*]\s\+\S'
|
||||
let ind = ind + len(matchstr(prevline,'^\s*\zs[-+\*]\s\+\ze\S'))
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfunction
|
||||
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
VimOrganizer version 0.30, November 2, 2011. Requires Vim version that
|
||||
is compiled with support for folding and tabs. Conceal will
|
||||
be taken advantage of if working with Vim73 supporting conceal.
|
||||
(Also, I STRONGLY suggest that you apply a patch to Vim so that
|
||||
folded headings can have level-dependent highlighting,
|
||||
patch for Vim73 is in contrib directory of the download. If you're on
|
||||
Windows contact me and I should be able to provide you with an
|
||||
executable. If I hadn't been able to make Vim do this I would have
|
||||
bitten the bullet and moved to Emacs, as much as I hate editing in Emacs.)
|
||||
|
||||
VimOrganizer is a Vim filetype plugin that attempts to clone Emacs' Org-mode.
|
||||
It is currently (November 2011) in an alpha-stage, both in terms of (1) the
|
||||
breadth and depth of Org-mode features it clones and (2) the stability of its
|
||||
operation. It is nevertheless very usable.
|
||||
|
||||
Some of the ADDITIONS AND IMPROVEMENTS since previous (December 2010) version:
|
||||
-- Adjusts to any colorscheme
|
||||
-- Org menu in gvim.
|
||||
-- "Dashboards" to assist with Date entry, Columns, Tables,
|
||||
Agenda searches, and exporting.
|
||||
-- VimOrganizer help file to install in Vim.
|
||||
-- Better compatibility with Org-mode files. Open, edit, and save same
|
||||
files in Org-mode and/or VimOrganizer with (some) of the functionality and
|
||||
configuration-specific options of Org-mode supported in VimOrganizer.
|
||||
-- Support for Org-mode style links (as well as use of 'Conceal' in Vim73
|
||||
to hide link brackets and
|
||||
descriptions)
|
||||
-- Easy to use Org-like column mode, including column headings,
|
||||
inherited columns, support for Org column blocks, and ability to
|
||||
specify a list of custom column specs to apply in any buffer.
|
||||
-- Org-like narrowing of code blocks and subtrees
|
||||
-- Support for Org-like specifications of TODOS, tags, dates,
|
||||
including support for Org-compatible config lines in a file.
|
||||
-- Support for Org-like CATEGORIES, both in specification and in
|
||||
their inherited behavior.
|
||||
-- Search specification in Agenda searches is now nearly identical
|
||||
to specification of searches in Org-mode.
|
||||
-- User can specify list of commonly used custom agenda searches.
|
||||
-- Clockin, clockout, and (when a running Emacs server is available,
|
||||
clocktable block creation and updates.
|
||||
-- Org-like "refiling"
|
||||
-- Easy creation and editing of tables, as well as (when a running Emacs
|
||||
server is available) manipulation and evaluation of tables, including
|
||||
all spreadsheet functionality in Org-mode.
|
||||
-- "Live" block evaluation (when a running Emacs server is available)
|
||||
-- Support for nearly all the export types and export options
|
||||
available in Org-mode (when running Emacs server is available)
|
||||
-- Call out to an Emacs server to do "tangling" (literate programming).
|
||||
-- Many bug fixes and small improvements
|
||||
|
||||
Org-mode, and thus VimOrganizer, is a text-editor plugin/application that can
|
||||
be used for (1) keeping notes, (2) maintaining TODO lists, (3) planning
|
||||
projects, and/or (4) authoring and publishing documents, including support for
|
||||
literate programming and "reproducible research". Like Org-mode, VimOrganizer
|
||||
does this by implementing a flexible plain-text system with a lightly
|
||||
structured document format. Org-mode has been in constant development for
|
||||
seven or eight years, and continues to be developed. Work on VimOrganizer is
|
||||
likewise ongoing, but VimOrganizer is at present a smaller and less ambitious
|
||||
project than Org-mode.
|
||||
|
||||
File formats and basic workflows for VimOrganizer and Org-mode are very
|
||||
similar (files auto-convert as part of loading process) and VimOrganizer
|
||||
actually calls out to an Emacs' Org-mode server to
|
||||
implement important features, e.g., exporting to pdf format for printing.
|
||||
|
||||
Thus, to make full use of VimOrganizer you will want to have an Emacs'
|
||||
server running alongside. In most cases this requires little knowledge of
|
||||
Emacs other than how to start it up and add a few lines to the '.emacs' file,
|
||||
Emacs' counterpart to Vim's '.vimrc'. (You can even edit the .emacs file in
|
||||
Vim.) VimOrganizer is focused on leveraging Org-mode by accessing it via
|
||||
an Emacs server, and re-implementing in Vim only what is necessary and makes
|
||||
sense.
|
||||
|
||||
VimOrganizer also lets Vim users access Org-babel, a subproject of
|
||||
Org-mode that allows execution of source-code blocks in org-format
|
||||
documents. Uses for Org-babel range from writing technical research papers to
|
||||
simply using a VimOrganizer document as a "language-scratchpad". Over
|
||||
twenty languages are supported, including C, R, Lisp, Python, Perl, Ruby,
|
||||
and others. VimOrganizer calls out to a running Emacs server for Org-babel
|
||||
processing; functionality and speed are essentially the same as
|
||||
when editing with Org-mode in Emacs.
|
||||
|
||||
VimOrganizer has a first draft of a Vim help file, but the best first step in
|
||||
learning about VimOrganizer is to learn about Emacs' Org-mode. VimOrganizer
|
||||
uses the same basic concepts but implements them within the context of Vim
|
||||
(and with a reduced feature set). Org-mode's main documentation and
|
||||
support newsgroup are found here:
|
||||
Org-mode Main Manual: http://orgmode.org/manual/index.html
|
||||
Org-mode Compact Guide: http://orgmode.org/guide/index.html
|
||||
Org-mode support: http://news.gmane.org/gmane.emacs.orgmode
|
||||
Org-babel information: http://orgmode.org/worg/org-contrib/babel/
|
||||
|
||||
VimOrganizer help can be found here:
|
||||
https://github.com/hsitz/VimOrganizer/blob/master/doc/vimorg.txt
|
||||
|
||||
==========================
|
||||
INSTALLATION INSTRUCTIONS
|
||||
===========================
|
||||
https://github.com/hsitz/VimOrganizer/blob/master/INSTALL.txt
|
||||
|
||||
|
||||
QUESTIONS, COMMENTS, SUGGESTIONS
|
||||
================================
|
||||
Questions, comments, and suggestions regarding VimOrganizer are always
|
||||
appreciated. The preferred place for those is in the VimOrganizer newsgroup
|
||||
here:
|
||||
http://groups.google.com/group/vimorganizer/topics
|
||||
|
||||
VimOrganizer project files are maintained at github and the version
|
||||
there may be more recent than the files at vim.org:
|
||||
https://github.com/hsitz/VimOrganizer
|
||||
|
||||
----------------------------------------------------------------
|
||||
NOTE: some code from other Vim plugins has been incorporated into the
|
||||
VimOrganizer script files. Do NOT download these plugins to use them
|
||||
with VimOrganizer; since VimOrganizer does not call out to them in any way:
|
||||
|
||||
1. Charles Campbell's great calendar utilities
|
||||
2. Table editing routines from Maxim Kim's excellent vimwiki plugin.
|
||||
These are really quite nice (seem to be inspired by Org-mode's
|
||||
own table-editing stuff) and deserve to be offered as a separate
|
||||
plugin of their own, not dependent on any larger project. (If
|
||||
VimOrganizer is not quite the sort of plugin you're looking for then
|
||||
vimwiki may be.)
|
||||
----------------------------------------------------------------
|
||||
|
||||
VimOrganizer page at vim.org:
|
||||
http://www.vim.org/scripts/script.php?script_id=3342
|
||||
|
||||
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
" org.vim - VimOrganizer plugin for Vim
|
||||
" -------------------------------------------------------------
|
||||
" Version: 0.30
|
||||
" Maintainer: Herbert Sitz <hesitz@gmail.com>
|
||||
" Last Change: 2011 Nov 02
|
||||
"
|
||||
" Script: http://www.vim.org/scripts/script.php?script_id=3342
|
||||
" Github page: http://github.com/hsitz/VimOrganizer
|
||||
" Copyright: (c) 2010, 2011 by Herbert Sitz
|
||||
" The VIM LICENSE applies to all files in the
|
||||
" VimOrganizer plugin.
|
||||
" (See the Vim copyright except read "VimOrganizer"
|
||||
" in places where that copyright refers to "Vim".)
|
||||
" http://vimdoc.sourceforge.net/htmldoc/uganda.html#license
|
||||
" No warranty, express or implied.
|
||||
" *** *** Use At-Your-Own-Risk *** ***
|
||||
|
||||
" THIS FUNC is only for variable stars per level, currently
|
||||
" not exposed to users
|
||||
function! s:SynStars(perlevel)
|
||||
let b:levelstars = a:perlevel
|
||||
exe 'syntax match OL1 +^\(*\)\{1}\s.*+ contains=stars'
|
||||
exe 'syntax match OL2 +^\(*\)\{'.( 1 + 1*a:perlevel).'}\s.*+ contains=stars'
|
||||
exe 'syntax match OL3 +^\(*\)\{'.(1 + 2*a:perlevel).'}\s.*+ contains=stars'
|
||||
exe 'syntax match OL4 +^\(*\)\{'.(1 + 3*a:perlevel).'}\s.*+ contains=stars'
|
||||
exe 'syntax match OL5 +^\(*\)\{'.(1 + 4*a:perlevel).'}\s.*+ contains=stars'
|
||||
exe 'syntax match OL6 +^\(*\)\{'.(1 + 5*a:perlevel).'}\s.*+ contains=stars'
|
||||
exe 'syntax match OL7 +^\(*\)\{'.(1 + 6*a:perlevel).'}\s.*+ contains=stars'
|
||||
exe 'syntax match OL8 +^\(*\)\{'.(1 + 7*a:perlevel).'}\s.*+ contains=stars'
|
||||
exe 'syntax match OL9 +^\(*\)\{'.(1 + 8*a:perlevel).'}\s.*+ contains=stars'
|
||||
endfunction
|
||||
command! ChangeSyn call <SID>SynStars(b:levelstars)
|
||||
|
||||
|
||||
syntax match Org_Property_Value +^\s*:\S*:\ze.*+
|
||||
|
||||
syntax match Org_Tag +\s*:\S*:$+
|
||||
syntax match Org_Drawer +^\s*:\(PROPERTIES\|LOGBOOK\|END\):\ze.*+
|
||||
syntax match Org_Date +[<[]\d\d\d\d-\d\d-\d\d.\{-1,}[\]>]+
|
||||
syntax match Org_Star +\*\+\*+me=e-1 containedin=OL1,OL2,OL3,OL4,OL5,OL6
|
||||
syntax match Org_Table +^\s*|.\+|\s*$+ contains=Org_Full_Link,Org_Half_Link
|
||||
"syntax match NEXT '\* \zsNEXT' containedin=OL1,OL2,OL3,OL4,OL5,OL6
|
||||
"syntax match CANCELED '\* \zsCANCELED' containedin=OL1,OL2,OL3,OL4,OL5,OL6
|
||||
|
||||
"syntax match STARTED '\* \zsSTARTED' containedin=OL1,OL2,OL3,OL4,OL5,OL6
|
||||
"syntax match TODO '^\*\+ \zsTODO' containedin=OL1,OL2,OL3,OL4,OL5,OL6
|
||||
"syntax match DONE '\* \zsDONE' containedin=OL1,OL2,OL3,OL4,OL5,OL6
|
||||
|
||||
syntax match Org_Config_Line '^#+.*' containedin=Org_Block,Org_Src_Block
|
||||
syntax region Org_Block start='\c^#+begin.*$' end='\c^#+end.*' keepend contains=Org_Config_Line,Org_Table
|
||||
syntax region Org_Src_Block start='\c^#+begin_src.*$' end='\c^#+end.*' keepend contains=Org_Config_Line
|
||||
|
||||
"exec "syntax match DONETODO '" . b:v.todoDoneMatch . "' contained"
|
||||
"exec "syntax match NOTDONETODO '" . b:v.todoNotDoneMatch . "' contained"
|
||||
syntax match OL1 +^\(*\)\{1}\s.*+
|
||||
syntax match OL2 +^\(*\)\{2}\s.*+
|
||||
syntax match OL3 +^\(*\)\{3}\s.*+
|
||||
syntax match OL4 +^\(*\)\{4}\s.*+
|
||||
syntax match OL5 +^\(*\)\{5}\s.*+
|
||||
syntax match OL6 +^\(*\)\{6}\s.*+
|
||||
syntax match OL7 +^\(*\)\{7}\s.*+
|
||||
syntax match OL8 +^\(*\)\{8}\s.*+
|
||||
syntax match OL9 +^\(*\)\{9}\s.*+
|
||||
|
||||
" character highlights
|
||||
syn match Org_Code '=\S.\{-}\S='
|
||||
syn match Org_Itals '\(\_^\|\W\)/\zs\S[^/]\{-}\S\ze/\_W'
|
||||
syn match Org_Bold '\(\_^\|\W\)\*\zs\S[^*]\{-}\S\ze\*\_W'
|
||||
syn match Org_Underline '\(\_^\|\W\)_\zs\S[^_]\{-}\S\ze_\_W'
|
||||
syn match Org_Lnumber '^\t*\(\d\.\)*\s\s' contained
|
||||
|
||||
if has("conceal")
|
||||
syn region Org_Half_Link concealends matchgroup=linkends start='\[\[' end=']]' contains=FullLink
|
||||
syn region Org_Full_Link concealends matchgroup=linkends start='\[\[\(.\{-1,}\)]\[' end=']]'
|
||||
endif
|
||||
"exec "syntax match DONETODO '" . b:v.todoDoneMatch . "' containedin=OL1,OL2,OL3,OL4,OL5,OL6"
|
||||
"exec "syntax match NOTDONETODO '" . b:v.todoNotDoneMatch . "' containedin=OL1,OL2,OL3,OL4,OL5,OL6"
|
||||
|
||||
" ***********************************************
|
||||
" section below is example for having subregions
|
||||
" of code in an .org file that use syntax highlighting
|
||||
" for the language in the code block itself
|
||||
" not regular Org syntax highlighting.
|
||||
" See Emacs' Org documentation for some details:
|
||||
" http://orgmode.org/manual/Working-With-Source-Code.html#Working-With-Source-Code
|
||||
" Notice that much of the functionality of
|
||||
" source code blocks is for when they are exported or 'tangled'.
|
||||
" VimOrganizer calls out to an Emacs server for exports (and,
|
||||
" -- soon to come -- for tangling) so the functionality described
|
||||
" in the Emacs Org-mode docs already exists for VimOrganizer.
|
||||
"
|
||||
" The example below is for Lisp, other languages could be added
|
||||
" using same priciple. In addition to using context-sensitive
|
||||
" syntax highlighting for code blocks, VimOrganizer will
|
||||
" eventually use context-sensitive language indent-rules. . .
|
||||
" ************************************************"
|
||||
"let b:current_syntax=''
|
||||
"unlet b:current_syntax
|
||||
"syntax include @Lispcode $VIMRUNTIME/syntax/lisp.vim
|
||||
"syntax region orgLisp start='^#+begin_src/semacs-lisp' end='^#+end_src$' contains=@Lispcode
|
||||
"let b:current_syntax = 'combined'
|
||||
"hi orgLisp gui=bold
|
||||
|
||||
|
||||
" vim600: set foldmethod=marker foldlevel=0:
|
||||
1
.vim/bundle/ack.vim
Submodule
1
.vim/bundle/ack.vim
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 9895285042a2fd5691b2f6582aa979e4d1bdffea
|
||||
1
.vim/bundle/ack.vim/.gitignore
vendored
1
.vim/bundle/ack.vim/.gitignore
vendored
|
|
@ -1 +0,0 @@
|
|||
tags
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
# ack.vim #
|
||||
|
||||
This plugin is a front for the Perl module
|
||||
[App::Ack](http://search.cpan.org/~petdance/ack/ack). Ack can be used as a
|
||||
replacement for 99% of the uses of _grep_. This plugin will allow you to run
|
||||
ack from vim, and shows the results in a split window.
|
||||
|
||||
The *Official Version* of this plugin is available at [vim.org](http://www.vim.org/scripts/script.php?script_id=2572).
|
||||
|
||||
## Installation ##
|
||||
|
||||
|
||||
### Ack
|
||||
|
||||
You have to install [ack](http://betterthangrep.com/), of course.
|
||||
|
||||
Install on Debian / Ubuntu with:
|
||||
|
||||
sudo apt-get install ack-grep
|
||||
|
||||
For Debian / Ubuntu you can add this line into your .vimrc:
|
||||
|
||||
let g:ackprg="ack-grep -H --nocolor --nogroup --column"
|
||||
|
||||
Install on Gentoo with:
|
||||
|
||||
sudo emerge ack
|
||||
|
||||
Install with Homebrew:
|
||||
brew install ack
|
||||
|
||||
Install with MacPorts:
|
||||
|
||||
sudo port install p5-app-ack
|
||||
|
||||
Install with Gentoo Prefix
|
||||
|
||||
emerge ack
|
||||
|
||||
Otherwise, you are on your own.
|
||||
|
||||
### The Plugin
|
||||
|
||||
If you have [Rake](http://rake.rubyforge.org/) installed, you can just run: `rake install`.
|
||||
|
||||
Otherwise, the file ack.vim goes in ~/.vim/plugin, and the ack.txt file belongs in ~/.vim/doc. Be sure to run
|
||||
|
||||
:helptags ~/.vim/doc
|
||||
|
||||
afterwards.
|
||||
|
||||
|
||||
## Usage ##
|
||||
|
||||
:Ack [options] {pattern} [{directory}]
|
||||
|
||||
Search recursively in {directory} (which defaults to the current directory) for the {pattern}.
|
||||
|
||||
Files containing the search term will be listed in the split window, along with
|
||||
the line number of the occurrence, once for each occurrence. [Enter] on a line
|
||||
in this window will open the file, and place the cursor on the matching line.
|
||||
|
||||
Just like where you use :grep, :grepadd, :lgrep, and :lgrepadd, you can use `:Ack`, `:AckAdd`, `:LAck`, and `:LAckAdd` respectively. (See `doc/ack.txt`, or install and `:h Ack` for more information.)
|
||||
|
||||
**From the [ack docs](http://betterthangrep.com/)** (my favorite feature):
|
||||
|
||||
--type=TYPE, --type=noTYPE
|
||||
|
||||
Specify the types of files to include or exclude from a search. TYPE is a filetype, like perl or xml. --type=perl can also be specified as --perl, and --type=noperl can be done as --noperl.
|
||||
|
||||
If a file is of both type "foo" and "bar", specifying --foo and --nobar will exclude the file, because an exclusion takes precedence over an inclusion.
|
||||
|
||||
Type specifications can be repeated and are ORed together.
|
||||
|
||||
See ack --help=types for a list of valid types.
|
||||
|
||||
### Keyboard Shortcuts ###
|
||||
|
||||
In the quickfix window, you can use:
|
||||
|
||||
o to open (same as enter)
|
||||
go to preview file (open but maintain focus on ack.vim results)
|
||||
t to open in new tab
|
||||
T to open in new tab silently
|
||||
q to close the quickfix window
|
||||
|
||||
This Vim plugin is derived (and by derived, I mean copied, essentially) from
|
||||
Antoine Imbert's blog post [Ack and Vim
|
||||
Integration](http://blog.ant0ine.com/typepad/2007/03/ack-and-vim-integration.html) (in
|
||||
particular, the function at the bottom of the post). I added a help file that
|
||||
provides just enough reference to get you going. I also highly recommend you
|
||||
check out the docs for the Perl script 'ack', for obvious reasons: [ack -
|
||||
grep-like text finder](http://betterthangrep.com/).
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
# Added by Josh Nichols, a.k.a. technicalpickles
|
||||
require 'rake'
|
||||
|
||||
files = ['doc/ack.txt', 'plugin/ack.vim']
|
||||
|
||||
desc 'Install plugin and documentation'
|
||||
task :install do
|
||||
vimfiles = if ENV['VIMFILES']
|
||||
ENV['VIMFILES']
|
||||
elsif RUBY_PLATFORM =~ /(win|w)32$/
|
||||
File.expand_path("~/vimfiles")
|
||||
else
|
||||
File.expand_path("~/.vim")
|
||||
end
|
||||
files.each do |file|
|
||||
target_file = File.join(vimfiles, file)
|
||||
FileUtils.mkdir_p File.dirname(target_file)
|
||||
FileUtils.cp file, target_file
|
||||
|
||||
puts " Copied #{file} to #{target_file}"
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
*ack.txt* Plugin that integrates ack with Vim
|
||||
|
||||
==============================================================================
|
||||
Author: Antoine Imbert <antoine.imbert+ackvim@gmail.com> *ack-author*
|
||||
License: Same terms as Vim itself (see |license|)
|
||||
|
||||
==============================================================================
|
||||
INTRODUCTION *ack*
|
||||
|
||||
This plugin is a front for the Perl module App::Ack. Ack can be used as a
|
||||
replacement for grep. This plugin will allow you to run ack from vim, and
|
||||
shows the results in a split window.
|
||||
|
||||
:Ack[!] [options] {pattern} [{directory}] *:Ack*
|
||||
|
||||
Search recursively in {directory} (which defaults to the current
|
||||
directory) for the {pattern}. Behaves just like the |:grep| command, but
|
||||
will open the |Quickfix| window for you. If [!] is not given the first
|
||||
error is jumped to.
|
||||
|
||||
:AckAdd [options] {pattern} [{directory}] *:AckAdd*
|
||||
|
||||
Just like |:Ack|, but instead of making a new list, the matches are
|
||||
appended to the current |quickfix| list.
|
||||
|
||||
:AckFromSearch [{directory}] *:AckFromSearch*
|
||||
|
||||
Just like |:Ack| but the pattern is from previous search.
|
||||
|
||||
:LAck [options] {pattern} [{directory}] *:LAck*
|
||||
|
||||
Just like |:Ack| but instead of the |quickfix| list, matches are placed in
|
||||
the current |location-list|.
|
||||
|
||||
:LAckAdd [options] {pattern} [{directory}] *:LAckAdd*
|
||||
|
||||
Just like |:AckAdd| but instead of the |quickfix| list, matches are added
|
||||
to the current |location-list|
|
||||
|
||||
:AckFile [options] {pattern} [{directory}] *:AckFile*
|
||||
|
||||
Search recursively in {directory} (which defaults to the current
|
||||
directory) for filenames matching the {pattern}. Behaves just like the
|
||||
|:grep| command, but will open the |Quickfix| window for you.
|
||||
|
||||
Files containing the search term will be listed in the split window, along
|
||||
with the line number of the occurrence, once for each occurrence. <Enter> on
|
||||
a line in this window will open the file, and place the cursor on the matching
|
||||
line.
|
||||
|
||||
See http://betterthangrep.com/ for more information.
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
" NOTE: You must, of course, install the ack script
|
||||
" in your path.
|
||||
" On Debian / Ubuntu:
|
||||
" sudo apt-get install ack-grep
|
||||
" On your vimrc:
|
||||
" let g:ackprg="ack-grep -H --nocolor --nogroup --column"
|
||||
"
|
||||
" With MacPorts:
|
||||
" sudo port install p5-app-ack
|
||||
|
||||
" Location of the ack utility
|
||||
if !exists("g:ackprg")
|
||||
let g:ackprg="ack -H --nocolor --nogroup --column"
|
||||
endif
|
||||
|
||||
function! s:Ack(cmd, args)
|
||||
redraw
|
||||
echo "Searching ..."
|
||||
|
||||
" If no pattern is provided, search for the word under the cursor
|
||||
if empty(a:args)
|
||||
let l:grepargs = expand("<cword>")
|
||||
else
|
||||
let l:grepargs = a:args
|
||||
end
|
||||
|
||||
" Format, used to manage column jump
|
||||
if a:cmd =~# '-g$'
|
||||
let g:ackformat="%f"
|
||||
else
|
||||
let g:ackformat="%f:%l:%c:%m"
|
||||
end
|
||||
|
||||
let grepprg_bak=&grepprg
|
||||
let grepformat_bak=&grepformat
|
||||
try
|
||||
let &grepprg=g:ackprg
|
||||
let &grepformat=g:ackformat
|
||||
silent execute a:cmd . " " . l:grepargs
|
||||
finally
|
||||
let &grepprg=grepprg_bak
|
||||
let &grepformat=grepformat_bak
|
||||
endtry
|
||||
|
||||
if a:cmd =~# '^l'
|
||||
botright lopen
|
||||
else
|
||||
botright copen
|
||||
endif
|
||||
|
||||
" TODO: Document this!
|
||||
exec "nnoremap <silent> <buffer> q :ccl<CR>"
|
||||
exec "nnoremap <silent> <buffer> t <C-W><CR><C-W>T"
|
||||
exec "nnoremap <silent> <buffer> T <C-W><CR><C-W>TgT<C-W><C-W>"
|
||||
exec "nnoremap <silent> <buffer> o <CR>"
|
||||
exec "nnoremap <silent> <buffer> go <CR><C-W><C-W>"
|
||||
|
||||
" If highlighting is on, highlight the search keyword.
|
||||
if exists("g:ackhighlight")
|
||||
let @/=a:args
|
||||
set hlsearch
|
||||
end
|
||||
|
||||
redraw!
|
||||
endfunction
|
||||
|
||||
function! s:AckFromSearch(cmd, args)
|
||||
let search = getreg('/')
|
||||
" translate vim regular expression to perl regular expression.
|
||||
let search = substitute(search,'\(\\<\|\\>\)','\\b','g')
|
||||
call s:Ack(a:cmd, '"' . search .'" '. a:args)
|
||||
endfunction
|
||||
|
||||
command! -bang -nargs=* -complete=file Ack call s:Ack('grep<bang>',<q-args>)
|
||||
command! -bang -nargs=* -complete=file AckAdd call s:Ack('grepadd<bang>', <q-args>)
|
||||
command! -bang -nargs=* -complete=file AckFromSearch call s:AckFromSearch('grep<bang>', <q-args>)
|
||||
command! -bang -nargs=* -complete=file LAck call s:Ack('lgrep<bang>', <q-args>)
|
||||
command! -bang -nargs=* -complete=file LAckAdd call s:Ack('lgrepadd<bang>', <q-args>)
|
||||
command! -bang -nargs=* -complete=file AckFile call s:Ack('grep<bang> -g', <q-args>)
|
||||
command! -bang -nargs=* -complete=file AckWord call s:Ack('grep<bang>', expand("<cword>"))
|
||||
1
.vim/bundle/calendar.vim--Matsumoto
Submodule
1
.vim/bundle/calendar.vim--Matsumoto
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 9ce3ebc0018dc6fdaac8320002daf616685efc89
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
This is a mirror of http://www.vim.org/scripts/script.php?script_id=52
|
||||
|
||||
This script create calender window.
|
||||
This don't use the external program(cal).
|
||||
|
||||
File diff suppressed because it is too large
Load diff
1
.vim/bundle/lusty
Submodule
1
.vim/bundle/lusty
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit c89b9cfa80a5add2b4e47b7392ad1b974e2e7ff1
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
# Copyright (C) 2007-2010 Stephen Bach
|
||||
#
|
||||
# Permission is hereby granted to use and distribute this code, with or without
|
||||
# modifications, provided that this copyright notice is copied with it. Like
|
||||
# anything else that's free, this file is provided *as is* and comes with no
|
||||
# warranty of any kind, either expressed or implied. In no event will the
|
||||
# copyright holder be liable for any damages resulting from the use of this
|
||||
# software.
|
||||
|
||||
EXPLORER_VIM_FILE = src/explorer.vim
|
||||
|
||||
# Order matters.
|
||||
EXPLORER_RUBY_FILES = src/vim.rb \
|
||||
src/lusty.rb \
|
||||
src/mercury.rb \
|
||||
src/lusty/entry.rb \
|
||||
src/lusty/explorer.rb \
|
||||
src/lusty/buffer-explorer.rb \
|
||||
src/lusty/filesystem-explorer.rb \
|
||||
src/lusty/buffer-grep.rb \
|
||||
src/lusty/prompt.rb \
|
||||
src/lusty/window.rb \
|
||||
src/lusty/saved-settings.rb \
|
||||
src/lusty/display.rb \
|
||||
src/lusty/file-masks.rb \
|
||||
src/lusty/vim-swaps.rb \
|
||||
src/lusty/buffer-stack.rb
|
||||
|
||||
JUGGLER_VIM_FILE = src/juggler.vim
|
||||
|
||||
# Order matters.
|
||||
JUGGLER_RUBY_FILES = src/vim.rb \
|
||||
src/lusty.rb \
|
||||
src/lusty/juggler.rb \
|
||||
src/lusty/bar-item.rb \
|
||||
src/lusty/name-bar.rb \
|
||||
src/lusty/buffer-stack.rb
|
||||
|
||||
all: plugin/lusty-explorer.vim plugin/lusty-juggler.vim
|
||||
|
||||
UNAME := $(shell uname)
|
||||
|
||||
# OS X's sed doesn't have \< or \b for word boundaries.
|
||||
ifeq ($(UNAME), Darwin)
|
||||
LEFT_BOUND = [[:<:]]
|
||||
RIGHT_BOUND = [[:>:]]
|
||||
else
|
||||
LEFT_BOUND = \<
|
||||
RIGHT_BOUND = \>
|
||||
endif
|
||||
|
||||
# Concatenate the Ruby files, removing redundant copyrights, and insert
|
||||
# the results into the vimscript files. Change LustyM module references to
|
||||
# LustyE or LustyJ, so that using out-of-sync versions of lusty-explorer and
|
||||
# lusty-juggler is less likely to cause monkey patching issues.
|
||||
|
||||
plugin/lusty-explorer.vim: $(EXPLORER_VIM_FILE) $(EXPLORER_RUBY_FILES)
|
||||
for file in $(EXPLORER_RUBY_FILES); do \
|
||||
cat $$file | sed '1,/^$$/d' ;\
|
||||
echo ; \
|
||||
done | sed 's/$(LEFT_BOUND)LustyM$(RIGHT_BOUND)/LustyE/g' > \
|
||||
ruby-content.tmp
|
||||
( sed '/{{RUBY_CODE_INSERTION_POINT}}/,$$d' $(EXPLORER_VIM_FILE) ; \
|
||||
cat ruby-content.tmp ; \
|
||||
sed '1,/{{RUBY_CODE_INSERTION_POINT}}/d' $(EXPLORER_VIM_FILE) ) > \
|
||||
plugin/lusty-explorer.vim
|
||||
rm -f ruby-content.tmp
|
||||
|
||||
plugin/lusty-juggler.vim: $(JUGGLER_VIM_FILE) $(JUGGLER_RUBY_FILES)
|
||||
for file in $(JUGGLER_RUBY_FILES); do \
|
||||
cat $$file | sed '1,/^$$/d' ;\
|
||||
echo ; \
|
||||
done | sed 's/$(LEFT_BOUND)LustyM$(RIGHT_BOUND)/LustyJ/g' > \
|
||||
ruby-content.tmp
|
||||
( sed '/{{RUBY_CODE_INSERTION_POINT}}/,$$d' $(JUGGLER_VIM_FILE) ; \
|
||||
cat ruby-content.tmp ; \
|
||||
sed '1,/{{RUBY_CODE_INSERTION_POINT}}/d' $(JUGGLER_VIM_FILE) ) > \
|
||||
plugin/lusty-juggler.vim
|
||||
rm -f ruby-content.tmp
|
||||
clean:
|
||||
rm -f ruby-content.tmp plugin/lusty-explorer.vim \
|
||||
plugin/lusty-juggler.vim
|
||||
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
These are a set of plugins for Vim. You can download released versions here:
|
||||
|
||||
lusty-explorer.vim: http://www.vim.org/scripts/script.php?script_id=1890
|
||||
lusty-juggler.vim: http://www.vim.org/scripts/script.php?script_id=2050
|
||||
|
||||
The Emacs version of this plugin used to be here, too, but now it has its own
|
||||
repository:
|
||||
|
||||
http://github.com/sjbach/lusty-emacs
|
||||
|
||||
NOTE: lusty-explorer.vim and lusty-juggler.vim are generated files; modify
|
||||
src/ if you'd like to submit a patch.
|
||||
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
- New and improved fuzzy matching algorithm: Mercury. (Matt Tolton)
|
||||
- Buffer Explorer: don't show unlisted buffers. (Thanks to Johannes Holzfuß)
|
||||
- Align multi-byte CJK characters correctly in filenames. (Thanks to lilydjwg)
|
||||
- Truncate prompt if longer than window width to avoid "press any key" message. (Thanks to Martin Wache)
|
||||
- Save/restore window config better. (Thanks to robquant)
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
LustyExplorer is a fast and responsive way to manage files and buffers in Vim. It includes a filesystem explorer, a buffer switcher, and a buffer grep for searching through and switching between files and buffers quickly, all through a mostly common interface.
|
||||
|
||||
A short video someone made:
|
||||
|
||||
http://www.youtube.com/watch?v=dLMKVYqdarY
|
||||
|
||||
Some old stuff (pre v2.0 - we now use fuzzy matching instead of tab completion):
|
||||
http://viewglob.sourceforge.net/lusty-explorer-animated.gif
|
||||
http://viewglob.sourceforge.net/lusty-explorer-annotated.png
|
||||
|
||||
Instructions:
|
||||
|
||||
:LustyFilesystemExplorer
|
||||
:LustyFilesystemExplorerFromHere
|
||||
:LustyBufferExplorer
|
||||
:LustyBufferGrep (for searching through all open buffers)
|
||||
|
||||
<Leader>lf - Opens filesystem explorer.
|
||||
<Leader>lr - Opens filesystem explorer at the directory of the current file.
|
||||
<Leader>lb - Opens buffer explorer.
|
||||
<Leader>lg - Opens buffer grep.
|
||||
|
||||
When one of the explorers is launched, a new window appears at bottom presenting a table of files/dirs or buffers, and in the status bar is a prompt:
|
||||
|
||||
>>
|
||||
|
||||
As you type a name, the table updates using a fuzzy matching algorithm (or regex matching in the case of grep). Press enter to open the selected match, <C-n>/<C-p> to select the next/previous match, or press <ESC> or <Ctrl-c> to cancel.
|
||||
|
||||
See the "Usage:" section of the script for other tricks and features.
|
||||
|
||||
If you like LustyExplorer, you may also like LustyJuggler: vimscript #2050
|
||||
|
||||
Development repository: http://github.com/sjbach/lusty
|
||||
|
||||
install details
|
||||
Copy the script into your $HOME/.vim/plugin directory so that it will be sourced on startup.
|
||||
|
||||
NOTE: This plugin requires Vim be compiled with Ruby interpretation. If you do not currently have this functionality, see the "Install Details:" section of the script for directions to add it.
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
- Don't show unlisted buffers. (Thanks to Johannes Holzfuß)
|
||||
- New Alt-Tab mode to emulate window manager switching. See g:LustyJugglerAltTabMode in documentation. (Thanks to Martin Wache)
|
||||
- Save and restore keymappings. (Thanks to Vincent Driessen)
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
LustyJuggler is a high speed buffer juggler. Having to consciously think about which buffer you need to switch to sucks, so use this instead.
|
||||
|
||||
Someone made a screen cast showing it in action (jump to 6:20):
|
||||
|
||||
http://lococast.net/archives/185
|
||||
|
||||
Some older stuff:
|
||||
http://viewglob.sourceforge.net/lusty-juggler-animated.gif
|
||||
http://viewglob.sourceforge.net/lusty-juggler-annotated.png
|
||||
|
||||
Launch the juggler with this key combo:
|
||||
|
||||
<Leader>lj
|
||||
|
||||
The command bar at bottom is replaced with a new bar showing the names of your currently opened buffers in most-recently-used order.
|
||||
|
||||
The buffer names are mapped to these keys:
|
||||
|
||||
1st --> a or 1
|
||||
2nd --> s or 2
|
||||
3rd --> d or 3
|
||||
4th --> f or 4
|
||||
5th --> g or 5
|
||||
6th --> h or 6
|
||||
7th --> j or 7
|
||||
8th --> k or 8
|
||||
9th --> l or 9
|
||||
10th --> ; or 0
|
||||
|
||||
So if you type "f" or "4", the fourth buffer name will be highlighted and the bar will shift to center it as necessary (and show more of the buffer names on the right).
|
||||
|
||||
If you want to switch to that buffer, press "f" or "4" again or press "<ENTER>". Alternatively, press one of the other mapped keys to highlight another buffer.
|
||||
|
||||
If you changed your mind, cancel the juggler with any of "q", "<ESC>", "<C-c", "<BS>", "<Del>", or "<C-h>".
|
||||
|
||||
If you like LustyJuggler, you may also like LustyExplorer: vimscript #1890
|
||||
|
||||
Development repository: http://github.com/sjbach/lusty
|
||||
|
||||
install details
|
||||
Copy the script into your $HOME/.vim/plugin directory so that it will be sourced on startup.
|
||||
|
||||
NOTE: This plugin requires Vim be compiled with Ruby interpretation. If you do not currently have this functionality, see the "Install Details:" section of the script for directions on adding it. It's not too tough.
|
||||
|
||||
Also: because of a bug in Vim's maparg() call, this plugin can interact poorly with plugins that remap common normal mode keys such as "d" (for dd, dw, etc.) and "<ENTER>". These include YankRing and SuperTab.
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,345 +0,0 @@
|
|||
" Copyright: Copyright (C) 2007-2010 Stephen Bach
|
||||
" Permission is hereby granted to use and distribute this code,
|
||||
" with or without modifications, provided that this copyright
|
||||
" notice is copied with it. Like anything else that's free,
|
||||
" lusty-explorer.vim is provided *as is* and comes with no
|
||||
" warranty of any kind, either expressed or implied. In no
|
||||
" event will the copyright holder be liable for any damages
|
||||
" resulting from the use of this software.
|
||||
"
|
||||
" Name Of File: lusty-explorer.vim
|
||||
" Description: Dynamic Filesystem and Buffer Explorer Vim Plugin
|
||||
" Maintainers: Stephen Bach <this-file@sjbach.com>
|
||||
" Matt Tolton <matt-lusty-explorer@tolton.com>
|
||||
" Contributors: Raimon Grau, Sergey Popov, Yuichi Tateno, Bernhard Walle,
|
||||
" Rajendra Badapanda, cho45, Simo Salminen, Sami Samhuri,
|
||||
" Matt Tolton, Björn Winckler, sowill, David Brown
|
||||
" Brett DiFrischia, Ali Asad Lotia, Kenneth Love, Ben Boeckel,
|
||||
" robquant, lilydjwg, Martin Wache, Johannes Holzfuß
|
||||
"
|
||||
" Release Date: December 16, 2010
|
||||
" Version: 4.0
|
||||
"
|
||||
" Usage:
|
||||
" <Leader>lf - Opens the filesystem explorer.
|
||||
" <Leader>lr - Opens the filesystem explorer from the
|
||||
" directory of the current file.
|
||||
" <Leader>lb - Opens the buffer explorer.
|
||||
" <Leader>lg - Opens the buffer grep, for searching through
|
||||
" all loaded buffers
|
||||
"
|
||||
" You can also use the commands:
|
||||
"
|
||||
" ":LustyFilesystemExplorer"
|
||||
" ":LustyFilesystemExplorerFromHere"
|
||||
" ":LustyBufferExplorer"
|
||||
" ":LustyBufferGrep"
|
||||
"
|
||||
" (Personally, I map these to ,f ,r ,b and ,g)
|
||||
"
|
||||
" When launched, a new window appears at bottom presenting a
|
||||
" table of files/dirs or buffers, and in the status bar a
|
||||
" prompt:
|
||||
"
|
||||
" >>
|
||||
"
|
||||
" As you type, the table updates for possible matches using a
|
||||
" fuzzy matching algorithm (or regex matching, in the case of
|
||||
" grep). Special keys include:
|
||||
"
|
||||
" <Enter> open selected match
|
||||
" <Tab> open selected match
|
||||
" <Esc> cancel
|
||||
" <C-c> cancel
|
||||
" <C-g> cancel
|
||||
"
|
||||
" <C-t> open selected match in a new [t]ab
|
||||
" <C-o> open selected match in a new h[o]rizontal split
|
||||
" <C-v> open selected match in a new [v]ertical split
|
||||
"
|
||||
" <C-n> select [n]ext match
|
||||
" <C-p> select [p]revious match
|
||||
" <C-f> select [f]orward one column
|
||||
" <C-b> select [b]ack one column
|
||||
"
|
||||
" <C-u> clear prompt
|
||||
"
|
||||
" Additional shortcuts for the filesystem explorer:
|
||||
"
|
||||
" <C-w> ascend one directory at prompt
|
||||
" <C-r> [r]efresh directory contents
|
||||
" <C-a> open [a]ll files in current table
|
||||
" <C-e> create new buffer with the given name and path
|
||||
"
|
||||
" Filesystem Explorer:
|
||||
"
|
||||
" - Directory contents are memoized. (<C-r> to refresh.)
|
||||
" - You can recurse into and out of directories by typing the directory name
|
||||
" and a slash, e.g. "stuff/" or "../".
|
||||
" - Variable expansion, e.g. "$D" -> "/long/dir/path/".
|
||||
" - Tilde (~) expansion, e.g. "~/" -> "/home/steve/".
|
||||
" - Dotfiles are hidden by default, but are shown if the current search term
|
||||
" begins with a '.'. To show these file at all times, set this option:
|
||||
"
|
||||
" let g:LustyExplorerAlwaysShowDotFiles = 1
|
||||
"
|
||||
" You can prevent certain files from appearing in the table with the
|
||||
" following variable:
|
||||
"
|
||||
" set wildignore=*.o,*.fasl,CVS
|
||||
"
|
||||
" The above will mask all object files, compiled lisp files, and
|
||||
" files/directories named CVS from appearing in the table. Note that they
|
||||
" can still be opened by being named explicitly.
|
||||
"
|
||||
" See :help 'wildignore' for more information.
|
||||
"
|
||||
" Buffer Explorer:
|
||||
"
|
||||
" - Buffers are sorted first by fuzzy match and then by most-recently used.
|
||||
" - The currently active buffer is highlighted.
|
||||
"
|
||||
" Buffer Grep:
|
||||
"
|
||||
" - Searches all loaded buffers.
|
||||
" - Uses Ruby-style regexes instead of Vim style. This means:
|
||||
"
|
||||
" - \b instead of \< or \> for beginning/end of word.
|
||||
" - (foo|bar) instead of \(foo\|bar\)
|
||||
" - {2,5} instead of \{2,5}
|
||||
" - + instead of \+
|
||||
" - Generally, fewer backslashes. :-)
|
||||
"
|
||||
" - For now, searches are always case-insensitive.
|
||||
" - Matches from the previous grep are remembered upon relaunch; clear with
|
||||
" <C-u>.
|
||||
"
|
||||
"
|
||||
" Install Details:
|
||||
"
|
||||
" Copy this file into $HOME/.vim/plugin directory so that it will be sourced
|
||||
" on startup automatically.
|
||||
"
|
||||
" Note! This plugin requires Vim be compiled with Ruby interpretation. If you
|
||||
" don't know if your build of Vim has this functionality, you can check by
|
||||
" running "vim --version" from the command line and looking for "+ruby".
|
||||
" Alternatively, just try sourcing this script.
|
||||
"
|
||||
" If your version of Vim does not have "+ruby" but you would still like to
|
||||
" use this plugin, you can fix it. See the "Check for Ruby functionality"
|
||||
" comment below for instructions.
|
||||
"
|
||||
" If you are using the same Vim configuration and plugins for multiple
|
||||
" machines, some of which have Ruby and some of which don't, you may want to
|
||||
" turn off the "Sorry, LustyExplorer requires ruby" warning. You can do so
|
||||
" like this (in .vimrc):
|
||||
"
|
||||
" let g:LustyExplorerSuppressRubyWarning = 1
|
||||
"
|
||||
"
|
||||
" Contributing:
|
||||
"
|
||||
" Patches and suggestions welcome. Note: lusty-explorer.vim is a generated
|
||||
" file; if you'd like to submit a patch, check out the Github development
|
||||
" repository:
|
||||
"
|
||||
" http://github.com/sjbach/lusty
|
||||
"
|
||||
"
|
||||
" GetLatestVimScripts: 1890 1 :AutoInstall: lusty-explorer.vim
|
||||
"
|
||||
" TODO:
|
||||
" - when an edited file is in nowrap mode and the explorer is called while the
|
||||
" current window is scrolled to the right, name truncation occurs.
|
||||
" - enable VimSwaps stuff
|
||||
" - set callback when pipe is ready for read and force refresh()
|
||||
" - uppercase character should make matching case-sensitive
|
||||
" - FilesystemGrep
|
||||
" - C-jhkl navigation to highlight a file?
|
||||
|
||||
" Exit quickly when already loaded.
|
||||
if exists("g:loaded_lustyexplorer")
|
||||
finish
|
||||
endif
|
||||
|
||||
if &compatible
|
||||
echohl ErrorMsg
|
||||
echo "LustyExplorer is not designed to run in &compatible mode;"
|
||||
echo "To use this plugin, first disable vi-compatible mode like so:\n"
|
||||
|
||||
echo " :set nocompatible\n"
|
||||
|
||||
echo "Or even better, just create an empty .vimrc file."
|
||||
echohl none
|
||||
finish
|
||||
endif
|
||||
|
||||
if exists("g:FuzzyFinderMode.TextMate")
|
||||
echohl WarningMsg
|
||||
echo "Warning: LustyExplorer detects the presence of fuzzyfinder_textmate;"
|
||||
echo "that plugin often interacts poorly with other Ruby plugins."
|
||||
echo "If LustyExplorer gives you an error, you can probably fix it by"
|
||||
echo "renaming fuzzyfinder_textmate.vim to zzfuzzyfinder_textmate.vim so"
|
||||
echo "that it is last in the load order."
|
||||
echohl none
|
||||
endif
|
||||
|
||||
" Check for Ruby functionality.
|
||||
if !has("ruby") || version < 700
|
||||
if !exists("g:LustyExplorerSuppressRubyWarning") ||
|
||||
\ g:LustyExplorerSuppressRubyWarning == "0"
|
||||
if !exists("g:LustyJugglerSuppressRubyWarning") ||
|
||||
\ g:LustyJugglerSuppressRubyWarning == "0"
|
||||
echohl ErrorMsg
|
||||
echon "Sorry, LustyExplorer requires ruby. "
|
||||
echon "Here are some tips for adding it:\n"
|
||||
|
||||
echo "Debian / Ubuntu:"
|
||||
echo " # apt-get install vim-ruby\n"
|
||||
|
||||
echo "Fedora:"
|
||||
echo " # yum install vim-enhanced\n"
|
||||
|
||||
echo "Gentoo:"
|
||||
echo " # USE=\"ruby\" emerge vim\n"
|
||||
|
||||
echo "FreeBSD:"
|
||||
echo " # pkg_add -r vim+ruby\n"
|
||||
|
||||
echo "Windows:"
|
||||
echo " 1. Download and install Ruby from here:"
|
||||
echo " http://www.ruby-lang.org/"
|
||||
echo " 2. Install a Vim binary with Ruby support:"
|
||||
echo " http://segfault.hasno.info/vim/gvim72.zip\n"
|
||||
|
||||
echo "Manually (including Cygwin):"
|
||||
echo " 1. Install Ruby."
|
||||
echo " 2. Download the Vim source package (say, vim-7.0.tar.bz2)"
|
||||
echo " 3. Build and install:"
|
||||
echo " # tar -xvjf vim-7.0.tar.bz2"
|
||||
echo " # ./configure --enable-rubyinterp"
|
||||
echo " # make && make install"
|
||||
|
||||
echo "(If you just wish to stifle this message, set the following option:"
|
||||
echo " let g:LustyExplorerSuppressRubyWarning = 1)"
|
||||
echohl none
|
||||
endif
|
||||
endif
|
||||
finish
|
||||
endif
|
||||
|
||||
if ! &hidden
|
||||
echohl WarningMsg
|
||||
echo "You are running with 'hidden' mode off. LustyExplorer may"
|
||||
echo "sometimes emit error messages in this mode -- you should turn"
|
||||
echo "it on, like so:\n"
|
||||
|
||||
echo " :set hidden\n"
|
||||
|
||||
echo "Even better, put this in your .vimrc file."
|
||||
echohl none
|
||||
endif
|
||||
|
||||
let g:loaded_lustyexplorer = "yep"
|
||||
|
||||
" Commands.
|
||||
command LustyBufferExplorer :call <SID>LustyBufferExplorerStart()
|
||||
command -nargs=? LustyFilesystemExplorer :call <SID>LustyFilesystemExplorerStart("<args>")
|
||||
command LustyFilesystemExplorerFromHere :call <SID>LustyFilesystemExplorerStart(expand("%:p:h"))
|
||||
command LustyBufferGrep :call <SID>LustyBufferGrepStart()
|
||||
|
||||
" Deprecated command names.
|
||||
command BufferExplorer :call
|
||||
\ <SID>deprecated('BufferExplorer', 'LustyBufferExplorer')
|
||||
command FilesystemExplorer :call
|
||||
\ <SID>deprecated('FilesystemExplorer', 'LustyFilesystemExplorer')
|
||||
command FilesystemExplorerFromHere :call
|
||||
\ <SID>deprecated('FilesystemExplorerFromHere',
|
||||
\ 'LustyFilesystemExplorerFromHere')
|
||||
|
||||
function! s:deprecated(old, new)
|
||||
echohl WarningMsg
|
||||
echo ":" . a:old . " is deprecated; use :" . a:new . " instead."
|
||||
echohl none
|
||||
endfunction
|
||||
|
||||
|
||||
" Default mappings.
|
||||
nmap <silent> <Leader>lf :LustyFilesystemExplorer<CR>
|
||||
nmap <silent> <Leader>lr :LustyFilesystemExplorerFromHere<CR>
|
||||
nmap <silent> <Leader>lb :LustyBufferExplorer<CR>
|
||||
nmap <silent> <Leader>lg :LustyBufferGrep<CR>
|
||||
|
||||
" Vim-to-ruby function calls.
|
||||
function! s:LustyFilesystemExplorerStart(path)
|
||||
exec "ruby LustyE::profile() { $lusty_filesystem_explorer.run_from_path('".a:path."') }"
|
||||
endfunction
|
||||
|
||||
function! s:LustyBufferExplorerStart()
|
||||
ruby LustyE::profile() { $lusty_buffer_explorer.run }
|
||||
endfunction
|
||||
|
||||
function! s:LustyBufferGrepStart()
|
||||
ruby LustyE::profile() { $lusty_buffer_grep.run }
|
||||
endfunction
|
||||
|
||||
function! s:LustyFilesystemExplorerCancel()
|
||||
ruby LustyE::profile() { $lusty_filesystem_explorer.cancel }
|
||||
endfunction
|
||||
|
||||
function! s:LustyBufferExplorerCancel()
|
||||
ruby LustyE::profile() { $lusty_buffer_explorer.cancel }
|
||||
endfunction
|
||||
|
||||
function! s:LustyBufferGrepCancel()
|
||||
ruby LustyE::profile() { $lusty_buffer_grep.cancel }
|
||||
endfunction
|
||||
|
||||
function! s:LustyFilesystemExplorerKeyPressed(code_arg)
|
||||
ruby LustyE::profile() { $lusty_filesystem_explorer.key_pressed }
|
||||
endfunction
|
||||
|
||||
function! s:LustyBufferExplorerKeyPressed(code_arg)
|
||||
ruby LustyE::profile() { $lusty_buffer_explorer.key_pressed }
|
||||
endfunction
|
||||
|
||||
function! s:LustyBufferGrepKeyPressed(code_arg)
|
||||
ruby LustyE::profile() { $lusty_buffer_grep.key_pressed }
|
||||
endfunction
|
||||
|
||||
" Setup the autocommands that handle buffer MRU ordering.
|
||||
augroup LustyExplorer
|
||||
autocmd!
|
||||
autocmd BufEnter * ruby LustyE::profile() { $le_buffer_stack.push }
|
||||
autocmd BufDelete * ruby LustyE::profile() { $le_buffer_stack.pop }
|
||||
autocmd BufWipeout * ruby LustyE::profile() { $le_buffer_stack.pop }
|
||||
augroup End
|
||||
|
||||
ruby << EOF
|
||||
|
||||
require 'pathname'
|
||||
# For IO#ready -- but Cygwin doesn't have io/wait.
|
||||
require 'io/wait' unless RUBY_PLATFORM =~ /cygwin/
|
||||
# Needed for String#each_char in Ruby 1.8 on some platforms.
|
||||
require 'jcode' unless "".respond_to? :each_char
|
||||
# Needed for Array#each_slice in Ruby 1.8 on some platforms.
|
||||
require 'enumerator' unless [].respond_to? :each_slice
|
||||
|
||||
$LUSTY_PROFILING = false
|
||||
|
||||
if $LUSTY_PROFILING
|
||||
require 'rubygems'
|
||||
require 'ruby-prof'
|
||||
end
|
||||
|
||||
|
||||
{{RUBY_CODE_INSERTION_POINT}}
|
||||
|
||||
$lusty_buffer_explorer = LustyE::BufferExplorer.new
|
||||
$lusty_filesystem_explorer = LustyE::FilesystemExplorer.new
|
||||
$lusty_buffer_grep = LustyE::BufferGrep.new
|
||||
$le_buffer_stack = LustyE::BufferStack.new
|
||||
|
||||
EOF
|
||||
|
||||
" vim: set sts=2 sw=2:
|
||||
|
|
@ -1,264 +0,0 @@
|
|||
" Copyright: Copyright (C) 2008-2010 Stephen Bach
|
||||
" Permission is hereby granted to use and distribute this code,
|
||||
" with or without modifications, provided that this copyright
|
||||
" notice is copied with it. Like anything else that's free,
|
||||
" lusty-juggler.vim is provided *as is* and comes with no
|
||||
" warranty of any kind, either expressed or implied. In no
|
||||
" event will the copyright holder be liable for any damages
|
||||
" resulting from the use of this software.
|
||||
"
|
||||
" Name Of File: lusty-juggler.vim
|
||||
" Description: Dynamic Buffer Switcher Vim Plugin
|
||||
" Maintainer: Stephen Bach <this-file@sjbach.com>
|
||||
" Contributors: Juan Frias, Bartosz Leper, Marco Barberis, Vincent Driessen,
|
||||
" Martin Wache, Johannes Holzfuß, Adam Rutkowski
|
||||
"
|
||||
" Release Date: December 16, 2010
|
||||
" Version: 1.2
|
||||
"
|
||||
" Usage:
|
||||
" <Leader>lj - Opens the buffer juggler.
|
||||
"
|
||||
" You can also use this command:
|
||||
"
|
||||
" ":LustyJuggler"
|
||||
"
|
||||
" (Personally, I map this to ,j)
|
||||
"
|
||||
" When launched, the command bar at bottom is replaced with a
|
||||
" new bar showing the names of currently-opened buffers in
|
||||
" most-recently-used order.
|
||||
"
|
||||
" The buffers are mapped to these keys:
|
||||
"
|
||||
" 1st|2nd|3rd|4th|5th|6th|7th|8th|9th|10th
|
||||
" ----------------------------------------
|
||||
" a s d f g h j k l ;
|
||||
" 1 2 3 4 5 6 7 8 9 0
|
||||
"
|
||||
" So if you type "f" or "4", the fourth buffer name will be
|
||||
" highlighted and the bar will shift to center it as necessary
|
||||
" (and show more of the buffer names on the right).
|
||||
"
|
||||
" If you want to switch to that buffer, press "f" or "4" again
|
||||
" or press "<ENTER>". Alternatively, press one of the other
|
||||
" mapped keys to highlight another buffer.
|
||||
"
|
||||
" To display the key with the name of the buffer, add one of
|
||||
" the following lines to your .vimrc:
|
||||
"
|
||||
" let g:LustyJugglerShowKeys = 'a' (for alpha characters)
|
||||
" let g:LustyJugglerShowKeys = 1 (for digits)
|
||||
"
|
||||
" To cancel the juggler, press any of "q", "<ESC>", "<C-c",
|
||||
" "<BS>", "<Del>", or "<C-h>".
|
||||
"
|
||||
" LustyJuggler can act very much like <A-Tab> window switching.
|
||||
" To enable this mode, add the following line to your .vimrc:
|
||||
"
|
||||
" let g:LustyJugglerAltTabMode = 1
|
||||
"
|
||||
" Then, given the following mapping:
|
||||
"
|
||||
" noremap <silent> <A-s> :LustyJuggler<CR>
|
||||
"
|
||||
" Pressing "<A-s>" will launch the LustyJuggler with the
|
||||
" previous buffer highlighted. Typing "<A-s>" again will cycle
|
||||
" to the next buffer (in most-recently used order), and
|
||||
" "<ENTER>" will open the highlighted buffer. For example, the
|
||||
" sequence "<A-s><Enter>" will open the previous buffer, and
|
||||
" "<A-s><A-s><Enter>" will open the buffer used just before the
|
||||
" previous buffer, and so on.
|
||||
"
|
||||
" Bonus: This plugin also includes the following command, which will
|
||||
" immediately switch to your previously used buffer:
|
||||
"
|
||||
" ":LustyJugglePrevious"
|
||||
"
|
||||
" This is similar to the ":b#" command, but accounts for the
|
||||
" common situation where the previously used buffer (#) has
|
||||
" been killed and is thus inaccessible. In that case, it will
|
||||
" instead switch to the buffer used before that one (and on down
|
||||
" the line if that buffer has been killed too).
|
||||
"
|
||||
"
|
||||
" Install Details:
|
||||
"
|
||||
" Copy this file into $HOME/.vim/plugin directory so that it will be sourced
|
||||
" on startup automatically.
|
||||
"
|
||||
" Note! This plugin requires Vim be compiled with Ruby interpretation. If you
|
||||
" don't know if your build of Vim has this functionality, you can check by
|
||||
" running "vim --version" from the command line and looking for "+ruby".
|
||||
" Alternatively, just try sourcing this script.
|
||||
"
|
||||
" If your version of Vim does not have "+ruby" but you would still like to
|
||||
" use this plugin, you can fix it. See the "Check for Ruby functionality"
|
||||
" comment below for instructions.
|
||||
"
|
||||
" If you are using the same Vim configuration and plugins for multiple
|
||||
" machines, some of which have Ruby and some of which don't, you may want to
|
||||
" turn off the "Sorry, LustyJuggler requires ruby" warning. You can do so
|
||||
" like this (in .vimrc):
|
||||
"
|
||||
" let g:LustyJugglerSuppressRubyWarning = 1
|
||||
"
|
||||
"
|
||||
" Contributing:
|
||||
"
|
||||
" Patches and suggestions welcome. Note: lusty-juggler.vim is a generated
|
||||
" file; if you'd like to submit a patch, check out the Github development
|
||||
" repository:
|
||||
"
|
||||
" http://github.com/sjbach/lusty
|
||||
"
|
||||
"
|
||||
" GetLatestVimScripts: 2050 1 :AutoInstall: lusty-juggler.vim
|
||||
"
|
||||
" TODO:
|
||||
" - save and restore mappings
|
||||
" - Add TAB recognition back.
|
||||
" - Add option to open buffer immediately when mapping is pressed (but not
|
||||
" release the juggler until the confirmation press).
|
||||
" - Have the delimiter character settable.
|
||||
" - have colours settable?
|
||||
|
||||
" Exit quickly when already loaded.
|
||||
if exists("g:loaded_lustyjuggler")
|
||||
finish
|
||||
endif
|
||||
|
||||
if &compatible
|
||||
echohl ErrorMsg
|
||||
echo "LustyJuggler is not designed to run in &compatible mode;"
|
||||
echo "To use this plugin, first disable vi-compatible mode like so:\n"
|
||||
|
||||
echo " :set nocompatible\n"
|
||||
|
||||
echo "Or even better, just create an empty .vimrc file."
|
||||
echohl none
|
||||
finish
|
||||
endif
|
||||
|
||||
if exists("g:FuzzyFinderMode.TextMate")
|
||||
echohl WarningMsg
|
||||
echo "Warning: LustyJuggler detects the presence of fuzzyfinder_textmate;"
|
||||
echo "that plugin often interacts poorly with other Ruby plugins."
|
||||
echo "If LustyJuggler gives you an error, you can probably fix it by"
|
||||
echo "renaming fuzzyfinder_textmate.vim to zzfuzzyfinder_textmate.vim so"
|
||||
echo "that it is last in the load order."
|
||||
echohl none
|
||||
endif
|
||||
|
||||
" Check for Ruby functionality.
|
||||
if !has("ruby")
|
||||
if !exists("g:LustyExplorerSuppressRubyWarning") ||
|
||||
\ g:LustyExplorerSuppressRubyWarning == "0"
|
||||
if !exists("g:LustyJugglerSuppressRubyWarning") ||
|
||||
\ g:LustyJugglerSuppressRubyWarning == "0"
|
||||
echohl ErrorMsg
|
||||
echon "Sorry, LustyJuggler requires ruby. "
|
||||
echon "Here are some tips for adding it:\n"
|
||||
|
||||
echo "Debian / Ubuntu:"
|
||||
echo " # apt-get install vim-ruby\n"
|
||||
|
||||
echo "Fedora:"
|
||||
echo " # yum install vim-enhanced\n"
|
||||
|
||||
echo "Gentoo:"
|
||||
echo " # USE=\"ruby\" emerge vim\n"
|
||||
|
||||
echo "FreeBSD:"
|
||||
echo " # pkg_add -r vim+ruby\n"
|
||||
|
||||
echo "Windows:"
|
||||
echo " 1. Download and install Ruby from here:"
|
||||
echo " http://www.ruby-lang.org/"
|
||||
echo " 2. Install a Vim binary with Ruby support:"
|
||||
echo " http://segfault.hasno.info/vim/gvim72.zip\n"
|
||||
|
||||
echo "Manually (including Cygwin):"
|
||||
echo " 1. Install Ruby."
|
||||
echo " 2. Download the Vim source package (say, vim-7.0.tar.bz2)"
|
||||
echo " 3. Build and install:"
|
||||
echo " # tar -xvjf vim-7.0.tar.bz2"
|
||||
echo " # ./configure --enable-rubyinterp"
|
||||
echo " # make && make install\n"
|
||||
|
||||
echo "(If you just wish to stifle this message, set the following option:"
|
||||
echo " let g:LustyJugglerSuppressRubyWarning = 1)"
|
||||
echohl none
|
||||
endif
|
||||
endif
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_lustyjuggler = "yep"
|
||||
|
||||
" Commands.
|
||||
command LustyJuggler :call <SID>LustyJugglerStart()
|
||||
command LustyJugglePrevious :call <SID>LustyJugglePreviousRun()
|
||||
|
||||
" Deprecated command names.
|
||||
command JugglePrevious :call
|
||||
\ <SID>deprecated('JugglePrevious', 'LustyJugglePrevious')
|
||||
|
||||
function! s:deprecated(old, new)
|
||||
echohl WarningMsg
|
||||
echo ":" . a:old . " is deprecated; use :" . a:new . " instead."
|
||||
echohl none
|
||||
endfunction
|
||||
|
||||
|
||||
" Default mappings.
|
||||
nmap <silent> <Leader>lj :LustyJuggler<CR>
|
||||
|
||||
" Vim-to-ruby function calls.
|
||||
function! s:LustyJugglerStart()
|
||||
ruby LustyJ::profile() { $lusty_juggler.run }
|
||||
endfunction
|
||||
|
||||
function! s:LustyJugglerKeyPressed(code_arg)
|
||||
ruby LustyJ::profile() { $lusty_juggler.key_pressed }
|
||||
endfunction
|
||||
|
||||
function! s:LustyJugglerCancel()
|
||||
ruby LustyJ::profile() { $lusty_juggler.cleanup }
|
||||
endfunction
|
||||
|
||||
function! s:LustyJugglePreviousRun()
|
||||
ruby LustyJ::profile() { $lj_buffer_stack.juggle_previous }
|
||||
endfunction
|
||||
|
||||
" Setup the autocommands that handle buffer MRU ordering.
|
||||
augroup LustyJuggler
|
||||
autocmd!
|
||||
autocmd BufEnter * ruby LustyJ::profile() { $lj_buffer_stack.push }
|
||||
autocmd BufDelete * ruby LustyJ::profile() { $lj_buffer_stack.pop }
|
||||
autocmd BufWipeout * ruby LustyJ::profile() { $lj_buffer_stack.pop }
|
||||
augroup End
|
||||
|
||||
" Used to work around a flaw in Vim's ruby bindings.
|
||||
let s:maparg_holder = 0
|
||||
|
||||
ruby << EOF
|
||||
|
||||
require 'pathname'
|
||||
|
||||
$LUSTY_PROFILING = false
|
||||
|
||||
if $LUSTY_PROFILING
|
||||
require 'rubygems'
|
||||
require 'ruby-prof'
|
||||
end
|
||||
|
||||
|
||||
{{RUBY_CODE_INSERTION_POINT}}
|
||||
|
||||
$lusty_juggler = LustyJ::LustyJuggler.new
|
||||
$lj_buffer_stack = LustyJ::BufferStack.new
|
||||
|
||||
EOF
|
||||
|
||||
" vim: set sts=2 sw=2:
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
# Copyright (C) 2007-2010 Stephen Bach
|
||||
#
|
||||
# Permission is hereby granted to use and distribute this code, with or without
|
||||
# modifications, provided that this copyright notice is copied with it. Like
|
||||
# anything else that's free, this file is provided *as is* and comes with no
|
||||
# warranty of any kind, either expressed or implied. In no event will the
|
||||
# copyright holder be liable for any damages resulting from the use of this
|
||||
# software.
|
||||
|
||||
# Utility functions.
|
||||
module LustyM
|
||||
|
||||
unless const_defined? "MOST_POSITIVE_FIXNUM"
|
||||
MOST_POSITIVE_FIXNUM = 2**(0.size * 8 -2) -1
|
||||
end
|
||||
|
||||
def self.simplify_path(s)
|
||||
s = s.gsub(/\/+/, '/') # Remove redundant '/' characters
|
||||
begin
|
||||
if s[0] == ?~
|
||||
# Tilde expansion - First expand the ~ part (e.g. '~' or '~steve')
|
||||
# and then append the rest of the path. We can't just call
|
||||
# expand_path() or it'll throw on bad paths.
|
||||
s = File.expand_path(s.sub(/\/.*/,'')) + \
|
||||
s.sub(/^[^\/]+/,'')
|
||||
end
|
||||
|
||||
if s == '/'
|
||||
# Special-case root so we don't add superfluous '/' characters,
|
||||
# as this can make Cygwin choke.
|
||||
s
|
||||
elsif ends_with?(s, File::SEPARATOR)
|
||||
File.expand_path(s) + File::SEPARATOR
|
||||
else
|
||||
dirname_expanded = File.expand_path(File.dirname(s))
|
||||
if dirname_expanded == '/'
|
||||
dirname_expanded + File.basename(s)
|
||||
else
|
||||
dirname_expanded + File::SEPARATOR + File.basename(s)
|
||||
end
|
||||
end
|
||||
rescue ArgumentError
|
||||
s
|
||||
end
|
||||
end
|
||||
|
||||
def self.longest_common_prefix(paths)
|
||||
prefix = paths[0]
|
||||
paths.each do |path|
|
||||
for i in 0...prefix.length
|
||||
if path.length <= i or prefix[i] != path[i]
|
||||
prefix = prefix[0...i]
|
||||
prefix = prefix[0..(prefix.rindex('/') or -1)]
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
prefix
|
||||
end
|
||||
|
||||
def self.ready_for_read?(io)
|
||||
if io.respond_to? :ready?
|
||||
ready?
|
||||
else
|
||||
result = IO.select([io], nil, nil, 0)
|
||||
result && (result.first.first == io)
|
||||
end
|
||||
end
|
||||
|
||||
def self.ends_with?(s1, s2)
|
||||
tail = s1[-s2.length, s2.length]
|
||||
tail == s2
|
||||
end
|
||||
|
||||
def self.starts_with?(s1, s2)
|
||||
head = s1[0, s2.length]
|
||||
head == s2
|
||||
end
|
||||
|
||||
def self.option_set?(opt_name)
|
||||
opt_name = "g:LustyExplorer" + opt_name
|
||||
VIM::evaluate_bool("exists('#{opt_name}') && #{opt_name} != '0'")
|
||||
end
|
||||
|
||||
def self.profile
|
||||
# Profile (if enabled) and provide better
|
||||
# backtraces when there's an error.
|
||||
|
||||
if $LUSTY_PROFILING
|
||||
if not RubyProf.running?
|
||||
RubyProf.measure_mode = RubyProf::WALL_TIME
|
||||
RubyProf.start
|
||||
else
|
||||
RubyProf.resume
|
||||
end
|
||||
end
|
||||
|
||||
begin
|
||||
yield
|
||||
rescue Exception => e
|
||||
puts e
|
||||
puts e.backtrace
|
||||
end
|
||||
|
||||
if $LUSTY_PROFILING and RubyProf.running?
|
||||
RubyProf.pause
|
||||
end
|
||||
end
|
||||
|
||||
class AssertionError < StandardError ; end
|
||||
|
||||
def self.assert(condition, message = 'assertion failure')
|
||||
raise AssertionError.new(message) unless condition
|
||||
end
|
||||
|
||||
def self.d(s)
|
||||
# (Debug print)
|
||||
$stderr.puts s
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1,133 +0,0 @@
|
|||
# Copyright (C) 2008-2010 Stephen Bach
|
||||
#
|
||||
# Permission is hereby granted to use and distribute this code, with or without
|
||||
# modifications, provided that this copyright notice is copied with it. Like
|
||||
# anything else that's free, this file is provided *as is* and comes with no
|
||||
# warranty of any kind, either expressed or implied. In no event will the
|
||||
# copyright holder be liable for any damages resulting from the use of this
|
||||
# software.
|
||||
|
||||
# An item (delimiter/separator or buffer name) on the NameBar.
|
||||
module LustyM
|
||||
class BarItem
|
||||
def initialize(str, color)
|
||||
@str = str
|
||||
@color = color
|
||||
end
|
||||
|
||||
def length
|
||||
@str.length
|
||||
end
|
||||
|
||||
def pretty_print_input
|
||||
[@color, @str]
|
||||
end
|
||||
|
||||
def [](*rest)
|
||||
return BarItem.new(@str[*rest], @color)
|
||||
end
|
||||
|
||||
def self.full_length(array)
|
||||
if array
|
||||
array.inject(0) { |sum, el| sum + el.length }
|
||||
else
|
||||
0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class BufferItem < BarItem
|
||||
def initialize(str, highlighted)
|
||||
@str = str
|
||||
@highlighted = highlighted
|
||||
destructure()
|
||||
end
|
||||
|
||||
def [](*rest)
|
||||
return BufferItem.new(@str[*rest], @highlighted)
|
||||
end
|
||||
|
||||
def pretty_print_input
|
||||
@array
|
||||
end
|
||||
|
||||
private
|
||||
@@BUFFER_COLOR = "PreProc"
|
||||
#@@BUFFER_COLOR = "None"
|
||||
@@DIR_COLOR = "Directory"
|
||||
@@SLASH_COLOR = "Function"
|
||||
@@HIGHLIGHTED_COLOR = "Question"
|
||||
|
||||
# Breakdown the string to colourize each part.
|
||||
def destructure
|
||||
if @highlighted
|
||||
buf_color = @@HIGHLIGHTED_COLOR
|
||||
dir_color = @@HIGHLIGHTED_COLOR
|
||||
slash_color = @@HIGHLIGHTED_COLOR
|
||||
else
|
||||
buf_color = @@BUFFER_COLOR
|
||||
dir_color = @@DIR_COLOR
|
||||
slash_color = @@SLASH_COLOR
|
||||
end
|
||||
|
||||
pieces = @str.split(File::SEPARATOR, -1)
|
||||
|
||||
@array = []
|
||||
@array << dir_color
|
||||
@array << pieces.shift
|
||||
pieces.each { |piece|
|
||||
@array << slash_color
|
||||
@array << File::SEPARATOR
|
||||
@array << dir_color
|
||||
@array << piece
|
||||
}
|
||||
|
||||
# Last piece is the actual name.
|
||||
@array[-2] = buf_color
|
||||
end
|
||||
end
|
||||
|
||||
class SeparatorItem < BarItem
|
||||
public
|
||||
def initialize
|
||||
super(@@TEXT, @@COLOR)
|
||||
end
|
||||
|
||||
private
|
||||
@@TEXT = "|"
|
||||
#@@COLOR = "NonText"
|
||||
@@COLOR = "None"
|
||||
end
|
||||
|
||||
class LeftContinuerItem < BarItem
|
||||
public
|
||||
def initialize
|
||||
super(@@TEXT, @@COLOR)
|
||||
end
|
||||
|
||||
def self.length
|
||||
@@TEXT.length
|
||||
end
|
||||
|
||||
private
|
||||
@@TEXT = "<"
|
||||
@@COLOR = "NonText"
|
||||
end
|
||||
|
||||
class RightContinuerItem < BarItem
|
||||
public
|
||||
def initialize
|
||||
super(@@TEXT, @@COLOR)
|
||||
end
|
||||
|
||||
def self.length
|
||||
@@TEXT.length
|
||||
end
|
||||
|
||||
private
|
||||
@@TEXT = ">"
|
||||
@@COLOR = "NonText"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -1,126 +0,0 @@
|
|||
# Copyright (C) 2007-2010 Stephen Bach
|
||||
#
|
||||
# Permission is hereby granted to use and distribute this code, with or without
|
||||
# modifications, provided that this copyright notice is copied with it. Like
|
||||
# anything else that's free, this file is provided *as is* and comes with no
|
||||
# warranty of any kind, either expressed or implied. In no event will the
|
||||
# copyright holder be liable for any damages resulting from the use of this
|
||||
# software.
|
||||
|
||||
module LustyM
|
||||
class BufferExplorer < Explorer
|
||||
public
|
||||
def initialize
|
||||
super
|
||||
@prompt = Prompt.new
|
||||
@buffer_entries = []
|
||||
end
|
||||
|
||||
def run
|
||||
unless @running
|
||||
@prompt.clear!
|
||||
@curbuf_at_start = VIM::Buffer.current
|
||||
@buffer_entries = BufferEntry::compute_buffer_entries()
|
||||
@buffer_entries.each do |e|
|
||||
# Show modification indicator
|
||||
e.label = e.short_name
|
||||
e.label << " [+]" if e.vim_buffer.modified?
|
||||
# Disabled: show buffer number next to name
|
||||
#e.label << " #{buffer.number.to_s}"
|
||||
end
|
||||
|
||||
@selected_index = 0
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def title
|
||||
'[LustyExplorer-Buffers]'
|
||||
end
|
||||
|
||||
def set_syntax_matching
|
||||
# Base highlighting -- more is set on refresh.
|
||||
if VIM::has_syntax?
|
||||
VIM::command 'syn match LustySlash "/" contained'
|
||||
VIM::command 'syn match LustyDir "\%(\S\+ \)*\S\+/" ' \
|
||||
'contains=LustySlash'
|
||||
VIM::command 'syn match LustyModified " \[+\]"'
|
||||
end
|
||||
end
|
||||
|
||||
def curbuf_match_string
|
||||
curbuf = @buffer_entries.find { |x| x.vim_buffer == @curbuf_at_start }
|
||||
if curbuf
|
||||
escaped = VIM::regex_escape(curbuf.label)
|
||||
Display.entry_syntaxify(escaped, @prompt.insensitive?)
|
||||
else
|
||||
""
|
||||
end
|
||||
end
|
||||
|
||||
def on_refresh
|
||||
# Highlighting for the current buffer name.
|
||||
if VIM::has_syntax?
|
||||
VIM::command 'syn clear LustyCurrentBuffer'
|
||||
VIM::command 'syn match LustyCurrentBuffer ' \
|
||||
"\"#{curbuf_match_string()}\" " \
|
||||
'contains=LustyModified'
|
||||
end
|
||||
end
|
||||
|
||||
def current_abbreviation
|
||||
@prompt.input
|
||||
end
|
||||
|
||||
def compute_sorted_matches
|
||||
abbrev = current_abbreviation()
|
||||
|
||||
if abbrev.length == 0
|
||||
# Take (current) MRU order if we have no abbreviation.
|
||||
@buffer_entries
|
||||
else
|
||||
matching_entries = \
|
||||
@buffer_entries.select { |x|
|
||||
x.current_score = Mercury.score(x.short_name, abbrev)
|
||||
x.current_score != 0.0
|
||||
}
|
||||
|
||||
# Sort by score.
|
||||
matching_entries.sort! { |x, y|
|
||||
if x.current_score == y.current_score
|
||||
x.mru_placement <=> y.mru_placement
|
||||
else
|
||||
y.current_score <=> x.current_score
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def open_entry(entry, open_mode)
|
||||
cleanup()
|
||||
LustyM::assert($curwin == @calling_window)
|
||||
|
||||
number = entry.vim_buffer.number
|
||||
LustyM::assert(number)
|
||||
|
||||
cmd = case open_mode
|
||||
when :current_tab
|
||||
"b"
|
||||
when :new_tab
|
||||
# For some reason just using tabe or e gives an error when
|
||||
# the alternate-file isn't set.
|
||||
"tab split | b"
|
||||
when :new_split
|
||||
"sp | b"
|
||||
when :new_vsplit
|
||||
"vs | b"
|
||||
else
|
||||
LustyM::assert(false, "bad open mode")
|
||||
end
|
||||
|
||||
VIM::command "silent #{cmd} #{number}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1,203 +0,0 @@
|
|||
# Copyright (C) 2007-2010 Stephen Bach
|
||||
#
|
||||
# Permission is hereby granted to use and distribute this code, with or without
|
||||
# modifications, provided that this copyright notice is copied with it. Like
|
||||
# anything else that's free, this file is provided *as is* and comes with no
|
||||
# warranty of any kind, either expressed or implied. In no event will the
|
||||
# copyright holder be liable for any damages resulting from the use of this
|
||||
# software.
|
||||
|
||||
# TODO:
|
||||
# - some way for user to indicate case-sensitive regex
|
||||
# - add slash highlighting back to file name?
|
||||
|
||||
module LustyM
|
||||
class BufferGrep < Explorer
|
||||
public
|
||||
def initialize
|
||||
super
|
||||
@display.single_column_mode = true
|
||||
@prompt = Prompt.new
|
||||
@buffer_entries = []
|
||||
@matched_strings = []
|
||||
|
||||
# State from previous run, so you don't have to retype
|
||||
# your search each time to get the previous entries.
|
||||
@previous_input = ''
|
||||
@previous_grep_entries = []
|
||||
@previous_matched_strings = []
|
||||
@previous_selected_index = 0
|
||||
end
|
||||
|
||||
def run
|
||||
return if @running
|
||||
|
||||
@prompt.set! @previous_input
|
||||
@buffer_entries = GrepEntry::compute_buffer_entries()
|
||||
|
||||
@selected_index = @previous_selected_index
|
||||
super
|
||||
end
|
||||
|
||||
private
|
||||
def title
|
||||
'[LustyExplorer-BufferGrep]'
|
||||
end
|
||||
|
||||
def set_syntax_matching
|
||||
VIM::command 'syn clear LustyGrepFileName'
|
||||
VIM::command 'syn clear LustyGrepLineNumber'
|
||||
VIM::command 'syn clear LustyGrepContext'
|
||||
|
||||
# Base syntax matching -- others are set on refresh.
|
||||
|
||||
VIM::command \
|
||||
'syn match LustyGrepFileName "^\zs.\{-}\ze:\d\+:" ' \
|
||||
'contains=NONE ' \
|
||||
'nextgroup=LustyGrepLineNumber'
|
||||
|
||||
VIM::command \
|
||||
'syn match LustyGrepLineNumber ":\d\+:" ' \
|
||||
'contained ' \
|
||||
'contains=NONE ' \
|
||||
'nextgroup=LustyGrepContext'
|
||||
|
||||
VIM::command \
|
||||
'syn match LustyGrepContext ".*" ' \
|
||||
'transparent ' \
|
||||
'contained ' \
|
||||
'contains=LustyGrepMatch'
|
||||
end
|
||||
|
||||
def on_refresh
|
||||
if VIM::has_syntax?
|
||||
|
||||
VIM::command 'syn clear LustyGrepMatch'
|
||||
|
||||
if not @matched_strings.empty?
|
||||
sub_regexes = @matched_strings.map { |s| VIM::regex_escape(s) }
|
||||
syntax_regex = '\%(' + sub_regexes.join('\|') + '\)'
|
||||
VIM::command "syn match LustyGrepMatch \"#{syntax_regex}\" " \
|
||||
"contained " \
|
||||
"contains=NONE"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def highlight_selected_index
|
||||
VIM::command 'syn clear LustySelected'
|
||||
|
||||
entry = @current_sorted_matches[@selected_index]
|
||||
return if entry.nil?
|
||||
|
||||
match_string = "#{entry.short_name}:#{entry.line_number}:"
|
||||
escaped = VIM::regex_escape(match_string)
|
||||
VIM::command "syn match LustySelected \"^#{match_string}\" " \
|
||||
'contains=NONE ' \
|
||||
'nextgroup=LustyGrepContext'
|
||||
end
|
||||
|
||||
def current_abbreviation
|
||||
@prompt.input
|
||||
end
|
||||
|
||||
def compute_sorted_matches
|
||||
abbrev = current_abbreviation()
|
||||
|
||||
grep_entries = @previous_grep_entries
|
||||
@matched_strings = @previous_matched_strings
|
||||
|
||||
@previous_input = ''
|
||||
@previous_grep_entries = []
|
||||
@previous_matched_strings = []
|
||||
@previous_selected_index = 0
|
||||
|
||||
if not grep_entries.empty?
|
||||
return grep_entries
|
||||
elsif abbrev == ''
|
||||
@buffer_entries.each do |e|
|
||||
e.label = e.short_name
|
||||
end
|
||||
return @buffer_entries
|
||||
end
|
||||
|
||||
begin
|
||||
regex = Regexp.compile(abbrev, Regexp::IGNORECASE)
|
||||
rescue RegexpError => e
|
||||
return []
|
||||
end
|
||||
|
||||
max_visible_entries = Display.max_height
|
||||
|
||||
# Used to avoid duplicating match strings, which slows down refresh.
|
||||
highlight_hash = {}
|
||||
|
||||
# Search through every line of every open buffer for the
|
||||
# given expression.
|
||||
@buffer_entries.each do |entry|
|
||||
vim_buffer = entry.vim_buffer
|
||||
line_count = vim_buffer.count
|
||||
(1..line_count). each do |i|
|
||||
line = vim_buffer[i]
|
||||
match = regex.match(line)
|
||||
if match
|
||||
matched_str = match.to_s
|
||||
|
||||
grep_entry = entry.clone()
|
||||
grep_entry.line_number = i
|
||||
grep_entry.label = "#{grep_entry.short_name}:#{i}:#{line}"
|
||||
grep_entries << grep_entry
|
||||
|
||||
# Keep track of all matched strings
|
||||
unless highlight_hash[matched_str]
|
||||
@matched_strings << matched_str
|
||||
highlight_hash[matched_str] = true
|
||||
end
|
||||
|
||||
if grep_entries.length > max_visible_entries
|
||||
return grep_entries
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return grep_entries
|
||||
end
|
||||
|
||||
def open_entry(entry, open_mode)
|
||||
cleanup()
|
||||
LustyM::assert($curwin == @calling_window)
|
||||
|
||||
number = entry.vim_buffer.number
|
||||
LustyM::assert(number)
|
||||
|
||||
cmd = case open_mode
|
||||
when :current_tab
|
||||
"b"
|
||||
when :new_tab
|
||||
# For some reason just using tabe or e gives an error when
|
||||
# the alternate-file isn't set.
|
||||
"tab split | b"
|
||||
when :new_split
|
||||
"sp | b"
|
||||
when :new_vsplit
|
||||
"vs | b"
|
||||
else
|
||||
LustyM::assert(false, "bad open mode")
|
||||
end
|
||||
|
||||
# Open buffer and go to the line number.
|
||||
VIM::command "silent #{cmd} #{number}"
|
||||
VIM::command "#{entry.line_number}"
|
||||
end
|
||||
|
||||
def cleanup
|
||||
@previous_input = @prompt.input
|
||||
@previous_grep_entries = @current_sorted_matches
|
||||
@previous_matched_strings = @matched_strings
|
||||
@previous_selected_index = @selected_index
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1,116 +0,0 @@
|
|||
# Copyright (C) 2008-2010 Stephen Bach
|
||||
#
|
||||
# Permission is hereby granted to use and distribute this code, with or without
|
||||
# modifications, provided that this copyright notice is copied with it. Like
|
||||
# anything else that's free, this file is provided *as is* and comes with no
|
||||
# warranty of any kind, either expressed or implied. In no event will the
|
||||
# copyright holder be liable for any damages resulting from the use of this
|
||||
# software.
|
||||
|
||||
# Maintain MRU ordering.
|
||||
module LustyM
|
||||
class BufferStack
|
||||
public
|
||||
def initialize
|
||||
@stack = []
|
||||
|
||||
(0..VIM::Buffer.count-1).each do |i|
|
||||
@stack << VIM::Buffer[i].number
|
||||
end
|
||||
end
|
||||
|
||||
# Switch to the previous buffer (the one you were using before the
|
||||
# current one). This is basically a smarter replacement for :b#,
|
||||
# accounting for the situation where your previous buffer no longer
|
||||
# exists.
|
||||
def juggle_previous
|
||||
buf = num_at_pos(2)
|
||||
VIM::command "b #{buf}"
|
||||
end
|
||||
|
||||
def names(n = :all)
|
||||
# Get the last n buffer names by MRU. Show only as much of
|
||||
# the name as necessary to differentiate between buffers of
|
||||
# the same name.
|
||||
cull!
|
||||
names = @stack.collect { |i| VIM::bufname(i) }.reverse
|
||||
if n != :all
|
||||
names = names[0,n]
|
||||
end
|
||||
shorten_paths(names)
|
||||
end
|
||||
|
||||
def numbers(n = :all)
|
||||
# Get the last n buffer numbers by MRU.
|
||||
cull!
|
||||
numbers = @stack.reverse
|
||||
if n == :all
|
||||
numbers
|
||||
else
|
||||
numbers[0,n]
|
||||
end
|
||||
end
|
||||
|
||||
def num_at_pos(i)
|
||||
cull!
|
||||
return @stack[-i] ? @stack[-i] : @stack.first
|
||||
end
|
||||
|
||||
def length
|
||||
cull!
|
||||
return @stack.length
|
||||
end
|
||||
|
||||
def push
|
||||
@stack.delete $curbuf.number
|
||||
@stack << $curbuf.number
|
||||
end
|
||||
|
||||
def pop
|
||||
number = VIM::evaluate('bufnr(expand("<afile>"))')
|
||||
@stack.delete number
|
||||
end
|
||||
|
||||
private
|
||||
def cull!
|
||||
# Remove empty and unlisted buffers.
|
||||
@stack.delete_if { |x|
|
||||
not (VIM::evaluate_bool("bufexists(#{x})") and
|
||||
VIM::evaluate_bool("getbufvar(#{x}, '&buflisted')"))
|
||||
}
|
||||
end
|
||||
|
||||
# NOTE: very similar to Entry::compute_buffer_entries()
|
||||
def shorten_paths(buffer_names)
|
||||
# Shorten each buffer name by removing all path elements which are not
|
||||
# needed to differentiate a given name from other names. This usually
|
||||
# results in only the basename shown, but if several buffers of the
|
||||
# same basename are opened, there will be more.
|
||||
|
||||
# Group the buffers by common basename
|
||||
common_base = Hash.new { |hash, k| hash[k] = [] }
|
||||
buffer_names.each do |name|
|
||||
basename = Pathname.new(name).basename.to_s
|
||||
common_base[basename] << name
|
||||
end
|
||||
|
||||
# Determine the longest common prefix for each basename group.
|
||||
basename_to_prefix = {}
|
||||
common_base.each do |k, names|
|
||||
if names.length > 1
|
||||
basename_to_prefix[k] = LustyM::longest_common_prefix(names)
|
||||
end
|
||||
end
|
||||
|
||||
# Shorten each buffer_name by removing the prefix.
|
||||
buffer_names.map { |name|
|
||||
base = Pathname.new(name).basename.to_s
|
||||
prefix = basename_to_prefix[base]
|
||||
prefix ? name[prefix.length..-1] \
|
||||
: base
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -1,445 +0,0 @@
|
|||
# Copyright (C) 2007-2010 Stephen Bach
|
||||
#
|
||||
# Permission is hereby granted to use and distribute this code, with or without
|
||||
# modifications, provided that this copyright notice is copied with it. Like
|
||||
# anything else that's free, this file is provided *as is* and comes with no
|
||||
# warranty of any kind, either expressed or implied. In no event will the
|
||||
# copyright holder be liable for any damages resulting from the use of this
|
||||
# software.
|
||||
|
||||
# Manage the explorer buffer.
|
||||
module LustyM
|
||||
|
||||
class Display
|
||||
private
|
||||
@@COLUMN_SEPARATOR = " "
|
||||
@@NO_MATCHES_STRING = "-- NO MATCHES --"
|
||||
@@TRUNCATED_STRING = "-- TRUNCATED --"
|
||||
|
||||
public
|
||||
ENTRY_START_VIM_REGEX = '\%(^\|' + @@COLUMN_SEPARATOR + '\)'
|
||||
ENTRY_END_VIM_REGEX = '\%(\s*$\|' + @@COLUMN_SEPARATOR + '\)'
|
||||
|
||||
def self.entry_syntaxify(s, case_insensitive)
|
||||
# Create a match regex string for the given s. This is for a Vim regex,
|
||||
# not for a Ruby regex.
|
||||
|
||||
str = "#{ENTRY_START_VIM_REGEX}\\zs#{s}\\ze#{ENTRY_END_VIM_REGEX}"
|
||||
|
||||
str << '\c' if case_insensitive
|
||||
|
||||
return str
|
||||
end
|
||||
|
||||
attr_writer :single_column_mode
|
||||
def initialize(title)
|
||||
@title = title
|
||||
@window = nil
|
||||
@buffer = nil
|
||||
@single_column_mode = false
|
||||
end
|
||||
|
||||
def create(prefix)
|
||||
|
||||
# Make a window for the display and move there.
|
||||
# Start at size 1 to mitigate flashing effect when
|
||||
# we resize the window later.
|
||||
VIM::command "silent! botright 1split #{@title}"
|
||||
|
||||
@window = $curwin
|
||||
@buffer = $curbuf
|
||||
|
||||
#
|
||||
# Display buffer is special -- set options.
|
||||
#
|
||||
|
||||
# Buffer-local.
|
||||
VIM::command "setlocal bufhidden=delete"
|
||||
VIM::command "setlocal buftype=nofile"
|
||||
VIM::command "setlocal nomodifiable"
|
||||
VIM::command "setlocal noswapfile"
|
||||
VIM::command "setlocal nowrap"
|
||||
VIM::command "setlocal nonumber"
|
||||
VIM::command "setlocal foldcolumn=0"
|
||||
VIM::command "setlocal nocursorline"
|
||||
VIM::command "setlocal nospell"
|
||||
VIM::command "setlocal nobuflisted"
|
||||
VIM::command "setlocal textwidth=0"
|
||||
VIM::command "setlocal noreadonly"
|
||||
|
||||
# Non-buffer-local (Vim is annoying).
|
||||
# (Update SavedSettings if adding to below.)
|
||||
VIM::set_option "timeoutlen=0"
|
||||
VIM::set_option "noinsertmode"
|
||||
VIM::set_option "noshowcmd"
|
||||
VIM::set_option "nolist"
|
||||
VIM::set_option "report=9999"
|
||||
VIM::set_option "sidescroll=0"
|
||||
VIM::set_option "sidescrolloff=0"
|
||||
|
||||
# TODO -- cpoptions?
|
||||
|
||||
#
|
||||
# Syntax highlighting.
|
||||
#
|
||||
|
||||
if VIM::has_syntax?
|
||||
# General syntax matching.
|
||||
VIM::command 'syn match LustyNoEntries "\%^\s*' \
|
||||
"#{@@NO_MATCHES_STRING}" \
|
||||
'\s*\%$"'
|
||||
VIM::command 'syn match LustyTruncated "^\s*' \
|
||||
"#{@@TRUNCATED_STRING}" \
|
||||
'\s*$"'
|
||||
|
||||
# Colour highlighting.
|
||||
VIM::command 'highlight link LustyDir Directory'
|
||||
VIM::command 'highlight link LustySlash Function'
|
||||
VIM::command 'highlight link LustySelected Type'
|
||||
VIM::command 'highlight link LustyModified Special'
|
||||
VIM::command 'highlight link LustyCurrentBuffer Constant'
|
||||
VIM::command 'highlight link LustyGrepMatch IncSearch'
|
||||
VIM::command 'highlight link LustyGrepLineNumber Directory'
|
||||
VIM::command 'highlight link LustyGrepFileName Comment'
|
||||
VIM::command 'highlight link LustyGrepContext None' # transparent
|
||||
VIM::command 'highlight link LustyOpenedFile PreProc'
|
||||
VIM::command 'highlight link LustyFileWithSwap WarningMsg'
|
||||
VIM::command 'highlight link LustyNoEntries ErrorMsg'
|
||||
VIM::command 'highlight link LustyTruncated Visual'
|
||||
|
||||
if VIM::exists? '*clearmatches'
|
||||
VIM::evaluate 'clearmatches()'
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
# Key mappings - we need to reroute user input.
|
||||
#
|
||||
|
||||
# Non-special printable characters.
|
||||
printables = '/!"#$%&\'()*+,-.0123456789:<=>?#@"' \
|
||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZ' \
|
||||
'[]^_`abcdefghijklmnopqrstuvwxyz{}~'
|
||||
|
||||
map = "noremap <silent> <buffer>"
|
||||
|
||||
printables.each_byte do |b|
|
||||
VIM::command "#{map} <Char-#{b}> :call <SID>#{prefix}KeyPressed(#{b})<CR>"
|
||||
end
|
||||
|
||||
# Special characters
|
||||
VIM::command "#{map} <Tab> :call <SID>#{prefix}KeyPressed(9)<CR>"
|
||||
VIM::command "#{map} <Bslash> :call <SID>#{prefix}KeyPressed(92)<CR>"
|
||||
VIM::command "#{map} <Space> :call <SID>#{prefix}KeyPressed(32)<CR>"
|
||||
VIM::command "#{map} \026| :call <SID>#{prefix}KeyPressed(124)<CR>"
|
||||
|
||||
VIM::command "#{map} <BS> :call <SID>#{prefix}KeyPressed(8)<CR>"
|
||||
VIM::command "#{map} <Del> :call <SID>#{prefix}KeyPressed(8)<CR>"
|
||||
VIM::command "#{map} <C-h> :call <SID>#{prefix}KeyPressed(8)<CR>"
|
||||
|
||||
VIM::command "#{map} <CR> :call <SID>#{prefix}KeyPressed(13)<CR>"
|
||||
VIM::command "#{map} <S-CR> :call <SID>#{prefix}KeyPressed(10)<CR>"
|
||||
VIM::command "#{map} <C-a> :call <SID>#{prefix}KeyPressed(1)<CR>"
|
||||
|
||||
VIM::command "#{map} <Esc> :call <SID>#{prefix}Cancel()<CR>"
|
||||
VIM::command "#{map} <C-c> :call <SID>#{prefix}Cancel()<CR>"
|
||||
VIM::command "#{map} <C-g> :call <SID>#{prefix}Cancel()<CR>"
|
||||
|
||||
VIM::command "#{map} <C-w> :call <SID>#{prefix}KeyPressed(23)<CR>"
|
||||
VIM::command "#{map} <C-n> :call <SID>#{prefix}KeyPressed(14)<CR>"
|
||||
VIM::command "#{map} <C-p> :call <SID>#{prefix}KeyPressed(16)<CR>"
|
||||
VIM::command "#{map} <C-f> :call <SID>#{prefix}KeyPressed(6)<CR>"
|
||||
VIM::command "#{map} <C-b> :call <SID>#{prefix}KeyPressed(2)<CR>"
|
||||
VIM::command "#{map} <C-o> :call <SID>#{prefix}KeyPressed(15)<CR>"
|
||||
VIM::command "#{map} <C-t> :call <SID>#{prefix}KeyPressed(20)<CR>"
|
||||
VIM::command "#{map} <C-v> :call <SID>#{prefix}KeyPressed(22)<CR>"
|
||||
VIM::command "#{map} <C-e> :call <SID>#{prefix}KeyPressed(5)<CR>"
|
||||
VIM::command "#{map} <C-r> :call <SID>#{prefix}KeyPressed(18)<CR>"
|
||||
VIM::command "#{map} <C-u> :call <SID>#{prefix}KeyPressed(21)<CR>"
|
||||
end
|
||||
|
||||
def print(strings)
|
||||
Window.select(@window) || return
|
||||
|
||||
if strings.empty?
|
||||
print_no_entries()
|
||||
return
|
||||
end
|
||||
|
||||
row_count, col_count, col_widths, truncated = \
|
||||
compute_optimal_layout(strings)
|
||||
|
||||
# Slice the strings into rows.
|
||||
rows = Array.new(row_count){[]}
|
||||
col_index = 0
|
||||
strings.each_slice(row_count) do |column|
|
||||
column_width = col_widths[col_index]
|
||||
column.each_index do |i|
|
||||
string = column[i]
|
||||
|
||||
rows[i] << string
|
||||
|
||||
if col_index < col_count - 1
|
||||
# Add spacer to the width of the column
|
||||
rows[i] << (" " * (column_width - VIM::strwidth(string)))
|
||||
rows[i] << @@COLUMN_SEPARATOR
|
||||
end
|
||||
end
|
||||
|
||||
col_index += 1
|
||||
break if col_index >= col_count
|
||||
end
|
||||
|
||||
print_rows(rows, truncated)
|
||||
row_count
|
||||
end
|
||||
|
||||
def close
|
||||
# Only wipe the buffer if we're *sure* it's the explorer.
|
||||
if Window.select @window and \
|
||||
$curbuf == @buffer and \
|
||||
$curbuf.name =~ /#{Regexp.escape(@title)}$/
|
||||
VIM::command "bwipeout!"
|
||||
@window = nil
|
||||
@buffer = nil
|
||||
end
|
||||
end
|
||||
|
||||
def self.max_height
|
||||
stored_height = $curwin.height
|
||||
$curwin.height = VIM::MOST_POSITIVE_INTEGER
|
||||
highest_allowable = $curwin.height
|
||||
$curwin.height = stored_height
|
||||
highest_allowable
|
||||
end
|
||||
|
||||
def self.max_width
|
||||
VIM::columns()
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def compute_optimal_layout(strings)
|
||||
# Compute optimal row count and corresponding column count.
|
||||
# The display attempts to fit `strings' on as few rows as
|
||||
# possible.
|
||||
|
||||
max_width = Display.max_width()
|
||||
max_height = Display.max_height()
|
||||
displayable_string_upper_bound = compute_displayable_upper_bound(strings)
|
||||
|
||||
# Determine optimal row count.
|
||||
optimal_row_count, truncated = \
|
||||
if @single_column_mode
|
||||
if strings.length <= max_height
|
||||
[strings.length, false]
|
||||
else
|
||||
[max_height - 1, true]
|
||||
end
|
||||
elsif strings.length > displayable_string_upper_bound
|
||||
# Use all available rows and truncate results.
|
||||
# The -1 is for the truncation indicator.
|
||||
[Display.max_height - 1, true]
|
||||
else
|
||||
single_row_width = \
|
||||
strings.inject(0) { |len, s|
|
||||
len + @@COLUMN_SEPARATOR.length + s.length
|
||||
}
|
||||
if single_row_width <= max_width or \
|
||||
strings.length == 1
|
||||
# All fits on a single row
|
||||
[1, false]
|
||||
else
|
||||
compute_optimal_row_count(strings)
|
||||
end
|
||||
end
|
||||
|
||||
# Compute column_count and column_widths.
|
||||
column_count = 0
|
||||
column_widths = []
|
||||
total_width = 0
|
||||
strings.each_slice(optimal_row_count) do |column|
|
||||
longest = column.max { |a, b| VIM::strwidth(a) <=> VIM::strwidth(b) }
|
||||
column_width = VIM::strwidth(longest)
|
||||
total_width += column_width
|
||||
|
||||
break if total_width > max_width
|
||||
|
||||
column_count += 1
|
||||
column_widths << column_width
|
||||
total_width += @@COLUMN_SEPARATOR.length
|
||||
end
|
||||
|
||||
[optimal_row_count, column_count, column_widths, truncated]
|
||||
end
|
||||
|
||||
def print_rows(rows, truncated)
|
||||
unlock_and_clear()
|
||||
|
||||
# Grow/shrink the window as needed
|
||||
$curwin.height = rows.length + (truncated ? 1 : 0)
|
||||
|
||||
# Print the rows.
|
||||
rows.each_index do |i|
|
||||
$curwin.cursor = [i+1, 1]
|
||||
$curbuf.append(i, rows[i].join(''))
|
||||
end
|
||||
|
||||
# Print a TRUNCATED indicator, if needed.
|
||||
if truncated
|
||||
$curbuf.append($curbuf.count - 1, \
|
||||
@@TRUNCATED_STRING.center($curwin.width, " "))
|
||||
end
|
||||
|
||||
# Stretch the last line to the length of the window with whitespace so
|
||||
# that we can "hide" the cursor in the corner.
|
||||
last_line = $curbuf[$curbuf.count - 1]
|
||||
last_line << (" " * [$curwin.width - last_line.length,0].max)
|
||||
$curbuf[$curbuf.count - 1] = last_line
|
||||
|
||||
# There's a blank line at the end of the buffer because of how
|
||||
# VIM::Buffer.append works.
|
||||
$curbuf.delete $curbuf.count
|
||||
lock()
|
||||
end
|
||||
|
||||
def print_no_entries
|
||||
unlock_and_clear()
|
||||
$curwin.height = 1
|
||||
$curbuf[1] = @@NO_MATCHES_STRING.center($curwin.width, " ")
|
||||
lock()
|
||||
end
|
||||
|
||||
def unlock_and_clear
|
||||
VIM::command "setlocal modifiable"
|
||||
|
||||
# Clear the explorer (black hole register)
|
||||
VIM::command "silent %d _"
|
||||
end
|
||||
|
||||
def lock
|
||||
VIM::command "setlocal nomodifiable"
|
||||
|
||||
# Hide the cursor
|
||||
VIM::command "normal! Gg$"
|
||||
end
|
||||
|
||||
def compute_displayable_upper_bound(strings)
|
||||
# Compute an upper-bound on the number of displayable matches.
|
||||
# Basically: find the length of the longest string, then keep
|
||||
# adding shortest strings until we pass the width of the Vim
|
||||
# window. This is the maximum possible column-count assuming
|
||||
# all strings can fit. Then multiply by the number of rows.
|
||||
|
||||
sorted_by_shortest = strings.sort { |x, y| x.length <=> y.length }
|
||||
longest_length = sorted_by_shortest.pop.length
|
||||
|
||||
row_width = longest_length + @@COLUMN_SEPARATOR.length
|
||||
|
||||
max_width = Display.max_width()
|
||||
column_count = 1
|
||||
|
||||
sorted_by_shortest.each do |str|
|
||||
row_width += str.length
|
||||
if row_width > max_width
|
||||
break
|
||||
end
|
||||
|
||||
column_count += 1
|
||||
row_width += @@COLUMN_SEPARATOR.length
|
||||
end
|
||||
|
||||
column_count * Display.max_height()
|
||||
end
|
||||
|
||||
def compute_optimal_row_count(strings)
|
||||
max_width = Display.max_width
|
||||
max_height = Display.max_height
|
||||
|
||||
# Hashes by range, e.g. 0..2, representing the width
|
||||
# of the column bounded by that range.
|
||||
col_range_widths = {}
|
||||
|
||||
# Binary search; find the lowest number of rows at which we
|
||||
# can fit all the strings.
|
||||
|
||||
# We've already failed for a single row, so start at two.
|
||||
lower = 1 # (1 = 2 - 1)
|
||||
upper = max_height + 1
|
||||
while lower + 1 != upper
|
||||
row_count = (lower + upper) / 2 # Mid-point
|
||||
|
||||
col_start_index = 0
|
||||
col_end_index = row_count - 1
|
||||
total_width = 0
|
||||
|
||||
while col_end_index < strings.length
|
||||
total_width += \
|
||||
compute_column_width(col_start_index..col_end_index,
|
||||
strings, col_range_widths)
|
||||
|
||||
if total_width > max_width
|
||||
# Early exit.
|
||||
total_width = LustyM::MOST_POSITIVE_FIXNUM
|
||||
break
|
||||
end
|
||||
|
||||
total_width += @@COLUMN_SEPARATOR.length
|
||||
|
||||
col_start_index += row_count
|
||||
col_end_index += row_count
|
||||
|
||||
if col_end_index >= strings.length and \
|
||||
col_start_index < strings.length
|
||||
# Remainder; last iteration will not be a full column.
|
||||
col_end_index = strings.length - 1
|
||||
end
|
||||
end
|
||||
|
||||
# The final column doesn't need a separator.
|
||||
total_width -= @@COLUMN_SEPARATOR.length
|
||||
|
||||
if total_width <= max_width
|
||||
# This row count fits.
|
||||
upper = row_count
|
||||
else
|
||||
# This row count doesn't fit.
|
||||
lower = row_count
|
||||
end
|
||||
end
|
||||
|
||||
if upper > max_height
|
||||
# No row count can accomodate all strings; have to truncate.
|
||||
# (-1 for the truncate indicator)
|
||||
[max_height - 1, true]
|
||||
else
|
||||
[upper, false]
|
||||
end
|
||||
end
|
||||
|
||||
def compute_column_width(range, strings, col_range_widths)
|
||||
|
||||
if (range.first == range.last)
|
||||
return strings[range.first].length
|
||||
end
|
||||
|
||||
width = col_range_widths[range]
|
||||
|
||||
if width.nil?
|
||||
# Recurse for each half of the range.
|
||||
split_point = range.first + ((range.last - range.first) >> 1)
|
||||
|
||||
first_half = compute_column_width(range.first..split_point,
|
||||
strings, col_range_widths)
|
||||
second_half = compute_column_width(split_point+1..range.last,
|
||||
strings, col_range_widths)
|
||||
|
||||
width = [first_half, second_half].max
|
||||
col_range_widths[range] = width
|
||||
end
|
||||
|
||||
width
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
# Copyright (C) 2007-2010 Stephen Bach
|
||||
#
|
||||
# Permission is hereby granted to use and distribute this code, with or without
|
||||
# modifications, provided that this copyright notice is copied with it. Like
|
||||
# anything else that's free, this file is provided *as is* and comes with no
|
||||
# warranty of any kind, either expressed or implied. In no event will the
|
||||
# copyright holder be liable for any damages resulting from the use of this
|
||||
# software.
|
||||
|
||||
module LustyM
|
||||
|
||||
# Abstract base class.
|
||||
class Entry
|
||||
attr_accessor :full_name, :short_name, :label
|
||||
def initialize(full_name, short_name, label)
|
||||
@full_name = full_name
|
||||
@short_name = short_name
|
||||
@label = label
|
||||
end
|
||||
|
||||
# NOTE: very similar to BufferStack::shorten_paths()
|
||||
def self.compute_buffer_entries()
|
||||
buffer_entries = []
|
||||
|
||||
$le_buffer_stack.numbers.each do |n|
|
||||
o = VIM::Buffer.obj_for_bufnr(n)
|
||||
next if (o.nil? or not o.listed?)
|
||||
buffer_entries << self.new(o, n)
|
||||
end
|
||||
|
||||
# Put the current buffer at the end of the list.
|
||||
buffer_entries << buffer_entries.shift
|
||||
|
||||
# Shorten each buffer name by removing all path elements which are not
|
||||
# needed to differentiate a given name from other names. This usually
|
||||
# results in only the basename shown, but if several buffers of the
|
||||
# same basename are opened, there will be more.
|
||||
|
||||
# Group the buffers by common basename
|
||||
common_base = Hash.new { |hash, k| hash[k] = [] }
|
||||
buffer_entries.each do |entry|
|
||||
if entry.full_name
|
||||
basename = Pathname.new(entry.full_name).basename.to_s
|
||||
common_base[basename] << entry
|
||||
end
|
||||
end
|
||||
|
||||
# Determine the longest common prefix for each basename group.
|
||||
basename_to_prefix = {}
|
||||
common_base.each do |base, entries|
|
||||
if entries.length > 1
|
||||
full_names = entries.map { |e| e.full_name }
|
||||
basename_to_prefix[base] = LustyM::longest_common_prefix(full_names)
|
||||
end
|
||||
end
|
||||
|
||||
# Compute shortened buffer names by removing prefix, if possible.
|
||||
buffer_entries.each do |entry|
|
||||
full_name = entry.full_name
|
||||
|
||||
short_name = if full_name.nil?
|
||||
'[No Name]'
|
||||
elsif LustyM::starts_with?(full_name, "scp://")
|
||||
full_name
|
||||
else
|
||||
base = Pathname.new(full_name).basename.to_s
|
||||
prefix = basename_to_prefix[base]
|
||||
|
||||
prefix ? full_name[prefix.length..-1] \
|
||||
: base
|
||||
end
|
||||
|
||||
entry.short_name = short_name
|
||||
end
|
||||
|
||||
buffer_entries
|
||||
end
|
||||
end
|
||||
|
||||
# Used in FilesystemExplorer
|
||||
class FilesystemEntry < Entry
|
||||
attr_accessor :current_score
|
||||
def initialize(label)
|
||||
super("::UNSET::", "::UNSET::", label)
|
||||
@current_score = 0.0
|
||||
end
|
||||
end
|
||||
|
||||
# Used in BufferExplorer
|
||||
class BufferEntry < Entry
|
||||
attr_accessor :vim_buffer, :mru_placement, :current_score
|
||||
def initialize(vim_buffer, mru_placement)
|
||||
super(vim_buffer.name, "::UNSET::", "::UNSET::")
|
||||
@vim_buffer = vim_buffer
|
||||
@mru_placement = mru_placement
|
||||
@current_score = 0.0
|
||||
end
|
||||
end
|
||||
|
||||
# Used in BufferGrep
|
||||
class GrepEntry < Entry
|
||||
attr_accessor :vim_buffer, :mru_placement, :line_number
|
||||
def initialize(vim_buffer, mru_placement)
|
||||
super(vim_buffer.name, "::UNSET::", "::UNSET::")
|
||||
@vim_buffer = vim_buffer
|
||||
@mru_placement = mru_placement
|
||||
@line_number = 0
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -1,173 +0,0 @@
|
|||
# Copyright (C) 2007-2010 Stephen Bach
|
||||
#
|
||||
# Permission is hereby granted to use and distribute this code, with or without
|
||||
# modifications, provided that this copyright notice is copied with it. Like
|
||||
# anything else that's free, this file is provided *as is* and comes with no
|
||||
# warranty of any kind, either expressed or implied. In no event will the
|
||||
# copyright holder be liable for any damages resulting from the use of this
|
||||
# software.
|
||||
|
||||
# Abstract base class; extended as BufferExplorer, FilesystemExplorer
|
||||
module LustyM
|
||||
class Explorer
|
||||
public
|
||||
def initialize
|
||||
@settings = SavedSettings.new
|
||||
@display = Display.new title()
|
||||
@prompt = nil
|
||||
@current_sorted_matches = []
|
||||
@running = false
|
||||
end
|
||||
|
||||
def run
|
||||
return if @running
|
||||
|
||||
@settings.save
|
||||
@running = true
|
||||
@calling_window = $curwin
|
||||
@saved_alternate_bufnum = if VIM::evaluate_bool("expand('#') == ''")
|
||||
nil
|
||||
else
|
||||
VIM::evaluate("bufnr(expand('#'))")
|
||||
end
|
||||
create_explorer_window()
|
||||
refresh(:full)
|
||||
end
|
||||
|
||||
def key_pressed()
|
||||
# Grab argument from the Vim function.
|
||||
i = VIM::evaluate("a:code_arg").to_i
|
||||
refresh_mode = :full
|
||||
|
||||
case i
|
||||
when 32..126 # Printable characters
|
||||
c = i.chr
|
||||
@prompt.add! c
|
||||
@selected_index = 0
|
||||
when 8 # Backspace/Del/C-h
|
||||
@prompt.backspace!
|
||||
@selected_index = 0
|
||||
when 9, 13 # Tab and Enter
|
||||
choose(:current_tab)
|
||||
when 23 # C-w (delete 1 dir backward)
|
||||
@prompt.up_one_dir!
|
||||
@selected_index = 0
|
||||
when 14 # C-n (select next)
|
||||
@selected_index = \
|
||||
(@selected_index + 1) % @current_sorted_matches.size
|
||||
refresh_mode = :no_recompute
|
||||
when 16 # C-p (select previous)
|
||||
@selected_index = \
|
||||
(@selected_index - 1) % @current_sorted_matches.size
|
||||
refresh_mode = :no_recompute
|
||||
when 6 # C-f (select right)
|
||||
columns = (@current_sorted_matches.size.to_f / @row_count.to_f).ceil
|
||||
cur_column = @selected_index / @row_count
|
||||
cur_row = @selected_index % @row_count
|
||||
new_column = (cur_column + 1) % columns
|
||||
if (new_column + 1) * (cur_row + 1) > @current_sorted_matches.size
|
||||
new_column = 0
|
||||
end
|
||||
@selected_index = new_column * @row_count + cur_row
|
||||
refresh_mode = :no_recompute
|
||||
when 2 # C-b (select left)
|
||||
columns = (@current_sorted_matches.size.to_f / @row_count.to_f).ceil
|
||||
cur_column = @selected_index / @row_count
|
||||
cur_row = @selected_index % @row_count
|
||||
new_column = (cur_column - 1) % columns
|
||||
if (new_column + 1) * (cur_row + 1) > @current_sorted_matches.size
|
||||
new_column = columns - 2
|
||||
end
|
||||
@selected_index = new_column * @row_count + cur_row
|
||||
refresh_mode = :no_recompute
|
||||
when 15 # C-o choose in new horizontal split
|
||||
choose(:new_split)
|
||||
when 20 # C-t choose in new tab
|
||||
choose(:new_tab)
|
||||
when 21 # C-u clear prompt
|
||||
@prompt.clear!
|
||||
@selected_index = 0
|
||||
when 22 # C-v choose in new vertical split
|
||||
choose(:new_vsplit)
|
||||
end
|
||||
|
||||
refresh(refresh_mode)
|
||||
end
|
||||
|
||||
def cancel
|
||||
if @running
|
||||
cleanup()
|
||||
# fix alternate file
|
||||
if @saved_alternate_bufnum
|
||||
cur = $curbuf
|
||||
VIM::command "silent b #{@saved_alternate_bufnum}"
|
||||
VIM::command "silent b #{cur.number}"
|
||||
end
|
||||
|
||||
if $LUSTY_PROFILING
|
||||
outfile = File.new('lusty-explorer-rbprof.html', 'a')
|
||||
#RubyProf::CallTreePrinter.new(RubyProf.stop).print(outfile)
|
||||
RubyProf::GraphHtmlPrinter.new(RubyProf.stop).print(outfile)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def refresh(mode)
|
||||
return if not @running
|
||||
|
||||
if mode == :full
|
||||
@current_sorted_matches = compute_sorted_matches()
|
||||
end
|
||||
|
||||
on_refresh()
|
||||
highlight_selected_index() if VIM::has_syntax?
|
||||
@row_count = @display.print @current_sorted_matches.map { |x| x.label }
|
||||
@prompt.print Display.max_width
|
||||
end
|
||||
|
||||
def create_explorer_window
|
||||
# Trim out the "::" in "LustyM::FooExplorer"
|
||||
key_binding_prefix = 'Lusty' + self.class.to_s.sub(/.*::/,'')
|
||||
|
||||
@display.create(key_binding_prefix)
|
||||
set_syntax_matching()
|
||||
end
|
||||
|
||||
def highlight_selected_index
|
||||
# Note: overridden by BufferGrep
|
||||
VIM::command 'syn clear LustySelected'
|
||||
|
||||
entry = @current_sorted_matches[@selected_index]
|
||||
return if entry.nil?
|
||||
|
||||
escaped = VIM::regex_escape(entry.label)
|
||||
label_match_string = Display.entry_syntaxify(escaped, false)
|
||||
VIM::command "syn match LustySelected \"#{label_match_string}\" " \
|
||||
'contains=LustyGrepMatch'
|
||||
end
|
||||
|
||||
def choose(open_mode)
|
||||
entry = @current_sorted_matches[@selected_index]
|
||||
return if entry.nil?
|
||||
open_entry(entry, open_mode)
|
||||
end
|
||||
|
||||
def cleanup
|
||||
@display.close
|
||||
Window.select @calling_window
|
||||
@settings.restore
|
||||
@running = false
|
||||
VIM::message ""
|
||||
LustyM::assert(@calling_window == $curwin)
|
||||
end
|
||||
|
||||
# Pure virtual methods
|
||||
# - set_syntax_matching
|
||||
# - on_refresh
|
||||
# - open_entry
|
||||
# - compute_sorted_matches
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
# Copyright (C) 2007-2010 Stephen Bach
|
||||
#
|
||||
# Permission is hereby granted to use and distribute this code, with or without
|
||||
# modifications, provided that this copyright notice is copied with it. Like
|
||||
# anything else that's free, this file is provided *as is* and comes with no
|
||||
# warranty of any kind, either expressed or implied. In no event will the
|
||||
# copyright holder be liable for any damages resulting from the use of this
|
||||
# software.
|
||||
|
||||
module LustyM
|
||||
class FileMasks
|
||||
private
|
||||
@@glob_masks = []
|
||||
|
||||
public
|
||||
def FileMasks.create_glob_masks
|
||||
@@glob_masks = \
|
||||
if VIM::exists? "g:LustyExplorerFileMasks"
|
||||
# Note: this variable deprecated.
|
||||
VIM::evaluate("g:LustyExplorerFileMasks").split(',')
|
||||
elsif VIM::exists? "&wildignore"
|
||||
VIM::evaluate("&wildignore").split(',')
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
def FileMasks.masked?(str)
|
||||
@@glob_masks.each do |mask|
|
||||
return true if File.fnmatch(mask, str)
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1,243 +0,0 @@
|
|||
# Copyright (C) 2007-2010 Stephen Bach
|
||||
#
|
||||
# Permission is hereby granted to use and distribute this code, with or without
|
||||
# modifications, provided that this copyright notice is copied with it. Like
|
||||
# anything else that's free, this file is provided *as is* and comes with no
|
||||
# warranty of any kind, either expressed or implied. In no event will the
|
||||
# copyright holder be liable for any damages resulting from the use of this
|
||||
# software.
|
||||
|
||||
module LustyM
|
||||
class FilesystemExplorer < Explorer
|
||||
public
|
||||
def initialize
|
||||
super
|
||||
@prompt = FilesystemPrompt.new
|
||||
@memoized_dir_contents = {}
|
||||
end
|
||||
|
||||
def run
|
||||
return if @running
|
||||
|
||||
FileMasks.create_glob_masks()
|
||||
@vim_swaps = VimSwaps.new
|
||||
@selected_index = 0
|
||||
super
|
||||
end
|
||||
|
||||
def run_from_path(path)
|
||||
return if @running
|
||||
if path.empty?
|
||||
path = VIM::getcwd()
|
||||
end
|
||||
@prompt.set!(path + File::SEPARATOR)
|
||||
run()
|
||||
end
|
||||
|
||||
def key_pressed()
|
||||
i = VIM::evaluate("a:code_arg").to_i
|
||||
|
||||
case i
|
||||
when 1, 10 # <C-a>, <Shift-Enter>
|
||||
cleanup()
|
||||
# Open all non-directories currently in view.
|
||||
@current_sorted_matches.each do |e|
|
||||
path_str = \
|
||||
if @prompt.at_dir?
|
||||
@prompt.input + e.label
|
||||
else
|
||||
dir = @prompt.dirname
|
||||
if dir == '/'
|
||||
dir + e.label
|
||||
else
|
||||
dir + File::SEPARATOR + e.label
|
||||
end
|
||||
end
|
||||
|
||||
load_file(path_str, :current_tab) unless File.directory?(path_str)
|
||||
end
|
||||
when 5 # <C-e> edit file, create it if necessary
|
||||
if not @prompt.at_dir?
|
||||
cleanup()
|
||||
# Force a reread of this directory so that the new file will
|
||||
# show up (as long as it is saved before the next run).
|
||||
@memoized_dir_contents.delete(view_path())
|
||||
load_file(@prompt.input, :current_tab)
|
||||
end
|
||||
when 18 # <C-r> refresh
|
||||
@memoized_dir_contents.delete(view_path())
|
||||
refresh(:full)
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def title
|
||||
'[LustyExplorer-Files]'
|
||||
end
|
||||
|
||||
def set_syntax_matching
|
||||
# Base highlighting -- more is set on refresh.
|
||||
if VIM::has_syntax?
|
||||
VIM::command 'syn match LustySlash "/" contained'
|
||||
VIM::command 'syn match LustyDir "\%(\S\+ \)*\S\+/" ' \
|
||||
'contains=LustySlash'
|
||||
end
|
||||
end
|
||||
|
||||
def on_refresh
|
||||
if VIM::has_syntax?
|
||||
VIM::command 'syn clear LustyFileWithSwap'
|
||||
|
||||
view = view_path()
|
||||
@vim_swaps.file_names.each do |file_with_swap|
|
||||
if file_with_swap.dirname == view
|
||||
base = file_with_swap.basename
|
||||
escaped = VIM::regex_escape(base.to_s)
|
||||
match_str = Display.entry_syntaxify(escaped, false)
|
||||
VIM::command "syn match LustyFileWithSwap \"#{match_str}\""
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# TODO: restore highlighting for open buffers?
|
||||
end
|
||||
|
||||
def current_abbreviation
|
||||
if @prompt.at_dir?
|
||||
""
|
||||
else
|
||||
File.basename(@prompt.input)
|
||||
end
|
||||
end
|
||||
|
||||
def view_path
|
||||
input = @prompt.input
|
||||
|
||||
path = \
|
||||
if @prompt.at_dir? and \
|
||||
input.length > 1 # Not root
|
||||
# The last element in the path is a directory + '/' and we want to
|
||||
# see what's in it instead of what's in its parent directory.
|
||||
|
||||
Pathname.new(input[0..-2]) # Canonicalize by removing trailing '/'
|
||||
else
|
||||
Pathname.new(input).dirname
|
||||
end
|
||||
|
||||
return path
|
||||
end
|
||||
|
||||
def all_files_at_view
|
||||
view = view_path()
|
||||
|
||||
unless @memoized_dir_contents.has_key?(view)
|
||||
|
||||
if not view.directory?
|
||||
return []
|
||||
elsif not view.readable?
|
||||
# TODO: show "-- PERMISSION DENIED --"
|
||||
return []
|
||||
end
|
||||
|
||||
# Generate an array of the files
|
||||
entries = []
|
||||
view_str = view.to_s
|
||||
unless LustyM::ends_with?(view_str, File::SEPARATOR)
|
||||
# Don't double-up on '/' -- makes Cygwin sad.
|
||||
view_str << File::SEPARATOR
|
||||
end
|
||||
|
||||
Dir.foreach(view_str) do |name|
|
||||
next if name == "." # Skip pwd
|
||||
next if name == ".." and LustyM::option_set?("AlwaysShowDotFiles")
|
||||
|
||||
# Hide masked files.
|
||||
next if FileMasks.masked?(name)
|
||||
|
||||
if FileTest.directory?(view_str + name)
|
||||
name << File::SEPARATOR
|
||||
end
|
||||
entries << FilesystemEntry.new(name)
|
||||
end
|
||||
@memoized_dir_contents[view] = entries
|
||||
end
|
||||
|
||||
all = @memoized_dir_contents[view]
|
||||
|
||||
if LustyM::option_set?("AlwaysShowDotFiles") or \
|
||||
current_abbreviation()[0] == ?.
|
||||
all
|
||||
else
|
||||
# Filter out dotfiles if the current abbreviation doesn't start with
|
||||
# '.'.
|
||||
all.select { |x| x.label[0] != ?. }
|
||||
end
|
||||
end
|
||||
|
||||
def compute_sorted_matches
|
||||
abbrev = current_abbreviation()
|
||||
|
||||
unsorted = all_files_at_view()
|
||||
|
||||
if abbrev.length == 0
|
||||
# Sort alphabetically if we have no abbreviation.
|
||||
unsorted.sort { |x, y| x.label <=> y.label }
|
||||
else
|
||||
matches = \
|
||||
unsorted.select { |x|
|
||||
x.current_score = Mercury.score(x.label, abbrev)
|
||||
x.current_score != 0.0
|
||||
}
|
||||
|
||||
if abbrev == '.'
|
||||
# Sort alphabetically, otherwise it just looks weird.
|
||||
matches.sort! { |x, y| x.label <=> y.label }
|
||||
else
|
||||
# Sort by score.
|
||||
matches.sort! { |x, y| y.current_score <=> x.current_score }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def open_entry(entry, open_mode)
|
||||
path = view_path() + entry.label
|
||||
|
||||
if File.directory?(path)
|
||||
# Recurse into the directory instead of opening it.
|
||||
@prompt.set!(path.to_s)
|
||||
@selected_index = 0
|
||||
elsif entry.label.include?(File::SEPARATOR)
|
||||
# Don't open a fake file/buffer with "/" in its name.
|
||||
return
|
||||
else
|
||||
cleanup()
|
||||
load_file(path.to_s, open_mode)
|
||||
end
|
||||
end
|
||||
|
||||
def load_file(path_str, open_mode)
|
||||
LustyM::assert($curwin == @calling_window)
|
||||
# Escape for Vim and remove leading ./ for files in pwd.
|
||||
filename_escaped = VIM::filename_escape(path_str).sub(/^\.\//,"")
|
||||
single_quote_escaped = VIM::single_quote_escape(filename_escaped)
|
||||
sanitized = VIM::evaluate "fnamemodify('#{single_quote_escaped}', ':.')"
|
||||
cmd = case open_mode
|
||||
when :current_tab
|
||||
"e"
|
||||
when :new_tab
|
||||
"tabe"
|
||||
when :new_split
|
||||
"sp"
|
||||
when :new_vsplit
|
||||
"vs"
|
||||
else
|
||||
LustyM::assert(false, "bad open mode")
|
||||
end
|
||||
|
||||
VIM::command "silent #{cmd} #{sanitized}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1,194 +0,0 @@
|
|||
# Copyright (C) 2008-2010 Stephen Bach
|
||||
#
|
||||
# Permission is hereby granted to use and distribute this code, with or without
|
||||
# modifications, provided that this copyright notice is copied with it. Like
|
||||
# anything else that's free, this file is provided *as is* and comes with no
|
||||
# warranty of any kind, either expressed or implied. In no event will the
|
||||
# copyright holder be liable for any damages resulting from the use of this
|
||||
# software.
|
||||
|
||||
module LustyM
|
||||
class LustyJuggler
|
||||
private
|
||||
@@KEYS = { "a" => 1,
|
||||
"s" => 2,
|
||||
"d" => 3,
|
||||
"f" => 4,
|
||||
"g" => 5,
|
||||
"h" => 6,
|
||||
"j" => 7,
|
||||
"k" => 8,
|
||||
"l" => 9,
|
||||
";" => 10,
|
||||
"1" => 1,
|
||||
"2" => 2,
|
||||
"3" => 3,
|
||||
"4" => 4,
|
||||
"5" => 5,
|
||||
"6" => 6,
|
||||
"7" => 7,
|
||||
"8" => 8,
|
||||
"9" => 9,
|
||||
"0" => 10 }
|
||||
|
||||
public
|
||||
def initialize
|
||||
@running = false
|
||||
@last_pressed = nil
|
||||
@name_bar = NameBar.new
|
||||
end
|
||||
|
||||
def run
|
||||
if $lj_buffer_stack.length <= 1
|
||||
VIM::pretty_msg("PreProc", "No other buffers")
|
||||
return
|
||||
end
|
||||
|
||||
# If already running, highlight next buffer
|
||||
if @running and LustyJuggler::alt_tab_mode_active?
|
||||
@last_pressed = (@last_pressed % $lj_buffer_stack.length) + 1;
|
||||
print_buffer_list(@last_pressed)
|
||||
return
|
||||
end
|
||||
|
||||
return if @running
|
||||
@running = true
|
||||
|
||||
# Need to zero the timeout length or pressing 'g' will hang.
|
||||
@ruler = VIM::evaluate_bool("&ruler")
|
||||
@showcmd = VIM::evaluate_bool("&showcmd")
|
||||
@showmode = VIM::evaluate_bool("&showmode")
|
||||
@timeoutlen = VIM::evaluate("&timeoutlen")
|
||||
VIM::set_option 'timeoutlen=0'
|
||||
VIM::set_option 'noruler'
|
||||
VIM::set_option 'noshowcmd'
|
||||
VIM::set_option 'noshowmode'
|
||||
|
||||
@key_mappings_map = Hash.new { |hash, k| hash[k] = [] }
|
||||
|
||||
# Selection keys.
|
||||
@@KEYS.keys.each do |c|
|
||||
map_key(c, ":call <SID>LustyJugglerKeyPressed('#{c}')<CR>")
|
||||
end
|
||||
# Can't use '<CR>' as an argument to :call func for some reason.
|
||||
map_key("<CR>", ":call <SID>LustyJugglerKeyPressed('ENTER')<CR>")
|
||||
map_key("<Tab>", ":call <SID>LustyJugglerKeyPressed('TAB')<CR>")
|
||||
|
||||
# Cancel keys.
|
||||
map_key("i", ":call <SID>LustyJugglerCancel()<CR>")
|
||||
map_key("q", ":call <SID>LustyJugglerCancel()<CR>")
|
||||
map_key("<Esc>", ":call <SID>LustyJugglerCancel()<CR>")
|
||||
map_key("<C-c>", ":call <SID>LustyJugglerCancel()<CR>")
|
||||
map_key("<BS>", ":call <SID>LustyJugglerCancel()<CR>")
|
||||
map_key("<Del>", ":call <SID>LustyJugglerCancel()<CR>")
|
||||
map_key("<C-h>", ":call <SID>LustyJugglerCancel()<CR>")
|
||||
|
||||
@last_pressed = 2 if LustyJuggler::alt_tab_mode_active?
|
||||
print_buffer_list(@last_pressed)
|
||||
end
|
||||
|
||||
def key_pressed()
|
||||
c = VIM::evaluate("a:code_arg")
|
||||
|
||||
if @last_pressed.nil? and c == 'ENTER'
|
||||
cleanup()
|
||||
elsif @last_pressed and (@@KEYS[c] == @last_pressed or c == 'ENTER')
|
||||
choose(@last_pressed)
|
||||
cleanup()
|
||||
else
|
||||
@last_pressed = @@KEYS[c]
|
||||
print_buffer_list(@last_pressed)
|
||||
end
|
||||
end
|
||||
|
||||
# Restore settings, mostly.
|
||||
def cleanup
|
||||
@last_pressed = nil
|
||||
|
||||
VIM::set_option "timeoutlen=#{@timeoutlen}"
|
||||
VIM::set_option "ruler" if @ruler
|
||||
VIM::set_option "showcmd" if @showcmd
|
||||
VIM::set_option "showmode" if @showmode
|
||||
|
||||
@@KEYS.keys.each do |c|
|
||||
unmap_key(c)
|
||||
end
|
||||
unmap_key("<CR>")
|
||||
unmap_key("<Tab>")
|
||||
|
||||
unmap_key("i")
|
||||
unmap_key("q")
|
||||
unmap_key("<Esc>")
|
||||
unmap_key("<C-c>")
|
||||
unmap_key("<BS>")
|
||||
unmap_key("<Del>")
|
||||
unmap_key("<C-h>")
|
||||
|
||||
@running = false
|
||||
VIM::message ''
|
||||
VIM::command 'redraw' # Prevents "Press ENTER to continue" message.
|
||||
end
|
||||
|
||||
private
|
||||
def self.alt_tab_mode_active?
|
||||
return (VIM::exists?("g:LustyJugglerAltTabMode") and
|
||||
VIM::evaluate("g:LustyJugglerAltTabMode").to_i != 0)
|
||||
end
|
||||
|
||||
def print_buffer_list(highlighted_entry = nil)
|
||||
# If the user pressed a key higher than the number of open buffers,
|
||||
# highlight the highest (see also BufferStack.num_at_pos()).
|
||||
|
||||
@name_bar.selected_buffer = \
|
||||
if highlighted_entry
|
||||
# Correct for zero-based array.
|
||||
[highlighted_entry, $lj_buffer_stack.length].min - 1
|
||||
else
|
||||
nil
|
||||
end
|
||||
|
||||
@name_bar.print
|
||||
end
|
||||
|
||||
def choose(i)
|
||||
buf = $lj_buffer_stack.num_at_pos(i)
|
||||
VIM::command "b #{buf}"
|
||||
end
|
||||
|
||||
def map_key(key, action)
|
||||
['n','v','o','i','c','l'].each do |mode|
|
||||
VIM::command "let s:maparg_holder = maparg('#{key}', '#{mode}')"
|
||||
if VIM::evaluate_bool("s:maparg_holder != ''")
|
||||
@key_mappings_map[key] << [mode, VIM::evaluate('s:maparg_holder')]
|
||||
end
|
||||
VIM::command "#{mode}noremap <silent> #{key} #{action}"
|
||||
end
|
||||
end
|
||||
|
||||
def unmap_key(key)
|
||||
modes_with_mappings_for_key = \
|
||||
{ 'n' => false,
|
||||
'v' => false,
|
||||
'o' => false,
|
||||
'i' => false,
|
||||
'c' => false,
|
||||
'l' => false }
|
||||
|
||||
if @key_mappings_map.has_key?(key)
|
||||
@key_mappings_map[key].each do |a|
|
||||
mode = a[0]
|
||||
action = a[1]
|
||||
VIM::command "#{mode}noremap <silent> #{key} #{action}"
|
||||
modes_with_mappings_for_key[mode] = true
|
||||
end
|
||||
end
|
||||
|
||||
modes_with_mappings_for_key.each_pair do |mode, had_mapping|
|
||||
unless had_mapping
|
||||
VIM::command "#{mode}unmap <silent> #{key}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1,183 +0,0 @@
|
|||
# Copyright (C) 2008-2010 Stephen Bach
|
||||
#
|
||||
# Permission is hereby granted to use and distribute this code, with or without
|
||||
# modifications, provided that this copyright notice is copied with it. Like
|
||||
# anything else that's free, this file is provided *as is* and comes with no
|
||||
# warranty of any kind, either expressed or implied. In no event will the
|
||||
# copyright holder be liable for any damages resulting from the use of this
|
||||
# software.
|
||||
|
||||
# A one-line display of the open buffers, appearing in the command display.
|
||||
module LustyM
|
||||
class NameBar
|
||||
public
|
||||
def initialize
|
||||
@selected_buffer = nil
|
||||
end
|
||||
|
||||
attr_writer :selected_buffer
|
||||
|
||||
def print
|
||||
items = create_items()
|
||||
|
||||
selected_item = \
|
||||
if @selected_buffer
|
||||
# Account for the separators we've added.
|
||||
[@selected_buffer * 2, (items.length - 1)].min
|
||||
end
|
||||
|
||||
clipped = clip(items, selected_item)
|
||||
NameBar.do_pretty_print(clipped)
|
||||
end
|
||||
|
||||
private
|
||||
@@LETTERS = ["a", "s", "d", "f", "g", "h", "j", "k", "l", ";"]
|
||||
|
||||
|
||||
def create_items
|
||||
names = $lj_buffer_stack.names(10)
|
||||
|
||||
items = names.inject([]) { |array, name|
|
||||
key = if VIM::exists?("g:LustyJugglerShowKeys")
|
||||
case VIM::evaluate("g:LustyJugglerShowKeys").to_s
|
||||
when /[[:alpha:]]/
|
||||
@@LETTERS[array.size / 2] + ":"
|
||||
when /[[:digit:]]/
|
||||
"#{((array.size / 2) + 1) % 10}:"
|
||||
else
|
||||
""
|
||||
end
|
||||
else
|
||||
""
|
||||
end
|
||||
|
||||
array << BufferItem.new("#{key}#{name}",
|
||||
(@selected_buffer and \
|
||||
name == names[@selected_buffer]))
|
||||
array << SeparatorItem.new
|
||||
}
|
||||
items.pop # Remove last separator.
|
||||
|
||||
return items
|
||||
end
|
||||
|
||||
# Clip the given array of items to the available display width.
|
||||
def clip(items, selected)
|
||||
# This function is pretty hard to follow...
|
||||
|
||||
# Note: Vim gives the annoying "Press ENTER to continue" message if we
|
||||
# use the full width.
|
||||
columns = VIM::columns() - 1
|
||||
|
||||
if BarItem.full_length(items) <= columns
|
||||
return items
|
||||
end
|
||||
|
||||
selected = 0 if selected.nil?
|
||||
half_displayable_len = columns / 2
|
||||
|
||||
# The selected buffer is excluded since it's basically split between
|
||||
# the sides.
|
||||
left_len = BarItem.full_length items[0, selected - 1]
|
||||
right_len = BarItem.full_length items[selected + 1, items.length - 1]
|
||||
|
||||
right_justify = (left_len > half_displayable_len) and \
|
||||
(right_len < half_displayable_len)
|
||||
|
||||
selected_str_half_len = (items[selected].length / 2) + \
|
||||
(items[selected].length % 2 == 0 ? 0 : 1)
|
||||
|
||||
if right_justify
|
||||
# Right justify the bar.
|
||||
first_layout = self.method :layout_right
|
||||
second_layout = self.method :layout_left
|
||||
first_adjustment = selected_str_half_len
|
||||
second_adjustment = -selected_str_half_len
|
||||
else
|
||||
# Left justify (sort-of more likely).
|
||||
first_layout = self.method :layout_left
|
||||
second_layout = self.method :layout_right
|
||||
first_adjustment = -selected_str_half_len
|
||||
second_adjustment = selected_str_half_len
|
||||
end
|
||||
|
||||
# Layout the first side.
|
||||
allocation = half_displayable_len + first_adjustment
|
||||
first_side, remainder = first_layout.call(items,
|
||||
selected,
|
||||
allocation)
|
||||
|
||||
# Then layout the second side, also grabbing any unused space.
|
||||
allocation = half_displayable_len + \
|
||||
second_adjustment + \
|
||||
remainder
|
||||
second_side, remainder = second_layout.call(items,
|
||||
selected,
|
||||
allocation)
|
||||
|
||||
if right_justify
|
||||
second_side + first_side
|
||||
else
|
||||
first_side + second_side
|
||||
end
|
||||
end
|
||||
|
||||
# Clip the given array of items to the given space, counting downwards.
|
||||
def layout_left(items, selected, space)
|
||||
trimmed = []
|
||||
|
||||
i = selected - 1
|
||||
while i >= 0
|
||||
m = items[i]
|
||||
if space > m.length
|
||||
trimmed << m
|
||||
space -= m.length
|
||||
elsif space > 0
|
||||
trimmed << m[m.length - (space - LeftContinuerItem.length), \
|
||||
space - LeftContinuerItem.length]
|
||||
trimmed << LeftContinuerItem.new
|
||||
space = 0
|
||||
else
|
||||
break
|
||||
end
|
||||
i -= 1
|
||||
end
|
||||
|
||||
return trimmed.reverse, space
|
||||
end
|
||||
|
||||
# Clip the given array of items to the given space, counting upwards.
|
||||
def layout_right(items, selected, space)
|
||||
trimmed = []
|
||||
|
||||
i = selected
|
||||
while i < items.length
|
||||
m = items[i]
|
||||
if space > m.length
|
||||
trimmed << m
|
||||
space -= m.length
|
||||
elsif space > 0
|
||||
trimmed << m[0, space - RightContinuerItem.length]
|
||||
trimmed << RightContinuerItem.new
|
||||
space = 0
|
||||
else
|
||||
break
|
||||
end
|
||||
i += 1
|
||||
end
|
||||
|
||||
return trimmed, space
|
||||
end
|
||||
|
||||
def NameBar.do_pretty_print(items)
|
||||
args = items.inject([]) { |array, item|
|
||||
array = array + item.pretty_print_input
|
||||
}
|
||||
|
||||
VIM::pretty_msg *args
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -1,160 +0,0 @@
|
|||
# Copyright (C) 2007-2010 Stephen Bach
|
||||
#
|
||||
# Permission is hereby granted to use and distribute this code, with or without
|
||||
# modifications, provided that this copyright notice is copied with it. Like
|
||||
# anything else that's free, this file is provided *as is* and comes with no
|
||||
# warranty of any kind, either expressed or implied. In no event will the
|
||||
# copyright holder be liable for any damages resulting from the use of this
|
||||
# software.
|
||||
|
||||
module LustyM
|
||||
|
||||
# Used in BufferExplorer
|
||||
class Prompt
|
||||
private
|
||||
@@PROMPT = ">> "
|
||||
|
||||
public
|
||||
def initialize
|
||||
clear!
|
||||
end
|
||||
|
||||
def clear!
|
||||
@input = ""
|
||||
end
|
||||
|
||||
def print(max_width = 0)
|
||||
text = @input
|
||||
# may need some extra characters for "..." and spacing
|
||||
max_width -= 5
|
||||
if max_width > 0 && text.length > max_width
|
||||
text = "..." + text[(text.length - max_width + 3 ) .. -1]
|
||||
end
|
||||
|
||||
VIM::pretty_msg("Comment", @@PROMPT,
|
||||
"None", VIM::single_quote_escape(text),
|
||||
"Underlined", " ")
|
||||
end
|
||||
|
||||
def set!(s)
|
||||
@input = s
|
||||
end
|
||||
|
||||
def input
|
||||
@input
|
||||
end
|
||||
|
||||
def insensitive?
|
||||
@input == @input.downcase
|
||||
end
|
||||
|
||||
def ends_with?(c)
|
||||
LustyM::ends_with?(@input, c)
|
||||
end
|
||||
|
||||
def add!(s)
|
||||
@input << s
|
||||
end
|
||||
|
||||
def backspace!
|
||||
@input.chop!
|
||||
end
|
||||
|
||||
def up_one_dir!
|
||||
@input.chop!
|
||||
while !@input.empty? and @input[-1] != ?/
|
||||
@input.chop!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Used in FilesystemExplorer
|
||||
class FilesystemPrompt < Prompt
|
||||
|
||||
def initialize
|
||||
super
|
||||
@memoized = nil
|
||||
@dirty = true
|
||||
end
|
||||
|
||||
def clear!
|
||||
super
|
||||
@dirty = true
|
||||
end
|
||||
|
||||
def set!(s)
|
||||
# On Windows, Vim will return paths with a '\' separator, but
|
||||
# we want to use '/'.
|
||||
super(s.gsub('\\', '/'))
|
||||
@dirty = true
|
||||
end
|
||||
|
||||
def backspace!
|
||||
super
|
||||
@dirty = true
|
||||
end
|
||||
|
||||
def up_one_dir!
|
||||
super
|
||||
@dirty = true
|
||||
end
|
||||
|
||||
def at_dir?
|
||||
# We have not typed anything yet or have just typed the final '/' on a
|
||||
# directory name in pwd. This check is interspersed throughout
|
||||
# FilesystemExplorer because of the conventions of basename and dirname.
|
||||
input().empty? or input()[-1] == File::SEPARATOR[0]
|
||||
# Don't think the File.directory? call is necessary, but leaving this
|
||||
# here as a reminder.
|
||||
#(File.directory?(input()) and input().ends_with?(File::SEPARATOR))
|
||||
end
|
||||
|
||||
def insensitive?
|
||||
at_dir? or (basename() == basename().downcase)
|
||||
end
|
||||
|
||||
def add!(s)
|
||||
# Assumption: add!() will only receive enough chars at a time to complete
|
||||
# a single directory level, e.g. foo/, not foo/bar/
|
||||
|
||||
@input << s
|
||||
@dirty = true
|
||||
end
|
||||
|
||||
def input
|
||||
if @dirty
|
||||
@memoized = LustyM::simplify_path(variable_expansion(@input))
|
||||
@dirty = false
|
||||
end
|
||||
|
||||
@memoized
|
||||
end
|
||||
|
||||
def basename
|
||||
File.basename input()
|
||||
end
|
||||
|
||||
def dirname
|
||||
File.dirname input()
|
||||
end
|
||||
|
||||
private
|
||||
def variable_expansion (input_str)
|
||||
strings = input_str.split('$', -1)
|
||||
return "" if strings.nil? or strings.length == 0
|
||||
|
||||
first = strings.shift
|
||||
|
||||
# Try to expand each instance of $<word>.
|
||||
strings.inject(first) { |str, s|
|
||||
if s =~ /^(\w+)/ and ENV[$1]
|
||||
str + s.sub($1, ENV[$1])
|
||||
else
|
||||
str + "$" + s
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
# Copyright (C) 2007-2010 Stephen Bach
|
||||
#
|
||||
# Permission is hereby granted to use and distribute this code, with or without
|
||||
# modifications, provided that this copyright notice is copied with it. Like
|
||||
# anything else that's free, this file is provided *as is* and comes with no
|
||||
# warranty of any kind, either expressed or implied. In no event will the
|
||||
# copyright holder be liable for any damages resulting from the use of this
|
||||
# software.
|
||||
|
||||
# Save and restore settings when creating the explorer buffer.
|
||||
module LustyM
|
||||
class SavedSettings
|
||||
def initialize
|
||||
save()
|
||||
end
|
||||
|
||||
def save
|
||||
@timeoutlen = VIM::evaluate("&timeoutlen")
|
||||
|
||||
@splitbelow = VIM::evaluate_bool("&splitbelow")
|
||||
@insertmode = VIM::evaluate_bool("&insertmode")
|
||||
@showcmd = VIM::evaluate_bool("&showcmd")
|
||||
@list = VIM::evaluate_bool("&list")
|
||||
|
||||
@report = VIM::evaluate("&report")
|
||||
@sidescroll = VIM::evaluate("&sidescroll")
|
||||
@sidescrolloff = VIM::evaluate("&sidescrolloff")
|
||||
|
||||
VIM::command "let s:win_size_restore = winrestcmd()"
|
||||
end
|
||||
|
||||
def restore
|
||||
VIM::set_option "timeoutlen=#{@timeoutlen}"
|
||||
|
||||
if @splitbelow
|
||||
VIM::set_option "splitbelow"
|
||||
else
|
||||
VIM::set_option "nosplitbelow"
|
||||
end
|
||||
|
||||
if @insertmode
|
||||
VIM::set_option "insertmode"
|
||||
else
|
||||
VIM::set_option "noinsertmode"
|
||||
end
|
||||
|
||||
if @showcmd
|
||||
VIM::set_option "showcmd"
|
||||
else
|
||||
VIM::set_option "noshowcmd"
|
||||
end
|
||||
|
||||
if @list
|
||||
VIM::set_option "list"
|
||||
else
|
||||
VIM::set_option "nolist"
|
||||
end
|
||||
|
||||
VIM::command "set report=#{@report}"
|
||||
VIM::command "set sidescroll=#{@sidescroll}"
|
||||
VIM::command "set sidescrolloff=#{@sidescrolloff}"
|
||||
|
||||
VIM::command "exe s:win_size_restore"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
# Copyright (C) 2007-2010 Stephen Bach
|
||||
#
|
||||
# Permission is hereby granted to use and distribute this code, with or without
|
||||
# modifications, provided that this copyright notice is copied with it. Like
|
||||
# anything else that's free, this file is provided *as is* and comes with no
|
||||
# warranty of any kind, either expressed or implied. In no event will the
|
||||
# copyright holder be liable for any damages resulting from the use of this
|
||||
# software.
|
||||
|
||||
module LustyM
|
||||
class VimSwaps
|
||||
def initialize
|
||||
if VIM::has_syntax?
|
||||
# FIXME: vvv disabled
|
||||
# @vim_r = IO.popen("vim -r --noplugin -i NONE 2>&1")
|
||||
# @files_with_swaps = nil
|
||||
@files_with_swaps = []
|
||||
else
|
||||
@files_with_swaps = []
|
||||
end
|
||||
end
|
||||
|
||||
def file_names
|
||||
if @files_with_swaps.nil?
|
||||
if LustyM::ready_for_read?(@vim_r)
|
||||
@files_with_swaps = []
|
||||
@vim_r.each_line do |line|
|
||||
if line =~ /^ +file name: (.*)$/
|
||||
file = $1.chomp
|
||||
@files_with_swaps << Pathname.new(LustyM::simplify_path(file))
|
||||
end
|
||||
end
|
||||
else
|
||||
return []
|
||||
end
|
||||
end
|
||||
|
||||
@files_with_swaps
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
# Copyright (C) 2007-2010 Stephen Bach
|
||||
#
|
||||
# Permission is hereby granted to use and distribute this code, with or without
|
||||
# modifications, provided that this copyright notice is copied with it. Like
|
||||
# anything else that's free, this file is provided *as is* and comes with no
|
||||
# warranty of any kind, either expressed or implied. In no event will the
|
||||
# copyright holder be liable for any damages resulting from the use of this
|
||||
# software.
|
||||
|
||||
# Simplify switching between windows.
|
||||
module LustyM
|
||||
class Window
|
||||
def self.select(window)
|
||||
return true if window == $curwin
|
||||
|
||||
start = $curwin
|
||||
|
||||
# Try to select the given window.
|
||||
begin
|
||||
VIM::command "wincmd w"
|
||||
end while ($curwin != window) and ($curwin != start)
|
||||
|
||||
if $curwin == window
|
||||
return true
|
||||
else
|
||||
# Failed -- re-select the starting window.
|
||||
VIM::command("wincmd w") while $curwin != start
|
||||
VIM::pretty_msg("ErrorMsg", "Cannot find the correct window!")
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
# Copyright (C) 2010 Matt Tolton
|
||||
#
|
||||
# Permission is hereby granted to use and distribute this code, with or without
|
||||
# modifications, provided that this copyright notice is copied with it. Like
|
||||
# anything else that's free, this file is provided *as is* and comes with no
|
||||
# warranty of any kind, either expressed or implied. In no event will the
|
||||
# copyright holder be liable for any damages resulting from the use of this
|
||||
# software.
|
||||
|
||||
# Mercury fuzzy matching algorithm, written by Matt Tolton.
|
||||
# based on the Quicksilver and LiquidMetal fuzzy matching algorithms
|
||||
class Mercury
|
||||
public
|
||||
def self.score(string, abbrev)
|
||||
return self.new(string, abbrev).score()
|
||||
end
|
||||
|
||||
def score()
|
||||
return @@SCORE_TRAILING if @abbrev.empty?
|
||||
return @@SCORE_NO_MATCH if @abbrev.length > @string.length
|
||||
|
||||
raw_score = raw_score(0, 0, 0, false)
|
||||
return raw_score / @string.length
|
||||
end
|
||||
|
||||
def initialize(string, abbrev)
|
||||
@string = string
|
||||
@lower_string = string.downcase()
|
||||
@abbrev = abbrev.downcase()
|
||||
@level = 0
|
||||
@branches = 0
|
||||
end
|
||||
|
||||
private
|
||||
@@SCORE_NO_MATCH = 0.0 # do not change, this is assumed to be 0.0
|
||||
@@SCORE_EXACT_MATCH = 1.0
|
||||
@@SCORE_MATCH = 0.9
|
||||
@@SCORE_TRAILING = 0.7
|
||||
@@SCORE_TRAILING_BUT_STARTED = 0.80
|
||||
@@SCORE_BUFFER = 0.70
|
||||
@@SCORE_BUFFER_BUT_STARTED = 0.80
|
||||
|
||||
@@BRANCH_LIMIT = 100
|
||||
|
||||
#def raw_score(a, b, c, d)
|
||||
# @level += 1
|
||||
# puts "#{' ' * @level}#{a}, #{b}, #{c}, #{d}"
|
||||
# ret = recurse_and_score(a, b, c, d)
|
||||
# puts "#{' ' * @level}#{a}, #{b}, #{c}, #{d} -> #{ret}"
|
||||
# @level -= 1
|
||||
# return ret
|
||||
#end
|
||||
|
||||
def raw_score(abbrev_idx, match_idx, score_idx, first_char_matched)
|
||||
index = @lower_string.index(@abbrev[abbrev_idx], match_idx)
|
||||
return 0.0 if index.nil?
|
||||
|
||||
# TODO Instead of having two scores, should there be a sliding "match"
|
||||
# score based on the distance of the matched character to the beginning
|
||||
# of the string?
|
||||
if abbrev_idx == index
|
||||
score = @@SCORE_EXACT_MATCH
|
||||
else
|
||||
score = @@SCORE_MATCH
|
||||
end
|
||||
|
||||
started = (index == 0 or first_char_matched)
|
||||
|
||||
# If matching on a word boundary, score the characters since the last match
|
||||
if index > score_idx
|
||||
buffer_score = started ? @@SCORE_BUFFER_BUT_STARTED : @@SCORE_BUFFER
|
||||
if " \t/._-".include?(@string[index - 1])
|
||||
score += @@SCORE_MATCH
|
||||
score += buffer_score * ((index - 1) - score_idx)
|
||||
elsif @string[index] >= "A"[0] and @string[index] <= "Z"[0]
|
||||
score += buffer_score * (index - score_idx)
|
||||
end
|
||||
end
|
||||
|
||||
if abbrev_idx + 1 == @abbrev.length
|
||||
trailing_score = started ? @@SCORE_TRAILING_BUT_STARTED : @@SCORE_TRAILING
|
||||
# We just matched the last character in the pattern
|
||||
score += trailing_score * (@string.length - (index + 1))
|
||||
else
|
||||
tail_score = raw_score(abbrev_idx + 1, index + 1, index + 1, started)
|
||||
return 0.0 if tail_score == 0.0
|
||||
score += tail_score
|
||||
end
|
||||
|
||||
if @branches < @@BRANCH_LIMIT
|
||||
@branches += 1
|
||||
alternate = raw_score(abbrev_idx,
|
||||
index + 1,
|
||||
score_idx,
|
||||
first_char_matched)
|
||||
#puts "#{' ' * @level}#{score}, #{alternate}"
|
||||
score = [score, alternate].max
|
||||
end
|
||||
|
||||
return score
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1,145 +0,0 @@
|
|||
# Mercury tests, as well the quicksilver and liquidmetal algorithms which we
|
||||
# sometimes use for comparison
|
||||
|
||||
require 'mercury'
|
||||
|
||||
# Fuzzy matching algorithm from Quicksilver, the OS X tool
|
||||
def qs_score(entry, abbrev)
|
||||
return 0.9 if abbrev.length == 0
|
||||
return 0.0 if abbrev.length > entry.length
|
||||
|
||||
abbrev.length.downto(1) do |i|
|
||||
sub_abbrev = abbrev[0...i]
|
||||
index = entry.index(sub_abbrev)
|
||||
|
||||
next if index.nil?
|
||||
next if index + sub_abbrev.length > entry.length
|
||||
|
||||
next_entry = entry[index+sub_abbrev.length..-1]
|
||||
|
||||
next_abbrev = i >= abbrev.length ? "" : abbrev[i..-1]
|
||||
|
||||
remaining_score = qs_score(next_entry, next_abbrev)
|
||||
|
||||
if remaining_score > 0
|
||||
score = entry.length - next_entry.length
|
||||
|
||||
if index != 0
|
||||
c = entry[index - 1]
|
||||
word_boundaries = " \t/._"
|
||||
if word_boundaries.include?(c)
|
||||
for j in 0...(index-1)
|
||||
c = entry[j]
|
||||
score -= word_boundaries.include?(c) ? 1 : 0.15
|
||||
end
|
||||
else
|
||||
score -= index
|
||||
end
|
||||
end
|
||||
|
||||
score += remaining_score * next_entry.length
|
||||
score /= entry.length
|
||||
return score
|
||||
end
|
||||
end
|
||||
return 0.0
|
||||
end
|
||||
|
||||
# Port of Ryan McGeary's LiquidMetal fuzzy matching algorithm found at:
|
||||
# http://github.com/rmm5t/liquidmetal/tree/master.
|
||||
class LiquidMetal
|
||||
@@SCORE_NO_MATCH = 0.0
|
||||
@@SCORE_MATCH = 1.0
|
||||
@@SCORE_TRAILING = 0.8
|
||||
@@SCORE_TRAILING_BUT_STARTED = 0.90
|
||||
@@SCORE_BUFFER = 0.85
|
||||
|
||||
def self.score(string, abbrev)
|
||||
return @@SCORE_TRAILING if abbrev.empty?
|
||||
return @@SCORE_NO_MATCH if abbrev.length > string.length
|
||||
|
||||
scores = buildScoreArray(string, abbrev)
|
||||
|
||||
sum = scores.inject { |a, b| a + b }
|
||||
|
||||
return sum / scores.length;
|
||||
end
|
||||
|
||||
def self.buildScoreArray(string, abbrev)
|
||||
scores = Array.new(string.length)
|
||||
lower = string.downcase()
|
||||
|
||||
lastIndex = -1
|
||||
started = false
|
||||
|
||||
abbrev.downcase().each_byte do |c|
|
||||
index = lower.index(c, lastIndex + 1)
|
||||
return scores.fill(@@SCORE_NO_MATCH, 0..-1) if index.nil?
|
||||
started = true if index == 0
|
||||
|
||||
if index > 0 and " \t/._-".include?(string[index - 1])
|
||||
scores[index - 1] = @@SCORE_MATCH
|
||||
scores.fill(@@SCORE_BUFFER, (lastIndex + 1)...(index - 1))
|
||||
elsif string[index] >= "A"[0] and string[index] <= "Z"[0]
|
||||
scores.fill(@@SCORE_BUFFER, (lastIndex + 1)...index)
|
||||
else
|
||||
scores.fill(@@SCORE_NO_MATCH, (lastIndex + 1)...index)
|
||||
end
|
||||
|
||||
scores[index] = @@SCORE_MATCH
|
||||
lastIndex = index
|
||||
end
|
||||
|
||||
trailing_score = started ? @@SCORE_TRAILING_BUT_STARTED : @@SCORE_TRAILING
|
||||
scores.fill(trailing_score, lastIndex + 1)
|
||||
return scores
|
||||
end
|
||||
end
|
||||
|
||||
def print_score(entry, abbrev)
|
||||
old_score = LiquidMetal.score(entry, abbrev)
|
||||
new_score = Mercury.score(entry, abbrev)
|
||||
|
||||
puts "%-25s %-10s %.4f %.4f" % [entry, abbrev, old_score, new_score]
|
||||
end
|
||||
|
||||
def test(high_entry, low_entry, abbrev)
|
||||
high = Mercury.score(high_entry, abbrev)
|
||||
low = Mercury.score(low_entry, abbrev)
|
||||
puts "%-8s %-10s %-25s %.4f %-25s %.4f" % [high > low ? "PASS" : "FAIL", abbrev,
|
||||
high_entry, high, low_entry, low]
|
||||
end
|
||||
|
||||
print_score("phone numbers.txt", "phnb")
|
||||
print_score("phone numbers.txt", "pht")
|
||||
print_score("poohead.txt", "pht")
|
||||
print_score("poohead.txt", "poo")
|
||||
print_score("poohead.txt", "pood")
|
||||
print_score("foo.lua", "lua")
|
||||
print_score("lua-expression.h", "lua")
|
||||
print_score("query-dispatcher.h", "qudisp")
|
||||
print_score("query-dispatcher.cc", "qudisp")
|
||||
print_score("query-dispatcher.h", "qudisph")
|
||||
print_score("query-dispatcher.cc", "qudisph")
|
||||
print_score("query-dispatczer.h", "qudisph")
|
||||
print_score("query-dispatczer.h", "qudisp")
|
||||
print_score("aaaaaaaaaaaaaaaaaaaaaa", "aaaaaaaaa")
|
||||
print_score("query-executor.h", "exec")
|
||||
print_score("query-executor.cc", "exec")
|
||||
print_score("tablet-executor-node.h", "ten")
|
||||
print_score("materialize-executor-node.h", "ten")
|
||||
|
||||
test("protocoltype.go", "serverstatus.proto", "proto")
|
||||
test("protocoltype.go", "test.proto", "proto")
|
||||
test("protocoltype.go", "test.proto", "pr")
|
||||
test("protocoltype.go", "test.proto", "p")
|
||||
test("protocoltype.go", "test.proto", "poto")
|
||||
test("query-dispatcher.h", "query-dispatcher.cc", "qudisph")
|
||||
test("query-plan.h", "query-dispatcher.h", "qup")
|
||||
test("phone numbers.txt", "poohead.txt", "pht")
|
||||
test("tokyo.txt", "abcde.txt", "t")
|
||||
test("tablet-executor-node.h", "materialize-executor-node.h", "ten")
|
||||
test("tent.txt", "tablet-executor-node.h", "ten")
|
||||
test("tent.txt", "tablet-executor-node.h", "te")
|
||||
test("ad", "m-a", "a")
|
||||
test("a", "b", "A")
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
# Copyright (C) 2007-2010 Stephen Bach
|
||||
#
|
||||
# Permission is hereby granted to use and distribute this code, with or without
|
||||
# modifications, provided that this copyright notice is copied with it. Like
|
||||
# anything else that's free, this file is provided *as is* and comes with no
|
||||
# warranty of any kind, either expressed or implied. In no event will the
|
||||
# copyright holder be liable for any damages resulting from the use of this
|
||||
# software.
|
||||
|
||||
module VIM
|
||||
|
||||
unless const_defined? "MOST_POSITIVE_INTEGER"
|
||||
MOST_POSITIVE_INTEGER = 2**(32 - 1) - 2 # Vim ints are signed 32-bit.
|
||||
end
|
||||
|
||||
def self.zero?(var)
|
||||
# In Vim 7.2 and older, VIM::evaluate returns Strings for boolean
|
||||
# expressions; in later versions, Fixnums.
|
||||
case var
|
||||
when String
|
||||
var == "0"
|
||||
when Fixnum
|
||||
var == 0
|
||||
else
|
||||
LustyM::assert(false, "unexpected type: #{var.class}")
|
||||
end
|
||||
end
|
||||
|
||||
def self.nonzero?(var)
|
||||
not zero?(var)
|
||||
end
|
||||
|
||||
def self.evaluate_bool(var)
|
||||
nonzero? evaluate(var)
|
||||
end
|
||||
|
||||
def self.exists?(s)
|
||||
nonzero? evaluate("exists('#{s}')")
|
||||
end
|
||||
|
||||
def self.has_syntax?
|
||||
nonzero? evaluate('has("syntax")')
|
||||
end
|
||||
|
||||
def self.columns
|
||||
evaluate("&columns").to_i
|
||||
end
|
||||
|
||||
def self.lines
|
||||
evaluate("&lines").to_i
|
||||
end
|
||||
|
||||
def self.getcwd
|
||||
evaluate("getcwd()")
|
||||
end
|
||||
|
||||
def self.bufname(i)
|
||||
if evaluate_bool("empty(bufname(#{i}))")
|
||||
"<Unknown #{i}>"
|
||||
else
|
||||
evaluate("bufname(#{i})")
|
||||
end
|
||||
end
|
||||
|
||||
def self.single_quote_escape(s)
|
||||
# Everything in a Vim single-quoted string is literal, except single
|
||||
# quotes. Single quotes are escaped by doubling them.
|
||||
s.gsub("'", "''")
|
||||
end
|
||||
|
||||
def self.filename_escape(s)
|
||||
# Escape slashes, open square braces, spaces, sharps, and double quotes.
|
||||
s.gsub(/\\/, '\\\\\\').gsub(/[\[ #"]/, '\\\\\0')
|
||||
end
|
||||
|
||||
def self.regex_escape(s)
|
||||
s.gsub(/[\]\[.~"^$\\*]/,'\\\\\0')
|
||||
end
|
||||
|
||||
class Buffer
|
||||
def modified?
|
||||
VIM::nonzero? VIM::evaluate("getbufvar(#{number()}, '&modified')")
|
||||
end
|
||||
|
||||
def listed?
|
||||
VIM::nonzero? VIM::evaluate("getbufvar(#{number()}, '&buflisted')")
|
||||
end
|
||||
|
||||
def self.obj_for_bufnr(n)
|
||||
# There's gotta be a better way to do this...
|
||||
(0..VIM::Buffer.count-1).each do |i|
|
||||
obj = VIM::Buffer[i]
|
||||
return obj if obj.number == n
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
# Print with colours
|
||||
def self.pretty_msg(*rest)
|
||||
return if rest.length == 0
|
||||
return if rest.length % 2 != 0
|
||||
|
||||
command "redraw" # see :help echo-redraw
|
||||
i = 0
|
||||
while i < rest.length do
|
||||
command "echohl #{rest[i]}"
|
||||
command "echon '#{rest[i+1]}'"
|
||||
i += 2
|
||||
end
|
||||
|
||||
command 'echohl None'
|
||||
end
|
||||
end
|
||||
|
||||
# Hack for wide CJK characters.
|
||||
if VIM::exists?("*strwidth")
|
||||
module VIM
|
||||
def self.strwidth(s)
|
||||
# strwidth() is defined in Vim 7.3.
|
||||
evaluate("strwidth('#{single_quote_escape(s)}')").to_i
|
||||
end
|
||||
end
|
||||
else
|
||||
module VIM
|
||||
def self.strwidth(s)
|
||||
s.length
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
spawn $env(VIEW) -N --noplugin -u ../vimrc
|
||||
set timeout 3
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
"VIM - Vi IMproved"
|
||||
}
|
||||
send ":LustyBufferExplorer\r"
|
||||
# Launching should not have caused a backtrace and "Press ENTER ..." message
|
||||
expect {
|
||||
"Changing a readonly file" {exit 1}
|
||||
"Error detected" {exit 1}
|
||||
"Press ENTER" {exit 1}
|
||||
timeout {exit 1}
|
||||
">>"
|
||||
}
|
||||
|
||||
# ESC
|
||||
send \033
|
||||
send ":q\r"
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
eof
|
||||
}
|
||||
exit 0
|
||||
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
spawn $env(VIM) -N --noplugin -u ../vimrc
|
||||
set timeout 3
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
"VIM - Vi IMproved"
|
||||
}
|
||||
send ":LustyBufferExplorer\r"
|
||||
# Launching should not have caused a backtrace and "Press ENTER ..." message
|
||||
expect {
|
||||
"Press ENTER" {exit 1}
|
||||
"Error" {exit 1}
|
||||
"Warning" {exit 1}
|
||||
timeout {exit 1}
|
||||
">>"
|
||||
}
|
||||
|
||||
# ESC
|
||||
send \033
|
||||
send ":q\r"
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
eof
|
||||
}
|
||||
exit 0
|
||||
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
spawn $env(VIM) -N --noplugin -u ../vimrc
|
||||
set timeout 3
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
"VIM - Vi IMproved"
|
||||
}
|
||||
send ":LustyBufferGrep\r"
|
||||
# Launching should not have caused a backtrace and "Press ENTER ..." message
|
||||
expect {
|
||||
"Press ENTER" {exit 1}
|
||||
"Error" {exit 1}
|
||||
"Warning" {exit 1}
|
||||
timeout {exit 1}
|
||||
">>"
|
||||
}
|
||||
|
||||
# ESC
|
||||
send \033
|
||||
send ":q\r"
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
eof
|
||||
}
|
||||
exit 0
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
bar***
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
spawn $env(VIM) -N --noplugin -u ../vimrc
|
||||
set timeout 3
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
"VIM - Vi IMproved"
|
||||
}
|
||||
send ":e foo\r"
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
"foo###" # Success
|
||||
}
|
||||
|
||||
send ":e bar\r"
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
"bar***" # Success
|
||||
}
|
||||
|
||||
send "otypingblah"
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
"typingblah" # Success
|
||||
}
|
||||
|
||||
# ESC
|
||||
send \033
|
||||
|
||||
send ":LustyBufferExplorer\r"
|
||||
expect {
|
||||
"Press ENTER" {exit 1}
|
||||
"Error" {exit 1}
|
||||
"Warning" {exit 1}
|
||||
timeout {exit 1}
|
||||
"\[+]" # Success
|
||||
}
|
||||
|
||||
send \033
|
||||
|
||||
send ":qa!\r"
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
eof
|
||||
}
|
||||
exit 0
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
foo###
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
spawn $env(VIM) -N --noplugin -u ../vimrc
|
||||
set timeout 3
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
"VIM - Vi IMproved"
|
||||
}
|
||||
send ":LustyFilesystemExplorer\r"
|
||||
expect ">>"
|
||||
send "random-file/"
|
||||
# Should not have caused a backtrace and "Press ENTER ..." message
|
||||
expect {
|
||||
"Press ENTER" {exit 1}
|
||||
timeout {exit 1}
|
||||
"NO MATCHES" # Success
|
||||
}
|
||||
|
||||
# ESC
|
||||
send \033
|
||||
send ":q\r"
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
eof
|
||||
}
|
||||
exit 0
|
||||
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
spawn $env(VIEW) -N --noplugin -u ../vimrc
|
||||
set timeout 3
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
"VIM - Vi IMproved"
|
||||
}
|
||||
send ":LustyFilesystemExplorerFromHere\r"
|
||||
# Launching should not have caused a backtrace and "Press ENTER ..." message
|
||||
expect {
|
||||
"Changing a readonly file" {exit 1}
|
||||
"Press ENTER" {exit 1}
|
||||
"Error" {exit 1}
|
||||
"Warning" {exit 1}
|
||||
timeout {exit 1}
|
||||
">>"
|
||||
}
|
||||
|
||||
# ESC
|
||||
send \033
|
||||
send ":q\r"
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
eof
|
||||
}
|
||||
exit 0
|
||||
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
spawn $env(VIM) -N --noplugin -u ../vimrc
|
||||
set timeout 3
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
"VIM - Vi IMproved"
|
||||
}
|
||||
send ":LustyFilesystemExplorerFromHere\r"
|
||||
# Launching should not have caused a backtrace and "Press ENTER ..." message
|
||||
expect {
|
||||
"Press ENTER" {exit 1}
|
||||
"Error" {exit 1}
|
||||
"Warning" {exit 1}
|
||||
timeout {exit 1}
|
||||
">>"
|
||||
}
|
||||
|
||||
# ESC
|
||||
send \033
|
||||
send ":q\r"
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
eof
|
||||
}
|
||||
exit 0
|
||||
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
spawn $env(VIEW) -N --noplugin -u ../vimrc
|
||||
set timeout 3
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
"VIM - Vi IMproved"
|
||||
}
|
||||
send ":LustyFilesystemExplorer\r"
|
||||
# Launching should not have caused a backtrace and "Press ENTER ..." message
|
||||
expect {
|
||||
"Changing a readonly file" {exit 1}
|
||||
"Press ENTER" {exit 1}
|
||||
"Error" {exit 1}
|
||||
"Warning" {exit 1}
|
||||
timeout {exit 1}
|
||||
">>"
|
||||
}
|
||||
|
||||
# ESC
|
||||
send \033
|
||||
send ":q\r"
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
eof
|
||||
}
|
||||
exit 0
|
||||
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
spawn $env(VIM) -N --noplugin -u ../vimrc
|
||||
set timeout 3
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
"VIM - Vi IMproved"
|
||||
}
|
||||
send ":LustyFilesystemExplorer\r"
|
||||
# Launching should not have caused a backtrace and "Press ENTER ..." message
|
||||
expect {
|
||||
"Press ENTER" {exit 1}
|
||||
"Error" {exit 1}
|
||||
"Warning" {exit 1}
|
||||
timeout {exit 1}
|
||||
">>"
|
||||
}
|
||||
|
||||
# ESC
|
||||
send \033
|
||||
send ":q\r"
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
eof
|
||||
}
|
||||
exit 0
|
||||
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
spawn $env(VIM) -N --noplugin -u ../vimrc
|
||||
set timeout 3
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
"VIM - Vi IMproved"
|
||||
}
|
||||
send ":e file-name-abc\r"
|
||||
send ":e file-name-def\r"
|
||||
send ":LustyJuggler\r"
|
||||
# Launching should not have caused a backtrace and "Press ENTER ..." message
|
||||
expect {
|
||||
"Press ENTER" {exit 1}
|
||||
"Error" {exit 1}
|
||||
"Warning" {exit 1}
|
||||
timeout {exit 1}
|
||||
"file-name-abc"
|
||||
}
|
||||
|
||||
# Choose and open second entry
|
||||
send "ss"
|
||||
expect {
|
||||
"Press ENTER" {exit 1}
|
||||
"Error" {exit 1}
|
||||
"Warning" {exit 1}
|
||||
timeout {exit 1}
|
||||
"inside abc"
|
||||
}
|
||||
|
||||
send ":q\r"
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
eof
|
||||
}
|
||||
exit 0
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
inside abc
|
||||
|
|
@ -1 +0,0 @@
|
|||
inside def
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
spawn $env(VIM) -N --noplugin -u ../vimrc
|
||||
set timeout 3
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
"VIM - Vi IMproved"
|
||||
}
|
||||
|
||||
# Open >10 files
|
||||
send ":e file-name-abc\r"
|
||||
send ":e file-name-def\r"
|
||||
send ":e file-name-ghi\r"
|
||||
send ":e file-name-jkl\r"
|
||||
send ":e file-name-mno\r"
|
||||
send ":e file-name-pqr\r"
|
||||
send ":e file-name-stu\r"
|
||||
send ":e file-name-vwx\r"
|
||||
send ":e file-name-yza\r"
|
||||
send ":e file-name-bcd\r"
|
||||
send ":e file-name-efg\r"
|
||||
send ":e file-name-hij\r"
|
||||
|
||||
send ":LustyJuggler\r"
|
||||
expect {
|
||||
"Press ENTER" {exit 1}
|
||||
"Error" {exit 1}
|
||||
"Warning" {exit 1}
|
||||
timeout {exit 1}
|
||||
"file-name-hij"
|
||||
}
|
||||
|
||||
# Choose and open last entry
|
||||
send ";;"
|
||||
expect {
|
||||
"Press ENTER" {exit 1}
|
||||
"Error" {exit 1}
|
||||
"Warning" {exit 1}
|
||||
timeout {exit 1}
|
||||
"\"file-name-ghi\""
|
||||
}
|
||||
|
||||
send ":LustyJuggler\r"
|
||||
expect {
|
||||
"Press ENTER" {exit 1}
|
||||
"Error" {exit 1}
|
||||
"Warning" {exit 1}
|
||||
timeout {exit 1}
|
||||
"file-name-hij"
|
||||
}
|
||||
|
||||
# Choose and open last entry
|
||||
send ";;"
|
||||
expect {
|
||||
"Press ENTER" {exit 1}
|
||||
"Error" {exit 1}
|
||||
"Warning" {exit 1}
|
||||
timeout {exit 1}
|
||||
"\"file-name-jkl\""
|
||||
}
|
||||
|
||||
send ":LustyJuggler\r"
|
||||
expect {
|
||||
"Press ENTER" {exit 1}
|
||||
"Error" {exit 1}
|
||||
"Warning" {exit 1}
|
||||
timeout {exit 1}
|
||||
"file-name-hij"
|
||||
}
|
||||
|
||||
# Choose and open sixth entry
|
||||
send "hh"
|
||||
expect {
|
||||
"Press ENTER" {exit 1}
|
||||
"Error" {exit 1}
|
||||
"Warning" {exit 1}
|
||||
timeout {exit 1}
|
||||
"\"file-name-yza\""
|
||||
}
|
||||
|
||||
send ":q\r"
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
eof
|
||||
}
|
||||
exit 0
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
inside abc
|
||||
|
|
@ -1 +0,0 @@
|
|||
inside bcd
|
||||
|
|
@ -1 +0,0 @@
|
|||
inside def
|
||||
|
|
@ -1 +0,0 @@
|
|||
inside efg
|
||||
|
|
@ -1 +0,0 @@
|
|||
inside ghi
|
||||
|
|
@ -1 +0,0 @@
|
|||
inside hij
|
||||
|
|
@ -1 +0,0 @@
|
|||
inside jkl
|
||||
|
|
@ -1 +0,0 @@
|
|||
inside mno
|
||||
|
|
@ -1 +0,0 @@
|
|||
inside pqr
|
||||
|
|
@ -1 +0,0 @@
|
|||
inside stu
|
||||
|
|
@ -1 +0,0 @@
|
|||
inside vwx
|
||||
|
|
@ -1 +0,0 @@
|
|||
inside yza
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
spawn $env(VIM) -N --noplugin -u ../vimrc
|
||||
set timeout 3
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
"VIM - Vi IMproved"
|
||||
}
|
||||
send ":LustyJuggler\r"
|
||||
# Launching should not have caused a backtrace and "Press ENTER ..." message
|
||||
expect {
|
||||
"Press ENTER" {exit 1}
|
||||
"Error" {exit 1}
|
||||
"Warning" {exit 1}
|
||||
timeout {exit 1}
|
||||
"No other buffers"
|
||||
}
|
||||
|
||||
send ":q\r"
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
eof
|
||||
}
|
||||
exit 0
|
||||
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
spawn $env(VIM) -N --noplugin -u ../vimrc
|
||||
set timeout 3
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
"VIM - Vi IMproved"
|
||||
}
|
||||
send ":e file-name-abc\r"
|
||||
send ":e file-name-def\r"
|
||||
send ":LustyJuggler\r"
|
||||
# Launching should not have caused a backtrace and "Press ENTER ..." message
|
||||
expect {
|
||||
"Press ENTER" {exit 1}
|
||||
"Error" {exit 1}
|
||||
"Warning" {exit 1}
|
||||
timeout {exit 1}
|
||||
"file-name-abc"
|
||||
}
|
||||
|
||||
# Choose and open second entry
|
||||
send "22"
|
||||
expect {
|
||||
"Press ENTER" {exit 1}
|
||||
"Error" {exit 1}
|
||||
"Warning" {exit 1}
|
||||
timeout {exit 1}
|
||||
"inside abc"
|
||||
}
|
||||
|
||||
send ":q\r"
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
eof
|
||||
}
|
||||
exit 0
|
||||
|
||||
|
|
@ -1 +0,0 @@
|
|||
inside abc
|
||||
|
|
@ -1 +0,0 @@
|
|||
inside def
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
spawn $env(VIM) -N --noplugin -u ../vimrc
|
||||
set timeout 3
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
"VIM - Vi IMproved"
|
||||
}
|
||||
send ":e file-name-abc\r"
|
||||
send ":e file-name-def\r"
|
||||
send ":LustyJuggler\r"
|
||||
# Launching should not have caused a backtrace and "Press ENTER ..." message
|
||||
expect {
|
||||
"Press ENTER" {exit 1}
|
||||
"Error" {exit 1}
|
||||
"Warning" {exit 1}
|
||||
timeout {exit 1}
|
||||
"file-name-abc"
|
||||
}
|
||||
|
||||
# Choose and open 10th entry -- should be second entry.
|
||||
send ";;"
|
||||
expect {
|
||||
"Press ENTER" {exit 1}
|
||||
"Error" {exit 1}
|
||||
"Warning" {exit 1}
|
||||
timeout {exit 1}
|
||||
"inside abc"
|
||||
}
|
||||
|
||||
send ":q\r"
|
||||
expect {
|
||||
timeout {exit 1}
|
||||
eof
|
||||
}
|
||||
exit 0
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue