Giter VIP home page Giter VIP logo

vim-quickhl's Introduction

help

Highlight on the fly.

quickhl.vim support highlight for

  • manual keywords
  • tag in ctags generated file
  • automatically highlight word under cursor(<cword>).

Config

Minimum

nmap <Space>m <Plug>(quickhl-manual-this)
xmap <Space>m <Plug>(quickhl-manual-this)
nmap <Space>M <Plug>(quickhl-manual-reset)
xmap <Space>M <Plug>(quickhl-manual-reset)

Full

nmap <Space>m <Plug>(quickhl-manual-this)
xmap <Space>m <Plug>(quickhl-manual-this)

nmap <Space>w <Plug>(quickhl-manual-this-whole-word)
xmap <Space>w <Plug>(quickhl-manual-this-whole-word)

nmap <Space>c <Plug>(quickhl-manual-clear)
vmap <Space>c <Plug>(quickhl-manual-clear)

nmap <Space>M <Plug>(quickhl-manual-reset)
xmap <Space>M <Plug>(quickhl-manual-reset)

nmap <Space>j <Plug>(quickhl-cword-toggle)
nmap <Space>] <Plug>(quickhl-tag-toggle)
map H <Plug>(operator-quickhl-manual-this-motion)

vim-quickhl's People

Contributors

adonis0147 avatar blueyed avatar micchy326 avatar msfm avatar rbtnn avatar t9md avatar thinca avatar xc1427 avatar xuyangy 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-quickhl's Issues

Incompatibility with fugitive's Gedit/diff functionality

I have reported an issue with fugitive over at: tpope/vim-fugitive#257 and it turns out that quickhl is triggering this behavior.

From the other report:

Using dd (for example) in the "Gstatus" COMMIT_EDITMSG window will open the file for diffing, but then appears to setup the buffers incorrectly: apparently "diffthis" (or something similar) gets called on the commit message window, but not one of the views of the file itself.

For example, also "o" and "O" get mapped in the COMMIT_EDITMSG window.

set completeopt+=popup and complete work,Error happen.

setting

vim work with asyncomplete
set set completeopt+=popup

start edit and completion happen.

complete item select

message

 Error detected while processing function quickhl#manual#refresh[1]..quickhl#windo:
line    6:
E994: Not allowed in a popup window

function! quickhl#windo(func, obj) "{{{
let winnum = winnr()
let pwinnum = winnr('#')
" echo [pwinnum, winnum]
" echo PP(a:func)
" echo PP(a:obj)
noautocmd windo call call(a:func, [], a:obj)
if pwinnum !=# 0
execute pwinnum . "wincmd w"
endif
execute winnum . "wincmd w"
endfunction "}}}

No license

This repository doesn't seem to have a license.
Shouldn't we specify a license?

"E15: Invalid expression" happens at quickhl-manual-this and quickhl-manual-this-whole-word

The following error happens when executing quickhl-manual-this on Vim 7.4.160 which is default package provided by RHEL 7:

Error detected while processing function quickhl#manual#this..quickhl#manual#add_or_del:
line    3:
E109: Missing ':' after '?'
E116: Invalid arguments for function 26
E15: Invalid expression: s:manual.index_of(a:escaped?a:pattern:quickhl#escape(a:pattern)) == -1

Also, the following error happens when executing quickhl-manual-this-whole-word:

Error detected while processing function quickhl#manual#this_whole_word..quickhl#manual#add_or_del:
line    3:
E117: Unknown function: a:pattern:quickhl#escape
E116: Invalid arguments for function 26
E15: Invalid expression: s:manual.index_of(a:escaped?a:pattern:quickhl#escape(a:pattern)) == -1

It looks the commit 3ca1252 added the following ternary operator (?:) in the quickhl#manual#add_or_del function and this causes this issue:

if s:manual.index_of(a:escaped?a:pattern:quickhl#escape(a:pattern)) == -1

Actually this should be:

if s:manual.index_of(a:escaped ? a:pattern : quickhl#escape(a:pattern)) == -1

Note: this error does not happen when I try it on Vim 8.0.1171 provided by Fedora 26, so I guess the newer version of Vim has some improvement for parsing the ternary operator. However, a plugin would be better to use a compatible notation to the previous versions.

<C-w>p の動作が壊れる

WinEnter の refresh で windo を使っているのが原因で、<C-w>p(直前のウィンドウに戻る) の動作がおかしくなってしまうようです。
ただ、以前はこのようなことはなかった気がするので Vim 側に何か変更があったのかもしれません。

Vim 7.4.565+ throws E16 for `0wincmd w`

Recent version of vim throws E16: Invalid range for 0wincmd w. quickhl is affected when winnr('#') is 0, with quickhl#windo having execute pwinnum . "wincmd w" in its body.

I believe this change was introduced in patch 7.4.565. At least vim 7.4.560 is not affected, and I confirmed this error in vim 7.4.567.

Jumping at different strings which is being highlighted.

Hi All,
First of all, Thanks a lot for this script. I am able to highlight multiple words using this script, but I want to jump at different colored strings just like 'n' followed by 'gd'.
is it already in this script if no then I would request all to please add this feature into this script?

Thanks a Lot.

Add an option to set the match style of :QuickhlMatchAuto

Is it possible to add a

g:quickhl_match_style =  "gui=undercurl guisp=cyan"

So you can chose the style of the matched word under the cursor ?
I have forked your repo and tried to do it but vimscript is just horrid and i can't get my head around it

Cheers.

Keymap screenshot is incorrect

I had trouble configuring, then I realized I had based my keybinds off what I saw in the screenshot on the main repo page. I assume these are out of date, as the # characters are now - characters. The change was so subtle I didn't see it for a while reading docs. The screenshot should be updated.

quickhl_cword_enable_at_startup only work with the first buffer

I have this let g:quickhl_cword_enable_at_startup = 1 in my vimrc, and I can see the highlight follows my cursor in test.txt if I launch vim using vim test.txt.

However, after opening another file in vim, like :e test1.txt, quickhl_cword seems only enable for the first buffer.

IMO, non-initial buffers should have auto-following highlight as well, if enable_at_startup is set.

cword highlight using CursorHold instead of CursorMoved

I changed the autocmd used for cword highlighting to CursorHold, which replicates behavior I've seen in several IDEs, and is less distracting than CursorMoved. Would you be willing to add an option to choose between the two autocmds. Or accept a pull request to that effect?

Suggest adding "cterm=bold" in g:quickhl_manual_colors

I spot that the current color scheme is not obvious in terminal, so I suggest adding cterm=bold in g:quickhl_manual_colors as default options like the options in gui.

current appearance in terminal:
wx20171014-131144 2x
It is hard to recognize the words in QuickhlManual3, QuickhlManual9 and QuickhlManual11.

"E117: Unknown function: bufwinid" happens at quickhl-manual-this and quickhl-manual-this-whole-word

The following error happens when executing quickhl-manual-this on Vim 7.4.629 which is included as an rpm package in RHEL/CentOS 7. It appears the function bufwinid() does not exist in the version.

Error detected while processing function quickhl#manual#this..quickhl#manual#enable..quickhl#manual#refresh..quickhl#windo:
line    4:
E117: Unknown function: bufwinid
E15: Invalid expression: bufwinid('') ==# -1
Error detected while processing function quickhl#manual#this..quickhl#manual#add_or_del..quickhl#manual#refresh..quickhl#windo:
line    4:
E117: Unknown function: bufwinid
E15: Invalid expression: bufwinid('') ==# -1

According to comments from rbtnn on twitter[1][2], the function bufwinid() was introduced since Vim 7.4.1893. So, ad-hoc but a feasible fix could be to check the existence of the fuction:

diff --git a/autoload/quickhl.vim b/autoload/quickhl.vim
index f9f83cb..0a7437f 100644
--- a/autoload/quickhl.vim
+++ b/autoload/quickhl.vim
@@ -29,8 +29,10 @@ function! quickhl#windo(func, obj) abort "{{{
   " [BUG] This function is invoked from WinEnter event.
   " Unexpectedly, this event is happen before buffer is not shown on window when invoke `pedit file`.
   " So here I will skip unxexisting buffer(which return `-1`) to avoid E994 error.
-  if bufwinid('') ==# -1
-    return
+  if exists('*bufwinid')
+    if bufwinid('') ==# -1
+      return
+    endif
   endif
   let winnum = winnr()
   let pwinnum = winnr('#')

[1] https://twitter.com/rbtnn/status/1202598640134447104
[2] https://twitter.com/rbtnn/status/1202600711961202688

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.