Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vim Cheatsheet #85

Open
AllanChain opened this issue Apr 18, 2020 · 0 comments
Open

Vim Cheatsheet #85

AllanChain opened this issue Apr 18, 2020 · 0 comments
Labels
blog: cheatsheet |108686978-1ae51480-7531-11eb-93c7-d201146b237d.jpg @post This is a blog post tag: vim

Comments

@AllanChain
Copy link
Owner

AllanChain commented Apr 18, 2020

View Post on Blog


Getting help

ctrl+] to follow link, ctrl+t to trace back.

Quit all

:qa

Scroll the terminal

From https://stackoverflow.com/a/50545253/8810271

ctrl+w N (notice the capital N) to enter terminal normal mode. You can even search in the terminal output!

And hit either i or a to enter insert mode.

Open terminal / help page verically

Use the :vert[ical] command modifier:

:vert term
:vert help ex

Enter normal mode for command history

CTRL-F q: q/ q?

Paste yanked text into the Vim command line

From https://stackoverflow.com/a/3997110/8810271

Hit Ctrl-R then ". If you have literal control characters in what you have yanked, use Ctrl-R, Ctrl-O, ".

PS: this Stack Overflow answer is excellent, maybe I will translate it into Chinese later.

Excute command on matched line

:h global for more information

:[range]g[lobal]/{pattern}/[cmd]

Execute the Ex command [cmd] (default ":p") on the lines within [range] where {pattern} matches.

For pattern not match, use :g! or :v instead. You can use another charater as delimiter or even nest g and v.

If you want to excute normal commands, just :g/This line/norm 3dd.

What is Ex mode?

Switch to "Ex" mode. This is a bit like typing ":" commands one after another, except:

  • You don't have to keep pressing ":".
  • The screen doesn't get updated after each command.
  • There is no normal command-line editing.
  • Mappings and abbreviations are not used.

Therefore, Ex command can simply be considered as command.

Measure startup time

vim --startuptime vim.log
@AllanChain AllanChain changed the title Vim | AC's Blog Vim Cheatsheet Jul 1, 2020
@AllanChain AllanChain added blog: cheatsheet |108686978-1ae51480-7531-11eb-93c7-d201146b237d.jpg tag: vim @post This is a blog post labels Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blog: cheatsheet |108686978-1ae51480-7531-11eb-93c7-d201146b237d.jpg @post This is a blog post tag: vim
Projects
None yet
Development

No branches or pull requests

1 participant