• Stars
    star
    525
  • Rank 84,404 (Top 2 %)
  • Language
    Vim Script
  • License
    MIT License
  • Created over 8 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A very simple plugin that makes hlsearch more useful.

vim-cool

Vim-cool disables search highlighting when you are done searching and re-enables it when you search again. That's it. No more :noh<CR>, no more /sytdstdrsid<CR>, and no more dodgy <C-l> mappings.

Vim-cool is cool.

Vim-cool is experimental.

cool

Requirements

Vim-cool is intended to be used with Vim, and only Vim, 7.4.2008 or later. It may or may not work in other editors but they are not and will not be officially supported.

Installation

Follow your favorite plugin/runtimepath manager's instructions.

If you choose manual installation, just put plugin/cool.vim where it belongs:

$HOME/.vim/plugin/cool.vim        on Unix-like systems
$HOME\vimfiles\plugin\cool.vim    on Windows

In Vim 8.0 and above, see :help package.

Setup

The whole assumption behind Vim-cool is that the user enabled search highlighting but they don't want the highlighting to linger on when they are done searching. This implies that the user has the following line in their vimrc:

set hlsearch

That's it. Nothing else to do.

Experimental features

  • Show number of matches in the command-line:

    let g:cool_total_matches = 1
    

    demo

  • Do something when we are doing nnnNNnn, do something else or do nothing when we are not:

    set statusline+=%{get(g:,'cool_is_searching',0)?'Yep':''}
    

Background

I wrote the first iteration of vim-cool in about twenty minutes, mostly to test a few ideas I had after a short discussion about 'hlsearch' and :nohlsearch on #vim.

Because it relied almost exclusively on mappings, that first iteration was way too brittle to be of any use and actually messed with a bunch of my own mappings.

Then came @purpleP and the game-changing approach he put together with the help of @chrisbra, @justinmk, @jamessan, and @ZyX-I.

The current version, essentially a weaponized version of @purpleP's code, doesn't rely on mappings anymore and thus should be devoid of nasty side-effects.

Many thanks to @bounceme for his help.

What they say about vim-cool

  • puremourning, in #vim:

    vim-cool is by far my favourite plugin

    it's just so... cool.

More Repositories

1

idiomatic-vimrc

Guidelines for sculpting your very own ~/.vimrc.
1,067
star
2

Apprentice

A dark, low-contrast, Vim colorscheme.
Vim Script
854
star
3

vim-qf

Tame the quickfix window.
Vim Script
594
star
4

ctags-patterns-for-javascript

Exuberant Ctags Patterns for JavaScript
JavaScript
409
star
5

flattened

Solarized, without the bullshit.
Vim Script
396
star
6

vim-rnb

RNB, a Vim colorscheme template
HTML
138
star
7

the-patient-vimmer

A guide for patient Vimmers.
112
star
8

vim-dichromatic

A dark Vim colorscheme for color blind vimmers. But not only.
HTML
82
star
9

vim-qlist

Persist the results of :ilist and related commands via the quickfix list.
Vim Script
66
star
10

vim-devdocs

Look up keyword on https://devdocs.io from Vim
Vim Script
55
star
11

minivimrc

Vim Script
41
star
12

iterm2-colorschemes

A collection of iTerm2 colorschemes.
23
star
13

apprentice-colorschemes

Terminal emulator themes based on the Apprentice Vim colorscheme
Shell
17
star
14

vim-tinyMRU

Vim Script
15
star
15

Disciple

A light low-contrast Vim colorscheme.
Vim Script
12
star
16

nanovimrc

Smaller than mini, smaller than micro: nano.
Vim Script
10
star
17

vim-colors

Modern rewrite of Vim's default colorschemes.
HTML
7
star
18

microvimrc

Smaller than mini, bigger than nano: micro.
Vim Script
6
star
19

quickstart

Makefile
5
star
20

vim-quicklist

Persist the result of list-like Ex commands to the quickfix list.
Vim Script
3
star
21

vim-malotru

A relatively comfortable Vim colorscheme primarily designed for 16color terminal emulators
Vim Script
2
star
22

ctagsd

Run ctags upon file change/addition/deletion in a Git repository
Shell
2
star
23

vim-sweet16

A 'light' colorscheme using exclusively the lower 16 colors of the xterm palette.
HTML
1
star
24

lspc

A Language Server Protocol Client for Vim. Maybe.
1
star
25

acp-forked

A personal fork of an old version of AutoComplPop.
Vim Script
1
star