All Projects β†’ dominikduda β†’ Vim_current_word

dominikduda / Vim_current_word

Licence: mit
Plugin highlighting word under cursor and all of its occurences

Projects that are alternatives of or similar to Vim current word

Crease.vim
Easy foldtext customization for [neo]vim.
Stars: ✭ 19 (-81%)
Mutual labels:  neovim, vim-plugin
Vimrc
πŸ“ Vim Configuration for nerds with vim-plug
Stars: ✭ 33 (-67%)
Mutual labels:  neovim, vim-plugin
Git Messenger.vim
Vim and Neovim plugin to reveal the commit messages under the cursor
Stars: ✭ 904 (+804%)
Mutual labels:  neovim, vim-plugin
Alchemist.vim
Elixir Integration Into Vim
Stars: ✭ 632 (+532%)
Mutual labels:  neovim, vim-plugin
Vim Lookup
Jump to the definition of variables or functions in VimL code.
Stars: ✭ 51 (-49%)
Mutual labels:  neovim, vim-plugin
Context.vim
Vim plugin that shows the context of the currently visible buffer contents
Stars: ✭ 688 (+588%)
Mutual labels:  neovim, vim-plugin
Asyncrun.vim
πŸš€ Run Async Shell Commands in Vim 8.0 / NeoVim and Output to the Quickfix Window !!
Stars: ✭ 1,332 (+1232%)
Mutual labels:  neovim, vim-plugin
Nnn.vim
File manager for vim/neovim powered by nΒ³
Stars: ✭ 414 (+314%)
Mutual labels:  neovim, vim-plugin
Vim Grepper
πŸ‘Ύ Helps you win at grep.
Stars: ✭ 1,030 (+930%)
Mutual labels:  neovim, vim-plugin
Vim Outdated Plugins
πŸ”„ Async Vim/Neovim plugin for showing the number of your outdated plugins
Stars: ✭ 44 (-56%)
Mutual labels:  neovim, vim-plugin
Vim Markdown Composer
An asynchronous markdown preview plugin for Vim and Neovim.
Stars: ✭ 501 (+401%)
Mutual labels:  neovim, vim-plugin
Todoist.nvim
A todoist extension for neovim
Stars: ✭ 84 (-16%)
Mutual labels:  neovim, vim-plugin
Tmux Complete.vim
Vim plugin for insert mode completion of words in adjacent tmux panes
Stars: ✭ 447 (+347%)
Mutual labels:  neovim, vim-plugin
Vim Which Key
🌷 Vim plugin that shows keybindings in popup
Stars: ✭ 1,310 (+1210%)
Mutual labels:  neovim, vim-plugin
Vim Startify
πŸ”— The fancy start screen for Vim.
Stars: ✭ 4,479 (+4379%)
Mutual labels:  neovim, vim-plugin
Hot Reload.vim
A (Neo)vim plugin for Flutter to automatically hot reload the project every time a file is saved
Stars: ✭ 33 (-67%)
Mutual labels:  neovim, vim-plugin
Barbar.nvim
A neovim tabline plugin.
Stars: ✭ 359 (+259%)
Mutual labels:  neovim, vim-plugin
Lens.vim
A Vim Automatic Window Resizing Plugin
Stars: ✭ 381 (+281%)
Mutual labels:  neovim, vim-plugin
Notational Fzf Vim
Notational velocity for vim.
Stars: ✭ 975 (+875%)
Mutual labels:  neovim, vim-plugin
Vista.vim
🌡 Viewer & Finder for LSP symbols and tags
Stars: ✭ 1,218 (+1118%)
Mutual labels:  neovim, vim-plugin

vim_current_word

Plugin highlighting word under cursor and all of its occurrences.

customized default

Why should you use it?
  • Helps predict how vim word movements (w, e, b) will behave
  • Plays well with * and #
  • Instant access to information where the variable under cursor is used
  • Works out of the box!
The most importantly it solves all the problems other similar plugins have with knowing what exactly is a word and when cursor is on the word.

Plugin determines what is a word based on what is a keyword in current file type. For example foo#bar in .vim file will be a single word (because vimscript allows to put # as part of variable name), but in .rb file foo#bar will be considered as two words (because # starts comment).

Installation

via Plug, Neobundle or Vundle:

Plug 'dominikduda/vim_current_word'
NeoBundle 'dominikduda/vim_current_word'
Plugin 'dominikduda/vim_current_word'

via Pathogen:

git clone https://github.com/dominikduda/vim_current_word.git ~/.vim/bundle/vim_current_word

via Vim 8 packages:

git clone https://github.com/dominikduda/vim_current_word.git ~/.vim/pack/plugins/start/vim_current_word

Quick start

By default vim_current_word will underline twins of word under cursor and use your Search highlight group to color word under cursor. If you want to change this behavior see the styling section.

Plugin defines :VimCurrentWordToggle command which enables/disables plugin on the fly.

Customization (values written here are defaults)

Enable/disable highlighting of:

" Twins of word under cursor:
let g:vim_current_word#highlight_twins = 1
" The word under cursor:
let g:vim_current_word#highlight_current_word = 1
Delay highlighting:

Setting this option to more than 0 will enable delayed highlighting. The value of this variable is a delay in milliseconds.

let g:vim_current_word#highlight_delay = 0
Enable/disable highlighting only in focused window:

Disabling this option will make the word highlight persist over window switches and even over focusing different application window.

let g:vim_current_word#highlight_only_in_focused_window = 1
Blacklist buffers:

To prevent the plugin from running in one or more buffers add following to your vimrc:

autocmd BufAdd NERD_tree_*,your_buffer_name.rb,*.js :let b:vim_current_word_disabled_in_this_buffer = 1

The example above disables the plugin in:

  • Every buffer which name start with NERD_tree_
  • Every buffer which name equals your_buffer_name.rb
  • Every buffer which name ends with .js
Enable/disable plugin:
let g:vim_current_word#enabled = 1

Styling

To change any style paste related code into your .vimrc

Change highlight style of twins of word under cursor:

hi CurrentWordTwins guifg=#XXXXXX guibg=#XXXXXX gui=underline,bold,italic ctermfg=XXX ctermbg=XXX cterm=underline,bold,italic
"                          └┴┴┴┴─        └┴┴┴┴─     └┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴─         └┴─         └┴─       └┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴─
"    gui-vim font color hex codeβ”‚             β”‚   gui-vim special stylesβ”‚           β”‚           β”‚ console-vim special stylesβ”‚
"    β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β”‚   β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β”‚           β”‚ β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
"            gui-vim background color hex codeβ”‚     console-vim font term color codeβ”‚           β”‚
"            β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β”‚
"                                                         console-vim background term color codeβ”‚
"                                                         β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Change highlight style of the word under cursor:

hi CurrentWord guifg=#XXXXXX guibg=#XXXXXX gui=underline,bold,italic ctermfg=XXX ctermbg=XXX cterm=underline,bold,italic
"                     └┴┴┴┴┴──┐     └┴┴┴┴─     └┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴─         └┴─         └┴─       └┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴─
"  gui-vim font color hex codeβ”‚          β”‚   gui-vim special stylesβ”‚           β”‚           β”‚ console-vim special stylesβ”‚
"  β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚   β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β”‚           β”‚ β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
"       gui-vim background color hex codeβ”‚     console-vim font term color codeβ”‚           β”‚
"       β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β”‚
"                                                    console-vim background term color codeβ”‚
"                                                    β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

To achieve the style from the first gif (in terminal vim):

hi CurrentWord ctermbg=53
hi CurrentWordTwins ctermbg=237

Rather important notes:

  • If you do not want any special styles just ommit them (or use gui=NONE cterm=NONE)
  • Here you can find color codes for console-vim

FAQ:

Why doesn't my customized highlight work?

You have to set custom higlights below colorscheme in your .vimrc.

Advanced:

Change word under cursor twins or word under cursor match id. You should touch this only if you encounter some match id already taken error - theoretically may occur when some other plugin will override required id.

let g:vim_current_word#twins_match_id = 502
let g:vim_current_word#current_word_match_id = 502

Credits

Thanks to Bartosz MΔ…ka for creating the gifs and testing.

Thanks to DΓ‘vid CsΓ‘kvΓ‘ri for information about a script which was the inspiration for this plugin.

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