All Projects → sunaku → Vim Shortcut

sunaku / Vim Shortcut

💇 Discoverable & searchable shortcuts for (Neo)Vim

Projects that are alternatives of or similar to Vim Shortcut

Lh Cpp
C&C++ ftplugins suite for Vim
Stars: ✭ 108 (-36.47%)
Mutual labels:  vim-plugins
Wmgraphviz.vim
Vim plugin for Graphviz
Stars: ✭ 142 (-16.47%)
Mutual labels:  vim-plugins
Vimux
easily interact with tmux from vim
Stars: ✭ 1,980 (+1064.71%)
Mutual labels:  vim-plugins
Local vimrc
Per project/tree configuration plugins
Stars: ✭ 118 (-30.59%)
Mutual labels:  vim-plugins
Tig Explorer.vim
Vim plugin to use Tig as a git client. Seamless switching between vim and Tig with opening in the same buffer.
Stars: ✭ 136 (-20%)
Mutual labels:  vim-plugins
Vim Tidal
Vim plugin for TidalCycles
Stars: ✭ 147 (-13.53%)
Mutual labels:  vim-plugins
Vim Dasht
💁 (Neo)Vim plugin for dasht integration
Stars: ✭ 104 (-38.82%)
Mutual labels:  vim-plugins
Vim Dadbod Completion
Database autocompletion powered by https://github.com/tpope/vim-dadbod
Stars: ✭ 163 (-4.12%)
Mutual labels:  vim-plugins
Jupytext.vim
Vim plugin for editing Jupyter ipynb files via jupytext
Stars: ✭ 142 (-16.47%)
Mutual labels:  vim-plugins
Vim Ruby
Vim/Ruby Configuration Files
Stars: ✭ 1,885 (+1008.82%)
Mutual labels:  vim-plugins
Vim Todo Lists
Vim plugin for TODO lists
Stars: ✭ 126 (-25.88%)
Mutual labels:  vim-plugins
Ale
Check syntax in Vim asynchronously and fix files, with Language Server Protocol (LSP) support
Stars: ✭ 11,380 (+6594.12%)
Mutual labels:  vim-plugins
Vim Gutentags
A Vim plugin that manages your tag files
Stars: ✭ 1,977 (+1062.94%)
Mutual labels:  vim-plugins
Dotfiles ikigai
dotfiles 🔥 includes scripts that makes my life easier!
Stars: ✭ 110 (-35.29%)
Mutual labels:  vim-plugins
Targets.vim
Vim plugin that provides additional text objects
Stars: ✭ 2,114 (+1143.53%)
Mutual labels:  vim-plugins
Coverage.vim
code coverage vim plugin
Stars: ✭ 106 (-37.65%)
Mutual labels:  vim-plugins
Django Plus.vim
🎸 Improvements to the handling of Django related files in Vim
Stars: ✭ 145 (-14.71%)
Mutual labels:  vim-plugins
Stackanswers.vim
Vim plugin to fetch and display answers from Stack Overflow
Stars: ✭ 165 (-2.94%)
Mutual labels:  vim-plugins
Vim Operator User
Vim plugin: Define your own operator easily
Stars: ✭ 161 (-5.29%)
Mutual labels:  vim-plugins
Vim Fakeclip
Vim plugin: Provide pseudo "clipboard" registers
Stars: ✭ 154 (-9.41%)
Mutual labels:  vim-plugins

shortcut.vim

This plugin provides a discoverable shortcut system for Vim that is inspired by Spacemacs and powered by fzf.vim. It displays a searchable menu of shortcuts when you pause partway while typing a shortcut, say, because you forgot the rest of it or because you just want to see the shortcut menu again to discover what else is available. You can interactively filter the menu by typing more shortcut keys or parts of shortcut descriptions shown in the menu.

asciicast

Requirements

Usage

  • Use the Shortcut! prefix (with a bang) to describe existing shortcuts.

  • Use the Shortcut prefix (without a bang) to define brand new shortcuts.

  • Use the :Shortcuts command to display a searchable menu of shortcuts.

  • Use the g:shortcuts variable to access shortcuts keys and descriptions.

  • Use the g:shortcuts_overwrite_warning variable to detect any conflicts.

Discovery & fallback shortcuts

I recommend that you define these two shortcuts for discovery and fallback (feel free to change the <Leader> key to your own commonly used prefix):

Shortcut show shortcut menu and run chosen shortcut
      \ noremap <silent> <Leader><Leader> :Shortcuts<Return>

Shortcut fallback to shortcut menu on partial entry
      \ noremap <silent> <Leader> :Shortcuts<Return>

The fallback shortcut's keys should represent the common prefix used by most of your shortcuts so that it can automatically launch the shortcut menu for you when you pause partway while typing a shortcut, say, because you forgot the rest of it or because you just want to see the shortcut menu again to discover what else is available. However, this is not a strict requirement because you might find it useful to map shortcuts with uncommon prefixes when you know them by heart and you thereby feel that a fallback is unnecessary. As a result, you can map any keys to any shortcut, regardless of the prefix! Furthermore, you can set up multiple fallback shortcuts too, one per prefix.

Describing existing shortcuts

Use Shortcut! with a bang to describe shortcuts that are already defined:

Shortcut! keys description

For more examples, see my vimrc:

Shortcut! [f       go to previous file in current file's directory
Shortcut! ]f       go to next     file in current file's directory

Any extra whitespace is ignored.

Defining new shortcuts

Simply prefix any existing map command with Shortcut and a description.

For example, take this mapping:

map definition

Add Shortcut and description:

Shortcut description map definition

You can use multiple lines too:

Shortcut description
      \ map definition

For more examples, see my vimrc:

Shortcut duplicate before cursor and then comment-out
      \ map <Space>cP  <Plug>NERDCommenterYank`[P
Shortcut fzf files in directory and go to chosen file
      \ nnoremap <silent> <Space>ef :Files<Return>
Shortcut save file as...
      \ nnoremap <silent> <Space>yf :call feedkeys(":saveas %\t", "t")<Return>
for i in range(1,9)
  execute 'Shortcut go to tab number '. i .' '
        \ 'nnoremap <silent> <Space>'. i .'t :tabfirst<Bar>'. i .'tabnext<Return>'
endfor
Shortcut comment-out using FIGlet ASCII art decoration
      \ nnoremap <silent> <Space>c@ V:call CommentUsingFIGlet()<Return>
      \|vnoremap <silent> <Space>c@ :<C-U>call CommentUsingFIGlet()<Return>

function! CommentUsingFIGlet()
  " ...
endfunction

Any extra whitespace is ignored.

Documentation

Run :help shortcut or see the doc/shortcut.txt file.

Testing

Developers can run the vim-vspec tests:

gem install bundler         # first time
bundle install              # first time
bundle exec vim-flavor test # every time

License

Like my work? 👍 Please spare a life today as thanks! 🐄🐖🐑🐔🐣🐟✨🙊✌
Why? For 💕 ethics, the 🌎 environment, and 💪 health; see link above. 🙇

Copyright 2015 Suraj N. Kurapati https://github.com/sunaku

Distributed under the same terms as Vim itself.

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].