Hacker News new | past | comments | ask | show | jobs | submit login

I didn't find that feature to be that handy tbh. Mostly because it necessitates me to search for the pattern manually. What I usually want in my workflow is to highlight the word under the cursor automatically. This simplifies the code reading significantly for me and I am not aware of such Vim feature baked in?

Luckily it's very easy to add one, e.g.

  function! HighlightWordUnderCursor()
      if getline(".")[col(".")-1] !~# '[[:punct:][:blank:]]'
          exec 'match' 'Search' '/\V\<'.expand('<cword>').'\>/'
      else
          match none
      endif
  endfunction
  autocmd! CursorHold,CursorHoldI * call HighlightWordUnderCursor()



Or, a stupid way: “#*” Or, also stupid: “*``”




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: