Questions tagged [vim-registers]
35 questions
1
vote
1 answer
how to query the highest digit in a search?
Searching for the pattern /{{c\d, I'd like to get the highest digit found and use it in a macro.
For context, I'm using Anki (flashcard tool) and its cloze card type, and recently started creating my cards within vim.
Example card:
## Front
reading:…
![](../../users/profiles/885053.webp)
Adrien Lemaire
- 1,294
- 2
- 13
- 23
1
vote
1 answer
Searching backward for visual mode selection
I am looking to remap my # and * keys in visual mode in Vim so that I am able to highlight a portion of text and search for it backwards and forwards, respectively. With the help of a previous answer I have managed to get forward searches working. I…
![](../../users/profiles/866235.webp)
Geert Smelt
- 376
- 3
- 11
1
vote
2 answers
Using a register in a .vimrc mapping
I'm doing a job involving multiple modifications of HTML template files in which values to be replaced are designated in the template with tokens such as "%%ARTICLE_DATE". I'd like to use the "+" or "*" (clipboard, X-clipboard) vim registers in a…
![](../../users/profiles/2770731.webp)
Lindsay Haisley
- 172
- 1
- 7
1
vote
1 answer
Paste the content from dot . command in vim
Given the word foo in a text, if I type ciwbar while recording it as a macro in w register and then type in the command line
:w it will brings me :ciwbar^[
However if i type :. it will only brings me bar
But both commands, the @w and…
![](../../users/profiles/3438158.webp)
intmarinoreturn0
- 184
- 15
1
vote
1 answer
"+ register cannot work in vim with clipboard support
I guess my question may be similar to vim system register * and + not working but my server version is ubuntu. And I'm sure the installed vim has clipboard support. However, I cannot see the "+ register when I run :reg in vim. The followings are the…
![](../../users/profiles/9862053.webp)
Haoran Shi
- 68
- 8
1
vote
2 answers
Print information about register used in Vim report
When I am yanking into registers, I often mistype the "x syntax, so I would like to have a confirmation of which register it used to yank the text.
For instance, my ideal output if I were to type "x3yy would be "3 lines yanked into x" instead of…
![](../../users/profiles/1392894.webp)
Brian Ecker
- 1,677
- 1
- 18
- 29
1
vote
2 answers
Who automatically writes vim registers?
I am playing with vim registers. Opening vim with
`vim -i NONE`
I can open vim without any register. Then I run ":NERDTree" command. After this operation, I can see these registers:
Now my question is. Why registers h and o exists? What exactly is…
![](../../users/profiles/1420625.webp)
sensorario
- 15,862
- 24
- 85
- 131
1
vote
1 answer
whats is the conventional file to put a function in vim
I was searching for the vim scripts to clear the registers in vim,
I found this helpful script
right now i am inserting the code withing a function and putting it in my .vimrc file
function ClearReg()
let…
![](../../users/profiles/2481350.webp)
souparno majumder
- 1,521
- 1
- 21
- 39
1
vote
2 answers
Vim: How to handle newlines when storing multiple commands in registers?
I have a file where I store snippets of vim commands. When I need a snippet, I yank it and then execute it with @". The snippets are stored as a script, one line per command, like this:
:s/foo/bar/g
:echo "hello"
:s/1/2/g
Edit: I removed normal…
![](../../users/profiles/60531.webp)
UncleZeiv
- 17,080
- 6
- 46
- 74
1
vote
3 answers
Is the vim clipboard a stack? If yes, how can I paste copied data from that stack?
When you are not in insert more in vim, and you delete something, this gets automatically in the clipboard. Does this clipboard work like a stack?
If the clipboard is a stack, how can I access previous entries in this stack?
If the clipboard is not…
![](../../users/profiles/454103.webp)
Gabriel Petrovay
- 17,013
- 19
- 79
- 142
1
vote
1 answer
VIM function to create CMakeLists.txt
I'm new to Vim, and I want to create a Vim function to make a CMake file.
It doesn't work, and I don't know how should I do it, so the relevant part of my code is:
function! CMake_CV()
let @d=@%:t
:split CMakeLists.txtiproject( "dpi…
![](../../users/profiles/1723308.webp)
davitomi
- 53
- 6
0
votes
1 answer
How to free some register in vim as well as viewing free registers?
If I yank some text into register a, b and c, They should have text stored in them. I can use :reg command to see the occupied registers as well as their content. But what if I want to see the registers that are not occupied?
This makes it easier if…
![](../../users/profiles/9140652.webp)
StackExchange123
- 1,541
- 5
- 17
0
votes
1 answer
How to set default registers in vim?
I want to set the default register of d, x, and c to the black hole and use some mapping for use other register, like d "*d
Of course I can remap like
noremap d "_d
but then I'd have to remap dd to "_dd and when I select something and press…
![](../../users/profiles/13214635.webp)
fxndvi
- 63
- 7
0
votes
1 answer
vim - how do I yank to register inside a function?
I am perplexed how to use the registers from inside a function. For example, if I want to yank the current word to register "k", from inside vim, I would use the command/keystrokes
"kyw
But this does not work from inside a function: " starts a…
![](../../users/profiles/3983613.webp)
Peter Kay
- 93
- 7
0
votes
2 answers
Restoring a register after a function call
I am currently writing a plugin for Vim and I would like that it restores the default register after I execute it. However, the function in question is called via a =Myfunction() construct, which means that I need to restore it after the…
![](../../users/profiles/6205895.webp)
Bennett Rennier
- 3
- 3