All Projects → mihaifm → bufstop

mihaifm / bufstop

Licence: other
Fast and efficient buffer switching for Vim

Programming Languages

Vim Script
2826 projects

Projects that are alternatives of or similar to bufstop

VimConfig
Configuration files for Vi-IMproved.
Stars: ✭ 23 (-71.95%)
Mutual labels:  vim-plugin, vim-plugins
vim-tmuxlike
A vim plugin that mimics the actions of tmux. 像操作Tmux一样操作Vim
Stars: ✭ 20 (-75.61%)
Mutual labels:  vim-plugin, vim-plugins
Visual Split.vim
Vim plugin to control splits with visual selections or text objects
Stars: ✭ 190 (+131.71%)
Mutual labels:  vim-plugin, vim-plugins
vim-bettergrep
A better way to grep in vim.
Stars: ✭ 15 (-81.71%)
Mutual labels:  vim-plugin, vim-plugins
swifty-vim
⌨️ A Vim plugin for Swift which provides file detection, syntax highlighting, support for compiling and running tests, and optional support for formatting and linting tools.
Stars: ✭ 18 (-78.05%)
Mutual labels:  vim-plugin, vim-plugins
Vim Dadbod Completion
Database autocompletion powered by https://github.com/tpope/vim-dadbod
Stars: ✭ 163 (+98.78%)
Mutual labels:  vim-plugin, vim-plugins
Nerdtree
A tree explorer plugin for vim.
Stars: ✭ 16,380 (+19875.61%)
Mutual labels:  vim-plugin, vim-plugins
Vim Todo Lists
Vim plugin for TODO lists
Stars: ✭ 126 (+53.66%)
Mutual labels:  vim-plugin, vim-plugins
vim-jsonc
⚠️Deprecated⚠️: Vim syntax highlighting plugin for JSON with C-style line (//) and block (/* */) comments.
Stars: ✭ 52 (-36.59%)
Mutual labels:  vim-plugin, vim-plugins
vim-phpstan
A Vim plugin for PHPStan - https://github.com/phpstan/phpstan. It calls `phpstan` to do static analysis of your PHP code and displays the errors in Vim's quickfix list.
Stars: ✭ 26 (-68.29%)
Mutual labels:  vim-plugin, vim-plugins
Targets.vim
Vim plugin that provides additional text objects
Stars: ✭ 2,114 (+2478.05%)
Mutual labels:  vim-plugin, vim-plugins
vim-inccomplete
Vim plugin for #include directive completion.
Stars: ✭ 14 (-82.93%)
Mutual labels:  vim-plugin, vim-plugins
Vimux
easily interact with tmux from vim
Stars: ✭ 1,980 (+2314.63%)
Mutual labels:  vim-plugin, vim-plugins
Exit Vim
Vim plugin that exits Vim on startup
Stars: ✭ 176 (+114.63%)
Mutual labels:  vim-plugin, vim-plugins
Ale
Check syntax in Vim asynchronously and fix files, with Language Server Protocol (LSP) support
Stars: ✭ 11,380 (+13778.05%)
Mutual labels:  vim-plugin, vim-plugins
Vifm.vim
Vim plugin that allows use of vifm as a file picker
Stars: ✭ 197 (+140.24%)
Mutual labels:  vim-plugin, vim-plugins
Fzf Filemru
File MRU with fzf.vim
Stars: ✭ 76 (-7.32%)
Mutual labels:  vim-plugin, vim-plugins
Vimpanel
A modern side panel for Vim
Stars: ✭ 97 (+18.29%)
Mutual labels:  vim-plugin, vim-plugins
vim-sass-colors
sass/scss/less/css color literal and color variable highlighting (works with imports)
Stars: ✭ 24 (-70.73%)
Mutual labels:  vim-plugin, vim-plugins
filestyle
filestyle is a Vim plugin that highlights unwanted whitespace and characters.
Stars: ✭ 30 (-63.41%)
Mutual labels:  vim-plugin, vim-plugins

Bufstop

If you find yourself frequently switching back and forth between files, and looking for a faster way to do it, well...your journey has come to an end. Welcome to the Bufstop !

Bufstop is a plugin for faster buffer switching, built for efficiency and less keystrokes. It provides no less than 7 ways to display and switch buffers.

If you can think of faster ways to switch files, let me know and I will include them in the plugin.

screenshot1

screenshot2

Buffer window with hotkeys

The :Bufstop command opens a new window at the top/bottom of the screen containing the list of current buffers, ordered by most recently used. Each buffer has an associated hotkey displayed besides it. When pressed, the correspoding buffer is loaded, with the focus remaining in the Bufstop window. This way you can quickly preview buffers with only 1 keystroke !

The Bufstop window is easily dismissed with the <Esc> key.

There is also a :BufstopFast command which opens the Bufstop window in the same way, but spares you the effort of pressing the <Esc> key : the window closes automatically after you select a buffer.

Tip: If you're using the recommended mappings (see below), <leader>b2 will always take you to the previously opened file (aka alternate buffer)

Preview mode

The :BufstopPreview command is similar to the :Bufstop command, with the notable difference that you can preview and navigate files by moving up or down in the window with j,k or arrow keys. It is a powerful and instant way to check your files.

Tip: You can still switch files by pressing the hotkeys associated with them.

Minimal mode inside the command line

Don't like a pottentially huge file list popping on the screen? Use the :BufstopMode command. Buffers will be displayed in the command line, in the same order: by most recently used.

In this mode, you can only press numbers. Pressing 3 will take you to the 3rd recently used buffer. However here's the catch: because the 3rd buffer will now be first in the hierarchy, it's place will be taken by another buffer.
So pressing 33333.... will cycle between the last 3 buffers.
Similarly, 4444 will cycle the last 4 buffers, and so on.

Pressing <Esc> will dismiss the mode. There is a :BufstopModeFast alternative, which dismisses the mode once you select a buffer.

Tip: The first buffer labeled with 1 will always be the current file.

On the statusline

The :BufstopStatusline command works the same way as :BufstopMode, but displays the buffers on the statusline. As before, there is a fast alternative, :BufstopStatuslineFast that will close the mode once you select something.

Tip: No worries, your old statusline is restored once you exit the mode.

Extreme speed hotkeys

The previous methods are cool, but they still require a mapping to bring up the buffer list (typically <leader>b).
Looking for a faster way? Use the :BufstopSpeedToggle command.

It creates the following mappings: <leader>2 opens the previous buffer, <leader>3 to open the 3rd recently used buffer, and so on.

Using :BufstopSpeedToggle again will clear out these mappings.

Tip: Pressing ,5,5,5... will cycle the last 5 buffers.

Ultimate

The previous speed method requires 2 keys to open any arbitrary buffer. Too much? Put this in your vimrc:

let g:BufstopSpeedKeys = ["<F1>", "<F2>", "<F3>", "<F4>", "<F5>", "<F6>"]
let g:BufstopLeader = ""
let g:BufstopAutoSpeedToggle = 1

Yes, you guessed it. 1 key to open arbitrary buffers !

Once again, pressing <F4><F4><F4>... will cycle between the last 4 buffers.

Tip: Already had something mapped to <Fx>? Use :BufstopSpeedToggle to switch off these mappings. Bufstop will attempt to restore your old mapping (given that you didn't use noremap).

Bonuses

  1. As a bonus, this plugin provides navigation history for each window.
    Use the :BufstopBack and :BufstopForward to navigate this history.

  2. The other bonus is the ability to sort the buffers by MFU (most frequently used). Use the g:BufstopSorting option to activate this powerful feature.

Recommended mappings

Hopefully we're not crazy to type in those long command names. You can use the below mappings or create your own:

map <leader>b :Bufstop<CR>             " get a visual on the buffers
map <leader>w :BufstopPreview<CR>      " switch files by moving inside the window
map <leader>a :BufstopModeFast<CR>     " a command for quick switching
map <C-tab>   :BufstopBack<CR>
map <S-tab>   :BufstopForward<CR>
let g:BufstopAutoSpeedToggle = 1       " now I can press ,3,3,3 to cycle the last 3 buffers

Don't like this plugin?

At least put this in your vimrc:

:map <leader>b :ls<CR>:b

It will display the buffer list and prompt you for a number. Simple, but primitive, especially when you're dealing with a lot of files.

In addition to this plugin, you can use a fuzzy finder like CtrlP, which requires you to type parts of the file name.

Reference documentation

Commands:

  • :Bufstop

Invokes the Bufstop window. Inside it, each buffer will have an associated hotkey that can be used to open the buffer.

In addition, the following key mappings are present in the Bufstop window:

d          Wipe the selected buffer (close the file)
<CR>       Open the selected buffer.
<Esc>      Dismiss the Bufstop window
k,j        Move up/down to select a buffer.
  • :BufstopFast

Same as :Bufstop, but the window is closed after you select a buffer.

  • :BufstopPreview

Same as :Bufstop but navigating to different rows with k,j or arrow keys will instantly swtich buffers.

  • :BufstopMode

Display the most recently used buffers in the command line and enter Bufstop mode. In this mode you can press only a number coresponding to a buffer, or the <Esc> key which exits the mode. The number of displayed files can be configured using the g:BufstopModeNumFiles option.

  • :BufstopModeFast

Same as :BufstopMode but exits the mode once a buffer is selected.

  • :BufstopStatusline

Same as :BufstopMode but displays the list in the statusline. The old statusline is restored once the mode is dismissed.

  • :BufstopStatuslineFast

Same as :BufstopStatusline but exists the mode once a buffer is selected.

  • :BufstopSpeedToggle

Toggle speed mappings. The defaults are <leader>2 to go to the 2nd recently used buffer, <leader>3 to go to the 3rd, an so on. These can be configured using the g:BufstopSpeedKeys and g:BufstopLeader options.

  • :BufstopBack

Opens the previous buffer in the navigation history for the current window.

  • :BufstopForward

Opens the next buffer in the navigation history for the current window.

Config

  • g:BufstopKeys

The shortcut keys used to switch buffers. The keys are displayed next to the buffer names, in the order they appear in this string. Default: "1234asfcvzx5qwertyuiopbnm67890ABCEFGHIJKLMNOPQRSTUVZ"

  • g:BufstopSpeedKeys

Keys used to create speed mappings. The g:BufstopLeader will be appended to each key to create the mappig. Default: ["1", "2", "3", "4", "5", "6"]

  • g:BufstopLeader

The key that is appended to the speed mappings. Default: "<leader>"

  • g:BufstopAutoSpeedToggle

Mount the speed mappings automatically when loading the plugin. Default is 0.

  • g:BufstopSplit

The split location of the Bufstop window. Valid options are the ones that influence the :split command in Vim: topleft, leftabove, rigthbelow, etc. Default: "botright"

  • g:BufstopSorting

Controls the way buffers are sorted before being displayed. Valid options are:

"MRU" - sort by most recently used
"MFU" - sort by most frequently used
"none" or "" - disable sorting

Default: "MRU"

More config options with :help Bufstop

Enjoy!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].