I was playing around with Vim 8.2's popups recently (I have a small plugin that
allows navigation of sections in a markup document and I was looking at showing section hierarchies in popups). I figured the info I collected could make a decent introduction...
Vim 8.2's popup windows allow Vimscript authors and plugin developers to create one or ...
That's very ambitious and impactful! 👍
My recommendation, though, is that you should look into whether you can implement this outside of Vim. More specifically, if you can use the Language Server Protocol to implement this style of AI-powered code completion enhancements. (See also the Wikipedia page on LSP and also langserver.org
If you do implement this ...
Yes, you've got it. It's an optional argument.
func(foo [, bar])
Can be called as
In the latter case the function will usually have some predetermined value assigned to bar. (What that is is usually noted in the function's documentation.) Or it might ignore it altogether.
Nested square brackets indicate that an optional ...
You are making use of vim-plug here to get solarized run PlugInstall inside vim to install it or just copy solarized.vim file manually present here to you ~/.vim/colors/ directory.
Then call the colorscheme by adding the line colorscheme solarized to your .vimrc
With the help of @ChristianBrabandt, I finished this function:
function! CustomReplace(target, newWord)
let x = 0
let cnt = len(getqflist())
while x < cnt
if x != cnt - 1
let x = x + 1
You can just use <cword> directly here:
vimgrep <cword> **/*.h **/*.hpp **/*.c **/*.cpp
If you look up :help <cword> you'll see it's on a section about "Ex special characters", which also cover special characters you might be familiar with, such as % and # (as in, :e #, to edit the alternate buffer.)
It resets 'cpo'
value to its default value.
Some people may be running vim in compatible mode, by choice or not. In those cases, various things would be inhibited, things we usually rely upon when writing plugins -- in particular :h line-continuation. As a consequence, the plugins would emit many error messages.
Resetting 'cpo' to its factory setting, ...
In my plugin library, I define the following to help running a function n times in order to have an estimation of the time it takes to execute
It's meant to be used this way
echo lh#time#bench_n(10000, function('Function1'), the, list, of, parameters) / 10000
lh#time#bench_n() returns a list of two elements: the 10000 results of the 10000 function ...
There is the reltime() function to get relative times, and reltimestr() to display that as the number of seconds:
:let start = reltime()
So in your case, you would do something like:
let start = reltime()
echom printf('Duration = ...
You can try using strptime function, if available, to convert both dates to unix time, substract and get number of seconds. Unfortunately on my win box this func is not available.
Something like this, NOT TESTED:
let u_time1 = strptime("%c", "24/03/2020 07:31:22")
let u_time2 = strptime("%c", "24/03/2020 07:31:28")
echo "Duration = " . (u_time2 - u_time1)...
The function setwinvar can change options using the & syntax:
call setwinvar(1, "&list", 0)
You can execute any code in the context of another window using win_execute (vim only):
call win_execute(winid, 'set syntax=python')
In neovim there is also nvim_win_set_option
call nvim_win_set_option(win, 'list', 0)
What about the new text-properties? They seem to have the property (sic) to follow.
Text properties can be attached to text in a buffer. They will move with the
text: If lines are deleted or inserted the properties move with the text they
are attached to. Also when inserting/deleting text in the line before the
I find a way myself -- a python module rpdb - remote debugger based on pdb.
It works for me.
Install using pip install rpdb
Set breakpoint with rpdb.set_trace() in plugin python script.
Try to active the plugin in vim. The vim will hang-up.
Use telnet to connect the vim process. telnet localhost 4444. It will be same as pdb to use.
I feel like this is all overly complicated, you can realize this with just a few lines of regex:
This expression will allow you to add a closing tag after the cursor:
- < matches the start of the opening tag
- \w\+ matches the tag content, we include it in braces so that we can use it in the replacement
- > ...
If you want to generate key sequences as strings, you need to use double-quoted strings and quote the < with a backslash. Such as "\<C-x>\<C-o>".
See :help expr-quote for more details (single quote strings are under :help literal-string).
Putting it all together:
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" :