yank

Vim yanking range of lines

心不动则不痛 提交于 2019-11-28 16:15:35
问题 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

How to select between brackets (or quotes or …) in Vim?

浪子不回头ぞ 提交于 2019-11-28 14:56:19
I'm sure there used to be a plugin for this kinda stuff, but now that I need it, I can't seem to find it (naturally), so I'll just ask nice and simple. What is the easiest way to select between brackets, or quotes, or generally a list of matching characters? write ( *, '(a)' ) 'Computed solution coefficients:' For example, here I'd like to select (a) , or Computed solution coefficients: . I'm not interested in multiline, just cases which occur on one line. Tim Whitcomb Use whatever navigation key you want to get inside the parentheses, then you can use either yi( or yi) to copy everything

Yank file name / path of current buffer in Vim

泄露秘密 提交于 2019-11-28 02:39:11
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 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 @" = expand("%")<cr> you can also use this for full path :let @" = expand("%:p") Explanation Vim uses the unnamed