r/vim • • Aug 08 '26

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

50 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?

54 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?

69 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 • • 18d ago

Need Help How do I delete current word and previous word?

19 Upvotes

Given the following two lines:

.row.mb-5.justify-content-evenly

If my cursor is at the y in justify-content-evenly, how can I delete that word, plus the period before it without losing the newline at the end?

EDIT: I didn’t say which y my cursor was at, but either would work for my use case.

EDIT 2: End result I want is for the first line to read:

.row.mb-5

r/vim • • Jun 19 '26

Need Help Change text in second set of quotes

28 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 • • 3d ago

Need Help Stuck on thehelp – keyboard shortcuts

4 Upvotes

Hi,

I have a Linux VPS and I'm currently struggling with vim... As soon as I type `:help`, the help page appears. The following shortcut is located there:

"Jump to a subject: Position the cursor on a tag (e.g. bars) and hit CTRL-]"

1.) I haven't seen a keyboard shortcut yet that had a minus sign between the keys. It’s always Ctrl+C, for example. What is the minus sign supposed to indicate?

2.) "Ctrl + closing square" bracket doesn't do anything either. I can jump to the subject by clicking the mouse or by pressing Ctrl + I. This might be due to the keyboard layout, or does "]" actually refer to the letter I?

Greetings

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.

94 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 • • 1d ago

Need Help How to set tab while branching in vim?

4 Upvotes

Hello guys! Lately I've often been using vim instead of VS code. But my habits didn't disappear: As you know, in VS code when you go to the next line, while you write conditionals or functions, IDE set
x number of tabs for you. For me it's pretty cool feature and vim doesn't have it natively. What can I write in ~/.vimrc or maybe download smth to enable this feature on vim?

r/vim • • 28d ago

Need Help Copy To From Windows Screen

9 Upvotes

There used to be cool windows utility that let you with a control key copy text from any current windows app (e.g., some programming ide or word), then paste it into a vim session. You could then edit the text in vim, and then when done it copied the text back.

Does anyone recall this app?

r/vim • • Aug 20 '26

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 • • 13d ago

Need Help Is there a way to edit bidirectional text on vim or even gvim?

20 Upvotes

There's Arabic mode in vim but it only good if your editing only Arabic text. Is there a way to edit bidirectional text? Both LTR & RTL in the same file?

r/vim • • 3d ago

Need Help cursor color manipulation on open

3 Upvotes

vimgang,

I have vim set to open nerdtree automatically on open and shift focus to whatever file im editing. My issue is my cursor highlight stays in nerdtree and doesnt follow the file focus : /

My current .vimrc invocation:

au VimEnter * NERDTree | wincmd p

Any ideas are appreciated!

r/vim • • Aug 02 '26

Need Help Why do my macros only work sometimes?

8 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 • • 22d ago

Need Help Who created the spell files automatically downloaded by Vim and how can I report errors?

18 Upvotes

They come from https://ftp.nluug.nl/pub/vim/runtime/spell/ but I can't find much information about who put them there and where they got them from. The esperanto one seems to have typos.

r/vim • • Jul 20 '26

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

5 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 • • Jan 04 '26

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

30 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

7 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 • • Aug 07 '26

Need Help Persist ECHO (from function) on Visual Selection

4 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 • • Apr 03 '26

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

15 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 • • Aug 09 '26

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 • • Jul 07 '25

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

73 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 18 '26

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

3 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 • • Aug 24 '24

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

29 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 • • Aug 06 '26

Need Help vim-fzf : Instruction problem

Post image
5 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.