All Questions

Filter by
Sorted by
Tagged with
1
vote
2answers
48 views

Is there a way to write a file and skip the autocmd on write?

My .vimrc has, autocmd FileType rust autocmd BufWritePre <buffer> call LanguageClient#textDocument_formatting_sync() This works great, unless my LanguageClient crashes. Then I can't write the ...
2
votes
1answer
28 views

Passing arguments function with --argument or -a format

Is it possible to pass arguments to Vimscript functions with the --argument or -a format, similar to arguments in the command line? I am writing a command that submits a job in a remote machine. I ...
1
vote
1answer
17 views

How to set norelativenumber on CmdlineEnter and relativenumber on CmdlineLeave?

I am trying to set norelativenumber on CmdlineEnter and relativenumber on CmdlineLeave, but it didn't work. Why is that? local setup = function() vim.api.nvim_exec([[ augroup SmartNumberGroup ...
0
votes
3answers
44 views

How can I perform a replacement a specified number of times per line?

Using vim, I know that I can replace all occurrences of a string across multiple lines by specifying a count or a range, as documented in :h subst. I have a markdown table which contains C function ...
0
votes
1answer
43 views

a way to run a function on CTRL-O / CTRL-I?

I wrote a little function to highlight a current line when navigating which basically mimics this emacs package. It works fine for navigating between windows. function Util.flash_cursorline() vim....
0
votes
0answers
10 views

Setting up Jedi Vim for the first time, are there some magic settings needed?

My problem is that I know vim only as well as I absolutely have to, and I think I may have gotten into trouble getting this jedi-vim to work... I use the following arch for my plugins: pathogen ...
0
votes
1answer
18 views

persistant error “E676: No matching autocommands for acwrite buffer”

I had a file called a.txt open in vim. I mashed some keys (I really don't know which) but when I tried to save the file :w I got the above error. Same when I tried to quit the file. Finally, I forced ...
0
votes
0answers
15 views

Cannot search for pairs with searchpairpos()

I am trying to search for the location of the start and the end of a pair with searchpairpos(). Given an example like this: *hel[]lo* And my code like this: local start_match = vim.api....
0
votes
1answer
33 views

Background color for listchars chars

I use the solution from this question to display tabs with litlle ⸱ characters. It works but they appear on a lighter gray background than the dark gray background I am using. It is quite distracting ...
1
vote
1answer
31 views

Add current position to the jump list the first time <C-u> or <C-d> is pressed

I'm often using <C-u> and <C-d> to quickly navigate around in my code (I don't like using { and } since they're hard to type on my layout). One thing that annoys me is that <C-u> and ...
1
vote
1answer
30 views

Why does ch_evalraw() evaluate to my message instead of the response?

I am trying to learn about jobs and channels on Vim (on Windows), and I am using the following sequence as an example: let job = job_start("cmd") let channel = job_getchannel(job) let ...
0
votes
0answers
33 views

Stenography (Plover) integration

I use Vim for academic writing and my preferred writing method is using stenography with Plover. Is there any initiative to integrate Stenography/Plover into Vim? Currently, I am switching keyboards ...
0
votes
0answers
24 views

Measurement/ tracking the time for editing a file (overall and statistics)

I use vim for coding and also for writing scientific articles and book chapters. It would be very interesting to know the time I spent on a file. For example how many hours or minutes the buffer was ...
0
votes
1answer
31 views

Global plugins source only once? [closed]

So here is a little experiment: with a clean config (i.e., no previous ~/.vimrc or ~/.vim/), do: $ mkdir -p ~/.vim/plugin/ $ vim ~/.vim/plugin/foo.vim And in that file, enter the following, save &...
0
votes
1answer
19 views

How can I get the current cursor position in Lua?

How can I get the current cursor position in Lua? I want to get a number so that I can use it in a for-loop. I tried this, but I got a hashed value instead: local lineNum = vim.api.nvim_win_get_cursor(...
1
vote
1answer
38 views

Launching vim with a servername

I am trying to use reverse searching from PDF documents to their respective *.tex files. I use vim (in terminal) as my editor and my PDF viewer is Zathura. Forward searching works however the problem ...
0
votes
0answers
17 views

E523: Not allowed here for command used in a function of <expr>

I am trying out <expr>, and I found out not all ex-mode command can be run in a function. :LspInfo is a command from nvim-lsp. function! Message() LspInfo endfunction nnoremap <expr> gd ...
0
votes
2answers
25 views

How to set autocmd for files without a filetype?

I want some autocmds to run when I open a file without a filetype like nvim (no file name) or nvim myfile (no extension). I also want them to run when opening certain file types like text and markdown ...
0
votes
0answers
27 views

Can you install both Vim 7 and Vim 8 on CentOS 7.9?

I teach classes that cover both Vim 7 and Vim 8. Is it possibly to install Vim 7 and Vim 8 together on CentOS? If so, how? Everything I've have looked at so far covers updating Vim 7 to Vim 8. I ...
0
votes
0answers
24 views

How to use `<count>` and `-count` to make command repeatable?

I am trying to use <count> and -count to make a command repeatable. This is the command I have right now: command! -count=1 Hello :d <count>. But I got this error instead when I run :...
0
votes
1answer
14 views

Hard-wrap multiple lines without selecting them?

To hard-wrap a single line, we can use gqq, and to hard-wrap multiple lines, we can select them in visual mode and then use the same gqq command. However, I suppose that there is probably a smarter ...
0
votes
1answer
25 views

How to detect the change that from insert mode to normal mode, so I can implement Auto-Save?

I want to do the following: autocmd changeFromItoN * if &readonly == 0 && filereadable(bufname('%')) \ | silent update | endif That is: I want to implement the ...
5
votes
0answers
47 views

Matching any Unicode whitespace

I'd like to match in Vim any whitespace character, not only normal space (U+0020) and tab (U+0009) with \s, and the other ASCII ones like form feed (U+000C) with [[:space:]], but any Unicode ...
0
votes
0answers
14 views

Open file in new tab or split if current file has changes in fzf.vim

I have been using :Files to get a list of files using fzf.vim. Although whenever I hit enter to open a new file and the current file has not been saved I get an error message saying No write since ...
0
votes
1answer
37 views

movement similar to “f” but you can specify more than one character as search criteria

Say we got this sentence: pafpaf apfa fpa i apa panda pafas af I would like to quickly move the cursor from the start of the line to the beginning of the word panda. I could do 6fp, but what takes ...
1
vote
1answer
32 views

Printing the name of all files inside the buffer inside a file

Let's say I have 10 files opened in buffer with vim *. One way of saving the name of all those files inside a new file would be using the command: :argdo !echo % >> filenames.txt This command ...
-1
votes
0answers
19 views

How do I automatically compile and run files?

I'm quite a newbie to vim/neovim. Now I'm searching for a way to detect which file type I'm editing at the moment; if it's something like .java or .py, I want to execute the corresponding compile ...
0
votes
1answer
23 views

Can't replace div using regex

I have the following code from lines 6-20 <div> 1 </div> <div> 2 </div> <div> ...
0
votes
1answer
26 views

Why my markdown syntax is not working?

I'd like to edit text with markdown syntax. Searching for ways of using mixed syntax in the same file I've discovered this question with an answer saying that if I add the line let g:...
0
votes
1answer
22 views

Select buffer from list of buffers filtered by a partial name match?

Let's say I entered a folder with many files and I opened them with vim *. I know that if I want to list all the files inside the buffer I can use the command :ls, and then I can navigate those files ...
0
votes
1answer
48 views

Delete everything between two surrounding characters

Commands I use a lot are commands like: dib (delete everything between two surrounding parantheses) di{ (delete everything between two surrounding curly brackets) ... it works for a few other ...
1
vote
1answer
26 views

Why does Vim load buffers from old session when new one is started?

The situation is this: I have 2 sessions: s1.vim and s2.vim. First one was saved with files A, B, C in buffers list. Second one was saved with file A. Next I start vim: vim -S s1.vim. :ls shows A, B, ...
0
votes
1answer
33 views

Remove text specifying mode “INSERT” in bottom vim line

In the bottom two lines, you'll see the statusline saying "INSERT", and the line where you enter commands showing -- INSERT -- This is quite redundant, and I would like any recommendations ...
0
votes
1answer
15 views

Neovim does not autoreload after a BufWritePost, maybe because the timestamps are too close?

I am using neovim to work on a Swift project, so I have set up an autocmd to run swiftformat when I write Swift files as shown. autocmd BufWritePost * if count(['swift'],&filetype) | silent ...
0
votes
1answer
16 views

How to map <Plug>MarkdownPreviewToggle

I am trying to map MarkdownPreviewToggle to an key like "mk". My vimrc is like it: nnoremap mk <Plug>MarkdownPreviewToggle But it doesnt work, what should i do? (the other key isnt ...
0
votes
2answers
49 views

Increment number for every 10 lines

The file consists of 2 columns (code and percentage). We need to add 2 more columns with increasing number for 4th column (Xcols) and increment 3rd column (Ycols) only for every 10 lines with reset of ...
0
votes
2answers
36 views

Is there any way to change the default startup text in vim?

When you first open vim there is a text that says "VIM - Vi IMproved version......" Is there a file or setting you can use to change this default text? I've looked on the internet and here ...
0
votes
1answer
44 views

Setting conceallevel in .vimrc does not work in .tex file

I've set conceallevel=0 in .vimrc, but the text is not shown normally after opening .tex file. I have to type it again while the file is open and it works. From my .vimrc: "vimtex config set ...
8
votes
3answers
945 views

See what Vim `:!` executes

Between :%! exe "!..." exe "!bash -c" shellescape(...) I'm getting quite confused as to what exactly Vim invokes. And I suspect at some point it invokes bash -c bash .... Is ...
0
votes
0answers
18 views

Cursor jumping to beginning of the line while typing [closed]

I installed the neovim extension for vscode today and a really weird problem occurred: Whenever I type, after a few words the cursor just jumps back to the beginning of the line, and it doesn't seem ...
1
vote
1answer
38 views

(coc-)vimtex .bib completion strange suggstions

I've noticed that (coc-)vimtex gives suggestions about bib(la)tex keys and allows too searching in the entries of the literature. Now this search works sometimes for me, sometimes not (see the gif). ...
0
votes
1answer
34 views

When searching and replacing can I store a capture group to a register?

This is similar but I am unable to draw the information I need from it: How to store all occurrences of a multiline search in a register? I have these lines ################### trim 8 ...
2
votes
0answers
46 views

While copying a file in netrw, why should I be in the directory where the file is located?

In netrw, I want to copy a file /dir/subdir1/file.txt to /dir/subdir2. For that, I do the following: I mark the file /dir/subdir1/file.txt I navigate up directory and mark /dir/subdir2/ as target ...
0
votes
0answers
11 views

How to disable mouse in nvim

I'm on Arch Linux with alacritty, zsh and neovim nightly (NVIM v0.5.0-dev+1069-g02a966386). I've read several posts on disabling the mouse in vim including 13566 and have put the following in my init....
0
votes
0answers
22 views

Why isn't vim recovering the most recent save

I'm having some graphical issues with my setup that means I sometimes need to restart my machine having not saved a file which is currently being edited in vim. However, the saved file which vim ...
0
votes
1answer
20 views

How to make cursor move to the top line inserted with 2O?

Using a simple example: h[]ello If I type 2o<esc>, the cursor will be moved to the last inserted line like this: hello [] But if I type 2O<esc>, the cursor will be moved to the last ...
0
votes
2answers
31 views

How to cut characters in the middle of a line and place later in the line (not at the end)

This top line shows how it needs to be formatted, and the other 3 lines show how it currently is formatted. I need the bottom three lines to look like the top line. So, I need to essentially cut this ...
0
votes
1answer
13 views

how to autocmd BufWritePost stdout to tidy upon :w?

tldr; How do pass stdout of BufWritePost to an external command? On command line I can run cat index.html | tidy -indent -modify I'm trying to call tidy automatically when I :w This is what I have so ...
0
votes
1answer
21 views

How to Start vim with splits open

I want IDE-like look when I start vim. 3 columns. Leftmost, at 15% width, file & symbol browser, then 60% width of main editor space and 25% showing debug points and run logs on right most part. ...
0
votes
1answer
29 views

What are the E tags in vim help?

I've been browsing vim's help and noticed there are some topics which have multiple E### tags and others with just a single E### tag. I'm curious as to what the significance of these E### tags are. My ...

15 30 50 per page
1
2 3 4 5
219