28,268 questions
-3
votes
0
answers
37
views
Vim in Far Manager editor INTERNALLY [closed]
How can I configure internal Far Manager's text editor to be vim-like? I have seen such configs in use watching top competitive programmers, such as tourist and radewoosh. But i couldn't find guide or ...
2
votes
1
answer
49
views
Escaping a backslash in a parser definition returns two backslashes / Ctrl-] over a keyword inserts backslashes where there shouldn't be
*Write setlocal iskeyword+=[,],^ in your markdown ftplugin file to reproduce this problem
I'm trying to create tags for my markdown endnotes in vim, so that jumping to them from the text is easier. An ...
Best practices
1
vote
4
replies
124
views
Open Vim with text in it, without saving the file
I want to write a script which ends by calling my text editor (vim) on a specific file path. The file doesn't yet exist, and I want the editor window to already have some contents in it. In particular,...
5
votes
1
answer
70
views
How to ignore keywords when rewrapping text in Vim?
Is there an option I can set in Vim and Neovim to force the gq motion to wrap text strictly at 80 characters, without addings hanging indents after lines that begin with common programming keywords ...
Advice
1
vote
1
replies
65
views
In vim how can I redo the last command, including those done by key-map
What do I want:
I set "<leader>gd" as the key to "go to definition"
vim.keymap.set("n", "<leader>gd", ":Lspsaga goto_definition<Enter>&...
Advice
0
votes
2
replies
67
views
Vim 9.1 & Python Virtual Env
I'm writing vim-script(s) that utilizes vim's embedded Python environment. One of these requires the Python Environment to utilize a virtual environment. Ideally for this application, vim would ...
2
votes
2
answers
127
views
Non-repeating patterns
I am trying to find lines where pattern does not repeat its value.
I have a CSV file like this:
2025-10-20;71149;WZ/OPM/04757/12/2023;-220.83;7622100598299;-1;1027144
2025-10-20;81142;WZ/OPM/04993/08/...
0
votes
0
answers
100
views
RecursionError in YouCompleteMe for Python Docs in VIm
I am trying to use YouCompleteMe in Vim for getting python documentation (using YcmCompleter GetDoc and the vim pop up menu). This works well for normal python commands, but there seems to be various ...
0
votes
1
answer
78
views
jj + vim: make syntax coloring for describe messages work like commit messages
I have vim configured as my editor when using jj.
When using git commit I have some vim extensions to provide colored output and some sane max-length defaults.
Here is my .vimrc
filetype plugin on
...
2
votes
2
answers
78
views
How can I figure out why vim is suddenly running an external binary when I press `gq` to reflow a comment?
I'm used to being able to do the following in vim to reflow a comment:
Use V to enter visual line selection mode.
Select the lines containing the comment.
Press gq to reflow the comment.
This has ...
1
vote
1
answer
77
views
In vim, how to search the contents of :highlight (*NOT* hlsearch) [duplicate]
When I type :highlight, I get a buffer like:
:highlight
SpecialKey xxx term=bold ctermfg=188 guifg=#dcdfe4
EndOfBuffer xxx links to NonText
NonText xxx term=bold ctermfg=239 guifg=#...
-1
votes
1
answer
62
views
Suppress latex warnings in vim-latex for package robust-externalize [closed]
I use vim-latex to edit LaTeX files. When compiling, usual warnings are suppressed.
If I use the package robust-externalize, they are not: I get a couple of (useless) windows, one of which says
/usr/...
-3
votes
1
answer
147
views
Can `jq` be forced` to take slightly malformed JSON body? [closed]
I like using :!pbpaste | jq to see my JSON objects when reading logs in vim.
But it often throws the following error with the slightest inconvenience in the JSON body.
jq: parse error: Invalid numeric ...
0
votes
0
answers
69
views
Odd indentation with vim, cindent, and nested parentheses
I want to indent some code with cindent and cino=(0,m1. When I have parentheses inside the argument list of a function call I get some extra indentation:
foo();
bar( // <--- normal ...
1
vote
0
answers
44
views
How to highlight Python class names in Vim (custom colorscheme)?
I’m working on a custom Vim colorscheme (Monokai-inspired with a Gruvbox background, 256-color accurate) and I’d like to highlight Python class names in a different color. I'm using Vim macOS version -...
6
votes
2
answers
172
views
Increment numbers in a space-delimited column by a constant value in Vim/Neovim
I am trying to increment the numbers in a column of a file by a constant value using:
:s/\d\+/\=submatch(0)+8192
where 8192 is the constant I want to add.
My file has the below structure:
ATOM 32760 ...
2
votes
0
answers
65
views
Vim syntax highlighting region is not correctly highlighted
I want to highlight special regions in a special extension .html.specialext, the regions are Lua code in some delimiter, here it's {{ and }}.
Detecting custom filetypes is trivial but here is my code ...
0
votes
0
answers
45
views
Open file with Vim, but limit the number of read lines / chars [duplicate]
Vim often hangs or is slow when opening a really large file (many lines, or many chars in a line)
I found a workaround (but for viewing only):
head -n 1000 mylargefile.txt | vim -
head -c 1000 ...
-1
votes
2
answers
101
views
An issue on output generation by vim
I want to display an output by vim, and I simulated it by a c source file (src/main.c). For this I wrote a vimscript as follow (vim/core.vim) :
" vim/core.vim
function! F1()
for line in ...
3
votes
7
answers
333
views
Remove only odd lines' line breaks, with Vim, sed or awk
I have the following file:
line 1
abc
line 2
def
line 3
ghi
.....
.....
I need it to become:
line 1 abc
line 2 def
line 3 ghi
......
......
I know how to remove newlines, but not odd or even line ...
1
vote
0
answers
46
views
syntax match with priority
I have some XML data
<layer>
<path data="S 35.33333,70.61539 L 34.46154,23.28205/>
<path data="S 30.66667,12.5641 D 33.64103,12.5641 37.58974/>
</layer>
I want ...
0
votes
0
answers
87
views
VIM keywords in syntax regex
I am currently writing a c3 syntax file for vim and I have some issues with a highlight.
I have this line:
syntax match ModuleName "\<module\>\s*\zs[a-z][a-zA-Z0-9_]*\ze;" display
and ...
-1
votes
1
answer
57
views
Conditional key mapping in .vimrc involving unix commands
I would like to be able to define a key mapping in my .vimrc file that does different things based on a condition involving a unix command. For example, something like
map xyz [[ $(egrep -c -e '^From: ...
2
votes
1
answer
86
views
How to disable fillers in COC
I am using Clangd as LSP server.
"inlayHint.display": false and "clangd.arguments": ["--function-arg-placeholders=0"]" work to disable the placeholders in functions ...
2
votes
1
answer
64
views
Interpreting VIM key sequence from xterm
Some of the key inputs on my nvim running in xterm are a bit odd. For example, to get the '^' key, I have to press shift-6, and instead of it just generating a '^' character, it actually generates '&...
-1
votes
2
answers
70
views
Can I configure vim to automatically do a hanging indent following a 5 character timecode?
As I am working on a project I like to keep a plain text log file of my progress using MacVim. I use Typinator to produce a timecode (but how the timecode is generated is irrelevant to the problem).
...
-1
votes
1
answer
44
views
Can't locate the .vimrc file in order to inspect contents [closed]
I'm working through a vim tutorial. The author suggested running the following command so that vim always launches in enhanced mode:
echo "set nocp" >> ~/.vimrc
I did this, and it ...
3
votes
1
answer
49
views
echom not displaying after changing colorscheme in Vim
This function assigns a random colorscheme in Vim. I also want it to display a message telling what the new colorscheme is but that part isn't working.
If I call this function and then type :messages, ...
-1
votes
1
answer
70
views
How to set Vim command without executing
I want to create a function such that when I execute it (:'<,'>call Foo()) with some text selected, it will set my command-line as ':%s/selected_text/selected_text/gc' so that I can edit the ...
0
votes
2
answers
89
views
How to autocomplete brackets in Vim only in some cases
For auto-expanding function body I have in my .vimrc file
:inoremap { {<CR>}<Esc>ko
(which produces)
fn main {
....
}
This works fine most of the time, but problem arises when curly ...
0
votes
2
answers
52
views
How to stop vim changiing indenting when I type "or" or "and"?
When I am entering perl code, vim enforces the indenting of the line when I type "or" or "and" on lines with only whitespace. If the cursor is inside the same (), [], or {} as the ...
-3
votes
1
answer
82
views
Autocomplete inserts wrong opening brace when working with Rust files
My .vimrc configuration is as below
set runtimepath^=~/.config/vim
" Visual mode select and move laterally using < and > sign
vnoremap < <gv
vnoremap > >gv
" Centre align ...
2
votes
1
answer
98
views
Get full mode in Vim/Neovim
When looking at :help mode(), it says:
mode([{expr}]) *mode()*
Return a string that indicates the current mode.
If {expr} is ...
3
votes
1
answer
69
views
vim regex search for a char Not Keyword and Not Space followed by a Keyword
I need to match couples of chars as
Char 1: not keyword and not space (so any other symbol)
Char 2: keyword or space
e.g. "!b", "$a", "$ ", ...
It would be trivial......
0
votes
1
answer
56
views
vim/gvim multi/consecutive line value/pattern highlighter
Log:
smac integral 48 'hab12
dmac integral 48 'hcd34
len integral 32 32
...1000 lines...
smac integral 48 'hblah
dmac integral 48 'hblah
len integral ...
2
votes
1
answer
59
views
Vim Regex for multiple-line quotes followed by punctuation
In my text file, I want Vim to search for a quote that is immediately followed by a period or a comma.
blah blah blah "Don't want
this" blah blah blah blah
blah blah blah blah "But
...
1
vote
1
answer
62
views
Vim regexp search and replace at a specific column number in a line
Within a given line, I would like to search for a text and replace it with a different text at a specific column number within the same line. for example, I would like to replace,
port_a,
port_xyz,
...
1
vote
1
answer
105
views
How to define syntax highlighting for both multi-line and single line strings inside of vim syntax file
I have a programming language that supports multi-line strings, the syntax is as follows (EBNF):
longstring ::= '"""' {'"'} newline chars newline '"""' {'"'}
...
0
votes
1
answer
74
views
Find and Replace using wildcard in VIM or VI [closed]
I have a file with numbered host names. I want to change the name while preserving the numbers.
CHANGE THIS:
server1.domain.com
server2.domain.com
server3.domain.com
server4.domain.com
server1....
4
votes
1
answer
95
views
Yanking until (t) doesn't move cursor while (T) does
Given this text: (^ is supposed to be the cursor)
the quick brown fox
^
ytx yanks the text from r up until (excluding) x and doesn't move the cursor.
yTq yanks the text from r up until (...
0
votes
1
answer
57
views
Shortcut to go to the start of the previous line? (opposite of enter / return) [closed]
I certainly am not searching for this answer properly. It should be obvious.
Basically, enter goes to the start of the next line.
I want the opposite of enter. I want to go to the start of the ...
-1
votes
4
answers
422
views
How do I find TODO comments in Neo/vim?
In my codebase I often leave comments in the form of // TODO: thing to get done. I need a way to find them across all my files and view them in one place. I am open to plugins but would equally want ...
1
vote
1
answer
480
views
Neovim - see unsaved changes to buffer compared to saved file
The goal
When I open a file in Neovim and make changes to it, I'd like to be able to view the difference between the buffer contents and the original file on disk.
Similar to what Sublime Text has:
...
1
vote
2
answers
149
views
How to go to the previous line in insert mode without loosing leading whitespaces (nvim)
Let's say we have the following code:
function test() {
const a = {<HERE>}; // `<HERE>` is the caret position
}
When enter is pressed, the leading whitespaces are added as expected:
...
0
votes
0
answers
54
views
Is there a way to re-use syntax match patterns for syn-match?
I have a vim syntax file like the following:
syntax match langString
\ /\v[^"' ][^;]+|"[^"]*"|'[^']*'/
\ contained
syntax keyword langName
\ ...
4
votes
2
answers
517
views
How to copy on mouse selection in Neovim?
I use Neovim under WSL, and I set copy on selection in WindowsTerminal.
However, with :set mouse=a in Neovim, copy on selection by mouse doesn't work in nvim.
How can I make this work in Neovim?
-1
votes
1
answer
92
views
Why does a regex that ends with `[^.]` match unexpectedly? [duplicate]
Consider following line (like in a table of contents):
6.1.34.2 Some text
(there is a tab after the "2").
When searching for ^\d\+[.]\d\+[.]\d\+[^.] the line is selected (and colored ...
0
votes
1
answer
44
views
How do you do multiple regex replacments in an UltiSnips snippet in vim?
I am trying to create a snippet for a LaTeX section that automatically fills in the label. I'd like the label to replace special characters and convert uppercase characters to lowercase characters. I ...
1
vote
3
answers
276
views
How to get path of filename relative to another directory in vim/neovim
Suppose I have a filename f that may or may not be absolute. And I have a directory d that f is in, that isn't (or at least might not be) the current working directory, or the home directory.
What is ...
1
vote
1
answer
106
views
How to set the Git Bash Vim's color file outside of "Program Files"
I'm using Windows, in Git Bash, if I use vimdiff as the compare tool, Git will trigger the vimdiff in its package.
However, it's hard to add a new color scheme, e.g. gruvbox.
Git's vim is in C:\...