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 = ...
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, ...
You can try this approach, using :h global command:
:g/startpattern/.;/endpattern/ call ProcessBlock
:g/startpattern/ search for startpattern
.;/endpattern/call ProcessBlock when found, use range from current line to endpattern and call your function. (it should be defined with range)
function! ProcessBlock() range
" get block number
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
- > ...
Uploaded my personal config tvp-repl
Copy from one pane with Ctrl+c and paste to another (requires xclip)
vim with +clipboard, .vimrc:
vnoremap <C-c> "+y
tmux bindings to dump the clipboard .tmux.conf:
bind-key Enter run "tmux send-keys -t 0 C-c" \;
run "tmux select-pane -t 1" \;
run "tmux set-buffer \"$(xclip -o -sel ...
You can use setline() to set the contents of a line in the current buffer.
Which, in your case, should be enough, since you're changing line contents in place and not inserting or deleting lines. (There's appendbufline() and deletebufline() which can help with that.)
Note that in your case you don't need to have your function be a range function, since 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.
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 ...
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>" :
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
It looks like there's an issue with how splits operate versus run of the mill pattern matching. I wasn't able to come up with a good explanation for why this problem exists, so I ended up taking a more iterative approach similar to @filbranden's suggestion:
const s:list_pattern =
You have a few problems with your regex that I can see:
the zero-width forward lookup with @= covers essentially all of the match, so highlighting your matches only gets the commas or beginning of lines.
your \| is splitting the two alternatives in a way that the first ([^''][^,]*) isn't really anchored to the end (\%(,\|$\)), so it doesn't match all the ...