pyratelog

personal blog
git clone git://git.pyratebeard.net/pyratelog.git
Log | Files | Refs | README

commit 64a2632d61576c4ba8a9110599ba7c390e0d51cb
parent 27f069031e6b28f2e52775d5e5e28cf7d1cdbd10
Author: pyratebeard <root@pyratebeard.net>
Date:   Wed, 12 Apr 2023 21:39:19 +0100

buffer_me_up

Diffstat:
Mentry/buffer_me_up.md | 18+++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/entry/buffer_me_up.md b/entry/buffer_me_up.md @@ -2,11 +2,11 @@ This is one of a few entries I am working on about everyone's favourite text edi I have been using Vim as my main (read "_only_") text editor for many years. Over this time I have continuously learnt new ways of working and how to use Vim's functions properly. -In the past couple of years I have been working on enhancing my Vim workflow and the first step was to master [buffers](https://vim.fandom.com/wiki/Buffers){target="_blank" rel="noreferrer"}. +In the past couple of years I have been working on enhancing my Vim workflow, the first step was to master [buffers](https://vim.fandom.com/wiki/Buffers){target="_blank" rel="noreferrer"}. When I switched to Vim from [Sublime](https://www.sublimetext.com/){target="_blank" rel="noreferrer"} I had trouble getting over the use of tabs for open files. Sublime, like a lot of GUI text editors, would open files in tabs at the top of the window. Vim does have tabs but they are not generally used in the same way. -Opening a file in Vim creates a buffer, by default filling the window. If you open another file the new buffer will fill the window, replacing the original buffer. To view your buffers incant +Opening a file in Vim creates a buffer, by default filling the window. If another file is opened the new buffer will fill the window, replacing the original buffer. To view buffers incant ``` :buffers ``` @@ -24,9 +24,9 @@ This will list all open buffers displaying them each with a unique number, one o In this example there are two buffers open, numbered 1 and 5. The `a` indicator on buffer 1 means it is the active buffer, i.e. what is currently loaded in the window. The `#` and `h` indicators on buffer 5 mean it is the alternate buffer (`#`) and it is hidden (`h`), i.e. it is loaded but not visible. -The alternate buffer indicator is normally the previously active buffer. You can quickly switch to this buffer with `CTRL-^` (that's `CTRL`, `SHIFT`, `6`, although most terminals will do the same with `CTRL`, `6`). This means if you are working on two files you can quickly toggle between them using `CTRL-^`. +The alternate buffer indicator is normally the previously active buffer. Switching to this buffer is done with `CTRL-^` (that's `CTRL`, `SHIFT`, `6`, although most terminals will do the same with `CTRL`, `6`). Meaning if two files are being worked on quickly toggle between them using `CTRL-^`. -The unique number of a buffer doesn't change once it is open. If you know the number of a buffer you can switch to it using `<number> CTRL-^`, or incant +The unique number of a buffer doesn't change once it is open. If the number of a buffer is known switch to it using `<number> CTRL-^`, or incant ``` :buffer <number> ``` @@ -42,9 +42,9 @@ In my ~/.vimrc I set the following keymap nnoremap <leader>b :ls<CR>:b ``` -With this I type `\b` (backslash is the default 'leader' key) to view my buffers and the prompt will wait for me to type a number and hit enter. It has made managing a large number of buffers quite easy. Vim also has a built in auto-complete. By entering `:b <TAB>` Vim will cycle through the buffers, or start typing part of the filename or filepath and it will auto-complete. +With this I type `\b` (backslash is the default 'leader' key) to view my buffers, the prompt will wait for me to type a number and hit enter. It has made managing a large number of buffers quite easy. Vim also has a built in auto-complete. By entering `:b <TAB>` Vim will cycle through the buffers, or start typing part of the filename or filepath and it will auto-complete. -You can find out more about buffers using Vim's help pages +Find out more about buffers using Vim's help pages ``` :help buffers :help :buffers @@ -56,7 +56,7 @@ Vim has the ability to split the window in order to show multiple buffers. With :split <filename> ``` -This will split the window horizontally and load the new buffer so you can view both files at once. It is also easy to split a loaded buffer with +This will split the window horizontally loading the new buffer so both files can be viewed at once. It is also easy to split a loaded buffer with ``` :sb<number> ``` @@ -75,7 +75,7 @@ To vertical split a loaded buffer incant Navigating between splits can be done with `CTRL-W` commands, e.g. `CTRL-W h`, `CTRL-W j`, `CTRL-W k`, `CTRL-W l` are left, down, up, right, respectively. ## tabulous -As mentioned previously Vim does have [tabs](https://vim.fandom.com/wiki/Quick_tips_for_using_tab_pages){target="_blank" rel="noreferrer"} but they aren't designed to be used like other text editors. If you have a few buffers open in splits, then maybe opening another file for a quick change, such as a 'scratchpad', could mess up your layout. Opening a tab will allow you to edit another file without disturbing your split layout. +As mentioned previously Vim does have [tabs](https://vim.fandom.com/wiki/Quick_tips_for_using_tab_pages){target="_blank" rel="noreferrer"} but they aren't designed to be used like other text editors. If there are a few buffers open in splits, maybe opening another file for a quick change, such as a 'scratchpad', could mess up the layout. Opening a tab will allow another file to be edited without disturbing the split layout. To open a new file in a tab incant ``` @@ -96,4 +96,4 @@ To find out more about tabs incant :help tabs ``` -This has only been a brief overview of buffers, splits, and tabs. For those that found this interesting take a look at the Vim help pages, or online resources such as [Vim Tips Wiki](https://vim.fandom.com/wiki/Vim_Tips_Wiki){target="_blank" rel="noreferrer"}, and embrace Vim as it was designed. If you learnt something from this post, or even if you have any tips for working with buffers, splits, or tabs, I would love to hear about it; contact information can be found on my [homepage](https://pyratebeard.net){target="_blank" rel="noreferrer"}. +This has only been a brief overview of buffers, splits, and tabs. For those that found this interesting take a look at the Vim help pages, or online resources such as [Vim Tips Wiki](https://vim.fandom.com/wiki/Vim_Tips_Wiki){target="_blank" rel="noreferrer"}, and embrace Vim as it was designed.