Tag Info

New answers tagged


As the external command is executed through the shell, you just have to append a & to launch the process in the background: nnoremap <leader>dc :execute 'silent !drush cc all &' | redraw!


note that in your question, echo > test.txt creates a file with a single line break in it, not an empty file. From the shell, consider using echo -n > test.txt or : > test.txt. While I'd generally use a vi editing command (I use ggdG), you can also call out to the shell with a reference to the current file like so: :!:>% It's nearly as ...


I'm a lazy dude, and I like to keep it simple. ggdG is five keystrokes including Shift gg goes to the first line in the file, d is the start of the delete verb and G is the movement to go to the bottom of the file. Verbosely, it's go to the beginning of the file and delete everything until the end of the tile.


Go to the beginning of the file and press dG.


I always use ggVG gg jumps to the start of the current editing file V (capitalized v) will select the current line. In this case the first line of the current editing file G (capitalized g) will jump to the end of the file. In this case, since I selected the first line, G will select the whole text in this file. Then you can simply press d or x to delete ...


If your cursor is on the first line (if not, type: gg or 1G), then you can just use dG. It will delete all lines from the current line to the end of file. So to make sure that you'll delete all the lines from the file, you may mix both together, which would be: ggdG (while in command mode). Related: How I can delete in VIM all text from current line to end ...


I use the c, "change", command quite frequently for this kind of thing, combined with regular search. You can search the file for each line/piece of text you are interested in and then use consecutive n. commands (n for next and then . to repeat the last change.) /^hello - find line beginning with hello; c$goodbye - change line to goodbye; n. - repeat find, ...


In vi I use :%d where : tells vi to go in command mode % means all the line d : delete On the command line, > test.txt will do also. What is the problem with dd? dd if=/dev/null of=test.txt where /dev/null is a special 0 byte file if is input file of is ouput file


In vi do :1,$d to delete all lines. The : introduces a command (and moves the cursor to the bottom). The 1,$ is an indication of which lines the following command (d) should work on. In this case the range from line one to the last line (indicated by $, so you don't need to know the number of lines in the document). The final d stands for delete the ...


I'd recommend that you just do this (should work in any POSIX-compliant shell): > test.txt If you really want to do it with vi, you can do: 1G (go to first line) dG (delete to last line)


There is no need to patch the ~/.viminfo file. As you are using vim you can use the +/pattern commandline option to get the cursor on the line of the pattern. After that you can use n to get to the following occurrences (if not at the start of the line it will be the first otherwise the second occurrence). The man page says that the cursor will be at the ...


No, there is unfortunately no history support in the SVR4 release of vi. Note it is not vi version 4 but "Version SVR4.0, Solaris 2.5.0". This version string is hardcoded and reported even in recent releases (Solaris 2.5 is something like 18 years old). Starting from Solaris 11, vim is bundled with the OS.

Top 50 recent answers are included