You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Menu and Context menu are the two widgets i use most.
I usually can't remember how to use some infrequently used plug-ins, so as long as these plug-ins are allowed to be used by
functions or commands, I will put them in these two widgets.
The true trick i think is adding an item for some functions that needs selected text.
For example, if you have openbrowser installed, select a text, then press <leader>q, and execute the item, your browser will be opened and search the selected text automatically.
usage: put this in your vimrc
note: if your leader key has not been modified, it should be "\"
" from https://stackoverflow.com/questions/1533565/how-to-get-visually-selected-text-in-vimscript/6271254#6271254function!Get_visual_selection()
" Why is this not a built-in Vim script function?!let [line_start, column_start] =getpos("'<")[1:2]
let [line_end, column_end] =getpos("'>")[1:2]
letlines=getline(line_start, line_end)
iflen(lines) ==0return''endifletlines[-1] =lines[-1][: column_end - (&selection=='inclusive' ? 1 : 2)]
letlines[0] =lines[0][column_start -1:]
returnjoin(lines, "\n")
endfunctionfunction!Demo()
letl:content= [
\ ["search", "call openbrowser#search(Get_visual_selection(), \"baidu\")"],
\ ]
" set cursor to the last positionlet opts = {'index':g:quickui#context#cursor}
callquickui#context#open(content, opts)
endfunctionvnoremap<leader>q :<c-u>call Demo()<CR>
This page is used to collect tips and tricks that can inspire novice or advanced users.
If you think this plugin is useful or fun, just show us how you use it. The idea comes from
here.
note: The user manual is highly recommended to read.
Rules
The text was updated successfully, but these errors were encountered: