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

Image may be NSFW.
Clik here to view.

vi show line numbers

$ :set nu you don't have to spell out numbers, you can just use nu View this command to comment, vote or add to favourites View all commands by killermike Diff your entire server config at ScriptRock.com

View Article


Image may be NSFW.
Clik here to view.

Format source code noninteractively (possibly en masse) using vim's...

$ vim +"bufdo norm gg=G" +wa +qa FILES The equivalent of opening each file in vim and doing gg=G:wq . Bufdo makes it faster by obviating the need to start vim for each file separately. View this...

View Article


Image may be NSFW.
Clik here to view.

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

$ git status --porcelain | sed -ne 's/^ M //p' | tr '\n' '\0' | tr -d '"' | xargs -0 vim Works even with spaces in filenames. As an alias in .gitconfig: [alias] editchanged = "!git status --porcelain |...

View Article

Image may be NSFW.
Clik here to view.

Save a file you edited in vim without the needed permissions

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

View Article

Image may be NSFW.
Clik here to view.

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

$ vim `git diff --name-only` For editing files added to the index: vim `git diff --name-only --cached` To edit all changed files: vim `git diff --name-only HEAD` To edit changed files matching glob:...

View Article


Image may be NSFW.
Clik here to view.

Update git-based vim plugins in a command

$ cd ~/.vim/bundle/ ; LS="$(ls -1)" ; for DIR in ${LS[@]} ; do cd $DIR ; git pull ; cd .. ; done View this command to comment, vote or add to favourites View all commands by caneta Diff your entire...

View Article

Image may be NSFW.
Clik here to view.

alias to close terminal with :q

$ alias ':q'='exit' Put this in your ~/.bashrc file (or the equivalent) If you use vim a lot, this alias will be immediately obvious. Your brain will thank you. View this command to comment, vote or...

View Article

Image may be NSFW.
Clik here to view.

Make vim open in tabs by default (save to .profile)

$ alias vim="vim -p" I always add this to my .profile rc so I can do things like: "vim *.c" and the files are opened in tabs. View this command to comment, vote or add to favourites View all commands...

View Article


Image may be NSFW.
Clik here to view.

the same as [Esc] in vim

$ Ctrl + [ Faster and more convinent than [Esc] View this command to comment, vote or add to favourites View all commands by light13 Diff your entire server config at ScriptRock.com

View Article


Image may be NSFW.
Clik here to view.

open two files side by side in vim (one window, two panes)

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

View Article

Image may be NSFW.
Clik here to view.

diff current vi buffer edits against original file

$ :w !diff -u % - View this command to comment, vote or add to favourites View all commands by jclulow Diff your entire server config at ScriptRock.com

View Article

Image may be NSFW.
Clik here to view.

view hex mode in vim

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

View Article

Image may be NSFW.
Clik here to view.

Emptying a text file in one shot

$ :%d % = buffer d = delete View this command to comment, vote or add to favourites View all commands by Vilemirth Diff your entire server config at ScriptRock.com

View Article


Image may be NSFW.
Clik here to view.

VIM: Replace a string with an incrementing number between marks 'a and 'b...

$ :let i=0 | 'a,'bg/ZZZZ/s/ZZZZ/\=i/ | let i=i+1 View this command to comment, vote or add to favourites View all commands by res0nat0r Diff your entire server config at ScriptRock.com

View Article

Image may be NSFW.
Clik here to view.

add the result of a command into vi

$ !!command in command mode, navigate your cursor to the line where you want the command output to appear, and hit "!!". No need to enter edit mode or even type a ":" (colon). View this command to...

View Article


Image may be NSFW.
Clik here to view.

Delete DOS Characters via VIM (^M)

$ :set ff=unix And in case you want to migrate back to, err.. MS-DOS: ":set ff=dos" does the opposite. View this command to comment, vote or add to favourites View all commands by Matejunkie Diff your...

View Article

Image may be NSFW.
Clik here to view.

Read the output of a command into the buffer in vim

$ :r !command This will append the output of "command" to whatever file you're currently editing in vim. Who else has good vim tricks? :) View this command to comment, vote or add to favourites View...

View Article


Image may be NSFW.
Clik here to view.

Colored SVN diff

$ svn diff <file> | vim -R - Simple way to achieve a colored SVN diff View this command to comment, vote or add to favourites View all commands by caiosba Diff your entire server config at...

View Article

Image may be NSFW.
Clik here to view.

Delete all empty lines from a file with vim

$ :g!/\S/d This command delete all the empty lines (include the lines with space) from a file. g = global command \S = non-whitespace character; !\S the opposite d = delete a range View this command to...

View Article

Image may be NSFW.
Clik here to view.

Quickly share code or text from vim to others.

$ :w !curl -F "sprunge=<-" http://sprunge.us | xclip Sprunge.us is a code/text sharing site like pastebin, but it is easy to post stuff from the command line. How it works: :w !command In vim, w...

View Article
Browsing all 51 articles
Browse latest View live