yank

How to map yank to OS's clipboard in Vim? [duplicate]

筅森魡賤 提交于 2020-01-13 11:11:52
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: vim: copy selection to OS X clipboard While I succeeded to map paste from clipboard ( nmap <leader>p "*p ), the same for yank ( nmap <leader>y "*y ) doesn't seem working. Actually, it yanks in Vim's clipboard. Any idea how to do it properly? I know of clipboard=unnamed but I might keep the old yank/paste vim's commands. EDIT : It seems there is some confusion about my needs. The command "*y works . So there is

Set iskeyword selectively

一笑奈何 提交于 2020-01-01 15:55:30
问题 Often I need to search large xml mode files for the next occurrence of the word under the cursor but preferably not if it's a tag the closing tag In the below example # is where the cursor is. Using * or # with iskeyword not including > or < will move between <Dealid> and </Dealid> . <Deali#d>4444</Dealid> ... 50 lines <Dealid>6666</Dealid> ... n lines <Dealid>5643</Dealid> I tried :set iskeyword+=< which worked fine for moving to the next match but it changed vey to include the < of the

Emacs: How to yank the last yanked text regardless of subsequent kills?

只愿长相守 提交于 2019-12-20 08:57:31
问题 I often find myself repeatedly yanking something after doing some kills and it becomes a process like: C-y C-y M-y C-y M-y M-y C-y M-y M-y M-y Each time I kill some text it pushes the first kill back in the kill ring so that I need to cycle through all the kills to return to text I want to yank. What I want to do is repeatedly yank the same text while killing text in-between yanks. Is this possible? 回答1: This is a strange hack, but may help. The first time you use M-y you normally get an

Yank file name / path of current buffer in Vim

可紊 提交于 2019-12-17 17:19:22
问题 Assuming the current buffer is a file open for edit, so :e does not display E32: No file name . I would like to yank one or all of: The file name exactly as show on the status line, e.g. ~\myfile.txt A full path to the file, e.g. c:\foo\bar\myfile.txt Just the file name, e.g. myfile.txt 回答1: TL;DR :let @" = expand("%") > this will copy the file name to the unamed register , then you can use good old p to paste it. and of course you can map this to a key for quicker use. :nmap cp :let @" =

After pasting a yanked line in Vim, why can't I paste it again?

为君一笑 提交于 2019-12-10 09:22:41
问题 This question was probably answered before, but I tried searching and could not find the answer anywhere. I am somewhat new to Vim and I am having the following issue. Once I yank a line and paste it, i cannot paste it again. For example, say in Word environment you would copy a text, paste it and then you can paste it again further. But in Vim, once I have pasted it and then try pasting again (p), it pastes the text I pasted the yanked line over. So for example, I yanked the line "This line

How to map yank to OS's clipboard in Vim? [duplicate]

旧街凉风 提交于 2019-12-05 18:13:58
This question already has answers here : Closed 7 years ago . Possible Duplicate: vim: copy selection to OS X clipboard While I succeeded to map paste from clipboard ( nmap <leader>p "*p ), the same for yank ( nmap <leader>y "*y ) doesn't seem working. Actually, it yanks in Vim's clipboard. Any idea how to do it properly? I know of clipboard=unnamed but I might keep the old yank/paste vim's commands. EDIT : It seems there is some confusion about my needs. The command "*y works . So there is nothing wrong with the +clipboard thing in my Vim env. What does not work is the mapping stuff. I want

After pasting a yanked line in Vim, why can't I paste it again?

China☆狼群 提交于 2019-12-05 17:43:18
This question was probably answered before, but I tried searching and could not find the answer anywhere. I am somewhat new to Vim and I am having the following issue. Once I yank a line and paste it, i cannot paste it again. For example, say in Word environment you would copy a text, paste it and then you can paste it again further. But in Vim, once I have pasted it and then try pasting again (p), it pastes the text I pasted the yanked line over. So for example, I yanked the line "This line is yanked" onto "I don't want this line" and so "This line is yanked" takes place over "I don't want

Set iskeyword selectively

丶灬走出姿态 提交于 2019-12-04 11:43:44
Often I need to search large xml mode files for the next occurrence of the word under the cursor but preferably not if it's a tag the closing tag In the below example # is where the cursor is. Using * or # with iskeyword not including > or < will move between <Dealid> and </Dealid> . <Deali#d>4444</Dealid> ... 50 lines <Dealid>6666</Dealid> ... n lines <Dealid>5643</Dealid> I tried :set iskeyword+=< which worked fine for moving to the next match but it changed vey to include the < of the closing tag so moving to the start of 6666 , for eg, and typing vey will yank 6666< rather than 6666 .

Emacs: How to yank the last yanked text regardless of subsequent kills?

蓝咒 提交于 2019-12-02 17:29:57
I often find myself repeatedly yanking something after doing some kills and it becomes a process like: C-y C-y M-y C-y M-y M-y C-y M-y M-y M-y Each time I kill some text it pushes the first kill back in the kill ring so that I need to cycle through all the kills to return to text I want to yank. What I want to do is repeatedly yank the same text while killing text in-between yanks. Is this possible? This is a strange hack, but may help. The first time you use M-y you normally get an error (no previous yank). So the idea is that this first time you get the last yank instead of the last kill.

Vim yanking range of lines

大城市里の小女人 提交于 2019-11-29 20:14:26
I'm a C# developer who has just recently decided to expand my knowledge of the tools available to me. The first tool I've decided to learn is Vi/Vim. Everything has been going well so far, but there are a couple of questions I can't seem to find the answer to: Lets say I wanted to yank a range of lines. I know there are many ways of doing so, but I would like to do it by line number. I figured it would be similar to how the substitute commands work, something like 81,91y . Is there a way to do this? I'm a little confused about the g command in normal mode. It seems to do a myriad of things and