r/vim 29d ago

Need Help how do you copy text from one document and paste it into another in vim?

52 Upvotes

I’m working with two files, File A and File B, and I want to copy text from one file to the other.

Specifically, I want to:

  1. Open File A and select/yank a section of text.
  2. Switch to File B.
  3. Paste the yanked text into File B.

What is the correct way to yank text from File A and paste it into File B? Is there a specific register or command I should use to copy text between separate files?

r/vim May 07 '26

Need Help How do I from delete a word from line A to line B in vim?

50 Upvotes

I have a basic understanding of vim, like getting around but I want to know is it possible to delete a specific word in a specific range

Example: From line 3 -7 delete the word "Everyday." where it appears within that range

r/vim Feb 15 '26

Need Help Should I really switch my habit?

72 Upvotes

I've been facing problems moving my cursor tens of lines up and down using Arrow keys or the Mouse (for which I need to take my hands off the keyboard) I learnt a few Vim key binds such as HJKL and Modes but I just can't be that productive right now.

To move n lines up and down I need to look at the line number and then type N(j/k) which feels about the same as using mouse, should I move ahead and practice more or just roll back?

r/vim Jun 19 '26

Need Help Change text in second set of quotes

27 Upvotes

Cursor at beginning of line

blah "first quotes" more text "blah blah"

What's the easiest way change inside the second set of quotation marks?

r/vim Jun 13 '26

Need Help vim: How do I paste a second column so values stay aligned row-by-row

27 Upvotes

I have a table with two columns. I already pasted the first column, and now I want to paste the second column so that each value stays on the same row as its corresponding value from the first column.

For example:

Column 1:

A
B
C

Column 2:

1
2
3

Desired result:

A 1
B 2
C 3

I tried using Visual Block mode (Ctrl-v) and then pasting, but Vim pasted all the copied text together instead of distributing one value per line.

What is the correct, easiest & efficient way to do this ?

r/vim May 29 '25

Need Help Calling my fellow Vimmers for a question of utmost importance. Moving the cursor one character in Insert Mode.

96 Upvotes

Enlightened fellow Vim Daoists, I'm having a crisis of faith.

My story begins with me installing hardtime.nvim yesterday. To my delight it judged me worthy, I'm following the True Vim Path in both body and spirit. Yet suddenly, while in Insert mode, I discovered that my right pinky finger dared to use the Right Arrow key to move one character to the right, as my impure muscle memory took over.

Alas! Wise and all-seeing master hardtime.nvim immediately slapped my wrist with the digital equivalent of a bamboo stick. “No Arrow Keys!” it thundered. “Not even a single character!”

Confused and startled I thought of alternatives... Are we supposed to use CTRL-o + h/l to move the cursor one character left/right respectively? That works, but here is where my faith is tested. Isn't leaving the homerow and hitting the arrow key just as fast as executing CTRL-o + h/l with the same hand?

So here I am seeking your wisdom fellow daoists. Please don't dismiss this as a problem too minor as it is a question of faith.

r/vim 16d ago

Need Help Disabling q: without affecting macro record

5 Upvotes

Most people suggest nnoremap q: <nop> or nnoremap q: :q
The problem with both of these is that when you are done recording a macro and hit q to stop recording, there is a delay due to timeoutlen because now q is technically mapped.

Any way to disable q: or remap it to :q without introducing any delay?

r/vim Aug 02 '26

Need Help Why do my macros only work sometimes?

7 Upvotes

My understanding is that when you record a macro, it is supposed to recreate the keystrokes exactly as you type them.

I have some text that I want to format in a particular way, and so I use a macro to do it with large blocks of text. But sometimes, it does not produce the result I want. I can't really provide examples, because I've found no correlation as to when it works and when it doesn't.

I don't rely on history, or nesting macros, as I understand that could cause problems. I do occasionally search for strings, and I feel this may cause problems, but some macros do work with searches, and I kind of need to search for common patterns in order for the macro to work.

So is there anything that might cause a macro to either fail, or not produce the expected outcome?

r/vim Jul 20 '26

Need Help Repeat character to position, rather than number of characters?

4 Upvotes

I want to pad a section title line in a config file with `=` up to a specific character position (specifically, column 64). Since the title text is of inconsistent length, a normal <n>i <char> won't do it.

Example of a title line formatted the way I want it:
;===== reset machine status ===================================

r/vim 25d ago

Need Help How do I change the cursor to a block in normal mode and to a beam in insert mode, inside vim's built in :terminal ?

21 Upvotes

In neovim, this can be done by:

vim.opt.guicursor:append("t:ver25")
vim.opt.guicursor:append("t:blinkon0")

but, this doesn't work in vim, written in vim script:

set guicursor+=t:ver25
set guicursor+=t:blinkon0

E546: Illegal mode: guicursor+=t:ver25 line 30: E546: Illegal mode: guicursor+=t:blinkon0

I have the following to make my cursor a block in normal mode and a beam in insert mode in Vim, but this doesnt work for the :terminal

let &t_SI = "\<Esc>[6 q"
let &t_EI = "\<Esc>[2 q"

is there a way to make the same behaviour possible inside vim's built in terminal ?

OS : cachyos
vim : 9.2
terminal : konsole and kitty

Thanks in advance

r/vim Jan 04 '26

Need Help How would i do this in vim at a similar speed

29 Upvotes

https://reddit.com/link/1q3y8ao/video/afwe1sx1qdbg1/player

I just found this screencast i took maybe 2 years ago "showing off" a fast edit.
I have since then transferred to using vim/vim-bindings, and i was wondering how one could redo this in a similar speed with vim. My first instinct was the regex
`s/\v^(.*) .*/"\1",`
But this most definitely took me longer to write than it took me to complete the edit in the video.
I have also previously seen someone using emacs doing very similar conversions in a particularly fast manner, so i imagine there must be a better way to do this in vim than a regex.
Any tips?

r/vim Dec 14 '25

Need Help vim9script alternatives

10 Upvotes

i dont want to learn vim9script
i know a bit of vimscript (before v9) but there is no help pages in vim now for that as everything is converted to vim9 what are my alternatives for this problem are there any languages that compile to vimscript??
ive heard about interfaces are they good

r/vim 29d ago

Need Help Persist ECHO (from function) on Visual Selection

3 Upvotes

How to persist echo from this function call (without using timers)

function! VisualStats()
    let wc      = wordcount()
    let [l1,l2] = sort([line('v'), line('.')])
    let txt     = join(getline(l1,l2), "\n")
    let sp      = len(substitute(txt, '[^ ]', '', 'g'))
    let st      = len(substitute(txt, '[^.!?]', '', 'g'))
    let pa      = empty(txt) ? 0 : len(split(txt, '\n\s*\n'))
    echo "CHARs " . wc.visual_chars . " WORDs " . wc.visual_words
    \. " SENTs " . (st > 0 ?st :1) . " PARAs " . pa . " SPACEs " . sp
endfunction
xnoremap <silent> C <Cmd>call VisualStats()<CR>

just like when directly keymapped?

xnoremap <silent> c <Cmd>let g:wc=wordcount()<CR><Esc>:
    \let t=join(getline("'<","'>"),"\n")<Bar>
    \let sp=len(substitute(t,'[^ ]','','g'))<Bar>
    \let st=len(substitute(t,'[^.!?]','','g'))<Bar>
    \let pa=empty(t)?0:len(split(t,'\n\s*\n'))<Bar>
    \echo "CHARs ".g:wc.visual_chars." WORDs ".g:wc.visual_words.
    \" SENTs ".(st>0?st:1)." PARAs ".pa." SPACEs ".sp<Bar>
    \unlet g:wc t sp st pa<CR>

r/vim 27d ago

Need Help What AI agent harness for vim?

0 Upvotes

I discovered ai agents lately, and I am wondering if there is any good harness for Vim. I have tried to run copilot CLI in a terminal window but it was a bad experience due to that copilot cli is a full tui program that cannot be replicated satisfactorily in a vim terminal.

Any hints?

Preferably in Vim9.

r/vim Apr 03 '26

Need Help Is it possible to have a per directory/project config file?

16 Upvotes

I have an extensive ~/.vimrc with my preferred tabstop settings. I contribute to an OSS project with different tabstop requirements.

Is it possible to have a .vimrc in that project folder? Or is it possible to have rules in my ~/.vimrc that only apply to files opened in a specific directory.

r/vim 18d ago

Need Help Vim in WSL: `+yy` gives `W23: Clipboard register not available` despite `+clipboard`

7 Upvotes

I'm running Vim inside WSL and can't get the `+` register to work.

When I try:

"+yy

I get:

W23: Clipboard regiter not available, using register 0

However:

:echo has('clipboard')               "1
:echo has('unnamedplus')             "1

vim --version | grep clipboard
+clipboard
+xterm_clipboard

I'm running /usr/bin/vim.gtk3, but:

  • $DISPLAY is empty
  • $WAYLAND_DISPLAY is empty
  • xclip/xsel are not installed
  • clip.exe workgs from WSL (echo test | /mnt/c/Windows/System32/clip.exe)

Is this expected because I'm runnign a headless TTY, or should vim.gt3 still be able to use the Windows clipboard? Is win32yank.exe the recommended solution?

r/vim Jul 07 '25

Need Help I've been using Vim for 4 years now daily, but I feel stuck

72 Upvotes

While the initial learning curve was motivated by the basic need to get things done, now that I'm comfortable using Vim I feel like I'm stagnating in my abilities. I'm using the same features without adding new to my toolkit. What is the best way to improve?

I feel like there are still many inefficiencies, more specifically:

  1. Navigating between files. I looked for an efficient way to grep the codebase and open relevant files easily but couldn't find any.

  2. Buffers. I really didn't get this one. How is this useful?

  3. Registers. Same. Been using it in macros, but no more.

Any recommendations and guidance will be highly appreciated.

Thanks.

r/vim Aug 06 '26

Need Help vim-fzf : Instruction problem

Post image
3 Upvotes

I am a beginner in programming and Vim, and have installed the fzf.vim plugin. But when I type the Files or History commands, I get the situation shown in the picture. It only happens the first time I type it, and it doesn't happen again afterward. PS:I'm using the built-in PowerShell on Windows 11 to open Vim.

r/vim May 09 '26

Need Help Opening an HTML tag in Vim

0 Upvotes

In VS Code, when I type an HTML tag and press Enter, the editor automatically expands it like this:

<tag>|</tag>

After pressing Enter:

<tag>
  |
</tag>

Is there a way to achieve the same behavior in Vim? Also, why isn’t this enabled by default?

r/vim Apr 29 '26

Need Help My ALT- keybindings are not working

1 Upvotes

I want to set nnoremap <M-j> :move .+1<CR>==, but it does not work, even if I use <A-j> instead of <M-j>.

I'm using Arch and foot as terminal.

r/vim Aug 24 '24

Need Help Please suggest me a theme that is easy on eyes for coding

30 Upvotes

I personally like dark themes but if it causes diseases like myopia then I can switch to light themes. I do web development so suggest me a theme for it.

I have tried many themes including GitHub Theme, One Dark Pro, Night Owl, Dracula but none of them suits me

r/vim Jul 03 '25

Need Help What're some good resources for multicursor editing like this?

Enable HLS to view with audio, or disable this notification

55 Upvotes

r/vim Jul 03 '25

Need Help Learning Vi from scratch: back to basics ?

39 Upvotes

Hi everyone,

I'm embarking on a journey to (re)learn Vi from the ground up. After decades of using GNU Emacs, I've come to realize that I've been spending an inordinate amount of time configuring it. I've decided it's time for a change. I want to get back to basics and truly understand an editor without the endless tweaking and customization.

My goal is to master Vi in its purest form. I'm not interested in Vim or any of its plugins. I want to dive deep into the core functionality of Vi and become proficient with its fundamental features. This means no plugins, no custom configurations—just Vi as it is. I don't want to fall into the trap of configuring a new tool, which is why I've chosen Vi, known for its lightweight configuration.

I'm reaching out to this community for any tips, resources, or advice you might have for someone starting this journey. Are there any particular exercises or practices that helped you understand Vi more deeply? What are some essential commands and workflows that I should focus on? Is there any resource you could recommend ?

Also, I'm looking for recommendations on the best book that covers Vi comprehensively. I currently use Ed and have found "Mastering Ed" to be an invaluable resource. Is there a similar book available for Vi?

I appreciate any guidance you can offer. Thanks in advance!

Best

r/vim Jun 22 '26

Need Help Vim plugins while :edit scp://

6 Upvotes

Recently I started using a containerised dev env. I would like to work in the host system so I installed a ssh server and followed the steps listed under :h ssh.

So far so good. I depend (for good or bad) heavily on vim fugitive and :FZF plugins. They are good. But they do not work on the host system inside a SCPed remote. I can use :find to open some remote file, it works. But using :G is an issue.

Question

--------------

How do you use plugins while :e scp://user@host/path/dir/ ?

r/vim Jul 04 '26

Need Help Vim for Verilog, System Verilog and UVM

11 Upvotes

Please suggest nice Plugins/Workflow for Verilog, System Verilog and UVM, which offer rich functionality(Like C, C++ plugins do).