28,268 questions
2
votes
1
answer
79
views
Vim is overriding the filetype I chose using .vimrc with another type
I am editing an OpenCL source file, foo.cl, in Vim 9.1 . My .vimrc has the line:
au BufRead,BufNewFile *.cl setfiletype opencl
for choosing an opencl file type for files with the .cl prefix. However, ...
3
votes
3
answers
67
views
map <Esc> to vim command in vimrc [closed]
This is my vimrc:
set hlsearch
nmap <silent> <Esc> :nohl<CR>
I am searching with / => matches highlighted
What I expect - pressing escape in normal mode will run :nohl, so ...
1
vote
2
answers
101
views
ALE does not line wrap linter messages
ALE does not wrap linting messages as you can see in the first image. I can see the complete line only when scaling as you can see in the second image.
What setting could I use to view the whole ...
2
votes
2
answers
67
views
How write a Vim search() function pattern to include ' and "?
How can I search a file for a regex pattern that includes both ' and ".
My actual search is:
:echo search('\l[,;"\'\-]* \u\l\+','ceW')
which gives me E116 Invalid arguments for function ...
Advice
0
votes
2
replies
69
views
Is there a faster way to do insert, backspace, escape in Vim?
Supposing you've got something like this, and you want to neaten the tags up so it's all on one line:
<p>The quick brown fox jumped over the lazy dog.
</p>
If your cursor is on the first ...
Advice
0
votes
4
replies
66
views
How to get config/utility files of vim in SUSE Linux
I had a hard time configurating Vim writing vimrc and other files, so I delete the directory indicated by $VIMRUNTIME, which in Suse was /usr/share/vim to start fresh. Then I reinstalled Vim, but now ...
-3
votes
1
answer
89
views
return value from a vimscript to a variable in calling bash script [closed]
First off, allow me to apologize for the confusion this question has created, and for my tardiness in responding. I live completely off-grid, and can only access internet at the library when I come to ...
0
votes
1
answer
85
views
How to not lose the cut ('x' key) text in Vim? [duplicate]
I thought I have understood how the vim registers work pretty well until I came across this scenario. Consider following line.
Toast #Mark Coffee
Now, I want to move Toast in between the Mark and ...
Best practices
0
votes
4
replies
91
views
Tips for using cscope with vim
I would like to know some best practices for using cscope with vim/nvim.
Here is the cscope related vim config from my init.vim.
fun! CscopeBuildReset()
:!cscope -Rbq
:cs reset
endfun
" ...
1
vote
1
answer
88
views
Syntax match issue with lookahead (regex \@=)
My understanding is the match resulting from \@= SHOULD NOT INCLUDE the lookahead characters. Here is an example that has me perplexed:
syn match InspectKeyword '\v(\+\s)\@=\w+'
Results in:
The ...
1
vote
3
answers
126
views
Copy lines that match a pattern within a range in nvim
Assume I have the following text, and I want to use nvim to extract only the lines that contain z_image:
README.md
14 kB
Update README.md
12 days ago
z_image_turbo-Q3_K.gguf
4.12 GB
Intial Commit
12 ...
0
votes
2
answers
89
views
Replacing multiple lines in Neovim based on an array
If I have the following content
head = cfg["head"]
head = cfg["head"]
head = cfg["head"]
head = cfg["head"]
Assuming I have a list as below
:let list = ['head',...
2
votes
1
answer
63
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
146
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
81
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 ...