Most Popular

1500 questions
7
votes
3 answers

How to get the highlight group of the word under the cursor in Neovim with Treesitter installed?

Ok folks, I've tried all these duplicates: How to know which highlighting group is used for the background of a word? How to identify the highlight groups in use on a particular character? How to check what of highlight is the word on…
artfulrobot
  • 601
  • 5
  • 13
7
votes
1 answer

Run bash command on writing a file with a particular extension?

I want to run a bash command on writing a .less file, saving it and generating the corresponding .css file with the same name and in the same directory. I do have the bash command which generates the .css file. I'm not used to vimscript except for…
oddRaven
  • 235
  • 2
  • 8
7
votes
5 answers

Why doesn't vimscript provide a random number generator?

EDIT Since 8.1.2342, Vim introduced a rand() function as described by @Maxim Kim's answer. I'll keep the question here for historical reference. I recently needed to generate a random number in vim and this question gave me all the solutions I…
statox
  • 49,782
  • 19
  • 148
  • 225
7
votes
1 answer

How to Interpret Syntax in VIM Help Pages

I have difficulty understanding syntax provided in man pages. I realize that the syntax is trying to tell me the range of things you can do, but I often can't distinguish between characters that are "needed while writing the command" and "characters…
Lonnie Best
  • 443
  • 4
  • 10
7
votes
1 answer

How to learn vimscript along with vim9script?

I've finally made the decision to learn vimscript. I don't hate reading manual and really like the built-in help files, so I am starting with usr_41.txt and plan to read eval.txt afterwards. Now as I run through the usr_41.txt, I notice it…
Masquue
  • 81
  • 4
7
votes
1 answer

Why does Vim highlight "in" in tex files and how can I stop it?

I write a lot of LaTeX. In plain text mode, sequences like 123 in are highlighted in red. That is a space, a digit string, a space, and then the specific word in. Such things as a1 in are not highlighted. Since in plain text this string has no…
Bruce
  • 205
  • 1
  • 6
7
votes
1 answer

Is it possible to break out of nested loops?

Say I have a nested loop, is there a way to break out of the outer loop from the inner one? For example this code: for i in range(3) for j in range(5) echo i j if i == 1 && j == 2 break endif …
Jake
  • 213
  • 1
  • 5
7
votes
3 answers

How do I close a hover'ed window with LSP information, Escape does not work?

Whenever I open a hover window with my LSP plugin, :lua vim.lsp.buf.hover() I get a floating window hovered over text, but then I can not close it? I've tried ESC and the like. How do you close these hovered windows?
Evan Carroll
  • 1,304
  • 14
  • 39
7
votes
1 answer

How can I prevent plugins from overwriting my key mappings?

In my vimrc I have: nnoremap :SyntasticToggleMode And this works. But I also have the unicode.vim plugin installed, which overrides this mapping: if !hasmapto('(MakeDigraph)', 'n') nmap (MakeDigraph) endif I "fixed"…
Martin Tournoij
  • 62,054
  • 25
  • 192
  • 271
7
votes
2 answers

Why is Vim9 mentioned at all in the doc of Vim 8?

Looking for lambda in the doc, I've found out (to my surprise) that they do exist in vimscript, and they use the syntax {args -> expr1}. But I've also discovered that there's Vim9, the doc of which is at :help Vim9, which offers a different syntax…
Enlico
  • 2,194
  • 15
  • 31
7
votes
1 answer

Vim normal mode: why is j/k jumping paragraphs instead of lines?

So i've copied and pasted text from my browser, and when i hit j/k, it does not bring the cursor up/down single lines like it's supposed to: COLLEYVILLE, Texas (AP) — The rabbi of a Texas synagogue where a gunman took hostages during livestreamed…
user8919
7
votes
3 answers

Make % jump between identical delimiters

I use Vim to edit LaTeX files frequently. I want to use % to jump between matching $ which can be used to delimit where mathematical expressions are written. I have tried using matchit and, separately, I have tried using a filetype.vim (tex.vim)…
fuzzybear3965
  • 618
  • 4
  • 13
7
votes
1 answer

Highlight double space in markdown

When writing markdown, a double space at the end of a line indicates a line break. Currently, neither single trailing whitespaces nor double-whitespaces are being highlighted. Is it possible to have vim highlight trailing whitespace in one colour…
alexytsu
  • 846
  • 1
  • 6
  • 11
7
votes
2 answers

Opening multiple files on specific line numbers in vim

I would find it useful to open several files at the same time on specific lines. I know I can open a single file on a specific line with: vi +123 ~/.zshrc And I can open multiple files with: vi ~/.zshrc ~/.profile But how can I open both files on…
Jim
  • 73
  • 2
7
votes
4 answers

Vim plugin where the first lines in the editor show the first line(s) with less indendation that are not visible

I would like to either find or write a plugin that does the following: Assume I have this python code: def foo(a,b,c): # comment [100 lines that do stuff] for i in range(N): [100 lines that do stuff] # another comment -->…
cmosig
  • 289
  • 2
  • 9
1 2 3
99
100