New answers tagged

0

In insert mode, Press Ctrl + R and then =. Now, you are in command line mode and a 'equal to' sign is shown. Type system('cat filename') The content of another file 'filename' is pasted in next line of cursor. Explanation: Ctrl+R pastes the content of any register. = executes/evaluates the function/expression. Hence, you paste the output of the ...


0

You could issue these commands (they're in ex mode): :.,$d :w! stuff2.txt The problem now is that vi has an internal representation of stuff.txt that is the same as the file stuff2.txt. So, you should issue one more command: :e! That will cause vi to read stuff.txt again, which effectively undoes the delete.


1

t$v,c Or if you want to create a text object: onoremap i$ :normal! T$v,<cr> vnoremap i$ <esc>T$v,


12

You don't need Shift + k. Using Esc + v will work since you are allowing shell command line editing using the built-in vi editor using set -o vi (same can be acheieved with Ctrl + x + e). This is equivalent to execute the builtin fc command which is useful to manipulate the history list and history file. It will invoke whatever editor is set in your $EDITOR ...


10

This allows you to construct a command with full Vi editing. If you type some commands in and save exit :wq the commands will be run. CLARIFICATION: it allows you to construct the command in whatever editor you have set in $EDITOR and when you save and quit from it the contents will be run. (Clarified that it's not just Vi!) ALSO, as noted by RealSkeptic, ...


1

Use the following code for replacing the "dots" :%s/\./_/g <ENTER> Here "_" is replaced word.



Top 50 recent answers are included