vi

How to copy and paste between different tmux panes running vim instances

◇◆丶佛笑我妖孽 提交于 2019-11-29 18:59:23
Example: copy in one tmux pane (via vim), then switch to another pane (running another vim instance) and paste using the vim paste command. I know this can be done via tmux (using prefix+]) but it would be really handy if I can copy and paste using vim bindings since i'm just switching between different panes running vim. Any ideas? Sorry, I'm trying to convince you to use vim built-in features. To make the copy/paste easy, you can open files in another Tabpages: :tabe /path/to/another/file Use gt or gT to switch Tabpages. Or split the window to edit another file: :sp /path/to/another/file Use

CentOS下Vim编辑器的使用

扶醉桌前 提交于 2019-11-29 18:57:13
1、进入VIM编辑器,可以新建文件也可以修改文件,命令为:vim /usr/local/con.cfg 2、如果这个文件,以前是没有的,则为新建,则下方有提示为新文件。 如果文件已存在,则没有提示。 3、进入编辑器后,我们先按"I”,即切换到“插入”状态。就可以通过上下左右移动光标,或空格、退格及回车等进行编辑内容了,和WINDOWS是一样的了。 退出vim编辑器的方法及区别 当文本编辑结束之后,通常需要退出编辑器。退出编辑器又分为4种情况:保存退出、正常退出、不保存退出及强制退出。下面简单说下吧! 1、先介绍一下保存退出。当我们编辑或修改好了文件内容。 我们当然要保存并退出了,然后下一步了。这时,我们要按键盘左上角的"ESC",留意到了没有?左下角的插入状态不见了。 2、然后这时,我们输入“冒号”,即":"(不需双引号),在下方会出现冒号,等待输入命令,我输入的是WQ。功能如下。 W:write,写入 Q:quit,退出 再回车,就保存退出了。 保存命令 按ESC键 跳到命令模式,然后: :w 保存文件但不退出vi :w file 将修改另外保存到file中,不退出vi :w! 强制保存,不推出vi :wq 保存文件并退出vi :wq! 强制保存文件,并退出vi q: 不保存文件,退出vi :q! 不保存文件,强制退出vi :e! 放弃所有修改,从上次保存文件开始再编辑

Delete newline in Vim

依然范特西╮ 提交于 2019-11-29 18:35:33
Is there a way to delete the newline at the end of a line in Vim, so that the next line is appended to the current line? For example: Evaluator<T>(): _bestPos(){ } I'd like to put this all on one line without copying lines and pasting them into the previous one. It seems like I should be able to put my cursor to the end of each line, press a key, and have the next line jump onto the same one the cursor is on. End result: Evaluator<T>(): _bestPos(){ } Is this possible in Vim? Xhantar If you are on the first line, pressing (upper case) J will join that line and the next line together, removing

Duplicate a whole line in Vim

会有一股神秘感。 提交于 2019-11-29 18:30:39
How do I duplicate a whole line in Vim in a similar way to Ctrl + D in IntelliJ IDEA/Resharper or Ctrl + Alt + ↑ / ↓ in Eclipse? Mark Biek y y or Y to copy the line (mnemonic: y ank) or d d to d elete the line (Vim copies what you deleted into a clipboard-like "register", like a cut operation) then p to p aste the copied or deleted text after the current line or P to p aste the copied or deleted text before the current line Benoit Normal mode: see other answers. The Ex way: :t. will duplicate the line, :t 7 will copy it after line 7, :,+t0 will copy current and next line at the beginning of

How do I make vim open all files matching a pattern in different tabs?

喜欢而已 提交于 2019-11-29 16:37:07
问题 In a given working directory, if I do :tabe **/test*.py vim complains with E77: Too many file names . What if I want it to open every matching file in a separate tab? There must be a way to do it, but I can't find it. 回答1: You could use the args list and argdo like so: :args **/test*.py :argdo tabe % However, the syntax event is turned off by argdo (to speed up the normal use case), so the files will be loaded without syntax at first. You could follow it up with a :syntax on to force the

How to copy/paste text from vi to different applications

风流意气都作罢 提交于 2019-11-29 15:41:01
Is it possible to copy/paste text without using :vs? If I have two vi windows open, I can copy/paste text with a mouse. How can I do it with a keyboard? I found two existing questions that are similar to this, but neither one answers my question. how to copy codes in vi to clipboard Copy and paste content from one file to another file in VI You can copy/paste by using the + register (read more: Accessing the system clipboard ) "+gyy will yank a line, and put it into the + register. You can paste in your other window with "+p in normal mode, or Ctrl+r + while in insert mode. If you don't wish

取消vi/vim的高亮

℡╲_俬逩灬. 提交于 2019-11-29 14:44:29
当在vi/vim中使用搜索/xxx后,搜索字符会变得高亮,且打开任何文件该字符都会处于高亮,要去除该高亮进入vi/vim后使用:noh即可 来源: https://blog.csdn.net/qq_39777992/article/details/100832843

Map Esc key in Vim

↘锁芯ラ 提交于 2019-11-29 14:39:31
问题 I'm a beginning Vim user. I hate pressing the Esc key, which is a little far on my T61. In order to return to command mode. How do I map it to F4 ? 回答1: For a single session, you could just enter the following keystrokes exactly: esc : i m a p space < f 4 > space < e s c > enter The esc key ensures that you're in command mode, colon starts a line command, and the imap maps the F4 key to ESCAPE. However, if you want this retained for every session, you'll need to put in in your Vim start-up

How can I launch VI from within Java under commons-exec?

霸气de小男生 提交于 2019-11-29 14:38:26
I would like to be able to launch VI from within my Java program and wait for the user to quit VI before proceeding. Here's the code snippet that I have currently: ... String previewFileName="test.txt"; // the file to edit CommandLine cmdLine = new CommandLine("/usr/bin/vi"); cmdLine.addArgument(previewFileName); cmdLine.addArgument(">/dev/tty"); cmdLine.addArgument("</dev/tty"); Executor executor = new DefaultExecutor(); try { DefaultExecuteResultHandler resultHandler = new ResetProcessResultHandler(cmdLine); executor.execute(cmdLine, resultHandler); } catch (IOException e) { throw new Error(

Replace while keeping certain “words” in vi/vim

会有一股神秘感。 提交于 2019-11-29 09:37:52
问题 For example, if I have $asd['word_123'] and I wanted to replace it with $this->line('word_123') , keeping the 'word_123'. How could I do that? By using this: %s/asd\[\'.*\'\]/this->line('.*')/g I will not be able to keep the wording in between. Please enlighten me. 回答1: Using regex, you could do something like :%s/\$asd\['\([^']*\)'\]/$this->line('\1')/g Step by step: %s - substitute on the whole file \$asd\[' - match "$asd['". Notice the $ and [ need to be escaped since these have special