Update bufexplorer.
This commit is contained in:
parent
05df43cd04
commit
3d5fd32152
6 changed files with 238 additions and 572 deletions
6
sources_non_forked/bufexplorer/.gitignore
vendored
6
sources_non_forked/bufexplorer/.gitignore
vendored
|
@ -1,6 +0,0 @@
|
||||||
# Ignore generated tags
|
|
||||||
/doc/tags
|
|
||||||
dist.bat
|
|
||||||
*.zip
|
|
||||||
tags
|
|
||||||
*.sw[a-p]
|
|
|
@ -1,27 +0,0 @@
|
||||||
Copyright (c) 2001-2013, Jeff Lanzarotta
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice, this
|
|
||||||
list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
|
||||||
list of conditions and the following disclaimer in the documentation and/or
|
|
||||||
other materials provided with the distribution.
|
|
||||||
|
|
||||||
* Neither the name of the {organization} nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived from
|
|
||||||
this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
||||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
||||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
20
sources_non_forked/bufexplorer/README
Normal file
20
sources_non_forked/bufexplorer/README
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
This is a mirror of http://www.vim.org/scripts/script.php?script_id=42
|
||||||
|
|
||||||
|
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.
|
|
@ -1,99 +0,0 @@
|
||||||
bufexplorer
|
|
||||||
===========
|
|
||||||
|
|
||||||
BufExplorer Plugin for Vim
|
|
||||||
|
|
||||||
With bufexplorer, you can quickly and easily switch between buffers by using the one of the default public interfaces:
|
|
||||||
|
|
||||||
`\<Leader\>be` normal open
|
|
||||||
|
|
||||||
`\<Leader\>bt` toggle open / close
|
|
||||||
|
|
||||||
`\<Leader\>bs` force horizontal split open
|
|
||||||
|
|
||||||
`\<Leader\>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.
|
|
||||||
|
|
||||||
## vim.org
|
|
||||||
This plugin can also be found at http://www.vim.org/scripts/script.php?script_id=42.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
### Manually
|
|
||||||
1. If you do not want to use one of the the bundle handlers, you can take the
|
|
||||||
zip file from vim.org and unzip it and copy the plugin to your vimfiles\plugin
|
|
||||||
directory and the txt file to your vimfiles\doc directory. If you do that,
|
|
||||||
make sure you generate the help by executing
|
|
||||||
|
|
||||||
`:helptag <your runtime directory>/doc`
|
|
||||||
|
|
||||||
Once help tags have been generated, you can view the manual with
|
|
||||||
`:help bufexplorer`.
|
|
||||||
|
|
||||||
### Vundle (https://github.com/gmarik/Vundle.vim)
|
|
||||||
1. Add the following configuration to your `.vimrc`.
|
|
||||||
|
|
||||||
Plugin 'jlanzarotta/bufexplorer'
|
|
||||||
|
|
||||||
2. Install with `:BundleInstall`.
|
|
||||||
|
|
||||||
### NeoBundle (https://github.com/Shougo/neobundle.vim)
|
|
||||||
1. Add the following configuration to your `.vimrc`.
|
|
||||||
|
|
||||||
NeoBundle 'jlanzarotta/bufexplorer'
|
|
||||||
|
|
||||||
2. Install with `:NeoBundleInstall`.
|
|
||||||
|
|
||||||
### Plug (https://github.com/junegunn/vim-plug)
|
|
||||||
1. Add the following configuration to your `.vimrc`.
|
|
||||||
|
|
||||||
Plug 'jlanzarotta/bufexplorer'
|
|
||||||
|
|
||||||
2. Install with `:PlugInstall`.
|
|
||||||
|
|
||||||
### Pathogen
|
|
||||||
1. Install with the following command.
|
|
||||||
|
|
||||||
git clone https://github.com/jlanzarotta/bufexplorer.git ~/.vim/bundle/bufexplorer.vim
|
|
||||||
|
|
||||||
## License
|
|
||||||
Copyright (c) 2001-2021, Jeff Lanzarotta
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice, this
|
|
||||||
list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
|
||||||
list of conditions and the following disclaimer in the documentation and/or
|
|
||||||
other materials provided with the distribution.
|
|
||||||
|
|
||||||
* Neither the name of the {organization} nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived from
|
|
||||||
this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
||||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
||||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
@ -1,7 +1,7 @@
|
||||||
*bufexplorer.txt* Buffer Explorer Last Change: 08 Dec 2018
|
*bufexplorer.txt* Buffer Explorer Last Change: 03 Nov 2014
|
||||||
|
|
||||||
Buffer Explorer *buffer-explorer* *bufexplorer*
|
Buffer Explorer *buffer-explorer* *bufexplorer*
|
||||||
Version 7.4.21
|
Version 7.4.6
|
||||||
|
|
||||||
Plugin for easily exploring (or browsing) Vim|:buffers|.
|
Plugin for easily exploring (or browsing) Vim|:buffers|.
|
||||||
|
|
||||||
|
@ -41,24 +41,22 @@ To install:
|
||||||
USAGE *bufexplorer-usage*
|
USAGE *bufexplorer-usage*
|
||||||
|
|
||||||
To start exploring in the current window, use: >
|
To start exploring in the current window, use: >
|
||||||
<Leader>be or :BufExplorer or Your custom key mapping
|
\be or :BufExplorer or Your custom key mapping
|
||||||
To toggle bufexplorer on or off in the current window, use: >
|
|
||||||
<Leader>bt or :ToggleBufExplorer or Your custom key mapping
|
|
||||||
To start exploring in a newly split horizontal window, use: >
|
To start exploring in a newly split horizontal window, use: >
|
||||||
<Leader>bs or :BufExplorerHorizontalSplit or Your custom key mapping
|
\bs or :BufExplorerHorizontalSplit or Your custom key mapping
|
||||||
To start exploring in a newly split vertical window, use: >
|
To start exploring in a newly split vertical window, use: >
|
||||||
<Leader>bv or :BufExplorerVerticalSplit or Your custom key mapping
|
\bv or :BufExplorerVerticalSplit or Your custom key mapping
|
||||||
|
|
||||||
If you would like to use something other than the default leader key - '\' -
|
If you would like to use something other than '\', you may simply change the
|
||||||
you may simply change the leader (see |mapleader|).
|
leader (see |mapleader|).
|
||||||
|
|
||||||
When <Leader>bs or <Leader>bv is issued, bufexplorer opens in either a
|
When \bs or \bv is issued, bufexplorer opens in either a horizonally or
|
||||||
horizontally or vertically split window. By issuing either of these commands,
|
vertically split window. By issusing either of these commands, the user is
|
||||||
the user is telling bufexplorer that they want to split the window and have
|
telling bufexplorer that they want to split the window and have bufexplorer
|
||||||
bufexplorer show the buffer they are about to select (from the bufexplorer
|
show the buffer they are about to select (from the bufexplorer windows) in the
|
||||||
windows) in the newly split window. When <Leader>be is issued, bufexplorer
|
newly split window. When \be is issued, bufexplorer opens the bufexplorer
|
||||||
opens the bufexplorer contents in the current window and the buffer the user
|
contents in the current window and the buffer the user selects is opened in
|
||||||
selects is opened in the current window.
|
the current window.
|
||||||
|
|
||||||
Note: If the current buffer is modified when bufexplorer started, the current
|
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 is always split and the new bufexplorer is displayed in that new
|
||||||
|
@ -72,20 +70,18 @@ Commands to use once exploring:
|
||||||
<leftmouse> Opens the buffer that is under the cursor into the current
|
<leftmouse> Opens the buffer that is under the cursor into the current
|
||||||
window.
|
window.
|
||||||
<shift-enter> Opens the buffer that is under the cursor in another tab.
|
<shift-enter> Opens the buffer that is under the cursor in another tab.
|
||||||
a Toggles whether you are taken to the active window when
|
|
||||||
selecting a buffer or not.
|
|
||||||
b Fast buffer switching with b<any bufnum>.
|
b Fast buffer switching with b<any bufnum>.
|
||||||
B Works in association with the |ShowTabBuffer| option. If
|
B Works in association with the|ShowTabBuffer|option. If
|
||||||
|ShowTabBuffer| is set to 1, this toggles if BufExplorer is to
|
|ShowTabBuffer|is set to 1, this toggles if BufExplorer is to
|
||||||
only store the most recent tab for this buffer or not.
|
only store the most recent tab for this buffer or not.
|
||||||
d |:delete| the buffer under the cursor from the list. The
|
d |:delete|the buffer under the cursor from the list. The
|
||||||
buffer's 'buflisted' is cleared. This allows for the buffer to
|
buffer's 'buflisted' is cleared. This allows for the buffer to
|
||||||
be displayed again using the 'show unlisted' command.
|
be displayed again using the 'show unlisted' command.
|
||||||
D |:wipeout| the buffer under the cursor from the list. When a
|
D |:wipeout|the buffer under the cursor from the list. When a
|
||||||
buffer is wiped, it will not be shown when unlisted buffers are
|
buffers is wiped, it will not be shown when unlisted buffer are
|
||||||
displayed.
|
displayed.
|
||||||
F Open selected buffer in another window above the current.
|
f Toggles whether you are taken to the active window when
|
||||||
f Open selected buffer in another window below the current.
|
selecting a buffer or not.
|
||||||
o Opens the buffer that is under the cursor into the current
|
o Opens the buffer that is under the cursor into the current
|
||||||
window.
|
window.
|
||||||
p Toggles the showing of a split filename/pathname.
|
p Toggles the showing of a split filename/pathname.
|
||||||
|
@ -101,14 +97,12 @@ Commands to use once exploring:
|
||||||
t Opens the buffer that is under the cursor in another tab.
|
t Opens the buffer that is under the cursor in another tab.
|
||||||
T Toggles to show only buffers for this tab or not.
|
T Toggles to show only buffers for this tab or not.
|
||||||
u Toggles the showing of "unlisted" buffers.
|
u Toggles the showing of "unlisted" buffers.
|
||||||
V Open the selected buffer in another window on the left of the current.
|
|
||||||
v Open the selected buffer in another window on the right of the current.
|
|
||||||
|
|
||||||
Once invoked, Buffer Explorer displays a sorted list (MRU is the default
|
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
|
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
|
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,
|
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
|
you can then either open it, close it(delete), resort the list, reverse
|
||||||
the sort, quit exploring and so on...
|
the sort, quit exploring and so on...
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
|
@ -125,18 +119,17 @@ WINDOW LAYOUT *bufexplorer-windowlayout*
|
||||||
| | | | +-- Current Line #.
|
| | | | +-- Current Line #.
|
||||||
| | | +-- Relative/Full Path
|
| | | +-- Relative/Full Path
|
||||||
| | +-- Buffer Name.
|
| | +-- Buffer Name.
|
||||||
| +-- Buffer Attributes. See |:buffers| for more information.
|
| +-- Buffer Attributes. See|:buffers|for more information.
|
||||||
+-- Buffer Number. See |:buffers| for more information.
|
+-- Buffer Number. See|:buffers|for more information.
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
CUSTOMIZATION *bufexplorer-customization*
|
CUSTOMIZATION *bufexplorer-customization*
|
||||||
|
|
||||||
If you do not like the default key mappings of <Leader>be, <Leader>bs, and
|
If you do not like the default key mappings of \be, \bs, and \bv, you can
|
||||||
<Leader>bv, you can override bufexplorer's default mappings by setting up
|
override bufexplorer's default mappings by setting up something like the
|
||||||
something like the following in your vimrc file:
|
following in your vimrc file:
|
||||||
|
|
||||||
nnoremap <silent> <F11> :BufExplorer<CR>
|
nnoremap <silent> <F11> :BufExplorer<CR>
|
||||||
nnoremap <silent> <s-F11> :ToggleBufExplorer<CR>
|
|
||||||
nnoremap <silent> <m-F11> :BufExplorerHorizontalSplit<CR>
|
nnoremap <silent> <m-F11> :BufExplorerHorizontalSplit<CR>
|
||||||
nnoremap <silent> <c-F11> :BufExplorerVerticalSplit<CR>
|
nnoremap <silent> <c-F11> :BufExplorerVerticalSplit<CR>
|
||||||
|
|
||||||
|
@ -200,13 +193,13 @@ directory, use: >
|
||||||
The default is to show absolute paths.
|
The default is to show absolute paths.
|
||||||
|
|
||||||
*g:bufExplorerShowTabBuffer*
|
*g:bufExplorerShowTabBuffer*
|
||||||
To control whether or not to show buffers on for the specific tab or not, use: >
|
To control weither or not to show buffers on for the specific tab or not, use: >
|
||||||
let g:bufExplorerShowTabBuffer=0 " No.
|
let g:bufExplorerShowTabBuffer=0 " No.
|
||||||
let g:bufExplorerShowTabBuffer=1 " Yes.
|
let g:bufExplorerShowTabBuffer=1 " Yes.
|
||||||
The default is not to show.
|
The default is not to show.
|
||||||
|
|
||||||
*g:bufExplorerShowUnlisted*
|
*g:bufExplorerShowUnlisted*
|
||||||
To control whether to show unlisted buffers or not, use: >
|
To control whether to show unlisted buffer or not, use: >
|
||||||
let g:bufExplorerShowUnlisted=0 " Do not show unlisted buffers.
|
let g:bufExplorerShowUnlisted=0 " Do not show unlisted buffers.
|
||||||
let g:bufExplorerShowUnlisted=1 " Show unlisted buffers.
|
let g:bufExplorerShowUnlisted=1 " Show unlisted buffers.
|
||||||
The default is to NOT show unlisted buffers.
|
The default is to NOT show unlisted buffers.
|
||||||
|
@ -249,79 +242,14 @@ current window, use: >
|
||||||
The default is to use the global &splitright.
|
The default is to use the global &splitright.
|
||||||
|
|
||||||
*g:bufExplorerSplitVertSize*
|
*g:bufExplorerSplitVertSize*
|
||||||
To control the size of the new vertical split window, use: >
|
To control the size of the new vertical split window. use: >
|
||||||
let g:bufExplorerSplitVertSize=n " New split window is n columns wide.
|
let g:bufExplorerVertSize=n " New split window is n columns wide.
|
||||||
let g:bufExplorerSplitVertSize=0 " New split windows size set by Vim.
|
let g:bufExplorerVertSize=0 " New split windows size set by Vim.
|
||||||
The default is 0, so that the size is set by Vim.
|
The default is 0, so that the size is set by Vim.
|
||||||
|
|
||||||
*g:bufExplorerVersionWarn*
|
|
||||||
To control whether to warning about Vim version or not, use: >
|
|
||||||
let g:bufExplorerVersionWarn=1 " Warn if version conflict.
|
|
||||||
let g:bufExplorerVersionWarn=0 " Do not warn if version conflict.
|
|
||||||
The default is 1.
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
CHANGE LOG *bufexplorer-changelog*
|
CHANGE LOG *bufexplorer-changelog*
|
||||||
|
|
||||||
7.4.21 December 8, 2018
|
|
||||||
- Merged in changes from adelarsq that introduced ryanoasis/vim-devicons
|
|
||||||
support. If the global g:loaded_webdevicons has been set, bufexplorer
|
|
||||||
will now load the associated dev icons for each buffer.
|
|
||||||
7.4.20 January 18, 2017
|
|
||||||
- Thanks to jpflouret for supplying code that can remove the warning
|
|
||||||
messages if you using this plugin on an older version of Vim. The
|
|
||||||
global variable is g:bufExplorerVersionWarn.
|
|
||||||
7.4.19 September 18, 2017
|
|
||||||
- Merged all changes from github back into this version and tried to sync
|
|
||||||
to the correct version number.
|
|
||||||
7.4.18 - Github.
|
|
||||||
7.4.17 - Github.
|
|
||||||
7.4.16 August 14, 2017
|
|
||||||
- Thanks to Yubo Su for the patch that adds 'f, F, V, and v' commands.
|
|
||||||
With this change, the original 'f' command was remapped to 'a'.
|
|
||||||
|
|
||||||
The set of commands that can be used during exploring are:
|
|
||||||
F - Open selected buffer in another window above the current.
|
|
||||||
f - Open selected buffer in another window below the current.
|
|
||||||
V - Open the selected buffer in another window on the left of the
|
|
||||||
current.
|
|
||||||
v - Open the selected buffer in another window on the right of the
|
|
||||||
current.
|
|
||||||
7.4.15 May 01, 2017
|
|
||||||
- Finally applied the patch submitted by justfalter. This patch is a
|
|
||||||
backward-compatible fix for the "invalid tab range" bug.
|
|
||||||
7.4.14 April 10, 2017
|
|
||||||
- As suggested by adelarsq way back on January 5th, 2016, a filetype has
|
|
||||||
been added. There is now 'filetype=bufexplorer'.
|
|
||||||
7.4.13 March 08, 2017
|
|
||||||
- Thanks to devakivamsi for pointing out that even though bufexplorer
|
|
||||||
turns off line numbers by default within its own window, this did not
|
|
||||||
work correctly when using WinManager. This has now been corrected.
|
|
||||||
7.4.12 September 30, 2016
|
|
||||||
- Thanks again to Martin Vuille for several more fixes related to making
|
|
||||||
bufexplorer more tab-friendly.
|
|
||||||
7.4.11 September, 20, 2016
|
|
||||||
- Thanks to Martin Vuille for reworking the per-tab buffer listing code.
|
|
||||||
Fix for g:bufExplorerShowTabBuffer is not working correctly and other
|
|
||||||
"gliches" when the ShotTabBuffer option is enabled. For example old
|
|
||||||
code would not correctly handle adding/deleting a tab that wasn't the
|
|
||||||
highest-numbered tab.
|
|
||||||
7.4.10 August 26, 2016
|
|
||||||
- Thanks to buddylindsey for fixing a misspelling in the docs.
|
|
||||||
7.4.9 April 01, 2016
|
|
||||||
- Thanks to ivegotasthma for supplying a patch to fix a major issue with
|
|
||||||
plugin performance when lots of buffers are open.
|
|
||||||
- Thanks to ershov for the patch to fix grouping of files in ambiguous
|
|
||||||
sort modes.
|
|
||||||
- Thanks to PhilRunninger for changing documentation to use <Leader>, in
|
|
||||||
place of '\'.
|
|
||||||
7.4.8 January 27, 2015
|
|
||||||
- Thanks to Marius Gedminas for fixing up the documentation and correcting
|
|
||||||
various typos.
|
|
||||||
7.4.7 January 20, 2015
|
|
||||||
- Thanks goes out to Phil Runninger for added the ability to toggle the
|
|
||||||
bufexplorer list on and off using the :ToggleBufExplorer command, the
|
|
||||||
map <Leader>bt, and the function ToggleBufExplorer().
|
|
||||||
7.4.6 November 03, 2014
|
7.4.6 November 03, 2014
|
||||||
- Not sure how, but the file format was converted to Dos instead of Unix.
|
- Not sure how, but the file format was converted to Dos instead of Unix.
|
||||||
I converted the file back to Unix.
|
I converted the file back to Unix.
|
||||||
|
@ -347,7 +275,7 @@ CHANGE LOG *bufexplorer-changelog*
|
||||||
- First update related to Vim 7.4.
|
- First update related to Vim 7.4.
|
||||||
- Changed license text.
|
- Changed license text.
|
||||||
- Fixed issue with 'hidden'. If 'hidden' is set, make sure that
|
- Fixed issue with 'hidden'. If 'hidden' is set, make sure that
|
||||||
g:bufExplorerFindActive is set to 0. Otherwise, when using \bs or \bv,
|
g:bufExplorerFindActive is set to 0. Otherwise, when using /bs or /bv,
|
||||||
and selecting a buffer, the original buffer will be switched to instead
|
and selecting a buffer, the original buffer will be switched to instead
|
||||||
of being opened in the newly created windows.
|
of being opened in the newly created windows.
|
||||||
- Added new 'b' mapping when the bufExplorer window is opened. When 'b'
|
- Added new 'b' mapping when the bufExplorer window is opened. When 'b'
|
||||||
|
@ -404,7 +332,7 @@ CHANGE LOG *bufexplorer-changelog*
|
||||||
fixes. Overall, I am hopeful that I not forgotten or lost a feature.
|
fixes. Overall, I am hopeful that I not forgotten or lost a feature.
|
||||||
- Thanks to Tim Johnson for testing out this new version.
|
- Thanks to Tim Johnson for testing out this new version.
|
||||||
- I have hopefully allowed for better mapping of the main public
|
- I have hopefully allowed for better mapping of the main public
|
||||||
methods as is explained in the |bufexplorer-customization| section
|
methods as is explained in the|bufexplorer-customization|section
|
||||||
of the documentation.
|
of the documentation.
|
||||||
- Add new 'B', 'o', and 'S' key mappings.
|
- Add new 'B', 'o', and 'S' key mappings.
|
||||||
7.2.8 November 08, 2010
|
7.2.8 November 08, 2010
|
||||||
|
@ -575,7 +503,7 @@ CHANGE LOG *bufexplorer-changelog*
|
||||||
- Dave Eggum has made some 'significant' updates to this latest
|
- Dave Eggum has made some 'significant' updates to this latest
|
||||||
version:
|
version:
|
||||||
* Added BufExplorerGetAltBuf() global function to be used in the
|
* Added BufExplorerGetAltBuf() global function to be used in the
|
||||||
user's rulerformat.
|
user’s rulerformat.
|
||||||
* Added g:bufExplorerSplitRight option.
|
* Added g:bufExplorerSplitRight option.
|
||||||
* Added g:bufExplorerShowRelativePath option with mapping.
|
* Added g:bufExplorerShowRelativePath option with mapping.
|
||||||
* Added current line highlighting.
|
* Added current line highlighting.
|
||||||
|
@ -764,7 +692,7 @@ TODO *bufexplorer-todo*
|
||||||
===============================================================================
|
===============================================================================
|
||||||
CREDITS *bufexplorer-credits*
|
CREDITS *bufexplorer-credits*
|
||||||
|
|
||||||
Author: Jeff Lanzarotta <delux256-vim at outlook dot com>
|
Author: Jeff Lanzarotta <delux256-vim at yahoo dot com>
|
||||||
|
|
||||||
Credit must go out to Bram Moolenaar and all the Vim developers for
|
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
|
making the world's best editor (IMHO). I also want to thank everyone who
|
||||||
|
@ -774,7 +702,7 @@ won't list names.
|
||||||
===============================================================================
|
===============================================================================
|
||||||
COPYRIGHT *bufexplorer-copyright*
|
COPYRIGHT *bufexplorer-copyright*
|
||||||
|
|
||||||
Copyright (c) 2001-2017, Jeff Lanzarotta
|
Copyright (c) 2001-2014, Jeff Lanzarotta
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
"============================================================================
|
"=============================================================================
|
||||||
" Copyright: Copyright (c) 2001-2018, Jeff Lanzarotta
|
" Copyright: Copyright (c) 2001-2014, Jeff Lanzarotta
|
||||||
" All rights reserved.
|
" All rights reserved.
|
||||||
"
|
"
|
||||||
" Redistribution and use in source and binary forms, with or
|
" Redistribution and use in source and binary forms, with or
|
||||||
|
@ -35,8 +35,8 @@
|
||||||
" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
" Name Of File: bufexplorer.vim
|
" Name Of File: bufexplorer.vim
|
||||||
" Description: Buffer Explorer Vim Plugin
|
" Description: Buffer Explorer Vim Plugin
|
||||||
" Maintainer: Jeff Lanzarotta (delux256-vim at outlook dot com)
|
" Maintainer: Jeff Lanzarotta (delux256-vim at yahoo dot com)
|
||||||
" Last Changed: Saturday, 08 December 2018
|
" Last Changed: Monday, 03 November 2014
|
||||||
" Version: See g:bufexplorer_version for version number.
|
" Version: See g:bufexplorer_version for version number.
|
||||||
" Usage: This file should reside in the plugin directory and be
|
" Usage: This file should reside in the plugin directory and be
|
||||||
" automatically sourced.
|
" automatically sourced.
|
||||||
|
@ -44,7 +44,6 @@
|
||||||
" You may use the default keymappings of
|
" You may use the default keymappings of
|
||||||
"
|
"
|
||||||
" <Leader>be - Opens BufExplorer
|
" <Leader>be - Opens BufExplorer
|
||||||
" <Leader>bt - Toggles BufExplorer open or closed
|
|
||||||
" <Leader>bs - Opens horizontally split window BufExplorer
|
" <Leader>bs - Opens horizontally split window BufExplorer
|
||||||
" <Leader>bv - Opens vertically split window BufExplorer
|
" <Leader>bv - Opens vertically split window BufExplorer
|
||||||
"
|
"
|
||||||
|
@ -52,14 +51,12 @@
|
||||||
" in your vimrc file, for example:
|
" in your vimrc file, for example:
|
||||||
"
|
"
|
||||||
" nnoremap <silent> <F11> :BufExplorer<CR>
|
" nnoremap <silent> <F11> :BufExplorer<CR>
|
||||||
" nnoremap <silent> <s-F11> :ToggleBufExplorer<CR>
|
|
||||||
" nnoremap <silent> <m-F11> :BufExplorerHorizontalSplit<CR>
|
" nnoremap <silent> <m-F11> :BufExplorerHorizontalSplit<CR>
|
||||||
" nnoremap <silent> <c-F11> :BufExplorerVerticalSplit<CR>
|
" nnoremap <silent> <c-F11> :BufExplorerVerticalSplit<CR>
|
||||||
"
|
"
|
||||||
" Or you can use
|
" Or you can use
|
||||||
"
|
"
|
||||||
" ":BufExplorer" - Opens BufExplorer
|
" ":BufExplorer" - Opens BufExplorer
|
||||||
" ":ToggleBufExplorer" - Opens/Closes BufExplorer
|
|
||||||
" ":BufExplorerHorizontalSplit" - Opens horizontally window BufExplorer
|
" ":BufExplorerHorizontalSplit" - Opens horizontally window BufExplorer
|
||||||
" ":BufExplorerVerticalSplit" - Opens vertically split window BufExplorer
|
" ":BufExplorerVerticalSplit" - Opens vertically split window BufExplorer
|
||||||
"
|
"
|
||||||
|
@ -67,45 +64,26 @@
|
||||||
" History: See supplied documentation.
|
" History: See supplied documentation.
|
||||||
"=============================================================================
|
"=============================================================================
|
||||||
|
|
||||||
" Exit quickly if already running or when 'compatible' is set. {{{1
|
" Plugin Code {{{1
|
||||||
|
" Exit quickly if already running or when 'compatible' is set. {{{2
|
||||||
if exists("g:bufexplorer_version") || &cp
|
if exists("g:bufexplorer_version") || &cp
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
"1}}}
|
"2}}}
|
||||||
|
|
||||||
" Version number
|
" Version number
|
||||||
let g:bufexplorer_version = "7.4.21"
|
let g:bufexplorer_version = "7.4.6"
|
||||||
|
|
||||||
" Plugin Code {{{1
|
|
||||||
" Check for Vim version {{{2
|
" Check for Vim version {{{2
|
||||||
if !exists("g:bufExplorerVersionWarn")
|
|
||||||
let g:bufExplorerVersionWarn = 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
if v:version < 700
|
if v:version < 700
|
||||||
if g:bufExplorerVersionWarn
|
|
||||||
echohl WarningMsg
|
echohl WarningMsg
|
||||||
echo "Sorry, bufexplorer ".g:bufexplorer_version." required Vim 7.0 or greater."
|
echo "Sorry, bufexplorer ".g:bufexplorer_version." required Vim 7.0 and greater."
|
||||||
echohl None
|
echohl None
|
||||||
endif
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
" Check to see if the version of Vim has the correct patch applied, if not, do
|
|
||||||
" not used <nowait>.
|
|
||||||
if v:version > 703 || v:version == 703 && has('patch1261') && has('patch1264')
|
|
||||||
" We are good to go.
|
|
||||||
else
|
|
||||||
if g:bufExplorerVersionWarn
|
|
||||||
echohl WarningMsg
|
|
||||||
echo "Sorry, bufexplorer ".g:bufexplorer_version." required Vim 7.3 or greater with patch1261 and patch1264."
|
|
||||||
echohl None
|
|
||||||
endif
|
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Create commands {{{2
|
" Create commands {{{2
|
||||||
command! BufExplorer :call BufExplorer()
|
command! BufExplorer :call BufExplorer()
|
||||||
command! ToggleBufExplorer :call ToggleBufExplorer()
|
|
||||||
command! BufExplorerHorizontalSplit :call BufExplorerHorizontalSplit()
|
command! BufExplorerHorizontalSplit :call BufExplorerHorizontalSplit()
|
||||||
command! BufExplorerVerticalSplit :call BufExplorerVerticalSplit()
|
command! BufExplorerVerticalSplit :call BufExplorerVerticalSplit()
|
||||||
|
|
||||||
|
@ -125,13 +103,14 @@ function! s:Set(var, default)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Script variables {{{2
|
" Script variables {{{2
|
||||||
let s:MRU_Exclude_List = ["[BufExplorer]","__MRU_Files__","[Buf\ List]"]
|
let s:MRU_Exclude_List = ["[BufExplorer]","__MRU_Files__"]
|
||||||
let s:MRUList = []
|
let s:MRUList = []
|
||||||
let s:name = '[BufExplorer]'
|
let s:name = '[BufExplorer]'
|
||||||
let s:originBuffer = 0
|
let s:originBuffer = 0
|
||||||
let s:running = 0
|
let s:running = 0
|
||||||
let s:sort_by = ["number", "name", "fullpath", "mru", "extension"]
|
let s:sort_by = ["number", "name", "fullpath", "mru", "extension"]
|
||||||
let s:splitMode = ""
|
let s:splitMode = ""
|
||||||
|
let s:tabSpace = []
|
||||||
let s:types = {"fullname": ':p', "path": ':p:h', "relativename": ':~:.', "relativepath": ':~:.:h', "shortname": ':t'}
|
let s:types = {"fullname": ':p', "path": ':p:h', "relativename": ':~:.', "relativepath": ':~:.:h', "shortname": ':t'}
|
||||||
|
|
||||||
" Setup the autocommands that handle the MRUList and other stuff. {{{2
|
" Setup the autocommands that handle the MRUList and other stuff. {{{2
|
||||||
|
@ -149,6 +128,8 @@ function! s:Setup()
|
||||||
autocmd BufDelete * call s:DeactivateBuffer(0)
|
autocmd BufDelete * call s:DeactivateBuffer(0)
|
||||||
autocmd BufWinEnter \[BufExplorer\] call s:Initialize()
|
autocmd BufWinEnter \[BufExplorer\] call s:Initialize()
|
||||||
autocmd BufWinLeave \[BufExplorer\] call s:Cleanup()
|
autocmd BufWinLeave \[BufExplorer\] call s:Cleanup()
|
||||||
|
autocmd TabEnter * call s:TabEnter()
|
||||||
|
autocmd SessionLoadPost * call s:Reset()
|
||||||
augroup END
|
augroup END
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -158,128 +139,82 @@ function! s:Reset()
|
||||||
" command line are picked up correctly.
|
" command line are picked up correctly.
|
||||||
let s:MRUList = range(1, bufnr('$'))
|
let s:MRUList = range(1, bufnr('$'))
|
||||||
|
|
||||||
" Initialize the association of buffers to tabs for any buffers
|
" Initialize one tab space array, ignore zero-based tabpagenr since all
|
||||||
" that have been created prior to now, e.g., files specified as
|
" tabpagenr's start at 1. -1 signifies this is the first time we are
|
||||||
" vim command line arguments
|
" referencing this tabpagenr.
|
||||||
call s:CatalogBuffers()
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" CatalogBuffers {{{2
|
|
||||||
" Create tab associations for any existing buffers
|
|
||||||
function! s:CatalogBuffers()
|
|
||||||
let ct = tabpagenr()
|
|
||||||
|
|
||||||
for tab in range(1, tabpagenr('$'))
|
|
||||||
silent execute 'normal! ' . tab . 'gt'
|
|
||||||
for buf in tabpagebuflist()
|
|
||||||
call s:UpdateTabBufData(buf)
|
|
||||||
endfor
|
|
||||||
endfor
|
|
||||||
|
|
||||||
silent execute 'normal! ' . ct . 'gt'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" AssociatedTab {{{2
|
|
||||||
" Return the number of the tab associated with the specified buffer.
|
|
||||||
" If the buffer is associated with more than one tab, the first one
|
|
||||||
" found is returned. If the buffer is not associated with any tabs,
|
|
||||||
" -1 is returned.
|
|
||||||
function! s:AssociatedTab(bufnr)
|
|
||||||
for tab in range(1, tabpagenr('$'))
|
|
||||||
let list = gettabvar(tab, 'bufexp_buf_list', [])
|
|
||||||
let idx = index(list, a:bufnr)
|
|
||||||
if idx != -1
|
|
||||||
return tab
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return -1
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" RemoveBufFromOtherTabs {{{2
|
|
||||||
" Remove the specified buffer from the buffer lists of all tabs
|
|
||||||
" except the current tab.
|
|
||||||
function! s:RemoveBufFromOtherTabs(bufnr)
|
|
||||||
for tab in range(1, tabpagenr('$'))
|
|
||||||
if tab == tabpagenr()
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
|
|
||||||
let list = gettabvar(tab, 'bufexp_buf_list', [])
|
|
||||||
let idx = index(list, a:bufnr)
|
|
||||||
if idx == -1
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
|
|
||||||
call remove(list, idx)
|
|
||||||
call settabvar(tab, 'bufexp_buf_list', list)
|
|
||||||
endfor
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" AddBufToCurrentTab {{{2
|
|
||||||
" Add the specified buffer to the list of buffers associated
|
|
||||||
" with the current tab
|
|
||||||
function! s:AddBufToCurrentTab(bufnr)
|
|
||||||
if index(t:bufexp_buf_list, a:bufnr) == -1
|
|
||||||
call add(t:bufexp_buf_list, a:bufnr)
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" IsInCurrentTab {{{2
|
|
||||||
" Returns whether the specified buffer is associated
|
|
||||||
" with the current tab
|
|
||||||
function! s:IsInCurrentTab(bufnr)
|
|
||||||
" It shouldn't happen that the list of buffers is
|
|
||||||
" not defined but if it does, play it safe and
|
|
||||||
" include the buffer
|
|
||||||
if !exists('t:bufexp_buf_list')
|
|
||||||
return 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
return (index(t:bufexp_buf_list, a:bufnr) != -1)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" UpdateTabBufData {{{2
|
|
||||||
" Update the tab buffer data for the specified buffer
|
|
||||||
"
|
|
||||||
" The current tab's list is updated. If a buffer is only
|
|
||||||
" allowed to be associated with one tab, it is removed
|
|
||||||
" from the lists of any other tabs with which it may have
|
|
||||||
" been associated.
|
|
||||||
"
|
|
||||||
" The associations between tabs and buffers are maintained
|
|
||||||
" in separate lists for each tab, which are stored in tab-
|
|
||||||
" specific variables 't:bufexp_buf_list'.
|
|
||||||
function! s:UpdateTabBufData(bufnr)
|
|
||||||
" The first time we add a tab, Vim uses the current buffer
|
|
||||||
" as its starting page even though we are about to edit a
|
|
||||||
" new page, and another BufEnter for the new page is triggered
|
|
||||||
" later. Use this first BufEnter to initialize the list of
|
|
||||||
" buffers, but don't add the buffer number to the list if
|
|
||||||
" it is already associated with another tab
|
|
||||||
"
|
"
|
||||||
" Unfortunately, this doesn't work right when the first
|
" If Vim has been loaded with mksession, then it is possible for more tabs
|
||||||
" buffer opened in the tab should be associated with it,
|
" to exist. So use tabpagenr() to determine how large to make the array. If
|
||||||
" such as when 'tab split +buffer N' is used
|
" there are 4 tabs, there should be 5 elements in this array.
|
||||||
if !exists("t:bufexp_buf_list")
|
"
|
||||||
let t:bufexp_buf_list = []
|
" Each element will hold a CSV list of buffers viewed in that tab. So on
|
||||||
|
" the 3rd tab, if there user has viewed 4 different buffers in that tab, the
|
||||||
|
" value would be:
|
||||||
|
" echo s:tabSpace[3]
|
||||||
|
" [4, 9, 1, 10]
|
||||||
|
" echo s:tabSpace
|
||||||
|
" [[-1], [-1], [-1], [4, 9, 1, 10], [-1]]
|
||||||
|
let s:tabSpace = []
|
||||||
|
let i = 0
|
||||||
|
|
||||||
if s:AssociatedTab(a:bufnr) != -1
|
while(tabpagenr('$') > 0 && i <= tabpagenr('$'))
|
||||||
return
|
call add(s:tabSpace, [-1])
|
||||||
endif
|
let i = i + 1
|
||||||
endif
|
endwhile
|
||||||
|
|
||||||
call s:AddBufToCurrentTab(a:bufnr)
|
|
||||||
|
|
||||||
if g:bufExplorerOnlyOneTab
|
|
||||||
call s:RemoveBufFromOtherTabs(a:bufnr)
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" ActivateBuffer {{{2
|
" ActivateBuffer {{{2
|
||||||
function! s:ActivateBuffer()
|
function! s:ActivateBuffer()
|
||||||
|
" Verify the current tabpage exists in the
|
||||||
|
" current s:tabSpace array. This can be missing
|
||||||
|
" entries when restoring sessions.
|
||||||
|
let i = 0
|
||||||
|
while( tabpagenr('$') > 0 && i <= tabpagenr() )
|
||||||
|
" Number: 0
|
||||||
|
" String: 1
|
||||||
|
" Funcref: 2
|
||||||
|
" List: 3
|
||||||
|
" Dictionary: 4
|
||||||
|
" Float: 5
|
||||||
|
if type(get(s:tabSpace, i)) == 0
|
||||||
|
call add(s:tabSpace, [-1])
|
||||||
|
endif
|
||||||
|
|
||||||
|
let i = i + 1
|
||||||
|
endwhile
|
||||||
|
|
||||||
let _bufnr = bufnr("%")
|
let _bufnr = bufnr("%")
|
||||||
call s:UpdateTabBufData(_bufnr)
|
let list = get(s:tabSpace, tabpagenr(), [-1])
|
||||||
|
|
||||||
|
if !empty(list) && list[0] == '-1'
|
||||||
|
" The first time we add a tab, Vim uses the current buffer
|
||||||
|
" as it's starting page. Even though we are about to
|
||||||
|
" edit a new page (BufEnter is triggered after), so
|
||||||
|
" remove the -1 entry indicating we have covered this case.
|
||||||
|
let list = []
|
||||||
|
call add(list, _bufnr)
|
||||||
|
let s:tabSpace[tabpagenr()] = list
|
||||||
|
elseif empty(list) || index(list, _bufnr) == -1
|
||||||
|
" Add new buffer to this tab's buffer list.
|
||||||
|
call add(list, _bufnr)
|
||||||
|
let s:tabSpace[tabpagenr()] = list
|
||||||
|
|
||||||
|
if g:bufExplorerOnlyOneTab == 1
|
||||||
|
" If a buffer can only be available in 1 tab page ensure this
|
||||||
|
" buffer is not present in any other tabs
|
||||||
|
let tabidx = 1
|
||||||
|
while tabidx < len(s:tabSpace)
|
||||||
|
if tabidx != tabpagenr()
|
||||||
|
let bufidx = index(s:tabSpace[tabidx], _bufnr)
|
||||||
|
if bufidx != -1
|
||||||
|
call remove(s:tabSpace[tabidx], bufidx)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
let tabidx = tabidx + 1
|
||||||
|
endwhile
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
call s:MRUPush(_bufnr)
|
call s:MRUPush(_bufnr)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -289,6 +224,14 @@ function! s:DeactivateBuffer(remove)
|
||||||
call s:MRUPop(_bufnr)
|
call s:MRUPop(_bufnr)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" TabEnter {{{2
|
||||||
|
function! s:TabEnter()
|
||||||
|
" Make s:tabSpace 1-based
|
||||||
|
if empty(s:tabSpace) || len(s:tabSpace) < (tabpagenr() + 1)
|
||||||
|
call add(s:tabSpace, [-1])
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
" MRUPop {{{2
|
" MRUPop {{{2
|
||||||
function! s:MRUPop(bufnr)
|
function! s:MRUPop(bufnr)
|
||||||
call filter(s:MRUList, 'v:val != '.a:bufnr)
|
call filter(s:MRUList, 'v:val != '.a:bufnr)
|
||||||
|
@ -337,7 +280,26 @@ endfunction
|
||||||
|
|
||||||
" Initialize {{{2
|
" Initialize {{{2
|
||||||
function! s:Initialize()
|
function! s:Initialize()
|
||||||
call s:SetLocalSettings()
|
let s:_insertmode = &insertmode
|
||||||
|
set noinsertmode
|
||||||
|
|
||||||
|
let s:_showcmd = &showcmd
|
||||||
|
set noshowcmd
|
||||||
|
|
||||||
|
let s:_cpo = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
let s:_report = &report
|
||||||
|
let &report = 10000
|
||||||
|
|
||||||
|
setlocal nonumber
|
||||||
|
setlocal foldcolumn=0
|
||||||
|
setlocal nofoldenable
|
||||||
|
setlocal cursorline
|
||||||
|
setlocal nospell
|
||||||
|
|
||||||
|
setlocal nobuflisted
|
||||||
|
|
||||||
let s:running = 1
|
let s:running = 1
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -365,29 +327,6 @@ function! s:Cleanup()
|
||||||
delmarks!
|
delmarks!
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" SetLocalSettings {{{2
|
|
||||||
function! s:SetLocalSettings()
|
|
||||||
let s:_insertmode = &insertmode
|
|
||||||
set noinsertmode
|
|
||||||
|
|
||||||
let s:_showcmd = &showcmd
|
|
||||||
set noshowcmd
|
|
||||||
|
|
||||||
let s:_cpo = &cpo
|
|
||||||
set cpo&vim
|
|
||||||
|
|
||||||
let s:_report = &report
|
|
||||||
let &report = 10000
|
|
||||||
|
|
||||||
setlocal nonumber
|
|
||||||
setlocal foldcolumn=0
|
|
||||||
setlocal nofoldenable
|
|
||||||
setlocal cursorline
|
|
||||||
setlocal nospell
|
|
||||||
setlocal nobuflisted
|
|
||||||
setlocal filetype=bufexplorer
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" BufExplorerHorizontalSplit {{{2
|
" BufExplorerHorizontalSplit {{{2
|
||||||
function! BufExplorerHorizontalSplit()
|
function! BufExplorerHorizontalSplit()
|
||||||
let s:splitMode = "sp"
|
let s:splitMode = "sp"
|
||||||
|
@ -400,15 +339,6 @@ function! BufExplorerVerticalSplit()
|
||||||
execute "BufExplorer"
|
execute "BufExplorer"
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" ToggleBufExplorer {{{2
|
|
||||||
function! ToggleBufExplorer()
|
|
||||||
if exists("s:running") && s:running == 1 && bufname(winbufnr(0)) == s:name
|
|
||||||
call s:Close()
|
|
||||||
else
|
|
||||||
call BufExplorer()
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" BufExplorer {{{2
|
" BufExplorer {{{2
|
||||||
function! BufExplorer()
|
function! BufExplorer()
|
||||||
let name = s:name
|
let name = s:name
|
||||||
|
@ -501,31 +431,28 @@ function! s:MapKeys()
|
||||||
nnoremap <buffer> <silent> <tab> :call <SID>SelectBuffer()<CR>
|
nnoremap <buffer> <silent> <tab> :call <SID>SelectBuffer()<CR>
|
||||||
endif
|
endif
|
||||||
|
|
||||||
nnoremap <script> <silent> <nowait> <buffer> <2-leftmouse> :call <SID>SelectBuffer()<CR>
|
nnoremap <script> <silent> <buffer> <2-leftmouse> :call <SID>SelectBuffer()<CR>
|
||||||
nnoremap <script> <silent> <nowait> <buffer> <CR> :call <SID>SelectBuffer()<CR>
|
nnoremap <script> <silent> <buffer> <CR> :call <SID>SelectBuffer()<CR>
|
||||||
nnoremap <script> <silent> <nowait> <buffer> <F1> :call <SID>ToggleHelp()<CR>
|
nnoremap <script> <silent> <buffer> <F1> :call <SID>ToggleHelp()<CR>
|
||||||
nnoremap <script> <silent> <nowait> <buffer> <s-cr> :call <SID>SelectBuffer("tab")<CR>
|
nnoremap <script> <silent> <buffer> <s-cr> :call <SID>SelectBuffer("tab")<CR>
|
||||||
nnoremap <script> <silent> <nowait> <buffer> a :call <SID>ToggleFindActive()<CR>
|
nnoremap <script> <silent> <buffer> B :call <SID>ToggleOnlyOneTab()<CR>
|
||||||
nnoremap <script> <silent> <nowait> <buffer> b :call <SID>SelectBuffer("ask")<CR>
|
nnoremap <script> <silent> <buffer> b :call <SID>SelectBuffer("ask")<CR>
|
||||||
nnoremap <script> <silent> <nowait> <buffer> d :call <SID>RemoveBuffer("delete")<CR>
|
nnoremap <script> <silent> <buffer> d :call <SID>RemoveBuffer("delete")<CR>
|
||||||
xnoremap <script> <silent> <nowait> <buffer> d :call <SID>RemoveBuffer("delete")<CR>
|
xnoremap <script> <silent> <buffer> d :call <SID>RemoveBuffer("delete")<CR>
|
||||||
nnoremap <script> <silent> <nowait> <buffer> D :call <SID>RemoveBuffer("wipe")<CR>
|
nnoremap <script> <silent> <buffer> D :call <SID>RemoveBuffer("wipe")<CR>
|
||||||
xnoremap <script> <silent> <nowait> <buffer> D :call <SID>RemoveBuffer("wipe")<CR>
|
xnoremap <script> <silent> <buffer> D :call <SID>RemoveBuffer("wipe")<CR>
|
||||||
nnoremap <script> <silent> <nowait> <buffer> f :call <SID>SelectBuffer("split", "sb")<CR>
|
nnoremap <script> <silent> <buffer> f :call <SID>ToggleFindActive()<CR>
|
||||||
nnoremap <script> <silent> <nowait> <buffer> F :call <SID>SelectBuffer("split", "st")<CR>
|
nnoremap <script> <silent> <buffer> m :call <SID>MRUListShow()<CR>
|
||||||
nnoremap <script> <silent> <nowait> <buffer> m :call <SID>MRUListShow()<CR>
|
nnoremap <script> <silent> <buffer> o :call <SID>SelectBuffer()<CR>
|
||||||
nnoremap <script> <silent> <nowait> <buffer> o :call <SID>SelectBuffer()<CR>
|
nnoremap <script> <silent> <buffer> p :call <SID>ToggleSplitOutPathName()<CR>
|
||||||
nnoremap <script> <silent> <nowait> <buffer> p :call <SID>ToggleSplitOutPathName()<CR>
|
nnoremap <script> <silent> <buffer> q :call <SID>Close()<CR>
|
||||||
nnoremap <script> <silent> <nowait> <buffer> q :call <SID>Close()<CR>
|
nnoremap <script> <silent> <buffer> r :call <SID>SortReverse()<CR>
|
||||||
nnoremap <script> <silent> <nowait> <buffer> r :call <SID>SortReverse()<CR>
|
nnoremap <script> <silent> <buffer> R :call <SID>ToggleShowRelativePath()<CR>
|
||||||
nnoremap <script> <silent> <nowait> <buffer> R :call <SID>ToggleShowRelativePath()<CR>
|
nnoremap <script> <silent> <buffer> s :call <SID>SortSelect()<CR>
|
||||||
nnoremap <script> <silent> <nowait> <buffer> s :call <SID>SortSelect()<CR>
|
nnoremap <script> <silent> <buffer> S :call <SID>ReverseSortSelect()<CR>
|
||||||
nnoremap <script> <silent> <nowait> <buffer> S :call <SID>ReverseSortSelect()<CR>
|
nnoremap <script> <silent> <buffer> t :call <SID>SelectBuffer("tab")<CR>
|
||||||
nnoremap <script> <silent> <nowait> <buffer> t :call <SID>SelectBuffer("tab")<CR>
|
nnoremap <script> <silent> <buffer> T :call <SID>ToggleShowTabBuffer()<CR>
|
||||||
nnoremap <script> <silent> <nowait> <buffer> T :call <SID>ToggleShowTabBuffer()<CR>
|
nnoremap <script> <silent> <buffer> u :call <SID>ToggleShowUnlisted()<CR>
|
||||||
nnoremap <script> <silent> <nowait> <buffer> u :call <SID>ToggleShowUnlisted()<CR>
|
|
||||||
nnoremap <script> <silent> <nowait> <buffer> v :call <SID>SelectBuffer("split", "vr")<CR>
|
|
||||||
nnoremap <script> <silent> <nowait> <buffer> V :call <SID>SelectBuffer("split", "vl")<CR>
|
|
||||||
|
|
||||||
for k in ["G", "n", "N", "L", "M", "H"]
|
for k in ["G", "n", "N", "L", "M", "H"]
|
||||||
execute "nnoremap <buffer> <silent>" k ":keepjumps normal!" k."<CR>"
|
execute "nnoremap <buffer> <silent>" k ":keepjumps normal!" k."<CR>"
|
||||||
|
@ -631,14 +558,11 @@ function! s:CreateHelp()
|
||||||
call add(header, '" <F1> : toggle this help')
|
call add(header, '" <F1> : toggle this help')
|
||||||
call add(header, '" <enter> or o or Mouse-Double-Click : open buffer under cursor')
|
call add(header, '" <enter> or o or Mouse-Double-Click : open buffer under cursor')
|
||||||
call add(header, '" <shift-enter> or t : open buffer in another tab')
|
call add(header, '" <shift-enter> or t : open buffer in another tab')
|
||||||
call add(header, '" a : toggle find active buffer')
|
|
||||||
call add(header, '" b : Fast buffer switching with b<any bufnum>')
|
|
||||||
call add(header, '" B : toggle if to save/use recent tab or not')
|
call add(header, '" B : toggle if to save/use recent tab or not')
|
||||||
call add(header, '" d : delete buffer')
|
call add(header, '" d : delete buffer')
|
||||||
call add(header, '" D : wipe buffer')
|
call add(header, '" D : wipe buffer')
|
||||||
call add(header, '" F : open buffer in another window above the current')
|
call add(header, '" f : toggle find active buffer')
|
||||||
call add(header, '" f : open buffer in another window below the current')
|
call add(header, '" p : toggle spliting of file and path name')
|
||||||
call add(header, '" p : toggle splitting of file and path name')
|
|
||||||
call add(header, '" q : quit')
|
call add(header, '" q : quit')
|
||||||
call add(header, '" r : reverse sort')
|
call add(header, '" r : reverse sort')
|
||||||
call add(header, '" R : toggle showing relative or full paths')
|
call add(header, '" R : toggle showing relative or full paths')
|
||||||
|
@ -646,8 +570,6 @@ function! s:CreateHelp()
|
||||||
call add(header, '" S : reverse cycle thru "sort by" fields')
|
call add(header, '" S : reverse cycle thru "sort by" fields')
|
||||||
call add(header, '" T : toggle if to show only buffers for this tab or not')
|
call add(header, '" T : toggle if to show only buffers for this tab or not')
|
||||||
call add(header, '" u : toggle showing unlisted buffers')
|
call add(header, '" u : toggle showing unlisted buffers')
|
||||||
call add(header, '" V : open buffer in another window on the left of the current')
|
|
||||||
call add(header, '" v : open buffer in another window on the right of the current')
|
|
||||||
else
|
else
|
||||||
call add(header, '" Press <F1> for Help')
|
call add(header, '" Press <F1> for Help')
|
||||||
endif
|
endif
|
||||||
|
@ -745,17 +667,24 @@ function! s:BuildBufferList()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Are we to show only buffer(s) for this tab?
|
" Are we to show only buffer(s) for this tab?
|
||||||
if g:bufExplorerShowTabBuffer && (!s:IsInCurrentTab(str2nr(buf.attributes)))
|
if g:bufExplorerShowTabBuffer
|
||||||
|
let show_buffer = 0
|
||||||
|
|
||||||
|
for bufnr in s:tabSpace[tabpagenr()]
|
||||||
|
if buf.attributes =~ '^\s*'.bufnr.'\>'
|
||||||
|
" Only buffers shown on the current tabpagenr
|
||||||
|
let show_buffer = 1
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
if show_buffer == 0
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
let line = buf.attributes." "
|
let line = buf.attributes." "
|
||||||
|
|
||||||
if exists("g:loaded_webdevicons")
|
|
||||||
let line .= WebDevIconsGetFileTypeSymbol(buf.shortname)
|
|
||||||
let line .= " "
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Are we to split the path and file name?
|
" Are we to split the path and file name?
|
||||||
if g:bufExplorerSplitOutPathName
|
if g:bufExplorerSplitOutPathName
|
||||||
let type = (g:bufExplorerShowRelativePath) ? "relativepath" : "path"
|
let type = (g:bufExplorerShowRelativePath) ? "relativepath" : "path"
|
||||||
|
@ -834,27 +763,20 @@ function! s:SelectBuffer(...)
|
||||||
return s:Close()
|
return s:Close()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Get the tab number where this bufer is located in.
|
" Are we suppose to open the selected buffer in a tab?
|
||||||
let tabNbr = s:GetTabNbr(_bufNbr)
|
|
||||||
" Are we supposed to open the selected buffer in a tab?
|
|
||||||
if (a:0 == 1) && (a:1 == "tab")
|
if (a:0 == 1) && (a:1 == "tab")
|
||||||
|
" Yes, we are to open the selected buffer in a tab.
|
||||||
|
|
||||||
" Restore [BufExplorer] buffer.
|
" Restore [BufExplorer] buffer.
|
||||||
execute "silent buffer!".s:originBuffer
|
execute "keepjumps silent buffer!".s:originBuffer
|
||||||
|
|
||||||
|
" Get the tab nmber where this bufer is located in.
|
||||||
|
let tabNbr = s:GetTabNbr(_bufNbr)
|
||||||
|
|
||||||
" Was the tab found?
|
" Was the tab found?
|
||||||
if tabNbr == 0
|
if tabNbr == 0
|
||||||
" _bufNbr is not opened in any tabs. Open a new tab with the
|
" _bufNbr is not opened in any tabs. Open a new tab with the selected buffer in it.
|
||||||
" selected buffer in it.
|
|
||||||
if v:version > 704 || ( v:version == 704 && has('patch2237') )
|
|
||||||
" new syntax for last tab as of 7.4.2237
|
|
||||||
execute "$tab split +buffer" . _bufNbr
|
|
||||||
else
|
|
||||||
execute "999tab split +buffer" . _bufNbr
|
execute "999tab split +buffer" . _bufNbr
|
||||||
endif
|
|
||||||
|
|
||||||
" Workaround for the issue mentioned in UpdateTabBufData.
|
|
||||||
call s:UpdateTabBufData(_bufNbr)
|
|
||||||
else
|
else
|
||||||
" The _bufNbr is already opened in a tab, go to that tab.
|
" The _bufNbr is already opened in a tab, go to that tab.
|
||||||
execute tabNbr . "tabnext"
|
execute tabNbr . "tabnext"
|
||||||
|
@ -862,42 +784,9 @@ function! s:SelectBuffer(...)
|
||||||
" Focus window.
|
" Focus window.
|
||||||
execute s:GetWinNbr(tabNbr, _bufNbr) . "wincmd w"
|
execute s:GetWinNbr(tabNbr, _bufNbr) . "wincmd w"
|
||||||
endif
|
endif
|
||||||
" Are we supposed to open the selected buffer in a split?
|
|
||||||
elseif (a:0 == 2) && (a:1 == "split")
|
|
||||||
if g:bufExplorerFindActive
|
|
||||||
call s:Close()
|
|
||||||
endif
|
|
||||||
" Was the tab found?
|
|
||||||
if tabNbr != 0
|
|
||||||
" Yes, the buffer is located in a tab. Go to that tab instead of
|
|
||||||
" opening split
|
|
||||||
execute tabNbr . "tabnext"
|
|
||||||
else
|
else
|
||||||
"Nope, the buffer is not in a tab, open it accordingly
|
" No, the user did not ask to open the selected buffer in a tab.
|
||||||
let _bufName = expand("#"._bufNbr.":p")
|
|
||||||
if (a:2 == "vl")
|
|
||||||
execute _bufName ?
|
|
||||||
\ "vert topleft sb ".escape(_bufName, " ") :
|
|
||||||
\ "vert topleft sb "._bufNbr
|
|
||||||
elseif (a:2 == "vr")
|
|
||||||
execute _bufName ?
|
|
||||||
\ "vert belowright sb ".escape(_bufName, " ") :
|
|
||||||
\ "vert belowright sb "._bufNbr
|
|
||||||
elseif (a:2 == "st")
|
|
||||||
execute _bufName ?
|
|
||||||
\ "topleft sb ".escape(_bufName, " ") :
|
|
||||||
\ "topleft sb "._bufNbr
|
|
||||||
else " = sb
|
|
||||||
execute _bufName ?
|
|
||||||
\ "belowright sb ".escape(_bufName, " ") :
|
|
||||||
\ "belowright sb "._bufNbr
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Switch to selected buffer
|
|
||||||
execute "keepalt silent b!" _bufNbr
|
|
||||||
" Default, open in current window
|
|
||||||
else
|
|
||||||
" Are we suppose to move to the tab where the active buffer is?
|
" Are we suppose to move to the tab where the active buffer is?
|
||||||
if exists("g:bufExplorerChgWin")
|
if exists("g:bufExplorerChgWin")
|
||||||
execute g:bufExplorerChgWin."wincmd w"
|
execute g:bufExplorerChgWin."wincmd w"
|
||||||
|
@ -906,6 +795,9 @@ function! s:SelectBuffer(...)
|
||||||
call s:Close()
|
call s:Close()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Get the tab number where this buffer is located in.
|
||||||
|
let tabNbr = s:GetTabNbr(_bufNbr)
|
||||||
|
|
||||||
" Was the tab found?
|
" Was the tab found?
|
||||||
if tabNbr != 0
|
if tabNbr != 0
|
||||||
" Yes, the buffer is located in a tab. Go to that tab number.
|
" Yes, the buffer is located in a tab. Go to that tab number.
|
||||||
|
@ -919,7 +811,7 @@ function! s:SelectBuffer(...)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Switch to the selected buffer.
|
" Switch to the selected buffer.
|
||||||
execute "keepjumps keepalt silent b!" _bufNbr
|
execute "keepalt keepjumps silent b!" _bufNbr
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Make the buffer 'listed' again.
|
" Make the buffer 'listed' again.
|
||||||
|
@ -955,7 +847,11 @@ function! s:RemoveBuffer(mode)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let mode = a:mode
|
" Do not allow this buffer to be deleted if it is the last one.
|
||||||
|
if len(s:MRUList) == 1
|
||||||
|
call s:Error("Sorry, you are not allowed to delete the last buffer")
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
" These commands are to temporarily suspend the activity of winmanager.
|
" These commands are to temporarily suspend the activity of winmanager.
|
||||||
if exists("b:displayMode") && b:displayMode == "winmanager"
|
if exists("b:displayMode") && b:displayMode == "winmanager"
|
||||||
|
@ -965,26 +861,12 @@ function! s:RemoveBuffer(mode)
|
||||||
let _bufNbr = str2nr(getline('.'))
|
let _bufNbr = str2nr(getline('.'))
|
||||||
|
|
||||||
if getbufvar(_bufNbr, '&modified') == 1
|
if getbufvar(_bufNbr, '&modified') == 1
|
||||||
" Calling confirm() requires Vim built with dialog option
|
|
||||||
if !has("dialog_con") && !has("dialog_gui")
|
|
||||||
call s:Error("Sorry, no write since last change for buffer "._bufNbr.", unable to delete")
|
call s:Error("Sorry, no write since last change for buffer "._bufNbr.", unable to delete")
|
||||||
return
|
return
|
||||||
endif
|
|
||||||
|
|
||||||
let answer = confirm('No write since last change for buffer '._bufNbr.'. Delete anyway?', "&Yes\n&No", 2)
|
|
||||||
|
|
||||||
if a:mode == "delete" && answer == 1
|
|
||||||
let mode = "force_delete"
|
|
||||||
elseif a:mode == "wipe" && answer == 1
|
|
||||||
let mode = "force_wipe"
|
|
||||||
else
|
else
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Okay, everything is good, delete or wipe the buffer.
|
" Okay, everything is good, delete or wipe the buffer.
|
||||||
call s:DeleteBuffer(_bufNbr, mode)
|
call s:DeleteBuffer(_bufNbr, a:mode)
|
||||||
|
endif
|
||||||
|
|
||||||
" Reactivate winmanager autocommand activity.
|
" Reactivate winmanager autocommand activity.
|
||||||
if exists("b:displayMode") && b:displayMode == "winmanager"
|
if exists("b:displayMode") && b:displayMode == "winmanager"
|
||||||
|
@ -1000,10 +882,6 @@ function! s:DeleteBuffer(buf, mode)
|
||||||
" Wipe/Delete buffer from Vim.
|
" Wipe/Delete buffer from Vim.
|
||||||
if a:mode == "wipe"
|
if a:mode == "wipe"
|
||||||
execute "silent bwipe" a:buf
|
execute "silent bwipe" a:buf
|
||||||
elseif a:mode == "force_wipe"
|
|
||||||
execute "silent bwipe!" a:buf
|
|
||||||
elseif a:mode == "force_delete"
|
|
||||||
execute "silent bdelete!" a:buf
|
|
||||||
else
|
else
|
||||||
execute "silent bdelete" a:buf
|
execute "silent bdelete" a:buf
|
||||||
endif
|
endif
|
||||||
|
@ -1020,20 +898,10 @@ function! s:DeleteBuffer(buf, mode)
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" ListedAndCurrentTab {{{2
|
|
||||||
" Returns whether the specified buffer is both listed and associated
|
|
||||||
" with the current tab
|
|
||||||
function! s:ListedAndCurrentTab(buf)
|
|
||||||
return buflisted(a:buf) && s:IsInCurrentTab(a:buf)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Close {{{2
|
" Close {{{2
|
||||||
function! s:Close()
|
function! s:Close()
|
||||||
" Get only the listed buffers associated with the current tab
|
" Get only the listed buffers.
|
||||||
let listed = filter(copy(s:MRUList), "s:ListedAndCurrentTab(v:val)")
|
let listed = filter(copy(s:MRUList), "buflisted(v:val)")
|
||||||
if len(listed) == 0
|
|
||||||
let listed = filter(range(1, bufnr('$')), "s:ListedAndCurrentTab(v:val)")
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If we needed to split the main window, close the split one.
|
" If we needed to split the main window, close the split one.
|
||||||
if s:splitMode != "" && bufwinnr(s:originBuffer) != -1
|
if s:splitMode != "" && bufwinnr(s:originBuffer) != -1
|
||||||
|
@ -1046,7 +914,7 @@ function! s:Close()
|
||||||
" buffers.
|
" buffers.
|
||||||
execute "enew"
|
execute "enew"
|
||||||
else
|
else
|
||||||
" Since there are buffers left to switch to, switch to the previous and
|
" Since there are buffers left to switch to, swith to the previous and
|
||||||
" then the current.
|
" then the current.
|
||||||
for b in reverse(listed[0:1])
|
for b in reverse(listed[0:1])
|
||||||
execute "keepjumps silent b ".b
|
execute "keepjumps silent b ".b
|
||||||
|
@ -1173,9 +1041,6 @@ function! s:SortListing()
|
||||||
" Easiest case.
|
" Easiest case.
|
||||||
execute sort 'n'
|
execute sort 'n'
|
||||||
elseif g:bufExplorerSortBy == "name"
|
elseif g:bufExplorerSortBy == "name"
|
||||||
" Sort by full path first
|
|
||||||
execute sort 'ir /\zs\f\+\ze\s\+line/'
|
|
||||||
|
|
||||||
if g:bufExplorerSplitOutPathName
|
if g:bufExplorerSplitOutPathName
|
||||||
execute sort 'ir /\d.\{7}\zs\f\+\ze/'
|
execute sort 'ir /\d.\{7}\zs\f\+\ze/'
|
||||||
else
|
else
|
||||||
|
@ -1189,16 +1054,6 @@ function! s:SortListing()
|
||||||
|
|
||||||
execute sort 'ir /\zs\f\+\ze\s\+line/'
|
execute sort 'ir /\zs\f\+\ze\s\+line/'
|
||||||
elseif g:bufExplorerSortBy == "extension"
|
elseif g:bufExplorerSortBy == "extension"
|
||||||
" Sort by full path...
|
|
||||||
execute sort 'ir /\zs\f\+\ze\s\+line/'
|
|
||||||
|
|
||||||
" Sort by name...
|
|
||||||
if g:bufExplorerSplitOutPathName
|
|
||||||
" Sort twice - first on the file name then on the path.
|
|
||||||
execute sort 'ir /\d.\{7}\zs\f\+\ze/'
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Sort by extension.
|
|
||||||
execute sort 'ir /\.\zs\w\+\ze\s/'
|
execute sort 'ir /\.\zs\w\+\ze\s/'
|
||||||
elseif g:bufExplorerSortBy == "mru"
|
elseif g:bufExplorerSortBy == "mru"
|
||||||
let l = getline(s:firstBufferLine, "$")
|
let l = getline(s:firstBufferLine, "$")
|
||||||
|
@ -1284,7 +1139,6 @@ call s:Set("g:bufExplorerMaxHeight", 25) " Handles dynamic resizing of the windo
|
||||||
" or by winmanager.
|
" or by winmanager.
|
||||||
function! BufExplorer_Start()
|
function! BufExplorer_Start()
|
||||||
let b:displayMode = "winmanager"
|
let b:displayMode = "winmanager"
|
||||||
call s:SetLocalSettings()
|
|
||||||
call BufExplorer()
|
call BufExplorer()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -1296,7 +1150,6 @@ endfunction
|
||||||
" Handles dynamic refreshing of the window.
|
" Handles dynamic refreshing of the window.
|
||||||
function! BufExplorer_Refresh()
|
function! BufExplorer_Refresh()
|
||||||
let b:displayMode = "winmanager"
|
let b:displayMode = "winmanager"
|
||||||
call s:SetLocalSettings()
|
|
||||||
call BufExplorer()
|
call BufExplorer()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -1327,7 +1180,7 @@ function! BufExplorer_ReSize()
|
||||||
call setpos(".", pres)
|
call setpos(".", pres)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Default values {{{2
|
" Default values {{{1
|
||||||
call s:Set("g:bufExplorerDisableDefaultKeyMapping", 0) " Do not disable default key mappings.
|
call s:Set("g:bufExplorerDisableDefaultKeyMapping", 0) " Do not disable default key mappings.
|
||||||
call s:Set("g:bufExplorerDefaultHelp", 1) " Show default help?
|
call s:Set("g:bufExplorerDefaultHelp", 1) " Show default help?
|
||||||
call s:Set("g:bufExplorerDetailedHelp", 0) " Show detailed help?
|
call s:Set("g:bufExplorerDetailedHelp", 0) " Show detailed help?
|
||||||
|
@ -1345,16 +1198,13 @@ call s:Set("g:bufExplorerSplitOutPathName", 1) " Split out path and fil
|
||||||
call s:Set("g:bufExplorerSplitRight", &splitright) " Should vertical splits be on the right or left of current window?
|
call s:Set("g:bufExplorerSplitRight", &splitright) " Should vertical splits be on the right or left of current window?
|
||||||
call s:Set("g:bufExplorerSplitVertSize", 0) " Height for a vertical split. If <=0, default Vim size is used.
|
call s:Set("g:bufExplorerSplitVertSize", 0) " Height for a vertical split. If <=0, default Vim size is used.
|
||||||
call s:Set("g:bufExplorerSplitHorzSize", 0) " Height for a horizontal split. If <=0, default Vim size is used.
|
call s:Set("g:bufExplorerSplitHorzSize", 0) " Height for a horizontal split. If <=0, default Vim size is used.
|
||||||
|
"1}}}
|
||||||
|
|
||||||
" Default key mapping {{{2
|
" Default key mapping {{{1
|
||||||
if !hasmapto('BufExplorer') && g:bufExplorerDisableDefaultKeyMapping == 0
|
if !hasmapto('BufExplorer') && g:bufExplorerDisableDefaultKeyMapping == 0
|
||||||
nnoremap <script> <silent> <unique> <Leader>be :BufExplorer<CR>
|
nnoremap <script> <silent> <unique> <Leader>be :BufExplorer<CR>
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !hasmapto('ToggleBufExplorer') && g:bufExplorerDisableDefaultKeyMapping == 0
|
|
||||||
nnoremap <script> <silent> <unique> <Leader>bt :ToggleBufExplorer<CR>
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !hasmapto('BufExplorerHorizontalSplit') && g:bufExplorerDisableDefaultKeyMapping == 0
|
if !hasmapto('BufExplorerHorizontalSplit') && g:bufExplorerDisableDefaultKeyMapping == 0
|
||||||
nnoremap <script> <silent> <unique> <Leader>bs :BufExplorerHorizontalSplit<CR>
|
nnoremap <script> <silent> <unique> <Leader>bs :BufExplorerHorizontalSplit<CR>
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in a new issue