update vim install to use fzf instead of ctrl p/buf explorer
This commit is contained in:
parent
b0a80da9ac
commit
4904f22fd9
41 changed files with 11 additions and 10791 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -7,3 +7,6 @@
|
||||||
[submodule "my_plugins/vim-snazzy"]
|
[submodule "my_plugins/vim-snazzy"]
|
||||||
path = my_plugins/vim-snazzy
|
path = my_plugins/vim-snazzy
|
||||||
url = git@github.com:connorholyday/vim-snazzy.git
|
url = git@github.com:connorholyday/vim-snazzy.git
|
||||||
|
[submodule "my_plugins/fzf.vim"]
|
||||||
|
path = my_plugins/fzf.vim
|
||||||
|
url = https://github.com/junegunn/fzf.vim.git
|
||||||
|
|
|
@ -14,5 +14,4 @@ set shiftwidth=2
|
||||||
set tabstop=2
|
set tabstop=2
|
||||||
set nofoldenable
|
set nofoldenable
|
||||||
map <C-W>` gg=G<C-o><C-o>
|
map <C-W>` gg=G<C-o><C-o>
|
||||||
cnoreabbrev Ack Ack!
|
nnoremap <C-f> :Files<Cr>
|
||||||
nnoremap <Leader>g :Ack!<Space>
|
|
||||||
|
|
1
my_plugins/fzf.vim
Submodule
1
my_plugins/fzf.vim
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 91ed5f4b39b6e4a2ca50be1c8cec7e1148145fab
|
1
sources_non_forked/ack.vim/.gitignore
vendored
1
sources_non_forked/ack.vim/.gitignore
vendored
|
@ -1 +0,0 @@
|
||||||
tags
|
|
|
@ -1,89 +0,0 @@
|
||||||
ack.vim is distributed under the same license terms as Vim itself, which you
|
|
||||||
can find in full with `:help license` within Vim, or copied in full herein.
|
|
||||||
|
|
||||||
Copyright (c) 2007-2015 Antoine Imbert <antoine.imbert+ackvim@gmail.com>
|
|
||||||
and contributors.
|
|
||||||
|
|
||||||
Maintainers may be contacted via GitHub Issues at:
|
|
||||||
|
|
||||||
https://github.com/mileszs/ack.vim/issues
|
|
||||||
|
|
||||||
|
|
||||||
VIM LICENSE
|
|
||||||
|
|
||||||
I) There are no restrictions on distributing unmodified copies of Vim except
|
|
||||||
that they must include this license text. You can also distribute
|
|
||||||
unmodified parts of Vim, likewise unrestricted except that they must
|
|
||||||
include this license text. You are also allowed to include executables
|
|
||||||
that you made from the unmodified Vim sources, plus your own usage
|
|
||||||
examples and Vim scripts.
|
|
||||||
|
|
||||||
II) It is allowed to distribute a modified (or extended) version of Vim,
|
|
||||||
including executables and/or source code, when the following four
|
|
||||||
conditions are met:
|
|
||||||
1) This license text must be included unmodified.
|
|
||||||
2) The modified Vim must be distributed in one of the following five ways:
|
|
||||||
a) If you make changes to Vim yourself, you must clearly describe in
|
|
||||||
the distribution how to contact you. When the maintainer asks you
|
|
||||||
(in any way) for a copy of the modified Vim you distributed, you
|
|
||||||
must make your changes, including source code, available to the
|
|
||||||
maintainer without fee. The maintainer reserves the right to
|
|
||||||
include your changes in the official version of Vim. What the
|
|
||||||
maintainer will do with your changes and under what license they
|
|
||||||
will be distributed is negotiable. If there has been no negotiation
|
|
||||||
then this license, or a later version, also applies to your changes.
|
|
||||||
The current maintainer is Bram Moolenaar <Bram@vim.org>. If this
|
|
||||||
changes it will be announced in appropriate places (most likely
|
|
||||||
vim.sf.net, www.vim.org and/or comp.editors). When it is completely
|
|
||||||
impossible to contact the maintainer, the obligation to send him
|
|
||||||
your changes ceases. Once the maintainer has confirmed that he has
|
|
||||||
received your changes they will not have to be sent again.
|
|
||||||
b) If you have received a modified Vim that was distributed as
|
|
||||||
mentioned under a) you are allowed to further distribute it
|
|
||||||
unmodified, as mentioned at I). If you make additional changes the
|
|
||||||
text under a) applies to those changes.
|
|
||||||
c) Provide all the changes, including source code, with every copy of
|
|
||||||
the modified Vim you distribute. This may be done in the form of a
|
|
||||||
context diff. You can choose what license to use for new code you
|
|
||||||
add. The changes and their license must not restrict others from
|
|
||||||
making their own changes to the official version of Vim.
|
|
||||||
d) When you have a modified Vim which includes changes as mentioned
|
|
||||||
under c), you can distribute it without the source code for the
|
|
||||||
changes if the following three conditions are met:
|
|
||||||
- The license that applies to the changes permits you to distribute
|
|
||||||
the changes to the Vim maintainer without fee or restriction, and
|
|
||||||
permits the Vim maintainer to include the changes in the official
|
|
||||||
version of Vim without fee or restriction.
|
|
||||||
- You keep the changes for at least three years after last
|
|
||||||
distributing the corresponding modified Vim. When the maintainer
|
|
||||||
or someone who you distributed the modified Vim to asks you (in
|
|
||||||
any way) for the changes within this period, you must make them
|
|
||||||
available to him.
|
|
||||||
- You clearly describe in the distribution how to contact you. This
|
|
||||||
contact information must remain valid for at least three years
|
|
||||||
after last distributing the corresponding modified Vim, or as long
|
|
||||||
as possible.
|
|
||||||
e) When the GNU General Public License (GPL) applies to the changes,
|
|
||||||
you can distribute the modified Vim under the GNU GPL version 2 or
|
|
||||||
any later version.
|
|
||||||
3) A message must be added, at least in the output of the ":version"
|
|
||||||
command and in the intro screen, such that the user of the modified Vim
|
|
||||||
is able to see that it was modified. When distributing as mentioned
|
|
||||||
under 2)e) adding the message is only required for as far as this does
|
|
||||||
not conflict with the license used for the changes.
|
|
||||||
4) The contact information as required under 2)a) and 2)d) must not be
|
|
||||||
removed or changed, except that the person himself can make
|
|
||||||
corrections.
|
|
||||||
|
|
||||||
III) If you distribute a modified version of Vim, you are encouraged to use
|
|
||||||
the Vim license for your changes and make them available to the
|
|
||||||
maintainer, including the source code. The preferred way to do this is
|
|
||||||
by e-mail or by uploading the files to a server and e-mailing the URL.
|
|
||||||
If the number of changes is small (e.g., a modified Makefile) e-mailing a
|
|
||||||
context diff will do. The e-mail address to be used is
|
|
||||||
<maintainer@vim.org>
|
|
||||||
|
|
||||||
IV) It is not allowed to remove this license from the distribution of the Vim
|
|
||||||
sources, parts of it or from a modified version. You may use this
|
|
||||||
license for previous Vim releases instead of the license that they came
|
|
||||||
with, at your option.
|
|
|
@ -1,163 +0,0 @@
|
||||||
# ack.vim
|
|
||||||
|
|
||||||
Run your favorite search tool from Vim, with an enhanced results list.
|
|
||||||
|
|
||||||
This plugin was designed as a Vim frontend for the programmer's search tool
|
|
||||||
[ack]. ack can be used as a replacement for 99% of the uses of `grep`. The
|
|
||||||
plugin allows you to search with ack from within Vim and shows the results in a
|
|
||||||
split window.
|
|
||||||
|
|
||||||
But here's a little secret for the Vim-seasoned: it's just a light wrapper for
|
|
||||||
Vim's [grepprg] and the [quickfix] window for match results. This makes it easy
|
|
||||||
to integrate with your own Vim configuration and use existing knowledge of core
|
|
||||||
features. It also means the plugin is flexible to use with other search tools.
|
|
||||||
|
|
||||||
[grepprg]: http://vimdoc.sourceforge.net/htmldoc/options.html#'grepprg'
|
|
||||||
[quickfix]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
### ack
|
|
||||||
|
|
||||||
You will need ack (>= 2.0), of course. To install it follow the
|
|
||||||
[manual](http://beyondgrep.com/install/).
|
|
||||||
|
|
||||||
### The Plugin
|
|
||||||
|
|
||||||
It is recommended to use one of the popular plugin managers for Vim. There are
|
|
||||||
many and you probably already have a preferred one, but a few examples for your
|
|
||||||
copy-and-paste convenience:
|
|
||||||
|
|
||||||
#### Pathogen
|
|
||||||
|
|
||||||
$ git clone https://github.com/mileszs/ack.vim.git ~/.vim/bundle/ack.vim
|
|
||||||
|
|
||||||
#### Vundle
|
|
||||||
|
|
||||||
```vim
|
|
||||||
Plugin 'mileszs/ack.vim'
|
|
||||||
```
|
|
||||||
|
|
||||||
#### NeoBundle
|
|
||||||
|
|
||||||
```vim
|
|
||||||
NeoBundle 'mileszs/ack.vim'
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Manual (not recommended)
|
|
||||||
|
|
||||||
[Download][releases] the plugin and extract it in `~/.vim/` (or
|
|
||||||
`%PROGRAMFILES%/Vim/vimfiles` on Windows).
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
:Ack [options] {pattern} [{directories}]
|
|
||||||
|
|
||||||
Search recursively in `{directories}` (which defaults to the current directory)
|
|
||||||
for the `{pattern}`.
|
|
||||||
|
|
||||||
Files containing the search term will be listed in the quickfix 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 `:help Ack`
|
|
||||||
after installing, or [`doc/ack.txt`][doc] in the repo, for more information.)
|
|
||||||
|
|
||||||
For more ack help see [ack documentation](http://beyondgrep.com/documentation/).
|
|
||||||
|
|
||||||
[doc]: https://github.com/mileszs/ack.vim/blob/master/doc/ack.txt
|
|
||||||
|
|
||||||
### Keyboard Shortcuts
|
|
||||||
|
|
||||||
The quickfix results window is augmented with these convenience mappings:
|
|
||||||
|
|
||||||
? a quick summary of these keys, repeat to close
|
|
||||||
o to open (same as Enter)
|
|
||||||
O to open and close the quickfix window
|
|
||||||
go to preview file, open but maintain focus on ack.vim results
|
|
||||||
t to open in new tab
|
|
||||||
T to open in new tab without moving to it
|
|
||||||
h to open in horizontal split
|
|
||||||
H to open in horizontal split, keeping focus on the results
|
|
||||||
v to open in vertical split
|
|
||||||
gv to open in vertical split, keeping focus on the results
|
|
||||||
q to close the quickfix window
|
|
||||||
|
|
||||||
### Gotchas
|
|
||||||
|
|
||||||
To search for a pattern that contains whitespace, you need to enclose the
|
|
||||||
pattern in single quotes. For example: `:Ack 'foo bar'` to search for
|
|
||||||
'foo bar'.
|
|
||||||
|
|
||||||
Some characters have special meaning, and need to be escaped in your search
|
|
||||||
pattern. For instance, `#`. You need to escape it with `:Ack '\\\#define
|
|
||||||
foo'` to search for '#define foo'. See [issue #5].
|
|
||||||
|
|
||||||
[issue #5]: https://github.com/mileszs/ack.vim/issues/5
|
|
||||||
|
|
||||||
## Possibly FAQ
|
|
||||||
|
|
||||||
#### Can I use `ag` ([The Silver Searcher]) with this?
|
|
||||||
|
|
||||||
Absolutely, and probably other tools if their output is similar or you can
|
|
||||||
write a pattern match for it--just set `g:ackprg`. If you like, you can fall
|
|
||||||
back to Ack in case you use your vimrc on a system without Ag available:
|
|
||||||
|
|
||||||
```vim
|
|
||||||
if executable('ag')
|
|
||||||
let g:ackprg = 'ag --vimgrep'
|
|
||||||
endif
|
|
||||||
```
|
|
||||||
|
|
||||||
Since Ack is quite portable you might check a copy of it into your dotfiles
|
|
||||||
repository in `~/bin` so you'll nearly always have it available.
|
|
||||||
|
|
||||||
#### What's the difference from ag.vim?
|
|
||||||
|
|
||||||
Well... not a lot really.
|
|
||||||
|
|
||||||
Present maintainer, yours truly, [kind of wishes they never forked][sadface],
|
|
||||||
contributes to both, and wouldn't mind seeing them merged again. ag.vim got a
|
|
||||||
nice code clean-up (which ack.vim is now hopefully getting), and ack.vim picked
|
|
||||||
up a few features that haven't made their way to ag.vim, like `:AckWindow`,
|
|
||||||
optional background search execution with [vim-dispatch], and auto-previewing.
|
|
||||||
|
|
||||||
#### I don't want to jump to the first result automatically. ####
|
|
||||||
|
|
||||||
Use `:Ack!`, with bang. If you want this behavior most of the time, you might
|
|
||||||
like an abbreviation or mapping in your personal config, something like these:
|
|
||||||
|
|
||||||
```vim
|
|
||||||
cnoreabbrev Ack Ack!
|
|
||||||
nnoremap <Leader>a :Ack!<Space>
|
|
||||||
```
|
|
||||||
|
|
||||||
Most of the `:[L]Ack*` commands support this. Note that this behavior follows
|
|
||||||
the convention of Vim's built-in `:grep` and `:make` commands.
|
|
||||||
|
|
||||||
[The Silver Searcher]: https://github.com/ggreer/the_silver_searcher
|
|
||||||
[sadface]: https://github.com/mileszs/ack.vim/commit/d97090fb502d40229e6976dfec0e06636ba227d5#commitcomment-5771145
|
|
||||||
|
|
||||||
## Changelog
|
|
||||||
|
|
||||||
Please see [the GitHub releases page][releases].
|
|
||||||
|
|
||||||
## Credits
|
|
||||||
|
|
||||||
This plugin is derived from Antoine Imbert's blog post [ack and Vim
|
|
||||||
Integration][] (in particular, the function in the update to the post). [Miles
|
|
||||||
Sterrett][mileszs] packaged it up as a plugin and documented it in Vim's help
|
|
||||||
format, and since then [many contributors][contributors] have submitted
|
|
||||||
enhancements and fixes.
|
|
||||||
|
|
||||||
And of course, where would we be without [ack]. And, you know, Vim.
|
|
||||||
|
|
||||||
[ack and Vim Integration]: http://blog.ant0ine.com/typepad/2007/03/ack-and-vim-integration.html
|
|
||||||
[mileszs]: https://github.com/mileszs
|
|
||||||
[contributors]: https://github.com/mileszs/ack.vim/graphs/contributors
|
|
||||||
[ack]: http://beyondgrep.com/
|
|
||||||
|
|
||||||
[vim-dispatch]: https://github.com/tpope/vim-dispatch
|
|
||||||
[releases]: https://github.com/mileszs/ack.vim/releases
|
|
|
@ -1,246 +0,0 @@
|
||||||
if exists('g:autoloaded_ack') || &cp
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
if exists('g:ack_use_dispatch')
|
|
||||||
if g:ack_use_dispatch && !exists(':Dispatch')
|
|
||||||
call s:Warn('Dispatch not loaded! Falling back to g:ack_use_dispatch = 0.')
|
|
||||||
let g:ack_use_dispatch = 0
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
let g:ack_use_dispatch = 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
"-----------------------------------------------------------------------------
|
|
||||||
" Public API
|
|
||||||
"-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function! ack#Ack(cmd, args) "{{{
|
|
||||||
call s:Init(a:cmd)
|
|
||||||
redraw
|
|
||||||
|
|
||||||
" Local values that we'll temporarily set as options when searching
|
|
||||||
let l:grepprg = g:ackprg
|
|
||||||
let l:grepformat = '%f:%l:%c:%m,%f:%l:%m' " Include column number
|
|
||||||
|
|
||||||
" Strip some options that are meaningless for path search and set match
|
|
||||||
" format accordingly.
|
|
||||||
if s:SearchingFilepaths()
|
|
||||||
let l:grepprg = substitute(l:grepprg, '-H\|--column', '', 'g')
|
|
||||||
let l:grepformat = '%f'
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Check user policy for blank searches
|
|
||||||
if empty(a:args)
|
|
||||||
if !g:ack_use_cword_for_empty_search
|
|
||||||
echo "No regular expression found."
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If no pattern is provided, search for the word under the cursor
|
|
||||||
let l:grepargs = empty(a:args) ? expand("<cword>") : a:args . join(a:000, ' ')
|
|
||||||
|
|
||||||
"Bypass search if cursor is on blank string
|
|
||||||
if l:grepargs == ""
|
|
||||||
echo "No regular expression found."
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
" NOTE: we escape special chars, but not everything using shellescape to
|
|
||||||
" allow for passing arguments etc
|
|
||||||
let l:escaped_args = escape(l:grepargs, '|#%')
|
|
||||||
|
|
||||||
echo "Searching ..."
|
|
||||||
|
|
||||||
if g:ack_use_dispatch
|
|
||||||
call s:SearchWithDispatch(l:grepprg, l:escaped_args, l:grepformat)
|
|
||||||
else
|
|
||||||
call s:SearchWithGrep(a:cmd, l:grepprg, l:escaped_args, l:grepformat)
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Dispatch has no callback mechanism currently, we just have to display the
|
|
||||||
" list window early and wait for it to populate :-/
|
|
||||||
call ack#ShowResults()
|
|
||||||
call s:Highlight(l:grepargs)
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
function! ack#AckFromSearch(cmd, args) "{{{
|
|
||||||
let search = getreg('/')
|
|
||||||
" translate vim regular expression to perl regular expression.
|
|
||||||
let search = substitute(search, '\(\\<\|\\>\)', '\\b', 'g')
|
|
||||||
call ack#Ack(a:cmd, '"' . search . '" ' . a:args)
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
function! ack#AckHelp(cmd, args) "{{{
|
|
||||||
let args = a:args . ' ' . s:GetDocLocations()
|
|
||||||
call ack#Ack(a:cmd, args)
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
function! ack#AckWindow(cmd, args) "{{{
|
|
||||||
let files = tabpagebuflist()
|
|
||||||
|
|
||||||
" remove duplicated filenames (files appearing in more than one window)
|
|
||||||
let files = filter(copy(sort(files)), 'index(files,v:val,v:key+1)==-1')
|
|
||||||
call map(files, "bufname(v:val)")
|
|
||||||
|
|
||||||
" remove unnamed buffers as quickfix (empty strings before shellescape)
|
|
||||||
call filter(files, 'v:val != ""')
|
|
||||||
|
|
||||||
" expand to full path (avoid problems with cd/lcd in au QuickFixCmdPre)
|
|
||||||
let files = map(files, "shellescape(fnamemodify(v:val, ':p'))")
|
|
||||||
let args = a:args . ' ' . join(files)
|
|
||||||
|
|
||||||
call ack#Ack(a:cmd, args)
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
function! ack#ShowResults() "{{{
|
|
||||||
let l:handler = s:UsingLocList() ? g:ack_lhandler : g:ack_qhandler
|
|
||||||
execute l:handler
|
|
||||||
call s:ApplyMappings()
|
|
||||||
redraw!
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
"-----------------------------------------------------------------------------
|
|
||||||
" Private API
|
|
||||||
"-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function! s:ApplyMappings() "{{{
|
|
||||||
if !s:UsingListMappings() || &filetype != 'qf'
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:wintype = s:UsingLocList() ? 'l' : 'c'
|
|
||||||
let l:closemap = ':' . l:wintype . 'close<CR>'
|
|
||||||
let g:ack_mappings.q = l:closemap
|
|
||||||
|
|
||||||
nnoremap <buffer> <silent> ? :call <SID>QuickHelp()<CR>
|
|
||||||
|
|
||||||
if g:ack_autoclose
|
|
||||||
" We just map the 'go' and 'gv' mappings to close on autoclose, wtf?
|
|
||||||
for key_map in items(g:ack_mappings)
|
|
||||||
execute printf("nnoremap <buffer> <silent> %s %s", get(key_map, 0), get(key_map, 1) . l:closemap)
|
|
||||||
endfor
|
|
||||||
|
|
||||||
execute "nnoremap <buffer> <silent> <CR> <CR>" . l:closemap
|
|
||||||
else
|
|
||||||
for key_map in items(g:ack_mappings)
|
|
||||||
execute printf("nnoremap <buffer> <silent> %s %s", get(key_map, 0), get(key_map, 1))
|
|
||||||
endfor
|
|
||||||
endif
|
|
||||||
|
|
||||||
if exists("g:ackpreview") " if auto preview in on, remap j and k keys
|
|
||||||
nnoremap <buffer> <silent> j j<CR><C-W><C-P>
|
|
||||||
nnoremap <buffer> <silent> k k<CR><C-W><C-P>
|
|
||||||
nmap <buffer> <silent> <Down> j
|
|
||||||
nmap <buffer> <silent> <Up> k
|
|
||||||
endif
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
function! s:GetDocLocations() "{{{
|
|
||||||
let dp = ''
|
|
||||||
for p in split(&rtp, ',')
|
|
||||||
let p = p . '/doc/'
|
|
||||||
if isdirectory(p)
|
|
||||||
let dp = p . '*.txt ' . dp
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return dp
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
function! s:Highlight(args) "{{{
|
|
||||||
if !g:ackhighlight
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
let @/ = matchstr(a:args, "\\v(-)\@<!(\<)\@<=\\w+|['\"]\\zs.{-}\\ze['\"]")
|
|
||||||
call feedkeys(":let &hlsearch=1 \| echo \<CR>", "n")
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
" Initialize state for an :Ack* or :LAck* search
|
|
||||||
function! s:Init(cmd) "{{{
|
|
||||||
let s:searching_filepaths = (a:cmd =~# '-g$') ? 1 : 0
|
|
||||||
let s:using_loclist = (a:cmd =~# '^l') ? 1 : 0
|
|
||||||
|
|
||||||
if g:ack_use_dispatch && s:using_loclist
|
|
||||||
call s:Warn('Dispatch does not support location lists! Proceeding with quickfix...')
|
|
||||||
let s:using_loclist = 0
|
|
||||||
endif
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
function! s:QuickHelp() "{{{
|
|
||||||
execute 'edit' globpath(&rtp, 'doc/ack_quick_help.txt')
|
|
||||||
|
|
||||||
silent normal gg
|
|
||||||
setlocal buftype=nofile bufhidden=hide nobuflisted
|
|
||||||
setlocal nomodifiable noswapfile
|
|
||||||
setlocal filetype=help
|
|
||||||
setlocal nonumber norelativenumber nowrap
|
|
||||||
setlocal foldmethod=diff foldlevel=20
|
|
||||||
|
|
||||||
nnoremap <buffer> <silent> ? :q!<CR>:call ack#ShowResults()<CR>
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
function! s:SearchWithDispatch(grepprg, grepargs, grepformat) "{{{
|
|
||||||
let l:makeprg_bak = &l:makeprg
|
|
||||||
let l:errorformat_bak = &l:errorformat
|
|
||||||
|
|
||||||
" We don't execute a :grep command for Dispatch, so add -g here instead
|
|
||||||
if s:SearchingFilepaths()
|
|
||||||
let l:grepprg = a:grepprg . ' -g'
|
|
||||||
else
|
|
||||||
let l:grepprg = a:grepprg
|
|
||||||
endif
|
|
||||||
|
|
||||||
try
|
|
||||||
let &l:makeprg = l:grepprg . ' ' . a:grepargs
|
|
||||||
let &l:errorformat = a:grepformat
|
|
||||||
|
|
||||||
Make
|
|
||||||
finally
|
|
||||||
let &l:makeprg = l:makeprg_bak
|
|
||||||
let &l:errorformat = l:errorformat_bak
|
|
||||||
endtry
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
function! s:SearchWithGrep(grepcmd, grepprg, grepargs, grepformat) "{{{
|
|
||||||
let l:grepprg_bak = &l:grepprg
|
|
||||||
let l:grepformat_bak = &grepformat
|
|
||||||
|
|
||||||
try
|
|
||||||
let &l:grepprg = a:grepprg
|
|
||||||
let &grepformat = a:grepformat
|
|
||||||
|
|
||||||
silent execute a:grepcmd a:grepargs
|
|
||||||
finally
|
|
||||||
let &l:grepprg = l:grepprg_bak
|
|
||||||
let &grepformat = l:grepformat_bak
|
|
||||||
endtry
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
" Are we finding matching files, not lines? (the -g option -- :AckFile)
|
|
||||||
function! s:SearchingFilepaths() "{{{
|
|
||||||
return get(s:, 'searching_filepaths', 0)
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
" Predicate for whether mappings are enabled for list type of current search.
|
|
||||||
function! s:UsingListMappings() "{{{
|
|
||||||
if s:UsingLocList()
|
|
||||||
return g:ack_apply_lmappings
|
|
||||||
else
|
|
||||||
return g:ack_apply_qmappings
|
|
||||||
endif
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
" Were we invoked with a :LAck command?
|
|
||||||
function! s:UsingLocList() "{{{
|
|
||||||
return get(s:, 'using_loclist', 0)
|
|
||||||
endfunction "}}}
|
|
||||||
|
|
||||||
function! s:Warn(msg) "{{{
|
|
||||||
echohl WarningMsg | echomsg 'Ack: ' . a:msg | echohl None
|
|
||||||
endf "}}}
|
|
||||||
|
|
||||||
let g:autoloaded_ack = 1
|
|
||||||
" vim:set et sw=2 ts=2 tw=78 fdm=marker
|
|
|
@ -1,315 +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|)
|
|
||||||
|
|
||||||
This plugin is only available if 'compatible' is not set.
|
|
||||||
|
|
||||||
{Vi does not have any of this}
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
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
|
|
||||||
occurrence 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.
|
|
||||||
|
|
||||||
:AckHelp[!] [options] {pattern} *:AckHelp*
|
|
||||||
|
|
||||||
Search vim documentation files for the {pattern}. Behaves just like the
|
|
||||||
|:Ack| command, but searches only vim documentation .txt files
|
|
||||||
|
|
||||||
:LAckHelp [options] {pattern} *:LAckHelp*
|
|
||||||
|
|
||||||
Just like |:AckHelp| but instead of the |quickfix| list, matches are placed
|
|
||||||
in the current |location-list|.
|
|
||||||
|
|
||||||
:AckWindow[!] [options] {pattern} *:AckWindow*
|
|
||||||
|
|
||||||
Search all buffers visible in the screen (current tab page only) files for
|
|
||||||
the {pattern}.
|
|
||||||
|
|
||||||
:LAckWindow [options] {pattern} *:LAckWindow*
|
|
||||||
|
|
||||||
Just like |:AckWindow| but instead of the |quickfix| list, matches are
|
|
||||||
placed in the current |location-list|.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
Note that if you are using Dispatch.vim with |g:ack_use_dispatch|, location
|
|
||||||
lists are not supported, because Dispatch does not support them at this time.
|
|
||||||
`:LAck` versions of commands above will give a warning and proceed to use the
|
|
||||||
quickfix list instead.
|
|
||||||
|
|
||||||
See http://beyondgrep.com/ for more information on searching with ack.
|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
CONFIGURATION *ack-configuration*
|
|
||||||
|
|
||||||
*g:ackprg*
|
|
||||||
g:ackprg
|
|
||||||
Default for ubuntu: "ack-grep"
|
|
||||||
Default for other systems: "ack"
|
|
||||||
|
|
||||||
Use this option to specify the search command and its default arguments.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
>
|
|
||||||
let g:ackprg = "ag --vimgrep"
|
|
||||||
<
|
|
||||||
*g:ack_default_options*
|
|
||||||
g:ack_default_options
|
|
||||||
Default: " -s -H --nocolor --nogroup --column"
|
|
||||||
|
|
||||||
Use this option to specify the default arguments given to `ack`. This is only
|
|
||||||
used if |g:ackprg| has not been customized from the default--if you are using
|
|
||||||
a custom search program instead of Ack, set your preferred options in
|
|
||||||
|g:ackprg|.
|
|
||||||
|
|
||||||
NOTE: This option may be deprecated in the future. ~
|
|
||||||
|
|
||||||
Example:
|
|
||||||
>
|
|
||||||
let g:ack_default_options =
|
|
||||||
\ " -s -H --nocolor --nogroup --column --smart-case --follow"
|
|
||||||
<
|
|
||||||
*g:ack_apply_qmappings*
|
|
||||||
g:ack_apply_qmappings
|
|
||||||
Default: 1
|
|
||||||
|
|
||||||
This option enables mappings on the |quickfix| window.
|
|
||||||
|
|
||||||
*g:ack_apply_lmappings*
|
|
||||||
g:ack_apply_lmappings
|
|
||||||
Default: 1
|
|
||||||
|
|
||||||
This option enables mappings on |location-list| windows.
|
|
||||||
|
|
||||||
*g:ack_mappings*
|
|
||||||
g:ack_mappings
|
|
||||||
Default: {
|
|
||||||
\ "t": "<C-W><CR><C-W>T",
|
|
||||||
\ "T": "<C-W><CR><C-W>TgT<C-W>j",
|
|
||||||
\ "o": "<CR>",
|
|
||||||
\ "O": "<CR><C-W><C-W>:ccl<CR>",
|
|
||||||
\ "go": "<CR><C-W>j",
|
|
||||||
\ "h": "<C-W><CR><C-W>K",
|
|
||||||
\ "H": "<C-W><CR><C-W>K<C-W>b",
|
|
||||||
\ "v": "<C-W><CR><C-W>H<C-W>b<C-W>J<C-W>t",
|
|
||||||
\ "gv": "<C-W><CR><C-W>H<C-W>b<C-W>J" }
|
|
||||||
|
|
||||||
This option list all maps create on quickfix/Location list window.
|
|
||||||
|
|
||||||
Example, if you want to open the result in the middle of the screen:
|
|
||||||
>
|
|
||||||
let g:ack_mappings = { "o": "<CR>zz" }
|
|
||||||
<
|
|
||||||
*g:ack_qhandler*
|
|
||||||
g:ack_qhandler
|
|
||||||
Default: "botright copen"
|
|
||||||
|
|
||||||
Command to open the quickview window.
|
|
||||||
|
|
||||||
If you want to open a quickview window with 30 lines you can do:
|
|
||||||
>
|
|
||||||
let g:ack_qhandler = "botright copen 30"
|
|
||||||
<
|
|
||||||
*g:ack_lhandler*
|
|
||||||
g:ack_lhandler
|
|
||||||
Default: "botright lopen"
|
|
||||||
|
|
||||||
Command to open the Location list window.
|
|
||||||
|
|
||||||
If you want to open a Location list window with 30 lines you can do:
|
|
||||||
>
|
|
||||||
let g:ack_lhandler = "botright lopen 30"
|
|
||||||
<
|
|
||||||
*g:ackhighlight*
|
|
||||||
g:ackhighlight
|
|
||||||
Default: 0
|
|
||||||
|
|
||||||
Use this option to highlight the searched term.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
>
|
|
||||||
let g:ackhighlight = 1
|
|
||||||
<
|
|
||||||
*g:ack_autoclose*
|
|
||||||
g:ack_autoclose
|
|
||||||
Default: 0
|
|
||||||
|
|
||||||
Use this option to specify whether to close the quickfix window after
|
|
||||||
using any of the shortcuts.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
>
|
|
||||||
let g:ack_autoclose = 1
|
|
||||||
<
|
|
||||||
*g:ack_autofold_results*
|
|
||||||
g:ack_autofold_results
|
|
||||||
Default: 0
|
|
||||||
|
|
||||||
Use this option to fold the results in quickfix by file name. Only the current
|
|
||||||
fold will be open by default and while you press 'j' and 'k' to move between the
|
|
||||||
results if you hit other fold the last one will be closed and the current will
|
|
||||||
be open.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
>
|
|
||||||
let g:ack_autofold_results = 1
|
|
||||||
<
|
|
||||||
*g:ackpreview*
|
|
||||||
g:ackpreview
|
|
||||||
Default: 0
|
|
||||||
|
|
||||||
Use this option to automagically open the file with 'j' or 'k'.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
>
|
|
||||||
let g:ackpreview = 1
|
|
||||||
<
|
|
||||||
*g:ack_use_dispatch*
|
|
||||||
g:ack_use_dispatch
|
|
||||||
Default: 0
|
|
||||||
|
|
||||||
Use this option to use vim-dispatch to run searches in the background, with a
|
|
||||||
variety of execution backends for different systems.
|
|
||||||
|
|
||||||
Due to limitations in Dispatch at this time, location lists are unsupported
|
|
||||||
and result windows will appear before results are ready. Still, these may be
|
|
||||||
acceptable tradeoffs for very large projects where searches are slow.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
>
|
|
||||||
let g:ack_use_dispatch = 1
|
|
||||||
<
|
|
||||||
*g:ack_use_cword_for_empty_search*
|
|
||||||
g:ack_use_cword_for_empty_search
|
|
||||||
Default: 1
|
|
||||||
|
|
||||||
Use this option to enable blank searches to run against the word under the
|
|
||||||
cursor. When this option is not set, blank searches will only output an error
|
|
||||||
message.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
>
|
|
||||||
let g:ack_use_cword_for_empty_search = 0
|
|
||||||
<
|
|
||||||
==============================================================================
|
|
||||||
MAPPINGS *ack-mappings*
|
|
||||||
|
|
||||||
The following keyboard shortcuts are available in the |quickfix| and
|
|
||||||
|location-list| windows:
|
|
||||||
|
|
||||||
? display a quick summary of these mappings.
|
|
||||||
|
|
||||||
o open file (same as Enter).
|
|
||||||
|
|
||||||
O open file and close the quickfix window.
|
|
||||||
|
|
||||||
go preview file (open but maintain focus on ack.vim results).
|
|
||||||
|
|
||||||
t open in a new tab.
|
|
||||||
|
|
||||||
T open in new tab without moving to it.
|
|
||||||
|
|
||||||
h open in horizontal split.
|
|
||||||
|
|
||||||
H open in horizontal split, keeping focus on the results.
|
|
||||||
|
|
||||||
v open in vertical split.
|
|
||||||
|
|
||||||
gv open in vertical split, keeping focus on the results.
|
|
||||||
|
|
||||||
q close the quickfix window.
|
|
||||||
|
|
||||||
To adjust these, see |g:ack_mappings|.
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
Ignoring files *ack-ignore*
|
|
||||||
|
|
||||||
If you're using this plugin with ag, The Silver Searcher, bear in mind that:
|
|
||||||
|
|
||||||
- It ignores file patterns from your .gitignore and .hgignore.
|
|
||||||
|
|
||||||
- If there are other files in your source repository you don't wish to
|
|
||||||
search, you can add their patterns to an .agignore file.
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
ISSUES AND FAQ *ack-issues-and-faq*
|
|
||||||
|
|
||||||
I don't want to jump to the first result automatically.~
|
|
||||||
|
|
||||||
Use `:Ack!`, with bang. If you want this behavior most of the time, you
|
|
||||||
might like an abbreviation or mapping in your personal config, something
|
|
||||||
like these:
|
|
||||||
>
|
|
||||||
cnoreabbrev Ack Ack!
|
|
||||||
nnoremap <Leader>a :Ack!<Space>
|
|
||||||
<
|
|
||||||
Most of the `:[L]Ack*` commands support this. Note that this behavior
|
|
||||||
follows the convention of Vim's built-in |:grep| and |:make| commands.
|
|
||||||
|
|
||||||
I use NERDTree and opening ack.vim results in a vertical split displacing it.~
|
|
||||||
|
|
||||||
You are probably using NERDTree with its default alignment at the left
|
|
||||||
side of the window. Set these custom mappings in your vimrc to work around
|
|
||||||
this:
|
|
||||||
>
|
|
||||||
let g:ack_mappings = {
|
|
||||||
\ 'v': '<C-W><CR><C-W>L<C-W>p<C-W>J<C-W>p',
|
|
||||||
\ 'gv': '<C-W><CR><C-W>L<C-W>p<C-W>J' }
|
|
||||||
<
|
|
||||||
This solution will be improved in the future.
|
|
||||||
|
|
||||||
Results show a mix of relative and absolute paths, making them hard to read.~
|
|
||||||
|
|
||||||
This is a quirk of Vim that can happen with plain |:vimgrep| too. You can
|
|
||||||
try this in your vimrc to work around it:
|
|
||||||
>
|
|
||||||
autocmd BufAdd * exe "cd" fnameescape(getcwd())
|
|
||||||
<
|
|
||||||
but for some users this may be disruptive to their Vim workflow. For more
|
|
||||||
details, see:
|
|
||||||
|
|
||||||
http://vi.stackexchange.com/a/4816/7174
|
|
||||||
https://github.com/mileszs/ack.vim/issues/143
|
|
||||||
|
|
||||||
vim:set et sw=4 ts=4 tw=78:
|
|
|
@ -1,15 +0,0 @@
|
||||||
==== ack.vim quick help ===============
|
|
||||||
|
|
||||||
*?:* a quick summary of these keys, repeat to close
|
|
||||||
*o:* to open (same as Enter)
|
|
||||||
*O:* to open and close the quickfix window
|
|
||||||
*go:* to preview file, open but maintain focus on ack.vim results
|
|
||||||
*t:* to open in new tab
|
|
||||||
*T:* to open in new tab without moving to it
|
|
||||||
*h:* to open in horizontal split
|
|
||||||
*H:* to open in horizontal split, keeping focus on the results
|
|
||||||
*v:* to open in vertical split
|
|
||||||
*gv:* to open in vertical split, keeping focus on the results
|
|
||||||
*q:* to close the quickfix window
|
|
||||||
|
|
||||||
========================================
|
|
|
@ -1,9 +0,0 @@
|
||||||
if exists("g:ack_autofold_results") && g:ack_autofold_results
|
|
||||||
setlocal foldlevel=0
|
|
||||||
setlocal foldmethod=expr
|
|
||||||
setlocal foldexpr=matchstr(getline(v:lnum),'^[^\|]\\+')==#matchstr(getline(v:lnum+1),'^[^\|]\\+')?1:'<1'
|
|
||||||
setlocal foldenable
|
|
||||||
setlocal foldclose=all
|
|
||||||
setlocal foldopen=all
|
|
||||||
nnoremap <buffer> j jzz
|
|
||||||
endif
|
|
|
@ -1,83 +0,0 @@
|
||||||
if exists('g:loaded_ack') || &cp
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !exists("g:ack_default_options")
|
|
||||||
let g:ack_default_options = " -s -H --nopager --nocolor --nogroup --column"
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Location of the ack utility
|
|
||||||
if !exists("g:ackprg")
|
|
||||||
if executable('ack-grep')
|
|
||||||
let g:ackprg = "ack-grep"
|
|
||||||
elseif executable('ack')
|
|
||||||
let g:ackprg = "ack"
|
|
||||||
else
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let g:ackprg .= g:ack_default_options
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !exists("g:ack_apply_qmappings")
|
|
||||||
let g:ack_apply_qmappings = !exists("g:ack_qhandler")
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !exists("g:ack_apply_lmappings")
|
|
||||||
let g:ack_apply_lmappings = !exists("g:ack_lhandler")
|
|
||||||
endif
|
|
||||||
|
|
||||||
let s:ack_mappings = {
|
|
||||||
\ "t": "<C-W><CR><C-W>T",
|
|
||||||
\ "T": "<C-W><CR><C-W>TgT<C-W>j",
|
|
||||||
\ "o": "<CR>",
|
|
||||||
\ "O": "<CR><C-W>p<C-W>c",
|
|
||||||
\ "go": "<CR><C-W>p",
|
|
||||||
\ "h": "<C-W><CR><C-W>K",
|
|
||||||
\ "H": "<C-W><CR><C-W>K<C-W>b",
|
|
||||||
\ "v": "<C-W><CR><C-W>H<C-W>b<C-W>J<C-W>t",
|
|
||||||
\ "gv": "<C-W><CR><C-W>H<C-W>b<C-W>J" }
|
|
||||||
|
|
||||||
if exists("g:ack_mappings")
|
|
||||||
let g:ack_mappings = extend(s:ack_mappings, g:ack_mappings)
|
|
||||||
else
|
|
||||||
let g:ack_mappings = s:ack_mappings
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !exists("g:ack_qhandler")
|
|
||||||
let g:ack_qhandler = "botright copen"
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !exists("g:ack_lhandler")
|
|
||||||
let g:ack_lhandler = "botright lopen"
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !exists("g:ackhighlight")
|
|
||||||
let g:ackhighlight = 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !exists("g:ack_autoclose")
|
|
||||||
let g:ack_autoclose = 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !exists("g:ack_autofold_results")
|
|
||||||
let g:ack_autofold_results = 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !exists("g:ack_use_cword_for_empty_search")
|
|
||||||
let g:ack_use_cword_for_empty_search = 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
command! -bang -nargs=* -complete=file Ack call ack#Ack('grep<bang>', <q-args>)
|
|
||||||
command! -bang -nargs=* -complete=file AckAdd call ack#Ack('grepadd<bang>', <q-args>)
|
|
||||||
command! -bang -nargs=* -complete=file AckFromSearch call ack#AckFromSearch('grep<bang>', <q-args>)
|
|
||||||
command! -bang -nargs=* -complete=file LAck call ack#Ack('lgrep<bang>', <q-args>)
|
|
||||||
command! -bang -nargs=* -complete=file LAckAdd call ack#Ack('lgrepadd<bang>', <q-args>)
|
|
||||||
command! -bang -nargs=* -complete=file AckFile call ack#Ack('grep<bang> -g', <q-args>)
|
|
||||||
command! -bang -nargs=* -complete=help AckHelp call ack#AckHelp('grep<bang>', <q-args>)
|
|
||||||
command! -bang -nargs=* -complete=help LAckHelp call ack#AckHelp('lgrep<bang>', <q-args>)
|
|
||||||
command! -bang -nargs=* AckWindow call ack#AckWindow('grep<bang>', <q-args>)
|
|
||||||
command! -bang -nargs=* LAckWindow call ack#AckWindow('lgrep<bang>', <q-args>)
|
|
||||||
|
|
||||||
let g:loaded_ack = 1
|
|
||||||
|
|
||||||
" vim:set et sw=2 ts=2 tw=78 fdm=marker
|
|
|
@ -1,39 +0,0 @@
|
||||||
created by
|
|
||||||
---------
|
|
||||||
[jeff lanzarotta](http://www.vim.org/account/profile.php?user_id=97)
|
|
||||||
|
|
||||||
script type
|
|
||||||
----------
|
|
||||||
utility
|
|
||||||
|
|
||||||
description
|
|
||||||
-----------
|
|
||||||
With bufexplorer, you can quickly and easily switch between buffers by using the one of the default public interfaces:
|
|
||||||
|
|
||||||
'\be' (normal open) or
|
|
||||||
'\bs' (force horizontal split open) or
|
|
||||||
'\bv' (force vertical split open)
|
|
||||||
|
|
||||||
Once the bufexplorer window is open you can use the normal movement keys (hjkl) to move around and then use <Enter> or <Left-Mouse-Click> to select the buffer you would like to open. If you would like to have the selected buffer opened in a new tab, simply press either <Shift-Enter> or 't'. Please note that when opening a buffer in a tab, that if the buffer is already in another tab, bufexplorer can switch to that tab automatically for you if you would like. More about that in the supplied VIM help.
|
|
||||||
|
|
||||||
Bufexplorer also offers various options including:
|
|
||||||
|
|
||||||
* Display the list of buffers in various sort orders including:
|
|
||||||
* Most Recently Used (MRU) which is the default
|
|
||||||
* Buffer number
|
|
||||||
* File name
|
|
||||||
* File extension
|
|
||||||
* Full file path name
|
|
||||||
* Delete buffer from list
|
|
||||||
|
|
||||||
For more about options, sort orders, configuration options, etc. please see the supplied VIM help.
|
|
||||||
|
|
||||||
install details
|
|
||||||
---------------
|
|
||||||
Simply unzip bufexplorer.zip into a directory in your 'runtimepath', usually ~/.vim or c:\vimfiles, and restart Vim. This zip file contains plugin\bufexplorer.vim, and doc\bufexplorer.txt. See ':help add-local-help' on how to add bufexplorer.txt to vim's help system.
|
|
||||||
|
|
||||||
NOTE
|
|
||||||
----
|
|
||||||
Version 7.0.12 and above will ONLY work with 7.0 and above of Vim.
|
|
||||||
|
|
||||||
**IMPORTANT**: If you have a version prior to 7.1.2 that contains an autoload\bufexplorer.vim file, please REMOVE the autoload\bufexlorer.vim AND the plugin\bufexplorer.vim files before installing a new version.
|
|
|
@ -1,513 +0,0 @@
|
||||||
*bufexplorer.txt* Buffer Explorer Last Change: 22 Oct 2010
|
|
||||||
|
|
||||||
Buffer Explorer *buffer-explorer* *bufexplorer*
|
|
||||||
Version 7.2.8
|
|
||||||
|
|
||||||
Plugin for easily exploring (or browsing) Vim |:buffers|.
|
|
||||||
|
|
||||||
|bufexplorer-installation| Installation
|
|
||||||
|bufexplorer-usage| Usage
|
|
||||||
|bufexplorer-windowlayout| Window Layout
|
|
||||||
|bufexplorer-customization| Customization
|
|
||||||
|bufexplorer-changelog| Change Log
|
|
||||||
|bufexplorer-todo| Todo
|
|
||||||
|bufexplorer-credits| Credits
|
|
||||||
|
|
||||||
For Vim version 7.0 and above.
|
|
||||||
This plugin is only available if 'compatible' is not set.
|
|
||||||
|
|
||||||
{Vi does not have any of this}
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
INSTALLATION *bufexplorer-installation*
|
|
||||||
|
|
||||||
To install:
|
|
||||||
- Download the bufexplorer.zip.
|
|
||||||
- Extract the zip archive into your runtime directory.
|
|
||||||
The archive contains plugin/bufexplorer.vim, and doc/bufexplorer.txt.
|
|
||||||
- Start Vim or goto an existing instance of Vim.
|
|
||||||
- Execute the following command:
|
|
||||||
>
|
|
||||||
:helptag <your runtime directory>/doc
|
|
||||||
<
|
|
||||||
This will generate all the help tags for any file located in the doc
|
|
||||||
directory.
|
|
||||||
|
|
||||||
==============================================================================
|
|
||||||
USAGE *bufexplorer-usage*
|
|
||||||
|
|
||||||
To start exploring in the current window, use: >
|
|
||||||
\be or :BufExplorer
|
|
||||||
To start exploring in a newly split horizontal window, use: >
|
|
||||||
\bs or :BufExplorerHorizontalSplit
|
|
||||||
To start exploring in a newly split vertical window, use: >
|
|
||||||
\bv or :BufExplorerVerticalSplit
|
|
||||||
|
|
||||||
If you would like to use something other than '\', you may simply change the
|
|
||||||
leader (see |mapleader|).
|
|
||||||
|
|
||||||
Note: If the current buffer is modified when bufexplorer started, the current
|
|
||||||
window is always split and the new bufexplorer is displayed in that new
|
|
||||||
window.
|
|
||||||
|
|
||||||
Commands to use once exploring:
|
|
||||||
|
|
||||||
<F1> Toggle help information.
|
|
||||||
<enter> Opens the buffer that is under the cursor into the current
|
|
||||||
window.
|
|
||||||
<leftmouse> Opens the buffer that is under the cursor into the current
|
|
||||||
window.
|
|
||||||
<shift-enter> Opens the buffer that is under the cursor in another tab.
|
|
||||||
d |:delete|the buffer under the cursor from the list. The
|
|
||||||
buffer's 'buflisted' is cleared. This allows for the buffer to
|
|
||||||
be displayed again using the 'show unlisted' command.
|
|
||||||
R Toggles relative path/absolute path.
|
|
||||||
T Toggles to show only buffers for this tab or not.
|
|
||||||
D |:wipeout|the buffer under the cursor from the list. When a
|
|
||||||
buffers is wiped, it will not be shown when unlisted buffer are
|
|
||||||
displayed.
|
|
||||||
f Toggles whether you are taken to the active window when
|
|
||||||
selecting a buffer or not.
|
|
||||||
o Opens the buffer that is under the cursor into the current
|
|
||||||
window.
|
|
||||||
p Toggles the showing of a split filename/pathname.
|
|
||||||
q Quit exploring.
|
|
||||||
r Reverses the order the buffers are listed in.
|
|
||||||
s Selects the order the buffers are listed in. Either by buffer
|
|
||||||
number, file name, file extension, most recently used (MRU), or
|
|
||||||
full path.
|
|
||||||
t Opens the buffer that is under the cursor in another tab.
|
|
||||||
u Toggles the showing of "unlisted" buffers.
|
|
||||||
|
|
||||||
Once invoked, Buffer Explorer displays a sorted list (MRU is the default
|
|
||||||
sort method) of all the buffers that are currently opened. You are then
|
|
||||||
able to move the cursor to the line containing the buffer's name you are
|
|
||||||
wanting to act upon. Once you have selected the buffer you would like,
|
|
||||||
you can then either open it, close it(delete), resort the list, reverse
|
|
||||||
the sort, quit exploring and so on...
|
|
||||||
|
|
||||||
===============================================================================
|
|
||||||
WINDOW LAYOUT *bufexplorer-windowlayout*
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
" Press <F1> for Help
|
|
||||||
" Sorted by mru | Locate buffer | Absolute Split path
|
|
||||||
"=
|
|
||||||
01 %a bufexplorer.txt C:\Vim\vimfiles\doc line 87
|
|
||||||
02 # bufexplorer.vim c:\Vim\vimfiles\plugin line 1
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
| | | | |
|
|
||||||
| | | | +-- Current Line #.
|
|
||||||
| | | +-- Relative/Full Path
|
|
||||||
| | +-- Buffer Name.
|
|
||||||
| +-- Buffer Attributes. See|:buffers|for more information.
|
|
||||||
+-- Buffer Number. See|:buffers|for more information.
|
|
||||||
|
|
||||||
===============================================================================
|
|
||||||
CUSTOMIZATION *bufexplorer-customization*
|
|
||||||
|
|
||||||
*g:bufExplorerChgWin*
|
|
||||||
If set, bufexplorer will bring up the selected buffer in the window specified
|
|
||||||
by g:bufExplorerChgWin.
|
|
||||||
|
|
||||||
*g:bufExplorerDefaultHelp*
|
|
||||||
To control whether the default help is displayed or not, use: >
|
|
||||||
let g:bufExplorerDefaultHelp=0 " Do not show default help.
|
|
||||||
let g:bufExplorerDefaultHelp=1 " Show default help.
|
|
||||||
The default is to show the default help.
|
|
||||||
|
|
||||||
*g:bufExplorerDetailedHelp*
|
|
||||||
To control whether detailed help is display by, use: >
|
|
||||||
let g:bufExplorerDetailedHelp=0 " Do not show detailed help.
|
|
||||||
let g:bufExplorerDetailedHelp=1 " Show detailed help.
|
|
||||||
The default is NOT to show detailed help.
|
|
||||||
|
|
||||||
*g:bufExplorerFindActive*
|
|
||||||
To control whether you are taken to the active window when selecting a buffer,
|
|
||||||
use: >
|
|
||||||
let g:bufExplorerFindActive=0 " Do not go to active window.
|
|
||||||
let g:bufExplorerFindActive=1 " Go to active window.
|
|
||||||
The default is to be taken to the active window.
|
|
||||||
|
|
||||||
*g:bufExplorerFuncRef*
|
|
||||||
When a buffer is selected, the functions specified either singly or as a list
|
|
||||||
will be called.
|
|
||||||
|
|
||||||
*g:bufExplorerReverseSort*
|
|
||||||
To control whether to sort the buffer in reverse order or not, use: >
|
|
||||||
let g:bufExplorerReverseSort=0 " Do not sort in reverse order.
|
|
||||||
let g:bufExplorerReverseSort=1 " Sort in reverse order.
|
|
||||||
The default is NOT to sort in reverse order.
|
|
||||||
|
|
||||||
*g:bufExplorerShowDirectories*
|
|
||||||
Directories usually show up in the list from using a command like ":e .".
|
|
||||||
To control whether to show directories in the buffer list or not, use: >
|
|
||||||
let g:bufExplorerShowDirectories=1 " Show directories.
|
|
||||||
let g:bufExplorerShowDirectories=0 " Don't show directories.
|
|
||||||
The default is to show directories.
|
|
||||||
|
|
||||||
*g:bufExplorerShowRelativePath*
|
|
||||||
To control whether to show absolute paths or relative to the current
|
|
||||||
directory, use: >
|
|
||||||
let g:bufExplorerShowRelativePath=0 " Show absolute paths.
|
|
||||||
let g:bufExplorerShowRelativePath=1 " Show relative paths.
|
|
||||||
The default is to show absolute paths.
|
|
||||||
|
|
||||||
*g:bufExplorerShowTabBuffer*
|
|
||||||
To control weither or not to show buffers on for the specific tab or not, use: >
|
|
||||||
let g:bufExplorerShowTabBuffer=0 " No.
|
|
||||||
let g:bufExplorerShowTabBuffer=1 " Yes.
|
|
||||||
The default is not to show.
|
|
||||||
|
|
||||||
*g:bufExplorerShowUnlisted*
|
|
||||||
To control whether to show unlisted buffer or not, use: >
|
|
||||||
let g:bufExplorerShowUnlisted=0 " Do not show unlisted buffers.
|
|
||||||
let g:bufExplorerShowUnlisted=1 " Show unlisted buffers.
|
|
||||||
The default is to NOT show unlisted buffers.
|
|
||||||
|
|
||||||
*g:bufExplorerSortBy*
|
|
||||||
To control what field the buffers are sorted by, use: >
|
|
||||||
let g:bufExplorerSortBy='extension' " Sort by file extension.
|
|
||||||
let g:bufExplorerSortBy='fullpath' " Sort by full file path name.
|
|
||||||
let g:bufExplorerSortBy='mru' " Sort by most recently used.
|
|
||||||
let g:bufExplorerSortBy='name' " Sort by the buffer's name.
|
|
||||||
let g:bufExplorerSortBy='number' " Sort by the buffer's number.
|
|
||||||
The default is to sort by mru.
|
|
||||||
|
|
||||||
*g:bufExplorerSplitBelow*
|
|
||||||
To control where the new split window will be placed above or below the
|
|
||||||
current window, use: >
|
|
||||||
let g:bufExplorerSplitBelow=1 " Split new window below current.
|
|
||||||
let g:bufExplorerSplitBelow=0 " Split new window above current.
|
|
||||||
The default is to use what ever is set by the global &splitbelow
|
|
||||||
variable.
|
|
||||||
|
|
||||||
*g:bufExplorerSplitOutPathName*
|
|
||||||
To control whether to split out the path and file name or not, use: >
|
|
||||||
let g:bufExplorerSplitOutPathName=1 " Split the path and file name.
|
|
||||||
let g:bufExplorerSplitOutPathName=0 " Don't split the path and file
|
|
||||||
" name.
|
|
||||||
The default is to split the path and file name.
|
|
||||||
|
|
||||||
*g:bufExplorerSplitRight*
|
|
||||||
To control where the new vsplit window will be placed to the left or right of
|
|
||||||
current window, use: >
|
|
||||||
let g:bufExplorerSplitRight=0 " Split left.
|
|
||||||
let g:bufExplorerSplitRight=1 " Split right.
|
|
||||||
The default is to use the global &splitright.
|
|
||||||
|
|
||||||
===============================================================================
|
|
||||||
CHANGE LOG *bufexplorer-changelog*
|
|
||||||
|
|
||||||
7.2.8 - Enhancements:
|
|
||||||
* Thanks to Charles Campbell for integrating bufexplorer with GDBMGR.
|
|
||||||
http://mysite.verizon.net/astronaut/vim/index.html#GDBMGR
|
|
||||||
7.2.7 - Fix:
|
|
||||||
* My 1st attempt to fix the "cache" issue where buffers information
|
|
||||||
has changed but the cache/display does not reflect those changes.
|
|
||||||
More work still needs to be done.
|
|
||||||
7.2.6 - Fix:
|
|
||||||
* Thanks to Michael Henry for pointing out that I totally forgot to
|
|
||||||
update the inline help to reflect the previous change to the 'd'
|
|
||||||
and 'D' keys. Opps!
|
|
||||||
7.2.5 - Fix:
|
|
||||||
* Philip Morant suggested switching the command (bwipe) associated
|
|
||||||
with the 'd' key with the command (bdelete) associated with the 'D'
|
|
||||||
key. This made sense since the 'd' key is more likely to be used
|
|
||||||
compared to the 'D' key.
|
|
||||||
7.2.4 - Fix:
|
|
||||||
* I did not implement the patch provided by Godefroid Chapelle
|
|
||||||
correctly. I missed one line which happened to be the most
|
|
||||||
important one :)
|
|
||||||
7.2.3 - Enhancements:
|
|
||||||
* Thanks to David Fishburn for helping me out with a much needed
|
|
||||||
code overhaul as well as some awesome performance enhancements.
|
|
||||||
He also reworked the handling of tabs.
|
|
||||||
* Thanks to Vladimir Dobriakov for making the suggestions on
|
|
||||||
enhancing the documentation to include a better explaination of
|
|
||||||
what is contained in the main bufexplorer window.
|
|
||||||
* Thanks to Yuriy Ershov for added code that when the bufexplorer
|
|
||||||
window is opened, the cursor is now positioned at the line with the
|
|
||||||
active buffer (useful in non-MRU sort modes).
|
|
||||||
* Yuriy also added the abiltiy to cycle through the sort fields in
|
|
||||||
reverse order.
|
|
||||||
Fixes:
|
|
||||||
* Thanks to Michael Henry for supplying a patch that allows
|
|
||||||
bufexplorer to be opened even when there is one buffer or less.
|
|
||||||
* Thanks to Godefroid Chapelle for supplying a patch that fixed
|
|
||||||
MRU sort order after loading a session.
|
|
||||||
7.2.2 - Fixes:
|
|
||||||
* Thanks to David L. Dight for spotting and fixing an issue when
|
|
||||||
using ctrl^. bufexplorer would incorrectly handle the previous
|
|
||||||
buffer so that when ctrl^ was pressed the incorrect file was opened.
|
|
||||||
7.2.1 - Fixes:
|
|
||||||
* Thanks to Dimitar for spotting and fixing a feature that was
|
|
||||||
inadvertently left out of the previous version. The feature was
|
|
||||||
when bufexplorer was used together with WinManager, you could use
|
|
||||||
the tab key to open a buffer in a split window.
|
|
||||||
7.2.0 - Enhancements:
|
|
||||||
* For all those missing the \bs and \bv commands, these have now
|
|
||||||
returned. Thanks to Phil O'Connell for asking for the return of
|
|
||||||
these missing features and helping test out this version.
|
|
||||||
Fixes:
|
|
||||||
* Fixed problem with the bufExplorerFindActive code not working
|
|
||||||
correctly.
|
|
||||||
* Fixed an incompatibility between bufexplorer and netrw that caused
|
|
||||||
buffers to be incorrectly removed from the MRU list.
|
|
||||||
7.1.7 - Fixes:
|
|
||||||
* TaCahiroy fixed several issues related to opening a buffer in a
|
|
||||||
tab.
|
|
||||||
7.1.6 - Fixes:
|
|
||||||
* Removed ff=unix from modeline in bufexplorer.txt. Found by Bill
|
|
||||||
McCarthy.
|
|
||||||
7.1.5 - Fixes:
|
|
||||||
* Could not open unnamed buffers. Fixed by TaCahiroy.
|
|
||||||
7.1.4 - Fixes:
|
|
||||||
* Sometimes when a file's path has 'white space' in it, extra buffers
|
|
||||||
would be created containing each piece of the path. i.e:
|
|
||||||
opening c:\document and settings\test.txt would create a buffer
|
|
||||||
named "and" and a buffer named "Documents". This was reported and
|
|
||||||
fixed by TaCa Yoss.
|
|
||||||
7.1.3 - Fixes:
|
|
||||||
* Added code to allow only one instance of the plugin to run at a
|
|
||||||
time. Thanks Dennis Hostetler.
|
|
||||||
7.1.2 - Fixes:
|
|
||||||
* Fixed a jumplist issue spotted by JiangJun. I overlooked the
|
|
||||||
'jumplist' and with a couple calls to 'keepjumps', everything is
|
|
||||||
fine again.
|
|
||||||
* Went back to just having a plugin file, no autoload file. By having
|
|
||||||
the autoload, WinManager was no longer working and without really
|
|
||||||
digging into the cause, it was easier to go back to using just a
|
|
||||||
plugin file.
|
|
||||||
7.1.1 - Fixes:
|
|
||||||
* A problem spotted by Thomas Arendsen Hein.
|
|
||||||
When running Vim (7.1.94), error E493 was being thrown.
|
|
||||||
Enhancements:
|
|
||||||
* Added 'D' for 'delete' buffer as the 'd' command was a 'wipe'
|
|
||||||
buffer.
|
|
||||||
7.1.0 - Another 'major' update, some by Dave Larson, some by me.
|
|
||||||
* Making use of 'autoload' now to make the plugin load quicker.
|
|
||||||
* Removed '\bs' and '\bv'. These are now controlled by the user. The
|
|
||||||
user can issue a ':sp' or ':vs' to create a horizontal or vertical
|
|
||||||
split window and then issue a '\be'
|
|
||||||
* Added handling of tabs.
|
|
||||||
7.0.17 - Fixed issue with 'drop' command.
|
|
||||||
Various enhancements and improvements.
|
|
||||||
7.0.16 - Fixed issue reported by Liu Jiaping on non Windows systems, which was
|
|
||||||
...
|
|
||||||
Open file1, open file2, modify file1, open bufexplorer, you get the
|
|
||||||
following error:
|
|
||||||
|
|
||||||
--------8<--------
|
|
||||||
Error detected while processing function
|
|
||||||
<SNR>14_StartBufExplorer..<SNR>14_SplitOpen:
|
|
||||||
line 4:
|
|
||||||
E37: No write since last change (add ! to override)
|
|
||||||
|
|
||||||
But the worse thing is, when I want to save the current buffer and
|
|
||||||
type ':w', I get another error message:
|
|
||||||
E382: Cannot write, 'buftype' option is set
|
|
||||||
--------8<--------
|
|
||||||
|
|
||||||
7.0.15 - Thanks to Mark Smithfield for suggesting bufexplorer needed to handle
|
|
||||||
the ':args' command.
|
|
||||||
7.0.14 - Thanks to Randall Hansen for removing the requirement of terminal
|
|
||||||
versions to be recompiled with 'gui' support so the 'drop' command
|
|
||||||
would work. The 'drop' command is really not needed in terminal
|
|
||||||
versions.
|
|
||||||
7.0.13 - Fixed integration with WinManager.
|
|
||||||
Thanks to Dave Eggum for another update.
|
|
||||||
- Fix: The detailed help didn't display the mapping for toggling
|
|
||||||
the split type, even though the split type is displayed.
|
|
||||||
- Fixed incorrect description in the detailed help for toggling
|
|
||||||
relative or full paths.
|
|
||||||
- Deprecated s:ExtractBufferNbr(). Vim's str2nr() does the same
|
|
||||||
thing.
|
|
||||||
- Created a s:Set() function that sets a variable only if it hasn't
|
|
||||||
already been defined. It's useful for initializing all those
|
|
||||||
default settings.
|
|
||||||
- Removed checks for repetitive command definitions. They were
|
|
||||||
unnecessary.
|
|
||||||
- Made the help highlighting a little more fancy.
|
|
||||||
- Minor reverse compatibility issue: Changed ambiguous setting
|
|
||||||
names to be more descriptive of what they do (also makes the code
|
|
||||||
easier to follow):
|
|
||||||
Changed bufExplorerSortDirection to bufExplorerReverseSort
|
|
||||||
Changed bufExplorerSplitType to bufExplorerSplitVertical
|
|
||||||
Changed bufExplorerOpenMode to bufExplorerUseCurrentWindow
|
|
||||||
- When the BufExplorer window closes, all the file-local marks are
|
|
||||||
now deleted. This may have the benefit of cleaning up some of the
|
|
||||||
jumplist.
|
|
||||||
- Changed the name of the parameter for StartBufExplorer from
|
|
||||||
"split" to "open". The parameter is a string which specifies how
|
|
||||||
the buffer will be open, not if it is split or not.
|
|
||||||
- Deprecated DoAnyMoreBuffersExist() - it is a one line function
|
|
||||||
only used in one spot.
|
|
||||||
- Created four functions (SplitOpen(), RebuildBufferList(),
|
|
||||||
UpdateHelpStatus() and ReSortListing()) all with one purpose - to
|
|
||||||
reduce repeated code.
|
|
||||||
- Changed the name of AddHeader() to CreateHelp() to be more
|
|
||||||
descriptive of what it does. It now returns an array instead of
|
|
||||||
updating the window directly. This has the benefit of making the
|
|
||||||
code more efficient since the text the function returns is used a
|
|
||||||
little differently in the two places the function is called.
|
|
||||||
- Other minor simplifications.
|
|
||||||
7.0.12 - MAJOR Update.
|
|
||||||
This version will ONLY run with Vim version 7.0 or greater.
|
|
||||||
Dave Eggum has made some 'significant' updates to this latest
|
|
||||||
version:
|
|
||||||
- Added BufExplorerGetAltBuf() global function to be used in the
|
|
||||||
user’s rulerformat.
|
|
||||||
- Added g:bufExplorerSplitRight option.
|
|
||||||
- Added g:bufExplorerShowRelativePath option with mapping.
|
|
||||||
- Added current line highlighting.
|
|
||||||
- The split type can now be changed whether bufexplorer is opened
|
|
||||||
in split mode or not.
|
|
||||||
- Various major and minor bug fixes and speed improvements.
|
|
||||||
- Sort by extension.
|
|
||||||
Other improvements/changes:
|
|
||||||
- Changed the help key from '?' to <F1> to be more 'standard'.
|
|
||||||
- Fixed splitting of vertical bufexplorer window.
|
|
||||||
Hopefully I have not forgot something :)
|
|
||||||
7.0.11 - Fixed a couple of highlighting bugs, reported by David Eggum. He also
|
|
||||||
changed passive voice to active on a couple of warning messages.
|
|
||||||
7.0.10 - Fixed bug report by Xiangjiang Ma. If the 'ssl' option is set,
|
|
||||||
the slash character used when displaying the path was incorrect.
|
|
||||||
7.0.9 - Martin Grenfell found and eliminated an annoying bug in the
|
|
||||||
bufexplorer/winmanager integration. The bug was were an
|
|
||||||
annoying message would be displayed when a window was split or
|
|
||||||
a new file was opened in a new window. Thanks Martin!
|
|
||||||
7.0.8 - Thanks to Mike Li for catching a bug in the WinManager integration.
|
|
||||||
The bug was related to the incorrect displaying of the buffer
|
|
||||||
explorer's window title.
|
|
||||||
7.0.7 - Thanks to Jeremy Cowgar for adding a new enhancement. This
|
|
||||||
enhancement allows the user to press 'S', that is capital S, which
|
|
||||||
will open the buffer under the cursor in a newly created split
|
|
||||||
window.
|
|
||||||
7.0.6 - Thanks to Larry Zhang for finding a bug in the "split" buffer code.
|
|
||||||
If you force set g:bufExplorerSplitType='v' in your vimrc, and if you
|
|
||||||
tried to do a \bs to split the bufexplorer window, it would always
|
|
||||||
split horizontal, not vertical. He also found that I had a typeo in
|
|
||||||
that the variable g:bufExplorerSplitVertSize was all lower case in
|
|
||||||
the documentation which was incorrect.
|
|
||||||
7.0.5 - Thanks to Mun Johl for pointing out a bug that if a buffer was
|
|
||||||
modified, the '+' was not showing up correctly.
|
|
||||||
7.0.4 - Fixed a problem discovered first by Xiangjiang Ma. Well since I've
|
|
||||||
been using vim 7.0 and not 6.3, I started using a function (getftype)
|
|
||||||
that is not in 6.3. So for backward compatibility, I conditionaly use
|
|
||||||
this function now. Thus, the g:bufExplorerShowDirectories feature is
|
|
||||||
only available when using vim 7.0 and above.
|
|
||||||
7.0.3 - Thanks to Erwin Waterlander for finding a problem when the last
|
|
||||||
buffer was deleted. This issue got me to rewrite the buffer display
|
|
||||||
logic (which I've wanted to do for sometime now).
|
|
||||||
Also great thanks to Dave Eggum for coming up with idea for
|
|
||||||
g:bufExplorerShowDirectories. Read the above information about this
|
|
||||||
feature.
|
|
||||||
7.0.2 - Thanks to Thomas Arendsen Hein for finding a problem when a user
|
|
||||||
has the default help turned off and then brought up the explorer. An
|
|
||||||
E493 would be displayed.
|
|
||||||
7.0.1 - Thanks to Erwin Waterlander for finding a couple problems.
|
|
||||||
The first problem allowed a modified buffer to be deleted. Opps! The
|
|
||||||
second problem occurred when several files were opened, BufExplorer
|
|
||||||
was started, the current buffer was deleted using the 'd' option, and
|
|
||||||
then BufExplorer was exited. The deleted buffer was still visible
|
|
||||||
while it is not in the buffers list. Opps again!
|
|
||||||
7.0.0 - Thanks to Shankar R. for suggesting to add the ability to set
|
|
||||||
the fixed width (g:bufExplorerSplitVertSize) of a new window
|
|
||||||
when opening bufexplorer vertically and fixed height
|
|
||||||
(g:bufExplorerSplitHorzSize) of a new window when opening
|
|
||||||
bufexplorer horizontally. By default, the windows are normally
|
|
||||||
split to use half the existing width or height.
|
|
||||||
6.3.0 - Added keepjumps so that the jumps list would not get cluttered with
|
|
||||||
bufexplorer related stuff.
|
|
||||||
6.2.3 - Thanks to Jay Logan for finding a bug in the vertical split position
|
|
||||||
of the code. When selecting that the window was to be split
|
|
||||||
vertically by doing a '\bv', from then on, all splits, i.e. '\bs',
|
|
||||||
were split vertically, even though g:bufExplorerSplitType was not set
|
|
||||||
to 'v'.
|
|
||||||
6.2.2 - Thanks to Patrik Modesto for adding a small improvement. For some
|
|
||||||
reason his bufexplorer window was always showing up folded. He added
|
|
||||||
'setlocal nofoldenable' and it was fixed.
|
|
||||||
6.2.1 - Thanks goes out to Takashi Matsuo for added the 'fullPath' sorting
|
|
||||||
logic and option.
|
|
||||||
6.2.0 - Thanks goes out to Simon Johann-Ganter for spotting and fixing a
|
|
||||||
problem in that the last search pattern is overridden by the search
|
|
||||||
pattern for blank lines.
|
|
||||||
6.1.6 - Thanks to Artem Chuprina for finding a pesky bug that has been around
|
|
||||||
for sometime now. The <esc> key mapping was causing the buffer
|
|
||||||
explored to close prematurely when vim was run in an xterm. The <esc>
|
|
||||||
key mapping is now removed.
|
|
||||||
6.1.5 - Thanks to Khorev Sergey. Added option to show default help or not.
|
|
||||||
6.1.4 - Thanks goes out to Valery Kondakoff for suggesting the addition of
|
|
||||||
setlocal nonumber and foldcolumn=0. This allows for line numbering
|
|
||||||
and folding to be turned off temporarily while in the explorer.
|
|
||||||
6.1.3 - Added folding. Did some code cleanup. Added the ability to force the
|
|
||||||
newly split window to be temporarily vertical, which was suggested by
|
|
||||||
Thomas Glanzmann.
|
|
||||||
6.1.2 - Now pressing the <esc> key will quit, just like 'q'.
|
|
||||||
Added folds to hide winmanager configuration.
|
|
||||||
If anyone had the 'C' option in their cpoptions they would receive
|
|
||||||
a E10 error on startup of BufExplorer. cpo is now saved, updated and
|
|
||||||
restored. Thanks to Charles E Campbell, Jr.
|
|
||||||
Attempted to make sure there can only be one BufExplorer window open
|
|
||||||
at a time.
|
|
||||||
6.1.1 - Thanks to Brian D. Goodwin for adding toupper to FileNameCmp. This
|
|
||||||
way buffers sorted by name will be in the correct order regardless of
|
|
||||||
case.
|
|
||||||
6.0.16 - Thanks to Andre Pang for the original patch/idea to get bufexplorer
|
|
||||||
to work in insertmode/modeless mode (evim). Added Initialize
|
|
||||||
and Cleanup autocommands to handle commands that need to be
|
|
||||||
performed when starting or leaving bufexplorer.
|
|
||||||
6.0.15 - Srinath Avadhanulax added a patch for winmanager.vim.
|
|
||||||
6.0.14 - Fix a few more bug that I thought I already had fixed. Thanks
|
|
||||||
to Eric Bloodworth for adding 'Open Mode/Edit in Place'. Added
|
|
||||||
vertical splitting.
|
|
||||||
6.0.13 - Thanks to Charles E Campbell, Jr. for pointing out some embarrassing
|
|
||||||
typos that I had in the documentation. I guess I need to run
|
|
||||||
the spell checker more :o)
|
|
||||||
6.0.12 - Thanks to Madoka Machitani, for the tip on adding the augroup command
|
|
||||||
around the MRUList autocommands.
|
|
||||||
6.0.11 - Fixed bug report by Xiangjiang Ma. '"=' was being added to the
|
|
||||||
search history which messed up hlsearch.
|
|
||||||
6.0.10 - Added the necessary hooks so that the Srinath Avadhanula's
|
|
||||||
winmanager.vim script could more easily integrate with this script.
|
|
||||||
Tried to improve performance.
|
|
||||||
6.0.9 - Added MRU (Most Recently Used) sort ordering.
|
|
||||||
6.0.8 - Was not resetting the showcmd command correctly.
|
|
||||||
Added nifty help file.
|
|
||||||
6.0.7 - Thanks to Brett Carlane for some great enhancements. Some are added,
|
|
||||||
some are not, yet. Added highlighting of current and alternate
|
|
||||||
filenames. Added splitting of path/filename toggle. Reworked
|
|
||||||
ShowBuffers().
|
|
||||||
Changed my email address.
|
|
||||||
6.0.6 - Copyright notice added. Needed this so that it could be distributed
|
|
||||||
with Debian Linux. Fixed problem with the SortListing() function
|
|
||||||
failing when there was only one buffer to display.
|
|
||||||
6.0.5 - Fixed problems reported by David Pascoe, in that you where unable to
|
|
||||||
hit 'd' on a buffer that belonged to a files that no longer existed
|
|
||||||
and that the 'yank' buffer was being overridden by the help text when
|
|
||||||
the bufexplorer was opened.
|
|
||||||
6.0.4 - Thanks to Charles Campbell, Jr. for making this plugin more plugin
|
|
||||||
*compliant*, adding default keymappings of <Leader>be and <Leader>bs
|
|
||||||
as well as fixing the 'w:sortDirLabel not being defined' bug.
|
|
||||||
6.0.3 - Added sorting capabilities. Sort taken from explorer.vim.
|
|
||||||
6.0.2 - Can't remember. (2001-07-25)
|
|
||||||
6.0.1 - Initial release.
|
|
||||||
|
|
||||||
===============================================================================
|
|
||||||
TODO *bufexplorer-todo*
|
|
||||||
|
|
||||||
- Nothing as of now, buf if you have any suggestions, drop me an email.
|
|
||||||
|
|
||||||
===============================================================================
|
|
||||||
CREDITS *bufexplorer-credits*
|
|
||||||
|
|
||||||
Author: Jeff Lanzarotta <delux256-vim at yahoo dot com>
|
|
||||||
|
|
||||||
Credit must go out to Bram Moolenaar and all the Vim developers for
|
|
||||||
making the world's best editor (IMHO). I also want to thank everyone who
|
|
||||||
helped and gave me suggestions. I wouldn't want to leave anyone out so I
|
|
||||||
won't list names.
|
|
||||||
|
|
||||||
===============================================================================
|
|
||||||
vim:tw=78:noet:wrap:ts=8:ft=help:norl:
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,21 +0,0 @@
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2016 Yuta Taniguchi
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
|
@ -1,136 +0,0 @@
|
||||||
# comfortable-motion.vim
|
|
||||||
|
|
||||||
Brings physics-based smooth scrolling to the Vim/Neovim world!
|
|
||||||
|
|
||||||
This is highly motivated by the lack of a plugin similar to my favorite Emacs package [emacs-inertial-scroll](https://github.com/kiwanami/emacs-inertial-scroll).
|
|
||||||
|
|
||||||
Scroll with `C-d`/`C-u`:
|
|
||||||
![Scroll with `C-d`/`C-u`](https://cloud.githubusercontent.com/assets/158553/21579969/841ab468-d013-11e6-8ce6-aa5442d52b6b.gif)
|
|
||||||
|
|
||||||
Scroll with `C-f`/`C-b`:
|
|
||||||
![Scroll with `C-f`/`C-b`](https://cloud.githubusercontent.com/assets/158553/21579968/841929ea-d013-11e6-82fb-e0f3d3e8e896.gif)
|
|
||||||
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
This plugin depends on the timer API, which requires Vim/Neovim to be at least the following version:
|
|
||||||
|
|
||||||
- Vim 7.4.1578 or above
|
|
||||||
- Neovim 0.1.5 or above
|
|
||||||
|
|
||||||
However, currently, this plugin is only tested on Vim 8.0 and Neovim 0.1.7, i.e. my current development environment.
|
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
For example, with [vim-plug](https://github.com/junegunn/vim-plug):
|
|
||||||
```vim
|
|
||||||
Plug 'yuttie/comfortable-motion.vim'
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
Please note that the following mappings for `<C-d>` and `<C-u>` are not ones for you if you expect they scroll a buffer just half a window.
|
|
||||||
|
|
||||||
### Scrolling Method
|
|
||||||
|
|
||||||
This plugin relies on `<C-e>` and `<C-y>` by default to actually scroll a window.
|
|
||||||
You can customize these keys to other combinations like `j` and `k` as follows:
|
|
||||||
|
|
||||||
```vim
|
|
||||||
let g:comfortable_motion_scroll_down_key = "j"
|
|
||||||
let g:comfortable_motion_scroll_up_key = "k"
|
|
||||||
```
|
|
||||||
|
|
||||||
This results in:
|
|
||||||
|
|
||||||
![Different scrolling method](https://cloud.githubusercontent.com/assets/158553/24331179/ebc5b106-1269-11e7-90c2-747a68dec44b.gif)
|
|
||||||
|
|
||||||
Please note that you cannot choose complex keys consisting of multiple motions, e.g. `$j`.
|
|
||||||
This is because the current implementation prepends the number of scroll amount to the keys, e.g. `5$j`, and executes it once per simulation tick.
|
|
||||||
|
|
||||||
|
|
||||||
### Keys and Mouse Wheel
|
|
||||||
|
|
||||||
By default, the following key mappings are defined.
|
|
||||||
|
|
||||||
```vim
|
|
||||||
nnoremap <silent> <C-d> :call comfortable_motion#flick(100)<CR>
|
|
||||||
nnoremap <silent> <C-u> :call comfortable_motion#flick(-100)<CR>
|
|
||||||
|
|
||||||
nnoremap <silent> <C-f> :call comfortable_motion#flick(200)<CR>
|
|
||||||
nnoremap <silent> <C-b> :call comfortable_motion#flick(-200)<CR>
|
|
||||||
```
|
|
||||||
|
|
||||||
To prevent the plugin from defining those default key mappings,
|
|
||||||
you can set `g:comfortable_motion_no_default_key_mappings` to 1.
|
|
||||||
|
|
||||||
```vim
|
|
||||||
let g:comfortable_motion_no_default_key_mappings = 1
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
Additionally, if your Vim/NeoVim has mouse support, you can get mouse wheel to scroll a window by the following mappings:
|
|
||||||
|
|
||||||
```vim
|
|
||||||
noremap <silent> <ScrollWheelDown> :call comfortable_motion#flick(40)<CR>
|
|
||||||
noremap <silent> <ScrollWheelUp> :call comfortable_motion#flick(-40)<CR>
|
|
||||||
```
|
|
||||||
|
|
||||||
You may need to enable the `mouse` option for the above to work, for example, by `set mouse=a`.
|
|
||||||
|
|
||||||
|
|
||||||
### Simulation Parameters
|
|
||||||
|
|
||||||
There are three configurable parameters:
|
|
||||||
|
|
||||||
* `g:comfortable_motion_interval` [default: 1000.0 / 60]
|
|
||||||
* `g:comfortable_motion_friction` [default: 80.0]
|
|
||||||
* `g:comfortable_motion_air_drag` [default: 2.0]
|
|
||||||
|
|
||||||
For example, with any of the following configurations, you can get `<C-u>`/`<C-d>` (with the
|
|
||||||
default impulse value of `-100`/`100`) to scroll a window about 25 lines, but
|
|
||||||
tastes are different.
|
|
||||||
|
|
||||||
|
|
||||||
### Friction & Air Resistance
|
|
||||||
|
|
||||||
```vim
|
|
||||||
let g:comfortable_motion_friction = 80.0
|
|
||||||
let g:comfortable_motion_air_drag = 2.0
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### Friction Only
|
|
||||||
|
|
||||||
```vim
|
|
||||||
let g:comfortable_motion_friction = 200.0
|
|
||||||
let g:comfortable_motion_air_drag = 0.0
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### Air Resistance Only
|
|
||||||
|
|
||||||
```vim
|
|
||||||
let g:comfortable_motion_friction = 0.0
|
|
||||||
let g:comfortable_motion_air_drag = 4.0
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Advanced Configurations
|
|
||||||
|
|
||||||
If you would like to use scrolling proportional to the window height,
|
|
||||||
you may use settings such as these:
|
|
||||||
```vim
|
|
||||||
let g:comfortable_motion_no_default_key_mappings = 1
|
|
||||||
let g:comfortable_motion_impulse_multiplier = 1 " Feel free to increase/decrease this value.
|
|
||||||
nnoremap <silent> <C-d> :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * 2)<CR>
|
|
||||||
nnoremap <silent> <C-u> :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * -2)<CR>
|
|
||||||
nnoremap <silent> <C-f> :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * 4)<CR>
|
|
||||||
nnoremap <silent> <C-b> :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * -4)<CR>
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
MIT License
|
|
|
@ -1,91 +0,0 @@
|
||||||
"=============================================================================
|
|
||||||
" File: comfortable_motion.vim
|
|
||||||
" Author: Yuta Taniguchi
|
|
||||||
" Created: 2016-10-02
|
|
||||||
"=============================================================================
|
|
||||||
|
|
||||||
scriptencoding utf-8
|
|
||||||
|
|
||||||
if !exists('g:loaded_comfortable_motion')
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let g:loaded_comfortable_motion = 1
|
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
|
||||||
set cpo&vim
|
|
||||||
|
|
||||||
|
|
||||||
" Default parameter values
|
|
||||||
if !exists('g:comfortable_motion_interval')
|
|
||||||
let g:comfortable_motion_interval = 1000.0 / 60
|
|
||||||
endif
|
|
||||||
if !exists('g:comfortable_motion_friction')
|
|
||||||
let g:comfortable_motion_friction = 80.0
|
|
||||||
endif
|
|
||||||
if !exists('g:comfortable_motion_air_drag')
|
|
||||||
let g:comfortable_motion_air_drag = 2.0
|
|
||||||
endif
|
|
||||||
if !exists('g:comfortable_motion_scroll_down_key')
|
|
||||||
let g:comfortable_motion_scroll_down_key = "\<C-e>"
|
|
||||||
endif
|
|
||||||
if !exists('g:comfortable_motion_scroll_up_key')
|
|
||||||
let g:comfortable_motion_scroll_up_key = "\<C-y>"
|
|
||||||
endif
|
|
||||||
|
|
||||||
" The state
|
|
||||||
let s:comfortable_motion_state = {
|
|
||||||
\ 'impulse': 0.0,
|
|
||||||
\ 'velocity': 0.0,
|
|
||||||
\ 'delta': 0.0,
|
|
||||||
\ }
|
|
||||||
|
|
||||||
function! s:tick(timer_id)
|
|
||||||
|
|
||||||
let l:st = s:comfortable_motion_state " This is just an alias for the global variable
|
|
||||||
if abs(l:st.velocity) >= 1 || l:st.impulse != 0 " short-circuit if velocity is less than one
|
|
||||||
let l:dt = g:comfortable_motion_interval / 1000.0 " Unit conversion: ms -> s
|
|
||||||
|
|
||||||
" Compute resistance forces
|
|
||||||
let l:vel_sign = l:st.velocity == 0
|
|
||||||
\ ? 0
|
|
||||||
\ : l:st.velocity / abs(l:st.velocity)
|
|
||||||
let l:friction = -l:vel_sign * g:comfortable_motion_friction * 1 " The mass is 1
|
|
||||||
let l:air_drag = -l:st.velocity * g:comfortable_motion_air_drag
|
|
||||||
let l:additional_force = l:friction + l:air_drag
|
|
||||||
|
|
||||||
" Update the state
|
|
||||||
let l:st.delta += l:st.velocity * l:dt
|
|
||||||
let l:st.velocity += l:st.impulse + (abs(l:additional_force * l:dt) > abs(l:st.velocity) ? -l:st.velocity : l:additional_force * l:dt)
|
|
||||||
let l:st.impulse = 0
|
|
||||||
|
|
||||||
" Scroll
|
|
||||||
let l:int_delta = float2nr(l:st.delta >= 0 ? floor(l:st.delta) : ceil(l:st.delta))
|
|
||||||
let l:st.delta -= l:int_delta
|
|
||||||
if l:int_delta > 0
|
|
||||||
execute "normal! " . string(abs(l:int_delta)) . g:comfortable_motion_scroll_down_key
|
|
||||||
elseif l:int_delta < 0
|
|
||||||
execute "normal! " . string(abs(l:int_delta)) . g:comfortable_motion_scroll_up_key
|
|
||||||
else
|
|
||||||
" Do nothing
|
|
||||||
endif
|
|
||||||
redraw
|
|
||||||
else
|
|
||||||
" Stop scrolling and the thread
|
|
||||||
let l:st.velocity = 0
|
|
||||||
let l:st.delta = 0
|
|
||||||
call timer_stop(s:timer_id)
|
|
||||||
unlet s:timer_id
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! comfortable_motion#flick(impulse)
|
|
||||||
if !exists('s:timer_id')
|
|
||||||
" There is no thread, start one
|
|
||||||
let l:interval = float2nr(round(g:comfortable_motion_interval))
|
|
||||||
let s:timer_id = timer_start(l:interval, function("s:tick"), {'repeat': -1})
|
|
||||||
endif
|
|
||||||
let s:comfortable_motion_state.impulse += a:impulse
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
|
||||||
unlet s:save_cpo
|
|
|
@ -1,29 +0,0 @@
|
||||||
"=============================================================================
|
|
||||||
" File: comfortable_motion.vim
|
|
||||||
" Author: Yuta Taniguchi
|
|
||||||
" Created: 2016-10-02
|
|
||||||
"=============================================================================
|
|
||||||
|
|
||||||
scriptencoding utf-8
|
|
||||||
|
|
||||||
if exists('g:loaded_comfortable_motion')
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let g:loaded_comfortable_motion = 1
|
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
|
||||||
set cpo&vim
|
|
||||||
|
|
||||||
|
|
||||||
if !exists('g:comfortable_motion_no_default_key_mappings') ||
|
|
||||||
\ !g:comfortable_motion_no_default_key_mappings
|
|
||||||
nnoremap <silent> <C-d> :call comfortable_motion#flick(100)<CR>
|
|
||||||
nnoremap <silent> <C-u> :call comfortable_motion#flick(-100)<CR>
|
|
||||||
|
|
||||||
nnoremap <silent> <C-f> :call comfortable_motion#flick(200)<CR>
|
|
||||||
nnoremap <silent> <C-b> :call comfortable_motion#flick(-200)<CR>
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
|
||||||
unlet s:save_cpo
|
|
7
sources_non_forked/ctrlp.vim/.gitignore
vendored
7
sources_non_forked/ctrlp.vim/.gitignore
vendored
|
@ -1,7 +0,0 @@
|
||||||
*.markdown
|
|
||||||
*.zip
|
|
||||||
note.txt
|
|
||||||
tags
|
|
||||||
tags-cn
|
|
||||||
.hg*
|
|
||||||
tmp/*
|
|
|
@ -1,30 +0,0 @@
|
||||||
VIM LICENSE
|
|
||||||
|
|
||||||
I) There are no restrictions on distributing unmodified copies of Vim except that they must include this license text. You can also distribute unmodified parts of Vim, likewise unrestricted except that they must include this license text. You are also allowed to include executables that you made from the unmodified Vim sources, plus your own usage examples and Vim scripts.
|
|
||||||
|
|
||||||
II) It is allowed to distribute a modified (or extended) version of Vim, including executables and/or source code, when the following four conditions are met:
|
|
||||||
|
|
||||||
1) This license text must be included unmodified.
|
|
||||||
|
|
||||||
2) The modified Vim must be distributed in one of the following five ways:
|
|
||||||
|
|
||||||
a) If you make changes to Vim yourself, you must clearly describe in the distribution how to contact you. When the maintainer asks you (in any way) for a copy of the modified Vim you distributed, you must make your changes, including source code, available to the maintainer without fee. The maintainer reserves the right to include your changes in the official version of Vim. What the maintainer will do with your changes and under what license they will be distributed is negotiable. If there has been no negotiation then this license, or a later version, also applies to your changes. The current maintainer is Bram Moolenaar <Bram@vim.org>. If this changes it will be announced in appropriate places (most likely vim.sf.net, www.vim.org and/or comp.editors). When it is completely impossible to contact the maintainer, the obligation to send him your changes ceases. Once the maintainer has confirmed that he has received your changes they will not have to be sent again.
|
|
||||||
|
|
||||||
b) If you have received a modified Vim that was distributed as mentioned under a) you are allowed to further distribute it unmodified, as mentioned at I). If you make additional changes the text under a) applies to those changes.
|
|
||||||
|
|
||||||
c) Provide all the changes, including source code, with every copy of the modified Vim you distribute. This may be done in the form of a context diff. You can choose what license to use for new code you add. The changes and their license must not restrict others from making their own changes to the official version of Vim.
|
|
||||||
|
|
||||||
d) When you have a modified Vim which includes changes as mentioned under c), you can distribute it without the source code for the changes if the following three conditions are met:
|
|
||||||
- The license that applies to the changes permits you to distribute the changes to the Vim maintainer without fee or restriction, and permits the Vim maintainer to include the changes in the official version of Vim without fee or restriction.
|
|
||||||
- You keep the changes for at least three years after last distributing the corresponding modified Vim. When the maintainer or someone who you distributed the modified Vim to asks you (in any way) for the changes within this period, you must make them available to him.
|
|
||||||
- You clearly describe in the distribution how to contact you. This contact information must remain valid for at least three years after last distributing the corresponding modified Vim, or as long as possible.
|
|
||||||
|
|
||||||
e) When the GNU General Public License (GPL) applies to the changes, you can distribute the modified Vim under the GNU GPL version 2 or any later version.
|
|
||||||
|
|
||||||
3) A message must be added, at least in the output of the ":version" command and in the intro screen, such that the user of the modified Vim is able to see that it was modified. When distributing as mentioned under 2)e) adding the message is only required for as far as this does not conflict with the license used for the changes.
|
|
||||||
|
|
||||||
4) The contact information as required under 2)a) and 2)d) must not be removed or changed, except that the person himself can make corrections.
|
|
||||||
|
|
||||||
III) If you distribute a modified version of Vim, you are encouraged to use the Vim license for your changes and make them available to the maintainer, including the source code. The preferred way to do this is by e-mail or by uploading the files to a server and e-mailing the URL. If the number of changes is small (e.g., a modified Makefile) e-mailing a context diff will do. The e-mail address to be used is <maintainer@vim.org>
|
|
||||||
|
|
||||||
IV) It is not allowed to remove this license from the distribution of the Vim sources, parts of it or from a modified version. You may use this license for previous Vim releases instead of the license that they came with, at your option.
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,173 +0,0 @@
|
||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/autoignore.vim
|
|
||||||
" Description: Auto-ignore Extension
|
|
||||||
" Author: Ludovic Chabant <github.com/ludovicchabant>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
|
|
||||||
" Global Settings {{{
|
|
||||||
|
|
||||||
if exists('g:ctrlp_autoignore_loaded') && g:ctrlp_autoignore_loaded
|
|
||||||
\ && !g:ctrlp_autoignore_debug
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let g:ctrlp_autoignore_loaded = 1
|
|
||||||
|
|
||||||
if !exists('g:ctrlp_autoignore_debug')
|
|
||||||
let g:ctrlp_autoignore_debug = 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !exists('g:ctrlp_autoignore_trace')
|
|
||||||
let g:ctrlp_autoignore_trace = 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
" }}}
|
|
||||||
|
|
||||||
" Initialization {{{
|
|
||||||
|
|
||||||
if !exists('g:ctrlp_custom_ignore')
|
|
||||||
let g:ctrlp_custom_ignore = {}
|
|
||||||
endif
|
|
||||||
let g:ctrlp_custom_ignore['func'] = 'ctrlp#autoignore#ignore'
|
|
||||||
let g:ctrlp_custom_ignore['func-init'] = 'ctrlp#autoignore#ignore_init'
|
|
||||||
let g:ctrlp_custom_ignore['func-close'] = 'ctrlp#autoignore#ignore_close'
|
|
||||||
|
|
||||||
if !exists('g:ctrlp_root_markers')
|
|
||||||
let g:ctrlp_root_markers = []
|
|
||||||
endif
|
|
||||||
call add(g:ctrlp_root_markers, '.ctrlpignore')
|
|
||||||
|
|
||||||
" }}}
|
|
||||||
|
|
||||||
" Internals {{{
|
|
||||||
|
|
||||||
function! s:trace(message) abort
|
|
||||||
if g:ctrlp_autoignore_trace
|
|
||||||
echom "ctrlp_autoignore: " . a:message
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
let s:proj_cache = {}
|
|
||||||
let s:active_cwd = ''
|
|
||||||
let s:active_cwd_len = 0
|
|
||||||
let s:active_patterns = []
|
|
||||||
let s:changed_wildignore = 0
|
|
||||||
let s:prev_wildignore = ''
|
|
||||||
|
|
||||||
function! s:load_project_patterns(root_dir) abort
|
|
||||||
let l:ign_path = a:root_dir . '/.ctrlpignore'
|
|
||||||
if !filereadable(l:ign_path)
|
|
||||||
call s:trace("No pattern file at: " . l:ign_path)
|
|
||||||
return []
|
|
||||||
endif
|
|
||||||
let l:cursyntax = 'regexp'
|
|
||||||
let l:knownsyntaxes = ['regexp', 'wildignore']
|
|
||||||
let l:patterns = []
|
|
||||||
let l:lines = readfile(l:ign_path)
|
|
||||||
for line in l:lines
|
|
||||||
" Comment line?
|
|
||||||
if match(line, '\v^\s*$') >= 0 || match(line, '\v^\s*#') >= 0
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
" Syntax change?
|
|
||||||
let l:matches = matchlist(line, '\v^syntax:\s?(\w+)\s*$')
|
|
||||||
if len(l:matches) > 0
|
|
||||||
let l:cursyntax = l:matches[1]
|
|
||||||
if index(l:knownsyntaxes, l:cursyntax) < 0
|
|
||||||
echoerr "ctrlp_autoignore: Unknown syntax '".l:cursyntax."' in: ".l:ign_path
|
|
||||||
endif
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
" Patterns!
|
|
||||||
let l:matches = matchlist(line, '\v^((dir|file|link)\:)?(.*)')
|
|
||||||
let l:mtype = l:matches[2]
|
|
||||||
let l:mpat = l:matches[3]
|
|
||||||
call add(l:patterns, {'syn': l:cursyntax, 'type': l:mtype, 'pat': l:mpat})
|
|
||||||
endfor
|
|
||||||
call s:trace("Loaded " . len(l:patterns) . " patterns from: " . l:ign_path)
|
|
||||||
return l:patterns
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! s:get_project_patterns(root_dir) abort
|
|
||||||
let l:ign_path = a:root_dir . '/.ctrlpignore'
|
|
||||||
let l:ign_mtime = getftime(l:ign_path)
|
|
||||||
let l:patterns = get(s:proj_cache, a:root_dir)
|
|
||||||
if type(l:patterns) == type({})
|
|
||||||
" Check that these patterns are still valid.
|
|
||||||
if l:ign_mtime < 0
|
|
||||||
" File got deleted! :(
|
|
||||||
let l:patterns['pats'] = []
|
|
||||||
return l:patterns['pats']
|
|
||||||
elseif l:ign_mtime <= l:patterns['mtime']
|
|
||||||
" File hasn't changed! :)
|
|
||||||
return l:patterns['pats']
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
call s:trace("Loading patterns for project: " . a:root_dir)
|
|
||||||
let l:loaded = s:load_project_patterns(a:root_dir)
|
|
||||||
let s:proj_cache[a:root_dir] = {
|
|
||||||
\'mtime': localtime(),
|
|
||||||
\'pats': l:loaded}
|
|
||||||
return l:loaded
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" The custom ignore function that CtrlP will be using in addition to
|
|
||||||
" normal pattern-based matching.
|
|
||||||
function! ctrlp#autoignore#ignore(item, type) abort
|
|
||||||
let l:cnv_item = tr(strpart(a:item, s:active_cwd_len), "\\", "/")
|
|
||||||
for pat in s:active_patterns
|
|
||||||
if pat['syn'] != 'regexp'
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
if pat['type'] == '' || pat['type'] == a:type
|
|
||||||
if match(l:cnv_item, pat['pat']) >= 0
|
|
||||||
call s:trace("Ignoring ".l:cnv_item." because of ".pat['pat'])
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
return 0
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ctrlp#autoignore#ignore_init() abort
|
|
||||||
let l:root = getcwd()
|
|
||||||
let s:active_cwd = l:root
|
|
||||||
" len+1 is for including the next separator after the root.
|
|
||||||
let s:active_cwd_len = len(l:root) + 1
|
|
||||||
let s:active_patterns = s:get_project_patterns(l:root)
|
|
||||||
call s:trace("Got ".len(s:active_patterns)." patterns for ".l:root)
|
|
||||||
|
|
||||||
let s:changed_wildignore = 0
|
|
||||||
let s:prev_wildignore = &wildignore
|
|
||||||
for pat in s:active_patterns
|
|
||||||
if pat['syn'] == 'wildignore'
|
|
||||||
execute 'set wildignore+='.pat['pat']
|
|
||||||
let s:changed_wildignore = 1
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
if s:changed_wildignore
|
|
||||||
call s:trace("Set wildignore to ".&wildignore)
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ctrlp#autoignore#ignore_close() abort
|
|
||||||
if s:changed_wildignore
|
|
||||||
execute 'set wildignore='.s:prev_wildignore
|
|
||||||
let s:prev_wildignore = ''
|
|
||||||
call s:trace("Set wildignore back to ".&wildignore)
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" List patterns for a given project's root.
|
|
||||||
function! ctrlp#autoignore#get_patterns(root_dir) abort
|
|
||||||
let l:patterns = s:get_project_patterns(a:root_dir)
|
|
||||||
for pat in l:patterns
|
|
||||||
let l:prefix = pat['type'] == '' ? '(all)' : pat['type']
|
|
||||||
echom l:prefix . ':' . pat['pat']
|
|
||||||
endfor
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" }}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
|
@ -1,147 +0,0 @@
|
||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/bookmarkdir.vim
|
|
||||||
" Description: Bookmarked directories extension
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Init {{{1
|
|
||||||
if exists('g:loaded_ctrlp_bookmarkdir') && g:loaded_ctrlp_bookmarkdir
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let g:loaded_ctrlp_bookmarkdir = 1
|
|
||||||
|
|
||||||
cal add(g:ctrlp_ext_vars, {
|
|
||||||
\ 'init': 'ctrlp#bookmarkdir#init()',
|
|
||||||
\ 'accept': 'ctrlp#bookmarkdir#accept',
|
|
||||||
\ 'lname': 'bookmarked dirs',
|
|
||||||
\ 'sname': 'bkd',
|
|
||||||
\ 'type': 'tabs',
|
|
||||||
\ 'opmul': 1,
|
|
||||||
\ 'nolim': 1,
|
|
||||||
\ 'wipe': 'ctrlp#bookmarkdir#remove',
|
|
||||||
\ })
|
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:getinput(str, ...)
|
|
||||||
echoh Identifier
|
|
||||||
cal inputsave()
|
|
||||||
let input = call('input', a:0 ? [a:str] + a:000 : [a:str])
|
|
||||||
cal inputrestore()
|
|
||||||
echoh None
|
|
||||||
retu input
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:cachefile()
|
|
||||||
if !exists('s:cadir') || !exists('s:cafile')
|
|
||||||
let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'bkd'
|
|
||||||
let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt'
|
|
||||||
en
|
|
||||||
retu s:cafile
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:writecache(lines)
|
|
||||||
cal ctrlp#utils#writecache(a:lines, s:cadir, s:cafile)
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:getbookmarks()
|
|
||||||
retu ctrlp#utils#readfile(s:cachefile())
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:savebookmark(name, cwd)
|
|
||||||
let cwds = exists('+ssl') ? [tr(a:cwd, '\', '/'), tr(a:cwd, '/', '\')] : [a:cwd]
|
|
||||||
let entries = filter(s:getbookmarks(), 'index(cwds, s:parts(v:val)[1]) < 0')
|
|
||||||
cal s:writecache(insert(entries, a:name.' '.a:cwd))
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:setentries()
|
|
||||||
let time = getftime(s:cachefile())
|
|
||||||
if !( exists('s:bookmarks') && time == s:bookmarks[0] )
|
|
||||||
let s:bookmarks = [time, s:getbookmarks()]
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:parts(str)
|
|
||||||
let mlist = matchlist(a:str, '\v([^\t]+)\t(.*)$')
|
|
||||||
retu mlist != [] ? mlist[1:2] : ['', '']
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:process(entries, type)
|
|
||||||
retu map(a:entries, 's:modify(v:val, a:type)')
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:modify(entry, type)
|
|
||||||
let [name, dir] = s:parts(a:entry)
|
|
||||||
let dir = fnamemodify(dir, a:type)
|
|
||||||
retu name.' '.( dir == '' ? '.' : dir )
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:msg(name, cwd)
|
|
||||||
redr
|
|
||||||
echoh Identifier | echon 'Bookmarked ' | echoh Constant
|
|
||||||
echon a:name.' ' | echoh Directory | echon a:cwd
|
|
||||||
echoh None
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:syntax()
|
|
||||||
if !ctrlp#nosy()
|
|
||||||
cal ctrlp#hicheck('CtrlPBookmark', 'Identifier')
|
|
||||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
|
||||||
sy match CtrlPBookmark '^> [^\t]\+' contains=CtrlPLinePre
|
|
||||||
sy match CtrlPTabExtra '\zs\t.*\ze$'
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#bookmarkdir#init()
|
|
||||||
cal s:setentries()
|
|
||||||
cal s:syntax()
|
|
||||||
retu s:process(copy(s:bookmarks[1]), ':.')
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#bookmarkdir#accept(mode, str)
|
|
||||||
let parts = s:parts(s:modify(a:str, ':p'))
|
|
||||||
cal call('s:savebookmark', parts)
|
|
||||||
if a:mode =~ 't\|v\|h'
|
|
||||||
cal ctrlp#exit()
|
|
||||||
en
|
|
||||||
cal ctrlp#setdir(parts[1], a:mode =~ 't\|h' ? 'chd!' : 'lc!')
|
|
||||||
if a:mode == 'e'
|
|
||||||
cal ctrlp#switchtype(0)
|
|
||||||
cal ctrlp#recordhist()
|
|
||||||
cal ctrlp#prtclear()
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#bookmarkdir#add(bang, dir, ...)
|
|
||||||
let ctrlp_tilde_homedir = get(g:, 'ctrlp_tilde_homedir', 0)
|
|
||||||
let cwd = fnamemodify(getcwd(), ctrlp_tilde_homedir ? ':p:~' : ':p')
|
|
||||||
let dir = fnamemodify(a:dir, ctrlp_tilde_homedir ? ':p:~' : ':p')
|
|
||||||
if a:bang == '!'
|
|
||||||
let cwd = dir != '' ? dir : cwd
|
|
||||||
let name = a:0 && a:1 != '' ? a:1 : cwd
|
|
||||||
el
|
|
||||||
let str = 'Directory to bookmark: '
|
|
||||||
let cwd = dir != '' ? dir : s:getinput(str, cwd, 'dir')
|
|
||||||
if cwd == '' | retu | en
|
|
||||||
let name = a:0 && a:1 != '' ? a:1 : s:getinput('Bookmark as: ', cwd)
|
|
||||||
if name == '' | retu | en
|
|
||||||
en
|
|
||||||
let name = tr(name, ' ', ' ')
|
|
||||||
cal s:savebookmark(name, cwd)
|
|
||||||
cal s:msg(name, cwd)
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#bookmarkdir#remove(entries)
|
|
||||||
cal s:process(a:entries, ':p')
|
|
||||||
cal s:writecache(a:entries == [] ? [] :
|
|
||||||
\ filter(s:getbookmarks(), 'index(a:entries, v:val) < 0'))
|
|
||||||
cal s:setentries()
|
|
||||||
retu s:process(copy(s:bookmarks[1]), ':.')
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#bookmarkdir#id()
|
|
||||||
retu s:id
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
|
@ -1,277 +0,0 @@
|
||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/buffertag.vim
|
|
||||||
" Description: Buffer Tag extension
|
|
||||||
" Maintainer: Kien Nguyen <github.com/kien>
|
|
||||||
" Credits: Much of the code was taken from tagbar.vim by Jan Larres, plus
|
|
||||||
" a few lines from taglist.vim by Yegappan Lakshmanan and from
|
|
||||||
" buffertag.vim by Takeshi Nishida.
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Init {{{1
|
|
||||||
if exists('g:loaded_ctrlp_buftag') && g:loaded_ctrlp_buftag
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let g:loaded_ctrlp_buftag = 1
|
|
||||||
|
|
||||||
cal add(g:ctrlp_ext_vars, {
|
|
||||||
\ 'init': 'ctrlp#buffertag#init(s:crfile)',
|
|
||||||
\ 'accept': 'ctrlp#buffertag#accept',
|
|
||||||
\ 'lname': 'buffer tags',
|
|
||||||
\ 'sname': 'bft',
|
|
||||||
\ 'exit': 'ctrlp#buffertag#exit()',
|
|
||||||
\ 'type': 'tabs',
|
|
||||||
\ 'opts': 'ctrlp#buffertag#opts()',
|
|
||||||
\ })
|
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
||||||
|
|
||||||
let [s:pref, s:opts] = ['g:ctrlp_buftag_', {
|
|
||||||
\ 'systemenc': ['s:enc', &enc],
|
|
||||||
\ 'ctags_bin': ['s:bin', ''],
|
|
||||||
\ 'types': ['s:usr_types', {}],
|
|
||||||
\ }]
|
|
||||||
|
|
||||||
let s:bins = [
|
|
||||||
\ 'ctags-exuberant',
|
|
||||||
\ 'exuberant-ctags',
|
|
||||||
\ 'exctags',
|
|
||||||
\ '/usr/local/bin/ctags',
|
|
||||||
\ '/opt/local/bin/ctags',
|
|
||||||
\ 'ctags',
|
|
||||||
\ 'ctags.exe',
|
|
||||||
\ 'tags',
|
|
||||||
\ ]
|
|
||||||
|
|
||||||
let s:types = {
|
|
||||||
\ 'ant' : '%sant%sant%spt',
|
|
||||||
\ 'asm' : '%sasm%sasm%sdlmt',
|
|
||||||
\ 'aspperl': '%sasp%sasp%sfsv',
|
|
||||||
\ 'aspvbs' : '%sasp%sasp%sfsv',
|
|
||||||
\ 'awk' : '%sawk%sawk%sf',
|
|
||||||
\ 'beta' : '%sbeta%sbeta%sfsv',
|
|
||||||
\ 'c' : '%sc%sc%sdgsutvf',
|
|
||||||
\ 'cpp' : '%sc++%sc++%snvdtcgsuf',
|
|
||||||
\ 'cs' : '%sc#%sc#%sdtncEgsipm',
|
|
||||||
\ 'cobol' : '%scobol%scobol%sdfgpPs',
|
|
||||||
\ 'delphi' : '%spascal%spascal%sfp',
|
|
||||||
\ 'dosbatch': '%sdosbatch%sdosbatch%slv',
|
|
||||||
\ 'eiffel' : '%seiffel%seiffel%scf',
|
|
||||||
\ 'erlang' : '%serlang%serlang%sdrmf',
|
|
||||||
\ 'expect' : '%stcl%stcl%scfp',
|
|
||||||
\ 'fortran': '%sfortran%sfortran%spbceiklmntvfs',
|
|
||||||
\ 'go' : '%sgo%sgo%sfctv',
|
|
||||||
\ 'html' : '%shtml%shtml%saf',
|
|
||||||
\ 'java' : '%sjava%sjava%spcifm',
|
|
||||||
\ 'javascript': '%sjavascript%sjavascript%sf',
|
|
||||||
\ 'lisp' : '%slisp%slisp%sf',
|
|
||||||
\ 'lua' : '%slua%slua%sf',
|
|
||||||
\ 'make' : '%smake%smake%sm',
|
|
||||||
\ 'matlab' : '%smatlab%smatlab%sf',
|
|
||||||
\ 'ocaml' : '%socaml%socaml%scmMvtfCre',
|
|
||||||
\ 'pascal' : '%spascal%spascal%sfp',
|
|
||||||
\ 'perl' : '%sperl%sperl%sclps',
|
|
||||||
\ 'php' : '%sphp%sphp%scdvf',
|
|
||||||
\ 'python' : '%spython%spython%scmf',
|
|
||||||
\ 'rexx' : '%srexx%srexx%ss',
|
|
||||||
\ 'ruby' : '%sruby%sruby%scfFm',
|
|
||||||
\ 'rust' : '%srust%srust%sfTgsmctid',
|
|
||||||
\ 'scheme' : '%sscheme%sscheme%ssf',
|
|
||||||
\ 'sh' : '%ssh%ssh%sf',
|
|
||||||
\ 'csh' : '%ssh%ssh%sf',
|
|
||||||
\ 'zsh' : '%ssh%ssh%sf',
|
|
||||||
\ 'scala' : '%sscala%sscala%sctTmlp',
|
|
||||||
\ 'slang' : '%sslang%sslang%snf',
|
|
||||||
\ 'sml' : '%ssml%ssml%secsrtvf',
|
|
||||||
\ 'sql' : '%ssql%ssql%scFPrstTvfp',
|
|
||||||
\ 'tex' : '%stex%stex%sipcsubPGl',
|
|
||||||
\ 'tcl' : '%stcl%stcl%scfmp',
|
|
||||||
\ 'vera' : '%svera%svera%scdefgmpPtTvx',
|
|
||||||
\ 'verilog': '%sverilog%sverilog%smcPertwpvf',
|
|
||||||
\ 'vhdl' : '%svhdl%svhdl%sPctTrefp',
|
|
||||||
\ 'vim' : '%svim%svim%savf',
|
|
||||||
\ 'yacc' : '%syacc%syacc%sl',
|
|
||||||
\ }
|
|
||||||
|
|
||||||
cal map(s:types, 'printf(v:val, "--language-force=", " --", "-types=")')
|
|
||||||
|
|
||||||
if executable('jsctags')
|
|
||||||
cal extend(s:types, { 'javascript': { 'args': '-f -', 'bin': 'jsctags' } })
|
|
||||||
en
|
|
||||||
|
|
||||||
fu! ctrlp#buffertag#opts()
|
|
||||||
for [ke, va] in items(s:opts)
|
|
||||||
let {va[0]} = exists(s:pref.ke) ? {s:pref.ke} : va[1]
|
|
||||||
endfo
|
|
||||||
" Ctags bin
|
|
||||||
if empty(s:bin)
|
|
||||||
for bin in s:bins | if executable(bin)
|
|
||||||
let s:bin = bin
|
|
||||||
brea
|
|
||||||
en | endfo
|
|
||||||
el
|
|
||||||
let s:bin = expand(s:bin, 1)
|
|
||||||
en
|
|
||||||
" Types
|
|
||||||
cal extend(s:types, s:usr_types)
|
|
||||||
endf
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:validfile(fname, ftype)
|
|
||||||
if ( !empty(a:fname) || !empty(a:ftype) ) && filereadable(a:fname)
|
|
||||||
\ && index(keys(s:types), a:ftype) >= 0 | retu 1 | en
|
|
||||||
retu 0
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:exectags(cmd)
|
|
||||||
if exists('+ssl')
|
|
||||||
let [ssl, &ssl] = [&ssl, 0]
|
|
||||||
en
|
|
||||||
if &sh =~ 'cmd\.exe'
|
|
||||||
let [sxq, &sxq, shcf, &shcf] = [&sxq, '"', &shcf, '/s /c']
|
|
||||||
en
|
|
||||||
let output = system(a:cmd)
|
|
||||||
if &sh =~ 'cmd\.exe'
|
|
||||||
let [&sxq, &shcf] = [sxq, shcf]
|
|
||||||
en
|
|
||||||
if exists('+ssl')
|
|
||||||
let &ssl = ssl
|
|
||||||
en
|
|
||||||
retu output
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:exectagsonfile(fname, ftype)
|
|
||||||
let [ags, ft] = ['-f - --sort=no --excmd=pattern --fields=nKs --extra= --file-scope=yes ', a:ftype]
|
|
||||||
if type(s:types[ft]) == 1
|
|
||||||
let ags .= s:types[ft]
|
|
||||||
let bin = s:bin
|
|
||||||
elsei type(s:types[ft]) == 4
|
|
||||||
let ags = s:types[ft]['args']
|
|
||||||
let bin = expand(s:types[ft]['bin'], 1)
|
|
||||||
en
|
|
||||||
if empty(bin) | retu '' | en
|
|
||||||
let cmd = s:esctagscmd(bin, ags, a:fname)
|
|
||||||
if empty(cmd) | retu '' | en
|
|
||||||
let output = s:exectags(cmd)
|
|
||||||
if v:shell_error || output =~ 'Warning: cannot open' | retu '' | en
|
|
||||||
retu output
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:esctagscmd(bin, args, ...)
|
|
||||||
if exists('+ssl')
|
|
||||||
let [ssl, &ssl] = [&ssl, 0]
|
|
||||||
en
|
|
||||||
let fname = a:0 ? shellescape(a:1) : ''
|
|
||||||
if (has('win32') || has('win64'))
|
|
||||||
let cmd = a:bin.' '.a:args.' '.fname
|
|
||||||
else
|
|
||||||
let cmd = shellescape(a:bin).' '.a:args.' '.fname
|
|
||||||
endif
|
|
||||||
if &sh =~ 'cmd\.exe'
|
|
||||||
let cmd = substitute(cmd, '[&()@^<>|]', '^\0', 'g')
|
|
||||||
en
|
|
||||||
if exists('+ssl')
|
|
||||||
let &ssl = ssl
|
|
||||||
en
|
|
||||||
if has('iconv')
|
|
||||||
let last = s:enc != &enc ? s:enc : !empty( $LANG ) ? $LANG : &enc
|
|
||||||
let cmd = iconv(cmd, &enc, last)
|
|
||||||
en
|
|
||||||
retu cmd
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:process(fname, ftype)
|
|
||||||
if !s:validfile(a:fname, a:ftype) | retu [] | endif
|
|
||||||
let ftime = getftime(a:fname)
|
|
||||||
if has_key(g:ctrlp_buftags, a:fname)
|
|
||||||
\ && g:ctrlp_buftags[a:fname]['time'] >= ftime
|
|
||||||
let lines = g:ctrlp_buftags[a:fname]['lines']
|
|
||||||
el
|
|
||||||
let data = s:exectagsonfile(a:fname, a:ftype)
|
|
||||||
let [raw, lines] = [split(data, '\n\+'), []]
|
|
||||||
for line in raw
|
|
||||||
if line !~# '^!_TAG_' && len(split(line, ';"')) == 2
|
|
||||||
let parsed_line = s:parseline(line)
|
|
||||||
if parsed_line != ''
|
|
||||||
cal add(lines, parsed_line)
|
|
||||||
en
|
|
||||||
en
|
|
||||||
endfo
|
|
||||||
let cache = { a:fname : { 'time': ftime, 'lines': lines } }
|
|
||||||
cal extend(g:ctrlp_buftags, cache)
|
|
||||||
en
|
|
||||||
retu lines
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:parseline(line)
|
|
||||||
let vals = matchlist(a:line,
|
|
||||||
\ '\v^([^\t]+)\t(.+)\t[?/]\^?(.{-1,})\$?[?/]\;\"\t(.+)\tline(no)?\:(\d+)')
|
|
||||||
if vals == [] | retu '' | en
|
|
||||||
let [bufnr, bufname] = [bufnr('^'.vals[2].'$'), fnamemodify(vals[2], ':p:t')]
|
|
||||||
retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3]
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:syntax()
|
|
||||||
if !ctrlp#nosy()
|
|
||||||
cal ctrlp#hicheck('CtrlPTagKind', 'Title')
|
|
||||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
|
||||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
|
||||||
sy match CtrlPTagKind '\zs[^\t|]\+\ze|\d\+:[^|]\+|\d\+|'
|
|
||||||
sy match CtrlPBufName '|\d\+:\zs[^|]\+\ze|\d\+|'
|
|
||||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName,CtrlPTagKind
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:chknearby(pat)
|
|
||||||
if match(getline('.'), a:pat) < 0
|
|
||||||
let [int, forw, maxl] = [1, 1, line('$')]
|
|
||||||
wh !search(a:pat, 'W'.( forw ? '' : 'b' ))
|
|
||||||
if !forw
|
|
||||||
if int > maxl | brea | en
|
|
||||||
let int += int
|
|
||||||
en
|
|
||||||
let forw = !forw
|
|
||||||
endw
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#buffertag#init(fname)
|
|
||||||
let bufs = exists('s:btmode') && s:btmode
|
|
||||||
\ ? filter(ctrlp#buffers(), 'filereadable(v:val)')
|
|
||||||
\ : [exists('s:bufname') ? s:bufname : a:fname]
|
|
||||||
let lines = []
|
|
||||||
for each in bufs
|
|
||||||
let bname = fnamemodify(each, ':p')
|
|
||||||
let tftype = get(split(getbufvar('^'.bname.'$', '&ft'), '\.'), 0, '')
|
|
||||||
cal extend(lines, s:process(bname, tftype))
|
|
||||||
endfo
|
|
||||||
cal s:syntax()
|
|
||||||
retu lines
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#buffertag#accept(mode, str)
|
|
||||||
let vals = matchlist(a:str,
|
|
||||||
\ '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|\s(.+)$')
|
|
||||||
let bufnr = str2nr(get(vals, 1))
|
|
||||||
if bufnr
|
|
||||||
cal ctrlp#acceptfile(a:mode, bufnr)
|
|
||||||
exe 'norm!' str2nr(get(vals, 2, line('.'))).'G'
|
|
||||||
cal s:chknearby('\V\C'.get(vals, 3, ''))
|
|
||||||
sil! norm! zvzz
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#buffertag#cmd(mode, ...)
|
|
||||||
let s:btmode = a:mode
|
|
||||||
if a:0 && !empty(a:1)
|
|
||||||
let s:btmode = 0
|
|
||||||
let bname = a:1 =~# '^%$\|^#\d*$' ? expand(a:1) : a:1
|
|
||||||
let s:bufname = fnamemodify(bname, ':p')
|
|
||||||
en
|
|
||||||
retu s:id
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#buffertag#exit()
|
|
||||||
unl! s:btmode s:bufname
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
|
@ -1,98 +0,0 @@
|
||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/changes.vim
|
|
||||||
" Description: Change list extension
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Init {{{1
|
|
||||||
if exists('g:loaded_ctrlp_changes') && g:loaded_ctrlp_changes
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let g:loaded_ctrlp_changes = 1
|
|
||||||
|
|
||||||
cal add(g:ctrlp_ext_vars, {
|
|
||||||
\ 'init': 'ctrlp#changes#init(s:bufnr, s:crbufnr)',
|
|
||||||
\ 'accept': 'ctrlp#changes#accept',
|
|
||||||
\ 'lname': 'changes',
|
|
||||||
\ 'sname': 'chs',
|
|
||||||
\ 'exit': 'ctrlp#changes#exit()',
|
|
||||||
\ 'type': 'tabe',
|
|
||||||
\ 'sort': 0,
|
|
||||||
\ 'nolim': 1,
|
|
||||||
\ })
|
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:changelist(bufnr)
|
|
||||||
sil! exe 'noa hid b' a:bufnr
|
|
||||||
redi => result
|
|
||||||
sil! changes
|
|
||||||
redi END
|
|
||||||
retu map(split(result, "\n")[1:], 'tr(v:val, " ", " ")')
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:process(clines, ...)
|
|
||||||
let [clines, evas] = [[], []]
|
|
||||||
for each in a:clines
|
|
||||||
let parts = matchlist(each, '\v^.\s*\d+\s+(\d+)\s+(\d+)\s(.*)$')
|
|
||||||
if !empty(parts)
|
|
||||||
if parts[3] == '' | let parts[3] = ' ' | en
|
|
||||||
cal add(clines, parts[3].' |'.a:1.':'.a:2.'|'.parts[1].':'.parts[2].'|')
|
|
||||||
en
|
|
||||||
endfo
|
|
||||||
retu reverse(filter(clines, 'count(clines, v:val) == 1'))
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:syntax()
|
|
||||||
if !ctrlp#nosy()
|
|
||||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
|
||||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
|
||||||
sy match CtrlPBufName '\t|\d\+:\zs[^|]\+\ze|\d\+:\d\+|$'
|
|
||||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#changes#init(original_bufnr, bufnr)
|
|
||||||
let bufnr = exists('s:bufnr') ? s:bufnr : a:bufnr
|
|
||||||
let bufs = exists('s:clmode') && s:clmode ? ctrlp#buffers('id') : [bufnr]
|
|
||||||
cal filter(bufs, 'v:val > 0')
|
|
||||||
let [swb, &swb] = [&swb, '']
|
|
||||||
let lines = []
|
|
||||||
for each in bufs
|
|
||||||
let bname = bufname(each)
|
|
||||||
let fnamet = fnamemodify(bname == '' ? '[No Name]' : bname, ':t')
|
|
||||||
cal extend(lines, s:process(s:changelist(each), each, fnamet))
|
|
||||||
endfo
|
|
||||||
sil! exe 'noa hid b' a:original_bufnr
|
|
||||||
let &swb = swb
|
|
||||||
cal ctrlp#syntax()
|
|
||||||
cal s:syntax()
|
|
||||||
retu lines
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#changes#accept(mode, str)
|
|
||||||
let info = matchlist(a:str, '\t|\(\d\+\):[^|]\+|\(\d\+\):\(\d\+\)|$')
|
|
||||||
let bufnr = str2nr(get(info, 1))
|
|
||||||
if bufnr
|
|
||||||
cal ctrlp#acceptfile(a:mode, bufnr)
|
|
||||||
cal cursor(get(info, 2), get(info, 3))
|
|
||||||
sil! norm! zvzz
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#changes#cmd(mode, ...)
|
|
||||||
let s:clmode = a:mode
|
|
||||||
if a:0 && !empty(a:1)
|
|
||||||
let s:clmode = 0
|
|
||||||
let bname = a:1 =~# '^%$\|^#\d*$' ? expand(a:1) : a:1
|
|
||||||
let s:bufnr = bufnr('^'.fnamemodify(bname, ':p').'$')
|
|
||||||
en
|
|
||||||
retu s:id
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#changes#exit()
|
|
||||||
unl! s:clmode s:bufnr
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
|
@ -1,95 +0,0 @@
|
||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/dir.vim
|
|
||||||
" Description: Directory extension
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Init {{{1
|
|
||||||
if exists('g:loaded_ctrlp_dir') && g:loaded_ctrlp_dir
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let [g:loaded_ctrlp_dir, g:ctrlp_newdir] = [1, 0]
|
|
||||||
|
|
||||||
let s:ars = ['s:maxdepth', 's:maxfiles', 's:compare_lim', 's:glob', 's:caching']
|
|
||||||
|
|
||||||
cal add(g:ctrlp_ext_vars, {
|
|
||||||
\ 'init': 'ctrlp#dir#init('.join(s:ars, ', ').')',
|
|
||||||
\ 'accept': 'ctrlp#dir#accept',
|
|
||||||
\ 'lname': 'dirs',
|
|
||||||
\ 'sname': 'dir',
|
|
||||||
\ 'type': 'path',
|
|
||||||
\ 'specinput': 1,
|
|
||||||
\ })
|
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
||||||
|
|
||||||
let s:dircounts = {}
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:globdirs(dirs, depth)
|
|
||||||
let entries = split(globpath(a:dirs, s:glob), "\n")
|
|
||||||
let [dirs, depth] = [ctrlp#dirnfile(entries)[0], a:depth + 1]
|
|
||||||
cal extend(g:ctrlp_alldirs, dirs)
|
|
||||||
let nr = len(g:ctrlp_alldirs)
|
|
||||||
if !empty(dirs) && !s:max(nr, s:maxfiles) && depth <= s:maxdepth
|
|
||||||
sil! cal ctrlp#progress(nr)
|
|
||||||
cal map(dirs, 'ctrlp#utils#fnesc(v:val, "g", ",")')
|
|
||||||
cal s:globdirs(join(dirs, ','), depth)
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:max(len, max)
|
|
||||||
retu a:max && a:len > a:max
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:nocache()
|
|
||||||
retu !s:caching || ( s:caching > 1 && get(s:dircounts, s:cwd) < s:caching )
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#dir#init(...)
|
|
||||||
let s:cwd = getcwd()
|
|
||||||
for each in range(len(s:ars))
|
|
||||||
let {s:ars[each]} = a:{each + 1}
|
|
||||||
endfo
|
|
||||||
let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'dir'
|
|
||||||
let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile('dir')
|
|
||||||
if g:ctrlp_newdir || s:nocache() || !filereadable(cafile)
|
|
||||||
let [s:initcwd, g:ctrlp_alldirs] = [s:cwd, []]
|
|
||||||
if !ctrlp#igncwd(s:cwd)
|
|
||||||
cal s:globdirs(ctrlp#utils#fnesc(s:cwd, 'g', ','), 0)
|
|
||||||
en
|
|
||||||
cal ctrlp#rmbasedir(g:ctrlp_alldirs)
|
|
||||||
if len(g:ctrlp_alldirs) <= s:compare_lim
|
|
||||||
cal sort(g:ctrlp_alldirs, 'ctrlp#complen')
|
|
||||||
en
|
|
||||||
cal ctrlp#utils#writecache(g:ctrlp_alldirs, cadir, cafile)
|
|
||||||
let g:ctrlp_newdir = 0
|
|
||||||
el
|
|
||||||
if !( exists('s:initcwd') && s:initcwd == s:cwd )
|
|
||||||
let s:initcwd = s:cwd
|
|
||||||
let g:ctrlp_alldirs = ctrlp#utils#readfile(cafile)
|
|
||||||
en
|
|
||||||
en
|
|
||||||
cal extend(s:dircounts, { s:cwd : len(g:ctrlp_alldirs) })
|
|
||||||
retu g:ctrlp_alldirs
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#dir#accept(mode, str)
|
|
||||||
let path = a:mode == 'h' ? getcwd() : s:cwd.ctrlp#call('s:lash', s:cwd).a:str
|
|
||||||
if a:mode =~ 't\|v\|h'
|
|
||||||
cal ctrlp#exit()
|
|
||||||
en
|
|
||||||
cal ctrlp#setdir(path, a:mode =~ 't\|h' ? 'chd!' : 'lc!')
|
|
||||||
if a:mode == 'e'
|
|
||||||
sil! cal ctrlp#statusline()
|
|
||||||
cal ctrlp#setlines(s:id)
|
|
||||||
cal ctrlp#recordhist()
|
|
||||||
cal ctrlp#prtclear()
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#dir#id()
|
|
||||||
retu s:id
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
|
@ -1,81 +0,0 @@
|
||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/line.vim
|
|
||||||
" Description: Line extension
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Init {{{1
|
|
||||||
if exists('g:loaded_ctrlp_line') && g:loaded_ctrlp_line
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let g:loaded_ctrlp_line = 1
|
|
||||||
|
|
||||||
cal add(g:ctrlp_ext_vars, {
|
|
||||||
\ 'init': 'ctrlp#line#init(s:crbufnr)',
|
|
||||||
\ 'accept': 'ctrlp#line#accept',
|
|
||||||
\ 'act_farg' : 'dict',
|
|
||||||
\ 'lname': 'lines',
|
|
||||||
\ 'sname': 'lns',
|
|
||||||
\ 'type': 'tabe',
|
|
||||||
\ })
|
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:syntax()
|
|
||||||
if !ctrlp#nosy()
|
|
||||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
|
||||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
|
||||||
sy match CtrlPBufName '\t|\zs[^|]\+\ze|\d\+:\d\+|$'
|
|
||||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#line#init(bufnr)
|
|
||||||
let [lines, bufnr] = [[], exists('s:bufnr') ? s:bufnr : a:bufnr]
|
|
||||||
let bufs = exists('s:lnmode') && !empty(s:lnmode) ? ctrlp#buffers('id') : [bufnr]
|
|
||||||
for bufnr in bufs
|
|
||||||
let [lfb, bufn] = [getbufline(bufnr, 1, '$'), bufname(bufnr)]
|
|
||||||
if lfb == [] && bufn != ''
|
|
||||||
let lfb = ctrlp#utils#readfile(fnamemodify(bufn, ':p'))
|
|
||||||
en
|
|
||||||
cal map(lfb, 'tr(v:val, '' '', '' '')')
|
|
||||||
let [linenr, len_lfb] = [1, len(lfb)]
|
|
||||||
let buft = bufn == '' ? '[No Name]' : fnamemodify(bufn, ':t')
|
|
||||||
wh linenr <= len_lfb
|
|
||||||
let lfb[linenr - 1] .= ' |'.buft.'|'.bufnr.':'.linenr.'|'
|
|
||||||
let linenr += 1
|
|
||||||
endw
|
|
||||||
cal extend(lines, filter(lfb, 'v:val !~ ''^\s*\t|[^|]\+|\d\+:\d\+|$'''))
|
|
||||||
endfo
|
|
||||||
cal s:syntax()
|
|
||||||
retu lines
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#line#accept(dict)
|
|
||||||
let mode = a:dict['action']
|
|
||||||
let str = a:dict['line']
|
|
||||||
let input = a:dict['input']
|
|
||||||
let info = matchlist(str, '\t|[^|]\+|\(\d\+\):\(\d\+\)|$')
|
|
||||||
let bufnr = str2nr(get(info, 1))
|
|
||||||
if bufnr
|
|
||||||
cal ctrlp#acceptfile(mode, bufnr, get(info, 2))
|
|
||||||
if !empty(input)
|
|
||||||
let @/ = input
|
|
||||||
call search(input, 'c')
|
|
||||||
call histadd("search", input)
|
|
||||||
en
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#line#cmd(mode, ...)
|
|
||||||
let s:lnmode = a:mode
|
|
||||||
if a:0 && !empty(a:1)
|
|
||||||
let s:lnmode = 0
|
|
||||||
let bname = a:1 =~# '^%$\|^#\d*$' ? expand(a:1) : a:1
|
|
||||||
let s:bufnr = bufnr('^'.fnamemodify(bname, ':p').'$')
|
|
||||||
en
|
|
||||||
retu s:id
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
|
@ -1,88 +0,0 @@
|
||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/mixed.vim
|
|
||||||
" Description: Mixing Files + MRU + Buffers
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Init {{{1
|
|
||||||
if exists('g:loaded_ctrlp_mixed') && g:loaded_ctrlp_mixed
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let [g:loaded_ctrlp_mixed, g:ctrlp_newmix] = [1, 0]
|
|
||||||
|
|
||||||
cal add(g:ctrlp_ext_vars, {
|
|
||||||
\ 'init': 'ctrlp#mixed#init(s:compare_lim)',
|
|
||||||
\ 'accept': 'ctrlp#acceptfile',
|
|
||||||
\ 'lname': 'fil + mru + buf',
|
|
||||||
\ 'sname': 'mix',
|
|
||||||
\ 'type': 'path',
|
|
||||||
\ 'opmul': 1,
|
|
||||||
\ 'specinput': 1,
|
|
||||||
\ })
|
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:newcache(cwd)
|
|
||||||
if g:ctrlp_newmix || !has_key(g:ctrlp_allmixes, 'data') | retu 1 | en
|
|
||||||
retu g:ctrlp_allmixes['cwd'] != a:cwd
|
|
||||||
\ || g:ctrlp_allmixes['filtime'] < getftime(ctrlp#utils#cachefile())
|
|
||||||
\ || g:ctrlp_allmixes['mrutime'] < getftime(ctrlp#mrufiles#cachefile())
|
|
||||||
\ || g:ctrlp_allmixes['bufs'] < len(ctrlp#mrufiles#bufs())
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:getnewmix(cwd, clim)
|
|
||||||
if g:ctrlp_newmix
|
|
||||||
cal ctrlp#mrufiles#refresh('raw')
|
|
||||||
let g:ctrlp_newcache = 1
|
|
||||||
en
|
|
||||||
let g:ctrlp_lines = copy(ctrlp#files())
|
|
||||||
cal ctrlp#progress('Mixing...')
|
|
||||||
let mrufs = copy(ctrlp#mrufiles#list('raw'))
|
|
||||||
if exists('+ssl') && &ssl
|
|
||||||
cal map(mrufs, 'tr(v:val, "\\", "/")')
|
|
||||||
en
|
|
||||||
let allbufs = map(ctrlp#buffers(), 'fnamemodify(v:val, ":p")')
|
|
||||||
let [bufs, ubufs] = [[], []]
|
|
||||||
for each in allbufs
|
|
||||||
cal add(filereadable(each) ? bufs : ubufs, each)
|
|
||||||
endfo
|
|
||||||
let mrufs = bufs + filter(mrufs, 'index(bufs, v:val) < 0')
|
|
||||||
if len(mrufs) > len(g:ctrlp_lines)
|
|
||||||
cal filter(mrufs, 'stridx(v:val, a:cwd)')
|
|
||||||
el
|
|
||||||
let cwd_mrufs = filter(copy(mrufs), '!stridx(v:val, a:cwd)')
|
|
||||||
let cwd_mrufs = ctrlp#rmbasedir(cwd_mrufs)
|
|
||||||
for each in cwd_mrufs
|
|
||||||
let id = index(g:ctrlp_lines, each)
|
|
||||||
if id >= 0 | cal remove(g:ctrlp_lines, id) | en
|
|
||||||
endfo
|
|
||||||
en
|
|
||||||
let mrufs += ubufs
|
|
||||||
cal map(mrufs, 'fnamemodify(v:val, ":.")')
|
|
||||||
let g:ctrlp_lines = len(mrufs) > len(g:ctrlp_lines)
|
|
||||||
\ ? g:ctrlp_lines + mrufs : mrufs + g:ctrlp_lines
|
|
||||||
if len(g:ctrlp_lines) <= a:clim
|
|
||||||
cal sort(g:ctrlp_lines, 'ctrlp#complen')
|
|
||||||
en
|
|
||||||
let g:ctrlp_allmixes = { 'filtime': getftime(ctrlp#utils#cachefile()),
|
|
||||||
\ 'mrutime': getftime(ctrlp#mrufiles#cachefile()), 'cwd': a:cwd,
|
|
||||||
\ 'bufs': len(ctrlp#mrufiles#bufs()), 'data': g:ctrlp_lines }
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#mixed#init(clim)
|
|
||||||
let cwd = getcwd()
|
|
||||||
if s:newcache(cwd)
|
|
||||||
cal s:getnewmix(cwd, a:clim)
|
|
||||||
el
|
|
||||||
let g:ctrlp_lines = g:ctrlp_allmixes['data']
|
|
||||||
en
|
|
||||||
let g:ctrlp_newmix = 0
|
|
||||||
retu g:ctrlp_lines
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#mixed#id()
|
|
||||||
retu s:id
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
|
@ -1,158 +0,0 @@
|
||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/mrufiles.vim
|
|
||||||
" Description: Most Recently Used Files extension
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Static variables {{{1
|
|
||||||
let [s:mrbs, s:mrufs] = [[], []]
|
|
||||||
let s:mruf_map_string = '!stridx(v:val, cwd) ? strpart(v:val, idx) : v:val'
|
|
||||||
|
|
||||||
fu! ctrlp#mrufiles#opts()
|
|
||||||
let [pref, opts] = ['g:ctrlp_mruf_', {
|
|
||||||
\ 'max': ['s:max', 250],
|
|
||||||
\ 'include': ['s:in', ''],
|
|
||||||
\ 'exclude': ['s:ex', ''],
|
|
||||||
\ 'case_sensitive': ['s:cseno', 1],
|
|
||||||
\ 'relative': ['s:re', 0],
|
|
||||||
\ 'save_on_update': ['s:soup', 1],
|
|
||||||
\ 'map_string': ['g:ctrlp_mruf_map_string', s:mruf_map_string],
|
|
||||||
\ }]
|
|
||||||
for [ke, va] in items(opts)
|
|
||||||
let [{va[0]}, {pref.ke}] = [pref.ke, exists(pref.ke) ? {pref.ke} : va[1]]
|
|
||||||
endfo
|
|
||||||
endf
|
|
||||||
cal ctrlp#mrufiles#opts()
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:excl(fn)
|
|
||||||
retu !empty({s:ex}) && a:fn =~# {s:ex}
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:mergelists()
|
|
||||||
let diskmrufs = ctrlp#utils#readfile(ctrlp#mrufiles#cachefile())
|
|
||||||
cal filter(diskmrufs, 'index(s:mrufs, v:val) < 0')
|
|
||||||
let mrufs = s:mrufs + diskmrufs
|
|
||||||
retu s:chop(mrufs)
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:chop(mrufs)
|
|
||||||
if len(a:mrufs) > {s:max} | cal remove(a:mrufs, {s:max}, -1) | en
|
|
||||||
retu a:mrufs
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:reformat(mrufs, ...)
|
|
||||||
let cwd = getcwd()
|
|
||||||
let cwd .= cwd !~ '[\/]$' ? ctrlp#utils#lash() : ''
|
|
||||||
if {s:re}
|
|
||||||
let cwd = exists('+ssl') ? tr(cwd, '/', '\') : cwd
|
|
||||||
cal filter(a:mrufs, '!stridx(v:val, cwd)')
|
|
||||||
en
|
|
||||||
if a:0 && a:1 == 'raw' | retu a:mrufs | en
|
|
||||||
let idx = strlen(cwd)
|
|
||||||
if exists('+ssl') && &ssl
|
|
||||||
let cwd = tr(cwd, '\', '/')
|
|
||||||
cal map(a:mrufs, 'tr(v:val, "\\", "/")')
|
|
||||||
en
|
|
||||||
retu map(a:mrufs, g:ctrlp_mruf_map_string)
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:record(bufnr)
|
|
||||||
if s:locked | retu | en
|
|
||||||
let bufnr = a:bufnr + 0
|
|
||||||
let bufname = bufname(bufnr)
|
|
||||||
if bufnr > 0 && !empty(bufname)
|
|
||||||
cal filter(s:mrbs, 'v:val != bufnr')
|
|
||||||
cal insert(s:mrbs, bufnr)
|
|
||||||
cal s:addtomrufs(bufname)
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:addtomrufs(fname)
|
|
||||||
let fn = fnamemodify(a:fname, get(g:, 'ctrlp_tilde_homedir', 0) ? ':p:~' : ':p')
|
|
||||||
let fn = exists('+ssl') ? tr(fn, '/', '\') : fn
|
|
||||||
let abs_fn = fnamemodify(fn,':p')
|
|
||||||
if ( !empty({s:in}) && fn !~# {s:in} ) || ( !empty({s:ex}) && fn =~# {s:ex} )
|
|
||||||
\ || !empty(getbufvar('^' . abs_fn . '$', '&bt')) || !filereadable(abs_fn)
|
|
||||||
retu
|
|
||||||
en
|
|
||||||
let idx = index(s:mrufs, fn, 0, !{s:cseno})
|
|
||||||
if idx
|
|
||||||
cal filter(s:mrufs, 'v:val !='.( {s:cseno} ? '#' : '?' ).' fn')
|
|
||||||
cal insert(s:mrufs, fn)
|
|
||||||
if {s:soup} && idx < 0
|
|
||||||
cal s:savetofile(s:mergelists())
|
|
||||||
en
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:savetofile(mrufs)
|
|
||||||
cal ctrlp#utils#writecache(a:mrufs, s:cadir, s:cafile)
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#mrufiles#refresh(...)
|
|
||||||
let mrufs = s:mergelists()
|
|
||||||
cal filter(mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)')
|
|
||||||
if exists('+ssl')
|
|
||||||
cal map(mrufs, 'tr(v:val, "/", "\\")')
|
|
||||||
cal map(s:mrufs, 'tr(v:val, "/", "\\")')
|
|
||||||
let cond = 'count(mrufs, v:val, !{s:cseno}) == 1'
|
|
||||||
cal filter(mrufs, cond)
|
|
||||||
cal filter(s:mrufs, cond)
|
|
||||||
en
|
|
||||||
cal s:savetofile(mrufs)
|
|
||||||
retu a:0 && a:1 == 'raw' ? [] : s:reformat(mrufs)
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#mrufiles#remove(files)
|
|
||||||
let mrufs = []
|
|
||||||
if a:files != []
|
|
||||||
let mrufs = s:mergelists()
|
|
||||||
let cond = 'index(a:files, v:val, 0, !{s:cseno}) < 0'
|
|
||||||
cal filter(mrufs, cond)
|
|
||||||
cal filter(s:mrufs, cond)
|
|
||||||
en
|
|
||||||
cal s:savetofile(mrufs)
|
|
||||||
retu s:reformat(mrufs)
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#mrufiles#add(fn)
|
|
||||||
if !empty(a:fn)
|
|
||||||
cal s:addtomrufs(a:fn)
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#mrufiles#list(...)
|
|
||||||
retu a:0 ? a:1 == 'raw' ? s:reformat(s:mergelists(), a:1) : 0
|
|
||||||
\ : s:reformat(s:mergelists())
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#mrufiles#bufs()
|
|
||||||
retu s:mrbs
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#mrufiles#tgrel()
|
|
||||||
let {s:re} = !{s:re}
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#mrufiles#cachefile()
|
|
||||||
if !exists('s:cadir') || !exists('s:cafile')
|
|
||||||
let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru'
|
|
||||||
let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt'
|
|
||||||
en
|
|
||||||
retu s:cafile
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#mrufiles#init()
|
|
||||||
if !has('autocmd') | retu | en
|
|
||||||
let s:locked = 0
|
|
||||||
aug CtrlPMRUF
|
|
||||||
au!
|
|
||||||
au BufWinEnter,BufWinLeave,BufWritePost * cal s:record(expand('<abuf>', 1))
|
|
||||||
au QuickFixCmdPre *vimgrep* let s:locked = 1
|
|
||||||
au QuickFixCmdPost *vimgrep* let s:locked = 0
|
|
||||||
au VimLeavePre * cal s:savetofile(s:mergelists())
|
|
||||||
aug END
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
|
@ -1,59 +0,0 @@
|
||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/quickfix.vim
|
|
||||||
" Description: Quickfix extension
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Init {{{1
|
|
||||||
if exists('g:loaded_ctrlp_quickfix') && g:loaded_ctrlp_quickfix
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let g:loaded_ctrlp_quickfix = 1
|
|
||||||
|
|
||||||
cal add(g:ctrlp_ext_vars, {
|
|
||||||
\ 'init': 'ctrlp#quickfix#init()',
|
|
||||||
\ 'accept': 'ctrlp#quickfix#accept',
|
|
||||||
\ 'lname': 'quickfix',
|
|
||||||
\ 'sname': 'qfx',
|
|
||||||
\ 'type': 'line',
|
|
||||||
\ 'sort': 0,
|
|
||||||
\ 'nolim': 1,
|
|
||||||
\ })
|
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
||||||
|
|
||||||
fu! s:lineout(dict)
|
|
||||||
retu printf('%s|%d:%d| %s', bufname(a:dict['bufnr']), a:dict['lnum'],
|
|
||||||
\ a:dict['col'], matchstr(a:dict['text'], '\s*\zs.*\S'))
|
|
||||||
endf
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:syntax()
|
|
||||||
if !ctrlp#nosy()
|
|
||||||
cal ctrlp#hicheck('CtrlPqfLineCol', 'Search')
|
|
||||||
sy match CtrlPqfLineCol '|\zs\d\+:\d\+\ze|'
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#quickfix#init()
|
|
||||||
cal s:syntax()
|
|
||||||
retu map(getqflist(), 's:lineout(v:val)')
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#quickfix#accept(mode, str)
|
|
||||||
let vals = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|')
|
|
||||||
if vals == [] || vals[1] == '' | retu | en
|
|
||||||
cal ctrlp#acceptfile(a:mode, vals[1])
|
|
||||||
let cur_pos = getpos('.')[1:2]
|
|
||||||
if cur_pos != [1, 1] && cur_pos != map(vals[2:3], 'str2nr(v:val)')
|
|
||||||
mark '
|
|
||||||
en
|
|
||||||
cal cursor(vals[2], vals[3])
|
|
||||||
sil! norm! zvzz
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#quickfix#id()
|
|
||||||
retu s:id
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
|
@ -1,59 +0,0 @@
|
||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/rtscript.vim
|
|
||||||
" Description: Runtime scripts extension
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Init {{{1
|
|
||||||
if exists('g:loaded_ctrlp_rtscript') && g:loaded_ctrlp_rtscript
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let [g:loaded_ctrlp_rtscript, g:ctrlp_newrts] = [1, 0]
|
|
||||||
|
|
||||||
cal add(g:ctrlp_ext_vars, {
|
|
||||||
\ 'init': 'ctrlp#rtscript#init(s:caching)',
|
|
||||||
\ 'accept': 'ctrlp#acceptfile',
|
|
||||||
\ 'lname': 'runtime scripts',
|
|
||||||
\ 'sname': 'rts',
|
|
||||||
\ 'type': 'path',
|
|
||||||
\ 'opmul': 1,
|
|
||||||
\ })
|
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
||||||
|
|
||||||
let s:filecounts = {}
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:nocache()
|
|
||||||
retu g:ctrlp_newrts ||
|
|
||||||
\ !s:caching || ( s:caching > 1 && get(s:filecounts, s:cwd) < s:caching )
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#rtscript#init(caching)
|
|
||||||
let [s:caching, s:cwd] = [a:caching, getcwd()]
|
|
||||||
if s:nocache() ||
|
|
||||||
\ !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp )
|
|
||||||
sil! cal ctrlp#progress('Indexing...')
|
|
||||||
let entries = split(globpath(ctrlp#utils#fnesc(&rtp, 'g'), '**/*.*'), "\n")
|
|
||||||
cal filter(entries, 'count(entries, v:val) == 1')
|
|
||||||
let [entries, echoed] = [ctrlp#dirnfile(entries)[1], 1]
|
|
||||||
el
|
|
||||||
let [entries, results] = g:ctrlp_rtscache[2:3]
|
|
||||||
en
|
|
||||||
if s:nocache() ||
|
|
||||||
\ !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, s:cwd] )
|
|
||||||
if !exists('echoed')
|
|
||||||
sil! cal ctrlp#progress('Processing...')
|
|
||||||
en
|
|
||||||
let results = map(copy(entries), 'fnamemodify(v:val, '':.'')')
|
|
||||||
en
|
|
||||||
let [g:ctrlp_rtscache, g:ctrlp_newrts] = [[&rtp, s:cwd, entries, results], 0]
|
|
||||||
cal extend(s:filecounts, { s:cwd : len(results) })
|
|
||||||
retu results
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#rtscript#id()
|
|
||||||
retu s:id
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
|
@ -1,146 +0,0 @@
|
||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/tag.vim
|
|
||||||
" Description: Tag file extension
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Init {{{1
|
|
||||||
if exists('g:loaded_ctrlp_tag') && g:loaded_ctrlp_tag
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let g:loaded_ctrlp_tag = 1
|
|
||||||
|
|
||||||
cal add(g:ctrlp_ext_vars, {
|
|
||||||
\ 'init': 'ctrlp#tag#init()',
|
|
||||||
\ 'accept': 'ctrlp#tag#accept',
|
|
||||||
\ 'lname': 'tags',
|
|
||||||
\ 'sname': 'tag',
|
|
||||||
\ 'enter': 'ctrlp#tag#enter()',
|
|
||||||
\ 'type': 'tabs',
|
|
||||||
\ })
|
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:findcount(str, tgaddr)
|
|
||||||
let [tg, ofname] = split(a:str, '\t\+\ze[^\t]\+$')
|
|
||||||
let tgs = taglist('^'.tg.'$')
|
|
||||||
if len(tgs) < 2
|
|
||||||
retu [0, 0, 0, 0]
|
|
||||||
en
|
|
||||||
let bname = fnamemodify(bufname('%'), ':p')
|
|
||||||
let fname = expand(fnamemodify(simplify(ofname), ':s?^[.\/]\+??:p:.'), 1)
|
|
||||||
let [fnd, cnt, pos, ctgs, otgs] = [0, 0, 0, [], []]
|
|
||||||
for tgi in tgs
|
|
||||||
let lst = bname == fnamemodify(tgi["filename"], ':p') ? 'ctgs' : 'otgs'
|
|
||||||
cal call('add', [{lst}, tgi])
|
|
||||||
endfo
|
|
||||||
let ntgs = ctgs + otgs
|
|
||||||
for tgi in ntgs
|
|
||||||
let cnt += 1
|
|
||||||
let fulname = fnamemodify(tgi["filename"], ':p')
|
|
||||||
if stridx(fulname, fname) >= 0
|
|
||||||
\ && strlen(fname) + stridx(fulname, fname) == strlen(fulname)
|
|
||||||
let fnd += 1
|
|
||||||
let pos = cnt
|
|
||||||
en
|
|
||||||
endfo
|
|
||||||
let cnt = 0
|
|
||||||
for tgi in ntgs
|
|
||||||
let cnt += 1
|
|
||||||
if tgi["filename"] == ofname
|
|
||||||
if a:tgaddr != ""
|
|
||||||
if a:tgaddr == tgi["cmd"]
|
|
||||||
let [fnd, pos] = [0, cnt]
|
|
||||||
en
|
|
||||||
else
|
|
||||||
let [fnd, pos] = [0, cnt]
|
|
||||||
en
|
|
||||||
en
|
|
||||||
endfo
|
|
||||||
retu [1, fnd, pos, len(ctgs)]
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:filter(tags)
|
|
||||||
let nr = 0
|
|
||||||
wh 0 < 1
|
|
||||||
if a:tags == [] | brea | en
|
|
||||||
if a:tags[nr] =~ '^!' && a:tags[nr] !~# '^!_TAG_'
|
|
||||||
let nr += 1
|
|
||||||
con
|
|
||||||
en
|
|
||||||
if a:tags[nr] =~# '^!_TAG_' && len(a:tags) > nr
|
|
||||||
cal remove(a:tags, nr)
|
|
||||||
el
|
|
||||||
brea
|
|
||||||
en
|
|
||||||
endw
|
|
||||||
retu a:tags
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:syntax()
|
|
||||||
if !ctrlp#nosy()
|
|
||||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
|
||||||
sy match CtrlPTabExtra '\zs\t.*\ze$'
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#tag#init()
|
|
||||||
if empty(s:tagfiles) | retu [] | en
|
|
||||||
let g:ctrlp_alltags = []
|
|
||||||
let tagfiles = sort(filter(s:tagfiles, 'count(s:tagfiles, v:val) == 1'))
|
|
||||||
for each in tagfiles
|
|
||||||
let alltags = s:filter(ctrlp#utils#readfile(each))
|
|
||||||
cal extend(g:ctrlp_alltags, alltags)
|
|
||||||
endfo
|
|
||||||
cal s:syntax()
|
|
||||||
retu g:ctrlp_alltags
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#tag#accept(mode, str)
|
|
||||||
cal ctrlp#exit()
|
|
||||||
let tgaddr = matchstr(a:str, '^[^\t]\+\t\+[^\t]\+\t\zs[^\t]\{-1,}\ze\%(;"\)\?\t')
|
|
||||||
let str = matchstr(a:str, '^[^\t]\+\t\+[^\t]\+\ze\t')
|
|
||||||
let [tg, fdcnt] = [split(str, '^[^\t]\+\zs\t')[0], s:findcount(str, tgaddr)]
|
|
||||||
let cmds = {
|
|
||||||
\ 't': ['tab sp', 'tab stj'],
|
|
||||||
\ 'h': ['sp', 'stj'],
|
|
||||||
\ 'v': ['vs', 'vert stj'],
|
|
||||||
\ 'e': ['', 'tj'],
|
|
||||||
\ }
|
|
||||||
let utg = fdcnt[3] < 2 && fdcnt[0] == 1 && fdcnt[1] == 1
|
|
||||||
let cmd = !fdcnt[0] || utg ? cmds[a:mode][0] : cmds[a:mode][1]
|
|
||||||
let cmd = a:mode == 'e' && ctrlp#modfilecond(!&aw)
|
|
||||||
\ ? ( cmd == 'tj' ? 'stj' : 'sp' ) : cmd
|
|
||||||
let cmd = a:mode == 't' ? ctrlp#tabcount().cmd : cmd
|
|
||||||
if !fdcnt[0] || utg
|
|
||||||
if cmd != ''
|
|
||||||
exe cmd
|
|
||||||
en
|
|
||||||
let save_cst = &cst
|
|
||||||
set cst&
|
|
||||||
cal feedkeys(":".( utg ? fdcnt[2] : "" )."ta ".tg."\r", 'nt')
|
|
||||||
let &cst = save_cst
|
|
||||||
el
|
|
||||||
let ext = ""
|
|
||||||
if fdcnt[1] < 2 && fdcnt[2]
|
|
||||||
let [sav_more, &more] = [&more, 0]
|
|
||||||
let ext = fdcnt[2]."\r".":let &more = ".sav_more."\r"
|
|
||||||
en
|
|
||||||
cal feedkeys(":".cmd." ".tg."\r".ext, 'nt')
|
|
||||||
en
|
|
||||||
cal feedkeys('zvzz', 'nt')
|
|
||||||
cal ctrlp#setlcdir()
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#tag#id()
|
|
||||||
retu s:id
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#tag#enter()
|
|
||||||
let tfs = get(g:, 'ctrlp_custom_tag_files', tagfiles())
|
|
||||||
let s:tagfiles = type(tfs) == 3 && tfs != [] ? filter(map(tfs, 'fnamemodify(v:val, ":p")'),
|
|
||||||
\ 'filereadable(v:val)') : []
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
|
@ -1,154 +0,0 @@
|
||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/undo.vim
|
|
||||||
" Description: Undo extension
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Init {{{1
|
|
||||||
if ( exists('g:loaded_ctrlp_undo') && g:loaded_ctrlp_undo )
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let g:loaded_ctrlp_undo = 1
|
|
||||||
|
|
||||||
cal add(g:ctrlp_ext_vars, {
|
|
||||||
\ 'init': 'ctrlp#undo#init()',
|
|
||||||
\ 'accept': 'ctrlp#undo#accept',
|
|
||||||
\ 'lname': 'undo',
|
|
||||||
\ 'sname': 'udo',
|
|
||||||
\ 'enter': 'ctrlp#undo#enter()',
|
|
||||||
\ 'exit': 'ctrlp#undo#exit()',
|
|
||||||
\ 'type': 'line',
|
|
||||||
\ 'sort': 0,
|
|
||||||
\ 'nolim': 1,
|
|
||||||
\ })
|
|
||||||
|
|
||||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
||||||
|
|
||||||
let s:text = map(['second', 'seconds', 'minutes', 'hours', 'days', 'weeks',
|
|
||||||
\ 'months', 'years'], '" ".v:val." ago"')
|
|
||||||
" Utilities {{{1
|
|
||||||
fu! s:getundo()
|
|
||||||
if exists('*undotree')
|
|
||||||
\ && ( v:version > 703 || ( v:version == 703 && has('patch005') ) )
|
|
||||||
retu [1, undotree()]
|
|
||||||
el
|
|
||||||
redi => result
|
|
||||||
sil! undol
|
|
||||||
redi END
|
|
||||||
retu [0, split(result, "\n")[1:]]
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:flatten(tree, cur)
|
|
||||||
let flatdict = {}
|
|
||||||
for each in a:tree
|
|
||||||
let saved = has_key(each, 'save') ? 'saved' : ''
|
|
||||||
let current = each['seq'] == a:cur ? 'current' : ''
|
|
||||||
cal extend(flatdict, { each['seq'] : [each['time'], saved, current] })
|
|
||||||
if has_key(each, 'alt')
|
|
||||||
cal extend(flatdict, s:flatten(each['alt'], a:cur))
|
|
||||||
en
|
|
||||||
endfo
|
|
||||||
retu flatdict
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:elapsed(nr)
|
|
||||||
let [text, time] = [s:text, localtime() - a:nr]
|
|
||||||
let mins = time / 60
|
|
||||||
let hrs = time / 3600
|
|
||||||
let days = time / 86400
|
|
||||||
let wks = time / 604800
|
|
||||||
let mons = time / 2592000
|
|
||||||
let yrs = time / 31536000
|
|
||||||
if yrs > 1
|
|
||||||
retu yrs.text[7]
|
|
||||||
elsei mons > 1
|
|
||||||
retu mons.text[6]
|
|
||||||
elsei wks > 1
|
|
||||||
retu wks.text[5]
|
|
||||||
elsei days > 1
|
|
||||||
retu days.text[4]
|
|
||||||
elsei hrs > 1
|
|
||||||
retu hrs.text[3]
|
|
||||||
elsei mins > 1
|
|
||||||
retu mins.text[2]
|
|
||||||
elsei time == 1
|
|
||||||
retu time.text[0]
|
|
||||||
elsei time < 120
|
|
||||||
retu time.text[1]
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:syntax()
|
|
||||||
if ctrlp#nosy() | retu | en
|
|
||||||
for [ke, va] in items({'T': 'Directory', 'Br': 'Comment', 'Nr': 'String',
|
|
||||||
\ 'Sv': 'Comment', 'Po': 'Title'})
|
|
||||||
cal ctrlp#hicheck('CtrlPUndo'.ke, va)
|
|
||||||
endfo
|
|
||||||
sy match CtrlPUndoT '\v\d+ \zs[^ ]+\ze|\d+:\d+:\d+'
|
|
||||||
sy match CtrlPUndoBr '\[\|\]'
|
|
||||||
sy match CtrlPUndoNr '\[\d\+\]' contains=CtrlPUndoBr
|
|
||||||
sy match CtrlPUndoSv 'saved'
|
|
||||||
sy match CtrlPUndoPo 'current'
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:dict2list(dict)
|
|
||||||
for ke in keys(a:dict)
|
|
||||||
let a:dict[ke][0] = s:elapsed(a:dict[ke][0])
|
|
||||||
endfo
|
|
||||||
retu map(keys(a:dict), 'eval(''[v:val, a:dict[v:val]]'')')
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:compval(...)
|
|
||||||
retu a:2[0] - a:1[0]
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:format(...)
|
|
||||||
let saved = !empty(a:1[1][1]) ? ' '.a:1[1][1] : ''
|
|
||||||
let current = !empty(a:1[1][2]) ? ' '.a:1[1][2] : ''
|
|
||||||
retu a:1[1][0].' ['.a:1[0].']'.saved.current
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:formatul(...)
|
|
||||||
let parts = matchlist(a:1,
|
|
||||||
\ '\v^\s+(\d+)\s+\d+\s+([^ ]+\s?[^ ]+|\d+\s\w+\s\w+)(\s*\d*)$')
|
|
||||||
retu parts == [] ? '----'
|
|
||||||
\ : parts[2].' ['.parts[1].']'.( parts[3] != '' ? ' saved' : '' )
|
|
||||||
endf
|
|
||||||
" Public {{{1
|
|
||||||
fu! ctrlp#undo#init()
|
|
||||||
let entries = s:undos[0] ? s:undos[1]['entries'] : s:undos[1]
|
|
||||||
if empty(entries) | retu [] | en
|
|
||||||
if !exists('s:lines')
|
|
||||||
if s:undos[0]
|
|
||||||
let entries = s:dict2list(s:flatten(entries, s:undos[1]['seq_cur']))
|
|
||||||
let s:lines = map(sort(entries, 's:compval'), 's:format(v:val)')
|
|
||||||
el
|
|
||||||
let s:lines = map(reverse(entries), 's:formatul(v:val)')
|
|
||||||
en
|
|
||||||
en
|
|
||||||
cal s:syntax()
|
|
||||||
retu s:lines
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#undo#accept(mode, str)
|
|
||||||
let undon = matchstr(a:str, '\[\zs\d\+\ze\]')
|
|
||||||
if empty(undon) | retu | en
|
|
||||||
cal ctrlp#exit()
|
|
||||||
exe 'u' undon
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#undo#id()
|
|
||||||
retu s:id
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#undo#enter()
|
|
||||||
let s:undos = s:getundo()
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#undo#exit()
|
|
||||||
unl! s:lines
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
|
@ -1,110 +0,0 @@
|
||||||
" =============================================================================
|
|
||||||
" File: autoload/ctrlp/utils.vim
|
|
||||||
" Description: Utilities
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
|
|
||||||
" Static variables {{{1
|
|
||||||
fu! ctrlp#utils#lash()
|
|
||||||
retu &ssl || !exists('+ssl') ? '/' : '\'
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:lash(...)
|
|
||||||
retu ( a:0 ? a:1 : getcwd() ) !~ '[\/]$' ? s:lash : ''
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#utils#opts()
|
|
||||||
let s:lash = ctrlp#utils#lash()
|
|
||||||
let usrhome = $HOME . s:lash( $HOME )
|
|
||||||
let cahome = exists('$XDG_CACHE_HOME') ? $XDG_CACHE_HOME : usrhome.'.cache'
|
|
||||||
let cadir = isdirectory(usrhome.'.ctrlp_cache')
|
|
||||||
\ ? usrhome.'.ctrlp_cache' : cahome.s:lash(cahome).'ctrlp'
|
|
||||||
if exists('g:ctrlp_cache_dir')
|
|
||||||
let cadir = expand(g:ctrlp_cache_dir, 1)
|
|
||||||
if isdirectory(cadir.s:lash(cadir).'.ctrlp_cache')
|
|
||||||
let cadir = cadir.s:lash(cadir).'.ctrlp_cache'
|
|
||||||
en
|
|
||||||
en
|
|
||||||
let s:cache_dir = cadir
|
|
||||||
endf
|
|
||||||
cal ctrlp#utils#opts()
|
|
||||||
|
|
||||||
let s:wig_cond = v:version > 702 || ( v:version == 702 && has('patch051') )
|
|
||||||
" Files and Directories {{{1
|
|
||||||
fu! ctrlp#utils#cachedir()
|
|
||||||
retu s:cache_dir
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#utils#cachefile(...)
|
|
||||||
let [tail, dir] = [a:0 == 1 ? '.'.a:1 : '', a:0 == 2 ? a:1 : getcwd()]
|
|
||||||
let cache_file = substitute(dir, '\([\/]\|^\a\zs:\)', '%', 'g').tail.'.txt'
|
|
||||||
retu a:0 == 1 ? cache_file : s:cache_dir.s:lash(s:cache_dir).cache_file
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#utils#readfile(file)
|
|
||||||
if filereadable(a:file)
|
|
||||||
let data = readfile(a:file)
|
|
||||||
if empty(data) || type(data) != 3
|
|
||||||
unl data
|
|
||||||
let data = []
|
|
||||||
en
|
|
||||||
retu data
|
|
||||||
en
|
|
||||||
retu []
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#utils#mkdir(dir)
|
|
||||||
if exists('*mkdir') && !isdirectory(a:dir)
|
|
||||||
sil! cal mkdir(a:dir, 'p')
|
|
||||||
en
|
|
||||||
retu a:dir
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#utils#writecache(lines, ...)
|
|
||||||
if isdirectory(ctrlp#utils#mkdir(a:0 ? a:1 : s:cache_dir))
|
|
||||||
sil! cal writefile(a:lines, a:0 >= 2 ? a:2 : ctrlp#utils#cachefile())
|
|
||||||
en
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#utils#glob(...)
|
|
||||||
let path = ctrlp#utils#fnesc(a:1, 'g')
|
|
||||||
retu s:wig_cond ? glob(path, a:2) : glob(path)
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#utils#globpath(...)
|
|
||||||
retu call('globpath', s:wig_cond ? a:000 : a:000[:1])
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#utils#fnesc(path, type, ...)
|
|
||||||
if exists('*fnameescape')
|
|
||||||
if exists('+ssl')
|
|
||||||
if a:type == 'c'
|
|
||||||
let path = escape(a:path, '%#')
|
|
||||||
elsei a:type == 'f'
|
|
||||||
let path = fnameescape(a:path)
|
|
||||||
elsei a:type == 'g'
|
|
||||||
let path = escape(a:path, '?*')
|
|
||||||
en
|
|
||||||
let path = substitute(path, '[', '[[]', 'g')
|
|
||||||
el
|
|
||||||
let path = fnameescape(a:path)
|
|
||||||
en
|
|
||||||
el
|
|
||||||
if exists('+ssl')
|
|
||||||
if a:type == 'c'
|
|
||||||
let path = escape(a:path, '%#')
|
|
||||||
elsei a:type == 'f'
|
|
||||||
let path = escape(a:path, " \t\n%#*?|<\"")
|
|
||||||
elsei a:type == 'g'
|
|
||||||
let path = escape(a:path, '?*')
|
|
||||||
en
|
|
||||||
let path = substitute(path, '[', '[[]', 'g')
|
|
||||||
el
|
|
||||||
let path = escape(a:path, " \t\n*?[{`$\\%#'\"|!<")
|
|
||||||
en
|
|
||||||
en
|
|
||||||
retu a:0 ? escape(path, a:1) : path
|
|
||||||
endf
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,72 +0,0 @@
|
||||||
" =============================================================================
|
|
||||||
" File: plugin/ctrlp.vim
|
|
||||||
" Description: Fuzzy file, buffer, mru, tag, etc finder.
|
|
||||||
" Author: Kien Nguyen <github.com/kien>
|
|
||||||
" =============================================================================
|
|
||||||
" GetLatestVimScripts: 3736 1 :AutoInstall: ctrlp.zip
|
|
||||||
|
|
||||||
if ( exists('g:loaded_ctrlp') && g:loaded_ctrlp ) || v:version < 700 || &cp
|
|
||||||
fini
|
|
||||||
en
|
|
||||||
let g:loaded_ctrlp = 1
|
|
||||||
|
|
||||||
let [g:ctrlp_lines, g:ctrlp_allfiles, g:ctrlp_alltags, g:ctrlp_alldirs,
|
|
||||||
\ g:ctrlp_allmixes, g:ctrlp_buftags, g:ctrlp_ext_vars, g:ctrlp_builtins]
|
|
||||||
\ = [[], [], [], [], {}, {}, [], 2]
|
|
||||||
|
|
||||||
if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
|
|
||||||
if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en
|
|
||||||
|
|
||||||
com! -n=? -com=dir CtrlP cal ctrlp#init(0, { 'dir': <q-args> })
|
|
||||||
com! -n=? -com=dir CtrlPMRUFiles cal ctrlp#init('mru', { 'dir': <q-args> })
|
|
||||||
|
|
||||||
com! -bar CtrlPBuffer cal ctrlp#init('buf')
|
|
||||||
com! -n=? CtrlPLastMode cal ctrlp#init(-1, { 'args': <q-args> })
|
|
||||||
|
|
||||||
com! -bar CtrlPClearCache cal ctrlp#clr()
|
|
||||||
com! -bar CtrlPClearAllCaches cal ctrlp#clra()
|
|
||||||
|
|
||||||
com! -bar ClearCtrlPCache cal ctrlp#clr()
|
|
||||||
com! -bar ClearAllCtrlPCaches cal ctrlp#clra()
|
|
||||||
|
|
||||||
com! -bar CtrlPCurWD cal ctrlp#init('fil', { 'mode': '' })
|
|
||||||
com! -bar CtrlPCurFile cal ctrlp#init('fil', { 'mode': 'c' })
|
|
||||||
com! -bar CtrlPRoot cal ctrlp#init('fil', { 'mode': 'r' })
|
|
||||||
|
|
||||||
exe 'nn <silent> <plug>(ctrlp) :<c-u>'.g:ctrlp_cmd.'<cr>'
|
|
||||||
|
|
||||||
if g:ctrlp_map != '' && !hasmapto('<plug>(ctrlp)')
|
|
||||||
exe 'map' g:ctrlp_map '<plug>(ctrlp)'
|
|
||||||
en
|
|
||||||
|
|
||||||
if !exists('g:ctrlp_types') || index(g:ctrlp_types, 'mru') >= 0
|
|
||||||
cal ctrlp#mrufiles#init()
|
|
||||||
en
|
|
||||||
|
|
||||||
com! -bar CtrlPTag cal ctrlp#init(ctrlp#tag#id())
|
|
||||||
com! -bar CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
|
|
||||||
|
|
||||||
com! -n=? -com=dir CtrlPDir
|
|
||||||
\ cal ctrlp#init(ctrlp#dir#id(), { 'dir': <q-args> })
|
|
||||||
|
|
||||||
com! -n=? -com=buffer CtrlPBufTag
|
|
||||||
\ cal ctrlp#init(ctrlp#buffertag#cmd(0, <q-args>))
|
|
||||||
|
|
||||||
com! -bar CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1))
|
|
||||||
com! -bar CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
|
|
||||||
com! -bar CtrlPUndo cal ctrlp#init(ctrlp#undo#id())
|
|
||||||
|
|
||||||
com! -n=? -com=buffer CtrlPLine
|
|
||||||
\ cal ctrlp#init(ctrlp#line#cmd('buf', <q-args>))
|
|
||||||
|
|
||||||
com! -n=? -com=buffer CtrlPChange
|
|
||||||
\ cal ctrlp#init(ctrlp#changes#cmd('fil', <q-args>))
|
|
||||||
|
|
||||||
com! -bar CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1))
|
|
||||||
com! -bar CtrlPMixed cal ctrlp#init(ctrlp#mixed#id())
|
|
||||||
com! -bar CtrlPBookmarkDir cal ctrlp#init(ctrlp#bookmarkdir#id())
|
|
||||||
|
|
||||||
com! -n=? -com=dir -bang CtrlPBookmarkDirAdd
|
|
||||||
\ cal ctrlp#call('ctrlp#bookmarkdir#add', '<bang>', <q-args>)
|
|
||||||
|
|
||||||
" vim:ts=2:sw=2:sts=2
|
|
|
@ -1,109 +0,0 @@
|
||||||
# ctrlp.vim
|
|
||||||
Full path fuzzy __file__, __buffer__, __mru__, __tag__, __...__ finder for Vim.
|
|
||||||
|
|
||||||
* Written in pure Vimscript for MacVim, gVim and Vim 7.0+.
|
|
||||||
* Full support for Vim's regexp as search patterns.
|
|
||||||
* Built-in Most Recently Used (MRU) files monitoring.
|
|
||||||
* Built-in project's root finder.
|
|
||||||
* Open multiple files at once.
|
|
||||||
* Create new files and directories.
|
|
||||||
* [Extensible][2].
|
|
||||||
|
|
||||||
![ctrlp][1]
|
|
||||||
|
|
||||||
## Basic Usage
|
|
||||||
* Run `:CtrlP` or `:CtrlP [starting-directory]` to invoke CtrlP in find file mode.
|
|
||||||
* Run `:CtrlPBuffer` or `:CtrlPMRU` to invoke CtrlP in find buffer or find MRU file mode.
|
|
||||||
* Run `:CtrlPMixed` to search in Files, Buffers and MRU files at the same time.
|
|
||||||
|
|
||||||
Check `:help ctrlp-commands` and `:help ctrlp-extensions` for other commands.
|
|
||||||
|
|
||||||
##### Once CtrlP is open:
|
|
||||||
* Press `<F5>` to purge the cache for the current directory to get new files, remove deleted files and apply new ignore options.
|
|
||||||
* Press `<c-f>` and `<c-b>` to cycle between modes.
|
|
||||||
* Press `<c-d>` to switch to filename only search instead of full path.
|
|
||||||
* Press `<c-r>` to switch to regexp mode.
|
|
||||||
* Use `<c-j>`, `<c-k>` or the arrow keys to navigate the result list.
|
|
||||||
* Use `<c-t>` or `<c-v>`, `<c-x>` to open the selected entry in a new tab or in a new split.
|
|
||||||
* Use `<c-n>`, `<c-p>` to select the next/previous string in the prompt's history.
|
|
||||||
* Use `<c-y>` to create a new file and its parent directories.
|
|
||||||
* Use `<c-z>` to mark/unmark multiple files and `<c-o>` to open them.
|
|
||||||
|
|
||||||
Run `:help ctrlp-mappings` or submit `?` in CtrlP for more mapping help.
|
|
||||||
|
|
||||||
* Submit two or more dots `..` to go up the directory tree by one or multiple levels.
|
|
||||||
* End the input string with a colon `:` followed by a command to execute it on the opening file(s):
|
|
||||||
Use `:25` to jump to line 25.
|
|
||||||
Use `:diffthis` when opening multiple files to run `:diffthis` on the first 4 files.
|
|
||||||
|
|
||||||
## Basic Options
|
|
||||||
* Change the default mapping and the default command to invoke CtrlP:
|
|
||||||
|
|
||||||
```vim
|
|
||||||
let g:ctrlp_map = '<c-p>'
|
|
||||||
let g:ctrlp_cmd = 'CtrlP'
|
|
||||||
```
|
|
||||||
|
|
||||||
* When invoked without an explicit starting directory, CtrlP will set its local working directory according to this variable:
|
|
||||||
|
|
||||||
```vim
|
|
||||||
let g:ctrlp_working_path_mode = 'ra'
|
|
||||||
```
|
|
||||||
|
|
||||||
`'c'` - the directory of the current file.
|
|
||||||
`'a'` - the directory of the current file, unless it is a subdirectory of the cwd
|
|
||||||
`'r'` - the nearest ancestor of the current file that contains one of these directories or files: `.git` `.hg` `.svn` `.bzr` `_darcs`
|
|
||||||
`'w'` - modifier to "r": start search from the cwd instead of the current file's directory
|
|
||||||
`0` or `''` (empty string) - disable this feature.
|
|
||||||
|
|
||||||
If none of the default markers (`.git` `.hg` `.svn` `.bzr` `_darcs`) are present in a project, you can define additional ones with `g:ctrlp_root_markers`:
|
|
||||||
|
|
||||||
```vim
|
|
||||||
let g:ctrlp_root_markers = ['pom.xml', '.p4ignore']
|
|
||||||
```
|
|
||||||
|
|
||||||
If more than one mode is specified, they will be tried in order until a directory is located.
|
|
||||||
|
|
||||||
* If a file is already open, open it again in a new pane instead of switching to the existing pane
|
|
||||||
|
|
||||||
`let g:ctrlp_switch_buffer = 'et'`
|
|
||||||
|
|
||||||
* Exclude files and directories using Vim's `wildignore` and CtrlP's own `g:ctrlp_custom_ignore`. If a custom listing command is being used, exclusions are ignored:
|
|
||||||
|
|
||||||
```vim
|
|
||||||
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
|
|
||||||
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows
|
|
||||||
|
|
||||||
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
|
|
||||||
let g:ctrlp_custom_ignore = {
|
|
||||||
\ 'dir': '\v[\/]\.(git|hg|svn)$',
|
|
||||||
\ 'file': '\v\.(exe|so|dll)$',
|
|
||||||
\ 'link': 'some_bad_symbolic_links',
|
|
||||||
\ }
|
|
||||||
```
|
|
||||||
|
|
||||||
* Use a custom file listing command:
|
|
||||||
|
|
||||||
```vim
|
|
||||||
let g:ctrlp_user_command = 'find %s -type f' " MacOSX/Linux
|
|
||||||
let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows
|
|
||||||
```
|
|
||||||
|
|
||||||
* Ignore files in `.gitignore`
|
|
||||||
|
|
||||||
```vim
|
|
||||||
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']
|
|
||||||
```
|
|
||||||
|
|
||||||
Check `:help ctrlp-options` for other options.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
Use your favorite method or check the homepage for a [quick installation guide][3].
|
|
||||||
|
|
||||||
## License
|
|
||||||
CtrlP is distributed under Vim's [license][4].
|
|
||||||
|
|
||||||
[1]: http://i.imgur.com/aOcwHwt.png
|
|
||||||
[2]: https://github.com/ctrlpvim/ctrlp.vim/tree/extensions
|
|
||||||
[3]: http://ctrlpvim.github.com/ctrlp.vim#installation
|
|
||||||
[4]: http://vimdoc.sourceforge.net/htmldoc/uganda.html
|
|
|
@ -19,9 +19,6 @@ PLUGINS = """
|
||||||
auto-pairs https://github.com/jiangmiao/auto-pairs
|
auto-pairs https://github.com/jiangmiao/auto-pairs
|
||||||
ale https://github.com/w0rp/ale
|
ale https://github.com/w0rp/ale
|
||||||
vim-yankstack https://github.com/maxbrunsfeld/vim-yankstack
|
vim-yankstack https://github.com/maxbrunsfeld/vim-yankstack
|
||||||
ack.vim https://github.com/mileszs/ack.vim
|
|
||||||
bufexplorer https://github.com/corntrace/bufexplorer
|
|
||||||
ctrlp.vim https://github.com/ctrlpvim/ctrlp.vim
|
|
||||||
mayansmoke https://github.com/vim-scripts/mayansmoke
|
mayansmoke https://github.com/vim-scripts/mayansmoke
|
||||||
nerdtree https://github.com/scrooloose/nerdtree
|
nerdtree https://github.com/scrooloose/nerdtree
|
||||||
nginx.vim https://github.com/chr4/nginx.vim
|
nginx.vim https://github.com/chr4/nginx.vim
|
||||||
|
@ -56,7 +53,6 @@ lightline-ale https://github.com/maximbaz/lightline-ale
|
||||||
vim-abolish https://github.com/tpope/tpope-vim-abolish
|
vim-abolish https://github.com/tpope/tpope-vim-abolish
|
||||||
mru.vim https://github.com/vim-scripts/mru.vim
|
mru.vim https://github.com/vim-scripts/mru.vim
|
||||||
vim-markdown https://github.com/plasticboy/vim-markdown
|
vim-markdown https://github.com/plasticboy/vim-markdown
|
||||||
comfortable-motion.vim https://github.com/yuttie/comfortable-motion.vim
|
|
||||||
""".strip()
|
""".strip()
|
||||||
|
|
||||||
GITHUB_ZIP = '%s/archive/master.zip'
|
GITHUB_ZIP = '%s/archive/master.zip'
|
||||||
|
|
|
@ -120,9 +120,6 @@ endif
|
||||||
" When you press gv you Ack after the selected text
|
" When you press gv you Ack after the selected text
|
||||||
vnoremap <silent> gv :call VisualSelection('gv', '')<CR>
|
vnoremap <silent> gv :call VisualSelection('gv', '')<CR>
|
||||||
|
|
||||||
" Open Ack and put the cursor in the right position
|
|
||||||
map <leader>g :Ack
|
|
||||||
|
|
||||||
" When you press <leader>r you can search and replace the selected text
|
" When you press <leader>r you can search and replace the selected text
|
||||||
vnoremap <silent> <leader>r :call VisualSelection('replace', '')<CR>
|
vnoremap <silent> <leader>r :call VisualSelection('replace', '')<CR>
|
||||||
|
|
||||||
|
|
|
@ -14,15 +14,6 @@ call pathogen#infect(s:vim_runtime.'/sources_non_forked/{}')
|
||||||
call pathogen#infect(s:vim_runtime.'/my_plugins/{}')
|
call pathogen#infect(s:vim_runtime.'/my_plugins/{}')
|
||||||
call pathogen#helptags()
|
call pathogen#helptags()
|
||||||
|
|
||||||
""""""""""""""""""""""""""""""
|
|
||||||
" => bufExplorer plugin
|
|
||||||
""""""""""""""""""""""""""""""
|
|
||||||
let g:bufExplorerDefaultHelp=0
|
|
||||||
let g:bufExplorerShowRelativePath=1
|
|
||||||
let g:bufExplorerFindActive=1
|
|
||||||
let g:bufExplorerSortBy='name'
|
|
||||||
map <leader>o :BufExplorer<cr>
|
|
||||||
|
|
||||||
|
|
||||||
""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""""
|
||||||
" => MRU plugin
|
" => MRU plugin
|
||||||
|
@ -41,17 +32,13 @@ nmap <c-n> <Plug>yankstack_substitute_newer_paste
|
||||||
|
|
||||||
|
|
||||||
""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""""
|
||||||
" => CTRL-P
|
" => FZF
|
||||||
""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""""
|
||||||
let g:ctrlp_working_path_mode = 0
|
set rtp+=~/.fzf
|
||||||
|
map <leader>j :Files<cr>
|
||||||
let g:ctrlp_map = '<c-f>'
|
nnoremap <C-f> :Files<Cr>
|
||||||
map <leader>j :CtrlP<cr>
|
map <leader>o :Buffers<cr>
|
||||||
map <c-b> :CtrlPBuffer<cr>
|
map <leader>g :Ag<CR>
|
||||||
|
|
||||||
let g:ctrlp_max_height = 20
|
|
||||||
let g:ctrlp_custom_ignore = 'node_modules\|^\.DS_Store\|^\.git\|^\.coffee'
|
|
||||||
|
|
||||||
|
|
||||||
""""""""""""""""""""""""""""""
|
""""""""""""""""""""""""""""""
|
||||||
" => ZenCoding
|
" => ZenCoding
|
||||||
|
|
Loading…
Reference in a new issue