Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tags
5 changes: 4 additions & 1 deletion autoload/quickhl/cword.vim
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
let s:cword = {
\ "enable": g:quickhl_cword_enable_at_startup,
\ "override_search": g:quickhl_cword_override_search,
\ }

function! s:cword.init() "{{{
Expand All @@ -12,7 +13,9 @@ function! s:cword.init_highlight() "{{{
endfunction "}}}

function! s:cword.set() "{{{
let pattern = quickhl#escape(expand('<cword>'))
let cword = expand('<cword>')
if !s:cword.override_search && match(cword, @/) >= 0 | return | endif
let pattern = quickhl#escape(cword)
exe "2match QuickhlCword /\\\<". pattern . "\\\>/"
endfunction "}}}

Expand Down
4 changes: 4 additions & 0 deletions doc/quickhl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ VARIABLES *quickhl-variables*

Passed to |:highlight|. Set this if you want change default highlight.

*g:quickhl_cword_override_search*
Default: 1
Whether the cword highlighting should apply to the current search term.

==============================================================================
CONFIGURATION EXAMPLE *quickhl-examples*

Expand Down
1 change: 1 addition & 0 deletions plugin/quickhl.vim
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ let s:default_settings = {
\ "g:quickhl_tag_minimum_identifier": 4,
\ "g:quickhl_cword_enable_at_startup": 0,
\ "g:quickhl_cword_hl_command": 'link QuickhlCword Search',
\ "g:quickhl_cword_override_search": 1,
\ }

function! s:set_default(dict) "{{{
Expand Down