Quantcast
Channel: Commands tagged vim sorted by votes
Browsing all 51 articles
Browse latest View live
↧

Image may be NSFW.
Clik here to view.

Increment next number in vim

$ CTRL + A ( in normal mode ) View this command to comment, vote or add to favourites View all commands by Zulu Diff your entire server config at ScriptRock.com

View Article


Image may be NSFW.
Clik here to view.

Run bash on top of a vi session (saved or not saved), run multiple commands,...

$ :shell View this command to comment, vote or add to favourites View all commands by unixmonkey41067 Diff your entire server config at ScriptRock.com

View Article


Image may be NSFW.
Clik here to view.

Open all files with a regular expression in vim

$ vim $(grep [REGULAR_EXPRESSION] -R * | cut -d":" -f1 | uniq) View this command to comment, vote or add to favourites View all commands by eduardostalinho Diff your entire server config at...

View Article

Image may be NSFW.
Clik here to view.

Open (in vim) all modified files in a git repository

$ vim `git status | grep modified | awk '{print $3}'` This oneliner gets all the 'modified' files in your git repository, and opens all of them in vim. Very handy when you're starting to work in the...

View Article

Image may be NSFW.
Clik here to view.

Open (in vim) all modified files in a git repository

$ vim `git status --porcelain | sed -ne 's/^ M //p'` The option --porcelain makes the output of git easier to parse. This one-liner may not work if there is a space in the modified file name. View this...

View Article


Image may be NSFW.
Clik here to view.

Grep inside Vim and navigate results

$ :vimgrep pattern % Will search for the given pattern and build a list of occurrences. Then you can use :copen and :cclose to toggle the list. When browsing the list, ENTER will take you to that line...

View Article

Image may be NSFW.
Clik here to view.

Paste what you previously wrote in INSERT MODE

$ . (in NORMAL MODE) Paste what you previously wrote in INSERT MODE, for example: 1. Write 'foo' in INSERT MODE 2. Return to NORMAL MODE 3. Press "." and it will paste 'foo' View this command to...

View Article

Image may be NSFW.
Clik here to view.

edit hex mode in vim

$ :%!xxd return to normal mode from hex mode :%!xxd -r View this command to comment, vote or add to favourites View all commands by b1067606 Diff your entire server config at ScriptRock.com

View Article


Image may be NSFW.
Clik here to view.

vim multiple files at one time, split vertically.

$ vim -O file1 file2 View this command to comment, vote or add to favourites View all commands by kyle Diff your entire server config at ScriptRock.com

View Article


Image may be NSFW.
Clik here to view.

vi a remote file with port

$ vim sftp://[user@]host.domain.tld:[port]/[path/][file] vim can open ssh/sftp and ftp connections for file editing using 'netrw'. If no path or file is provided vim opens the directory as a filelist....

View Article

Image may be NSFW.
Clik here to view.

Open (in vim) all modified files in a git repository

$ vim -p `git --porcelain | awk {print $2}` Opens all files in the index (modified plus not added yet) in tabs in vim. View this command to comment, vote or add to favourites View all commands by...

View Article

Image may be NSFW.
Clik here to view.

Go to a specified line in a file

$ vim +143 filename.txt View this command to comment, vote or add to favourites View all commands by techie Diff your entire server config at ScriptRock.com

View Article

Image may be NSFW.
Clik here to view.

Open a file using vim in read only (like less)

$ vim -R /etc/passwd View this command to comment, vote or add to favourites View all commands by techie Diff your entire server config at ScriptRock.com

View Article


Image may be NSFW.
Clik here to view.

Open a file using vim in read only (like less)

$ view /file/name View this command to comment, vote or add to favourites View all commands by mc0e Diff your entire server config at ScriptRock.com

View Article

Image may be NSFW.
Clik here to view.

Load your [git-controlled] working files into the vi arglist.

$ vim $(git diff origin/master --name-only) Branch name may be substituted, of course. View this command to comment, vote or add to favourites View all commands by sodapopcan Diff your entire server...

View Article


Image may be NSFW.
Clik here to view.

Delete all empty lines from a file with vim

$ ggqqqqq/^$dd@qq@q Here's the other way of doing it in vim: setting a recursive macro. 'gg' brings you to the top of the buffer, 'qqq' clears the 'q' macro, 'qq' starts recording a macro called 'q',...

View Article

Image may be NSFW.
Clik here to view.

Delete all empty lines from a file with vim

$ :v/./d If you need to delete lines that may contain space characters (such as tabs or spaces) as well as empty ones, try: :v/\S/d Just an alternative. View this command to comment, vote or add to...

View Article


Image may be NSFW.
Clik here to view.

Include a remote file (in vim)

$ :r scp://yourhost//your/file Like vim scp://yourhost//your/file but in vim cmds. View this command to comment, vote or add to favourites View all commands by Zulu Diff your entire server config at...

View Article

Image may be NSFW.
Clik here to view.

vim - save document with privileges from vim

$ :w !sudo tee % View this command to comment, vote or add to favourites View all commands by KodjoSuprem Diff your entire server config at ScriptRock.com

View Article

Image may be NSFW.
Clik here to view.

vi show line numbers

$ :set number Prints line numbers making it easier to see long lines that wrap in your terminal and extra line breaks at the end of a file. :set nu works too. View this command to comment, vote or add...

View Article
Browsing all 51 articles
Browse latest View live