From c64647f884096cb8af5e80688b56ae14c9128c79 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Thu, 17 Aug 2017 11:39:14 -0500 Subject: [PATCH] Add Quickly Switch To A Buffer By Number as a vim til --- README.md | 3 ++- vim/quickly-switch-to-a-buffer-by-number.md | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 vim/quickly-switch-to-a-buffer-by-number.md diff --git a/README.md b/README.md index b0f10bb..ab2d49b 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/). For a steady stream of TILs from a variety of rocketeers, checkout [til.hashrocket.com](https://til.hashrocket.com/). -_550 TILs and counting..._ +_551 TILs and counting..._ --- @@ -609,6 +609,7 @@ _550 TILs and counting..._ - [Quick File Info](vim/quick-file-info.md) - [Quick Man Pages](vim/quick-man-pages.md) - [Quick Quickfix List Navigation](vim/quick-quickfix-list-navigation.md) +- [Quickly Switch To A Buffer By Number](vim/quickly-switch-to-a-buffer-by-number.md) - [Re-indenting Your Code](vim/reindenting-your-code.md) - [Read In The Contents Of A Rails File](vim/read-in-the-contents-of-a-rails-file.md) - [Rename Current File](vim/rename-current-file.md) diff --git a/vim/quickly-switch-to-a-buffer-by-number.md b/vim/quickly-switch-to-a-buffer-by-number.md new file mode 100644 index 0000000..52ab2f8 --- /dev/null +++ b/vim/quickly-switch-to-a-buffer-by-number.md @@ -0,0 +1,21 @@ +# Quickly Switch To A Buffer By Number + +There are a number of different commands you can use for switching to a +buffer by its number. For example, if you want to switch to the buffer +assigned `7`, you can do `:7b` or `:e #7`. However, there is a quicker way +than typing out either of those commands. + +You may already be familiar with `CTRL-^` for switching to the _alternate +file_ which is generally the previous buffer. If you precede that command +with a number, you will switch to the buffer with that number instead of the +alternate file. + +From normal mode + +```vimscript +7 Ctrl-^ +``` + +will switch to buffer `7`. + +See `:h Ctrl-^` for more details.