All Projects → gelguy → Cmd2.vim

gelguy / Cmd2.vim

Licence: mit
cmdline-mode enhancement for Vim

Labels

Projects that are alternatives of or similar to Cmd2.vim

Distraction Free Writing Vim
Collection of configurations I use to for my distraction free editing environment in Vim
Stars: ✭ 86 (-8.51%)
Mutual labels:  viml
Vim
我的VIM配置
Stars: ✭ 89 (-5.32%)
Mutual labels:  viml
Vim Json
Syntax highlighting for JSON in Vim
Stars: ✭ 91 (-3.19%)
Mutual labels:  viml
Bash Support.vim
BASH IDE -- Write and run BASH-scripts using menus and hotkeys.
Stars: ✭ 86 (-8.51%)
Mutual labels:  viml
Source Insight Vim
source-insight-like vim.
Stars: ✭ 88 (-6.38%)
Mutual labels:  viml
Mango.vim
A color scheme for vim
Stars: ✭ 90 (-4.26%)
Mutual labels:  viml
Nodejs Vagrant
Stars: ✭ 86 (-8.51%)
Mutual labels:  viml
Vim Jst
A vim plugin for highlighting and indenting JST/EJS syntax
Stars: ✭ 92 (-2.13%)
Mutual labels:  viml
Vim Etherpad
Plugin to enable collaborative edition on etherpad with the best editor
Stars: ✭ 89 (-5.32%)
Mutual labels:  viml
Dotfiles
My dotfiles
Stars: ✭ 91 (-3.19%)
Mutual labels:  viml
Twitvim
Twitter client for Vim
Stars: ✭ 86 (-8.51%)
Mutual labels:  viml
Vim Jinja
Repository for Jinja support in vim.
Stars: ✭ 87 (-7.45%)
Mutual labels:  viml
Vim Search Pulse
Easily locate the cursor after a search
Stars: ✭ 91 (-3.19%)
Mutual labels:  viml
Vimclojure Easy
Setting up VimClojure is easy!
Stars: ✭ 86 (-8.51%)
Mutual labels:  viml
Prolog.vim
Prolog Integration for Vim
Stars: ✭ 91 (-3.19%)
Mutual labels:  viml
Vim Oblique
DEPRECATED Improved /-search (experimental)
Stars: ✭ 86 (-8.51%)
Mutual labels:  viml
Vim Go Extra
Extra plugin for golang
Stars: ✭ 90 (-4.26%)
Mutual labels:  viml
Vim config
My vim configuration; packaged to be other-user-friendly
Stars: ✭ 92 (-2.13%)
Mutual labels:  viml
Yavide
Modern C/C++ integrated development environment
Stars: ✭ 1,306 (+1289.36%)
Mutual labels:  viml
Unite Tag
tags soruce for unite.vim
Stars: ✭ 91 (-3.19%)
Mutual labels:  viml

Cmd2.vim

Power up your Vim's cmdline mode

  • Autosuggest for search

    Cmd2Suggest

  • Fuzzy search

    Cmd2Suggest

  • Much more

Overview

Cmd2.vim is a Vim plugin which enhances Vim's cmdline mode. It provides a submode where mappings, shortcuts, custom functions and extensions can be defined. A good comparison is <C-R>, which prompts for a target register and inserts its contents. Triggering Cmd2 will result in a similar prompt, except you can use predefined or custom functions to handle the input.

Cmd2Complete and Cmd2Suggest provide fuzzy search completion, with Cmd2Suggest showing suggestions as you type.

Cmd2Suggest

For Cmd2Suggest, add these mappings. The <F12> map can be changed to something else that is not used.

  nmap : :<F12>     " for : mode (experimental)
  nmap / /<F12>

  cmap <F12> <Plug>(Cmd2Suggest)

A wildmenu-style menu will appear as you type your search. Press <Tab> and <S-Tab> to move through the menu and <CR> to accept the suggestion.

Cmd2Suggest uses Cmd2Complete for getting its completions. By default, fuzzy completion is not enabled. See Cmd2CustomisingSearch in the help docs to customise your search.

The default Cmd2Suggest will be slow in larger files. See Cmd2OptimisingSearch on how to optimise your search using Python, Ruby or other methods.

Cmd2Complete

Cmd2Complete does the same fuzzy search completion, but on manual activation.

If you only want manual activation, add this to your .vimrc.

    let g:Cmd2_options = {
          \ '_complete_ignorecase': 1,
          \ '_complete_uniq_ignorecase': 0,
          \ '_complete_fuzzy': 1,
          \ }

    cmap <expr> <Tab> Cmd2#ext#complete#InContext() ? "\<Plug>(Cmd2Complete)" : "\<Tab>"

    set wildcharm=<Tab>

Press <Tab> to trigger the fuzzy completion.

FAQ

Choosing a cmap key

Different terminals have different Control keys hence the \<Plug>Cmd2 mapping may not be available in all terminals. If all else fails, using one of the Vim's default cmdline mappings will help solve the issue. See :h c_CTRL-V and onwards.

Flickering

As Cmd2 renders the cmdline and menu using echo, there might be flickering. Changing the g:Cmd2_loop_sleep variable will have different effects depending on the terminal used. In general, a lower value should result in less flickering. Otherwise, setting g:Cmd2_cursor_blink to 0 will turn off the cursor blink, which will result in no re-rendering and hence no flickering.

Slow fuzzy matching

The default fuzzy matcher uses Vim's inbuilt search() and match() functions to generate the list of candidates. The candidates are then sorted and uniq-ed with an unoptimised algorithm. This might result in a noticeable delay when dealing with large files. A way to fix this is to use set g:Cmd2_complete_generate to a custom function which is faster. Some possible ways to do this is to use Python or Lua, or use existing sources such as from neocomplete.

Putty mouse flickering

In Putty, the cursor may flicker between insert text mode and pointer mode when Cmd2 is triggered. This is due to the cursor changing into pointer mode when a sleep command is given to Vim. To prevent this, change g:Cmd2_loop_sleep to 0. This will stop Cmd2 from sleeping in between loops but may affect the cmdline flickering.

Esc key has to be pressed twice

This is fixed by Vim patch 7.4.306. Please update Vim to the latest version. Alternatively, you can map another key to Esc using

cnoremap <key> <nop>

Similar plugins

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