Quick Q: How do you re-type when you typo?
When I'm writing in vim insert-mode, and I notice I have written a typo in either the current word or one before, I find I tend to just hammer the backspace key. Sometimes I escape, 'b' then 'cw'. I'm curious to know what method you use to fix typos on the fly.
https://redd.it/1qrarsl
@r_vim
When I'm writing in vim insert-mode, and I notice I have written a typo in either the current word or one before, I find I tend to just hammer the backspace key. Sometimes I escape, 'b' then 'cw'. I'm curious to know what method you use to fix typos on the fly.
https://redd.it/1qrarsl
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Reading Learning the vi and Vim Editors in 2026
Any thoughts on this book?
https://redd.it/1qrhygk
@r_vim
Any thoughts on this book?
https://redd.it/1qrhygk
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
BufExplorer yields "Press ENTER or type command to continue"
BufExplorer is a plugin that lets users easily navigate between files that they have opened. When invoked, it shows these files in a split window, along with state metadata and the folder path. You can quickly go to the folder using Vim's gf command. I've grown highly dependent on BufExplorer, using it synergistically with tabs and windows within Vim. The files can be shown in various sort orders (by name, most recently used, and other criteria I don't recall). You can trim the list by deleting line times, which correspond to files that have been opened (it doesn't delete the file, just it's appearance in BufExplorer).
While indispensable, I do get tripped up by a wrinkle. I've seen the message in the subject line above for years if not decades. Not always, but once it starts, it never goes away. For someone use to finger muscle memory, it's not just friction-- it's a pothole.
Using ":set verbose=9", I found the problem to be:
E303: Unable to open swap file for "BufExplorer", recovery impossible
It turns out that my current working directory (":pwd") no longer exists. The solution was as simple as switching to a known existing directory, e.g., ":cd \~/tmp".
I find it easy to lose track of my working directory and get into this situation if:
I use Vim for days on end so that I'm relying on BufExplorer to switch between files
I rely heavily on a command line to pipe the full path of target file into the system clipboard and get Vim to switch to it using ":e <Ctrl+R>*"
I routinely use the Vim "gf" command in the path field of BufExplorer to a folder, making my "cwd" somewhat irrelevant
A commentor said it was odd for a buffer list to use a swap file. While I'm not certain, it is possibly a side-effect of sourcing a mksession file to resume a Vim session in a new instance of Vim at a later date. I'm not sure how that impacts the invocation :BufExplorer -- it's just a guess at a contributing factor.
https://redd.it/1qscvuh
@r_vim
BufExplorer is a plugin that lets users easily navigate between files that they have opened. When invoked, it shows these files in a split window, along with state metadata and the folder path. You can quickly go to the folder using Vim's gf command. I've grown highly dependent on BufExplorer, using it synergistically with tabs and windows within Vim. The files can be shown in various sort orders (by name, most recently used, and other criteria I don't recall). You can trim the list by deleting line times, which correspond to files that have been opened (it doesn't delete the file, just it's appearance in BufExplorer).
While indispensable, I do get tripped up by a wrinkle. I've seen the message in the subject line above for years if not decades. Not always, but once it starts, it never goes away. For someone use to finger muscle memory, it's not just friction-- it's a pothole.
Using ":set verbose=9", I found the problem to be:
E303: Unable to open swap file for "BufExplorer", recovery impossible
It turns out that my current working directory (":pwd") no longer exists. The solution was as simple as switching to a known existing directory, e.g., ":cd \~/tmp".
I find it easy to lose track of my working directory and get into this situation if:
I use Vim for days on end so that I'm relying on BufExplorer to switch between files
I rely heavily on a command line to pipe the full path of target file into the system clipboard and get Vim to switch to it using ":e <Ctrl+R>*"
I routinely use the Vim "gf" command in the path field of BufExplorer to a folder, making my "cwd" somewhat irrelevant
A commentor said it was odd for a buffer list to use a swap file. While I'm not certain, it is possibly a side-effect of sourcing a mksession file to resume a Vim session in a new instance of Vim at a later date. I'm not sure how that impacts the invocation :BufExplorer -- it's just a guess at a contributing factor.
https://redd.it/1qscvuh
@r_vim
Search and replace the two-character [ string
I use vim to edit LaTeX files among other things and I have run across a string pattern that I cannot figure out how to find with a sed-like substitution command. Suppose I want to replace the string "\\[" with "foo". Nothing I have tried in vim is capable of identifying the "\\[" sequence. Here are the things I have tried:
:%s/\\\\\[/foo/g
:%s/\\[/foo/g
:%s/"\\\["/foo/g
:%s/'\\['/foo/g
I thought the first one should work, but then I just started trying other stuff. In each case I get this error: "E486: Pattern not found: \\\\[/foo/g
Oddly enough, I *can* forward search to find the next occurrence of that sequence in the usual way: /\\\\[
Can someone please set me straight?
https://redd.it/1qu5rh9
@r_vim
I use vim to edit LaTeX files among other things and I have run across a string pattern that I cannot figure out how to find with a sed-like substitution command. Suppose I want to replace the string "\\[" with "foo". Nothing I have tried in vim is capable of identifying the "\\[" sequence. Here are the things I have tried:
:%s/\\\\\[/foo/g
:%s/\\[/foo/g
:%s/"\\\["/foo/g
:%s/'\\['/foo/g
I thought the first one should work, but then I just started trying other stuff. In each case I get this error: "E486: Pattern not found: \\\\[/foo/g
Oddly enough, I *can* forward search to find the next occurrence of that sequence in the usual way: /\\\\[
Can someone please set me straight?
https://redd.it/1qu5rh9
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Formatting of status line
Vim novice here. I understand that this is code for configuring the status line. Don't remember where I got it. I sense I may want to use it. I am not competent to read how it configures it. Help appreciated.
" Format the statusline
set statusline=CWD:\\ %{CurDir()}%h\\ \\
set statusline+=\\ \\ File:\\ %{HasPaste()}%t%m%r%y%w[%{&fenc}\]\\ \\ Line:\\ %l/%L:%c\\ \\ Value:\\ 0x%B\\ \\ %<%p%%
set statusline+=[wc:%{WordCount()}\]
Thanks.
https://redd.it/1qwu463
@r_vim
Vim novice here. I understand that this is code for configuring the status line. Don't remember where I got it. I sense I may want to use it. I am not competent to read how it configures it. Help appreciated.
" Format the statusline
set statusline=CWD:\\ %{CurDir()}%h\\ \\
set statusline+=\\ \\ File:\\ %{HasPaste()}%t%m%r%y%w[%{&fenc}\]\\ \\ Line:\\ %l/%L:%c\\ \\ Value:\\ 0x%B\\ \\ %<%p%%
set statusline+=[wc:%{WordCount()}\]
Thanks.
https://redd.it/1qwu463
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
How to horizontally scroll large popups?
Say that I have a huge table displayed in a popup.
Although I can add some keys in the popup filter function to scroll up and down, with entries like:
I tried with:
but it does not work.
Does anyone knows if it is possible? Because if not, then I could open an feature request on the issue tracker of vim.
https://redd.it/1qxlibf
@r_vim
Say that I have a huge table displayed in a popup.
Although I can add some keys in the popup filter function to scroll up and down, with entries like:
\# Move up
if \["\\<C-n>", "\\<Down>", "j", "\\<ScrollWheelDown>"\]
win\_execute(id, "normal! \\<c-e>")
\# Move up
elseif \["\\<C-p>", "\\<Up>", "k", "\\<ScrollWheelUp>"\]
win\_execute(id, "normal! \\<c-y>")
I tried with:
elseif key == "l"
win_execute(id, "normal! zl")
elseif key == "h"
win_execute(id, "normal! zh")
but it does not work.
Does anyone knows if it is possible? Because if not, then I could open an feature request on the issue tracker of vim.
https://redd.it/1qxlibf
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Do you actually need a whole plugin just for surrounding?
lately i've been learning about vimnoscript after ignoring it for a long time, and i thought about doing some stuff in order to.. you know, learn by doing.
i got the basic surrounding working with 7 lines, and the 8th one for the mapping.
I think it's obviously not the best surrounding snippet out there but am i missing something? this feels more than enough for basic quotes and brackets. what do you think?
Edit: code format
https://redd.it/1qzl7g0
@r_vim
lately i've been learning about vimnoscript after ignoring it for a long time, and i thought about doing some stuff in order to.. you know, learn by doing.
i got the basic surrounding working with 7 lines, and the 8th one for the mapping.
def Surround(): void
echo "Enter surround char..."
var pairs = {'(': ')', '{': '}', '[': ']', '<': '>'}
var lhc = nr2char(getchar())
var rhc = pairs->get(lhc, lhc)
execute "normal! `>" .. (visualmode() ==# "V" ? "g_" : "") .. "a" .. rhc .. "\<Esc>`<" .. (visualmode() ==# "V" ? "g^" : "") .. "i" .. lhc .. "\<Esc>"
enddef
I think it's obviously not the best surrounding snippet out there but am i missing something? this feels more than enough for basic quotes and brackets. what do you think?
Edit: code format
https://redd.it/1qzl7g0
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Manual creating CNC code, is Vim a good fit?
Hey y'all. I need help learning if I can use Vim to make large swaths of code quickly or if something else is a better fit. Example here:
I was once a manual code editor a decade ago and used Vim with snippets to create lots of NC code at an old job, rather simple snippets back then. I moved jobs and have only programmed with MasterCAM the past decade but a recent feature would have been faster to write the code by hand. How can I learn? I remember some but it has been so long I barely remember
Edit: I'm on windows at work, WSL is disabled. Anything not native would need IT approval which might take a while.
https://redd.it/1qzrynd
@r_vim
Hey y'all. I need help learning if I can use Vim to make large swaths of code quickly or if something else is a better fit. Example here:
G13D0R0.4217Z-0.0900
G13D0R0.4218Z-0.0901
G13D0R0.4219Z-0.0902
…
G13D0R0.4336Z-0.1019
G13D0R0.4337Z-0.1020
G13D0R0.4338Z-0.1021
I was once a manual code editor a decade ago and used Vim with snippets to create lots of NC code at an old job, rather simple snippets back then. I moved jobs and have only programmed with MasterCAM the past decade but a recent feature would have been faster to write the code by hand. How can I learn? I remember some but it has been so long I barely remember
:wq but I did find an example of :put =range(4217,4338) to get part of what I needed but can't figure out if I can get everything at once. The example on Vim tips wiki :for i in range(1,10) | put ='192.168.0.'.i | endfor makes me think I should be able too do that, can such a function handle multiple variables? Like i j k? I will need to wait for IT to install Vim so it may take a while. Is there better ways to get what I want? Thanks.Edit: I'm on windows at work, WSL is disabled. Anything not native would need IT approval which might take a while.
https://redd.it/1qzrynd
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
hatsune miku color scheme
https://preview.redd.it/4oump8ckydig1.png?width=1900&format=png&auto=webp&s=0dc2f6622b2a0fc6a80d1b96204d008f0eda7664
I've been using this minimal colorscheme I hacked together for half a year now. Draws inspiration from Atom editor's default font, as well as elflord.
I would love to get some feedback on this! I mostly code in C so I'm sure there's a lot of different cases in different languages that I didn't catch. I would also love any suggestions that would help readability etc.
https://github.com/cccfire/vim-miku-colors/tree/main
https://redd.it/1qzt76z
@r_vim
https://preview.redd.it/4oump8ckydig1.png?width=1900&format=png&auto=webp&s=0dc2f6622b2a0fc6a80d1b96204d008f0eda7664
I've been using this minimal colorscheme I hacked together for half a year now. Draws inspiration from Atom editor's default font, as well as elflord.
I would love to get some feedback on this! I mostly code in C so I'm sure there's a lot of different cases in different languages that I didn't catch. I would also love any suggestions that would help readability etc.
https://github.com/cccfire/vim-miku-colors/tree/main
https://redd.it/1qzt76z
@r_vim
Flash/Jump/Hop to fold headers?
So I love my easy motion style navigation, but I cant seem to find a way to use it to navigate to UFO folded headers because I guess the header is virtual text or not part of the searchable buffer.
Has anyone found a solution to this?
https://redd.it/1r086ku
@r_vim
So I love my easy motion style navigation, but I cant seem to find a way to use it to navigate to UFO folded headers because I guess the header is virtual text or not part of the searchable buffer.
Has anyone found a solution to this?
https://redd.it/1r086ku
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Is there a way to include it in :messages but prevent to show it on-screen?
As per noscript.
I want to place a message in
To me the obvious would be
https://redd.it/1r07ir9
@r_vim
As per noscript.
I want to place a message in
:message but I don't want it to appear on screen.To me the obvious would be
:silent echom "foo" but foo is not placed in :messages, nor it is shown on screen. https://redd.it/1r07ir9
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Vim 9.2 has been released: Vim 9.2 brings significant enhancements to the Vim9 noscripting language, improved diff mode, comprehensive completion features, and platform-specific improvements including experimental Wayland support.
https://www.vim.org/vim-9.2-released.php
https://redd.it/1r4ymj3
@r_vim
https://www.vim.org/vim-9.2-released.php
https://redd.it/1r4ymj3
@r_vim
Reddit
From the vim community on Reddit: Vim 9.2 has been released: Vim 9.2 brings significant enhancements to the Vim9 noscripting language…
Posted by anaxarchos - 14 votes and 2 comments
Why is this so fast in vim?
So if you have this C program :
#include <stdio.h>
#include <stdint.h>
int main(void)
{
for(uint64_t i = 0; i < 1000000; i++)
{
printf("iteration %lu\n", i);
}
return 0;
}
When i run this really simple program in my terminal(foot), it takes around 0.6 seconds, when i run this in emacs(compilation mode) it takes around 40 seconds, but in vim if i do this in command mode : `:r !time ./print` it only takes 0.1 seconds and the file has 1 million lines of the same output. What is the difference maker?
https://redd.it/1r1xz29
@r_vim
So if you have this C program :
#include <stdio.h>
#include <stdint.h>
int main(void)
{
for(uint64_t i = 0; i < 1000000; i++)
{
printf("iteration %lu\n", i);
}
return 0;
}
When i run this really simple program in my terminal(foot), it takes around 0.6 seconds, when i run this in emacs(compilation mode) it takes around 40 seconds, but in vim if i do this in command mode : `:r !time ./print` it only takes 0.1 seconds and the file has 1 million lines of the same output. What is the difference maker?
https://redd.it/1r1xz29
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Vim noscripting with AI
I've been using Claude code to generate vim noscripts and key mappings. As well as using vim-ai /ChatGPT Plugin inside Vim. I'm finding it very useful in creating complex tasks that I have always put off as not worth the effort to reward.
Does anyone else have any good tips or tricks using AI within Vim ?
https://redd.it/1r2pag3
@r_vim
I've been using Claude code to generate vim noscripts and key mappings. As well as using vim-ai /ChatGPT Plugin inside Vim. I'm finding it very useful in creating complex tasks that I have always put off as not worth the effort to reward.
Does anyone else have any good tips or tricks using AI within Vim ?
https://redd.it/1r2pag3
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
integration of opencode
Other than using
I know
https://redd.it/1r21mur
@r_vim
Other than using
opencode on a separate terminal and let vim "reload" automatically the modified file whenever the focus comes back to vim, is there any other use mode where I can harness the power of opencode directly from my vim instance?I know
neovim does have a plugin for opencode but I don't want to switch to it for a number of reasons.https://redd.it/1r21mur
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community
Fold all sibling and child blocks?
So is there a way to fold all child nodes or all sibling and child nodes? eg
foo {
test
bar { ... }
bar2 { .... }
}
so lets say the cursor is on "test" and i should be able to hit a key that will fold bar and bar2
https://redd.it/1r18kit
@r_vim
So is there a way to fold all child nodes or all sibling and child nodes? eg
foo {
test
bar { ... }
bar2 { .... }
}
so lets say the cursor is on "test" and i should be able to hit a key that will fold bar and bar2
https://redd.it/1r18kit
@r_vim
Reddit
From the vim community on Reddit
Explore this post and more from the vim community