Skip to main content

New answers tagged

0 votes

Recommended way of scripting: Ex commands or vimscript functions?

For what's given in the question, obviously the ex commands are the ones you should be using. setlocal nobuflisted is far more clear than setbufvar('', "&buflisted", 0); because it makes ...
cjs's user avatar
  • 367
0 votes

How to get the last non-blank line of a terminal buffer running a specific program?

To find the last non-blank line of a terminal buffer running a specific program, I come up with this function: vim9script def LastNonBlankLine(bufnrr: number): number var current_buf = bufnr() ...
Barzi2001's user avatar
  • 640
1 vote

How to get the last non-blank line of a terminal buffer running a specific program?

In addition to getting the right buffer, passing line('$') to a function for another buffer won’t work; line() translates lines for the current buffer: The result is a Number, which is the ...
D. Ben Knoble's user avatar
  • 26.6k
1 vote
Accepted

How to get the last non-blank line of a terminal buffer running a specific program?

The bufnr('IPYTHON') will not return the correct buffer number. If you have only one terminal you could do: var bufnr = term_list()[0] getbufline(bufnr, '$')[0] If you have more than one then you ...
Vivian De Smedt's user avatar
2 votes

Get return value of range function

I'm not sure this is possible. I only see a workaround for now where you could define 2 functions as 12,42let someresult = RangeFunction() is not supported. function! Function(firstline, lastline) ...
Luc Hermitte's user avatar
  • 17.5k
1 vote
Accepted

Recommended way of scripting: Ex commands or vimscript functions?

This is very much a matter of taste. Very often the command syntax is more compact which makes that I prefer to use it. The API is more rich and play well with variable which are good reasons to use ...
Vivian De Smedt's user avatar
1 vote

How to edit binary files with Vim?

excute :helpgrep USING XXD, then read. This will give you exactly the method suitable to your Vim version.
Lee Li's user avatar
  • 111
1 vote
Accepted

Provide bash vars or at least develop ~ through let variable

I would use the expand() function. It expands environment variables (expand('$HOME/.pyenv): let lspServers = [#{ name: 'pylsp', \ filetype: 'python', \ path: ...
Vivian De Smedt's user avatar

Top 50 recent answers are included