Code Monkey home page Code Monkey logo

vim-halo's Introduction

vim-halo

Highlight the cursor by putting blinking shapes around it.

By default, the shape is a halo and the cursor blinks three times. This can be used to quickly find the cursor after switching buffers etc. Moving the cursor will stop the blinking immediately.

vim-halo in action

Usage

There is only one function halo#run(), which takes one optional argument, a dictionary.

The dictionary takes up to 3 keys:

  • hlgroup: Highlight group as string. Default is Halo which links to IncSearch.
  • shape: Shape as a string. Can by any of halo1, halo2, cross1, cross2, cross2halo1, rectangle2, or line. Default is halo1.
  • intervals: A list of numbers. Calling halo#run() immediately shows a visual highlight. The numbers denote the alternating times visual highlights are shown and hidden. Thus an odd number of elements is sensible. Given an even number, the last element is ignored. Default is [100,100,100,100,100].
:call halo#run()
:call halo#run({'shape': 'cross2halo1'})
:call halo#run({'intervals': [100, 300, 600, 300, 100]})
:call halo#run({'intervals': [200,200,200], 'hlgroup': 'IncSearch'})

Examples

Every time you change buffers:

autocmd BufEnter * call halo#run()

When navigating the quickfix or location list:

nnoremap [q  :cprevious \| call halo#run()<cr>
nnoremap ]q  :cnext \| call halo#run()<cr>
nnoremap [Q  :cfirst \| call halo#run()<cr>
nnoremap ]Q  :clast \| call halo#run()<cr>

nnoremap [l  :lprevious \| call halo#run()<cr>
nnoremap ]l  :lnext \| call halo#run()<cr>
nnoremap [L  :lfirst \| call halo#run()<cr>
nnoremap ]L  :llast \| call halo#run()<cr>

Use colors from another highlight group:

highlight link Halo Search

Or define your own colors:

highlight Halo guifg=white guibg=#F92672 ctermfg=white ctermbg=197

Disclaimer

Only the line shape works works with wrapped lines!

vim-halo's People

Contributors

jlesquembre avatar junegunn avatar mhinz avatar tweekmonster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

tweekmonster

vim-halo's Issues

List index out of range error

I have this line on my vimrc config:

nnoremap <silent><expr> n 'Nn'[v:searchforward] . ':call halo#run()<cr>'

If I do a search, and I press n fast enough (when the line is still blinking), I get a 'list index out of range' error, and the last line highlighted is not cleared. I tested it on neovim 0.1.6.

I tried to fix it with this commit: link

Seems to work, but is not the best solution.

restoring a session triggers E803: ID not found

Hello,

I'm using this plugin along with obsession.vim and upon restoring a session, I get these errors:

Error detected while processing function <SNR>330_tick[3]..<SNR>330_clear:
line    2:
E803: ID not found: 47
Error detected while processing function halo#reset[2]..<SNR>330_reset[2]..<SNR>330_clear:
line    2:
E803: ID not found: 47

Thanks for your consideration.

fast window switching triggers E803: ID not found

Hello,

I have configured this plugin to activate after window switching, as follows:

autocmd WinEnter * call halo#run()

However, when I switch quickly between Vim split windows or enter/leave Vim to visit other tmux panes, I encounter errors like the following (only differing in the ID number reported in the error message):

line    2:
E803: ID not found: 286
Error detected while processing function <SNR>306_tick[3]..<SNR>306_clear:

I suppose that one way to work around this problem is to suppress the errors altogether with :silent!:

autocmd WinEnter * silent! call halo#run()

But I was wondering if you had a cleaner way to solve this problem than just sweeping it under the rug. ๐Ÿ˜‡

Thanks for your consideration.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.