diff --git a/.visual.txt.swp b/.buf-dad.txt.swp similarity index 75% rename from .visual.txt.swp rename to .buf-dad.txt.swp index 580df13..fa9e635 100644 Binary files a/.visual.txt.swp and b/.buf-dad.txt.swp differ diff --git a/buffer-tut.txt b/buffer-tut.txt new file mode 100644 index 0000000..d059057 --- /dev/null +++ b/buffer-tut.txt @@ -0,0 +1,133 @@ +Buffer +---------- + +Defination: It is the in-memory defination of a file. + It represent the content of the file by + storing it inside memory. + +Opening multipe files in Vim. + +* From terminal + vim .... + + +* Shell expansion shortcuts: + vim file* + + This will open all the file which follow pattern + in their file name that is mentioned as an argument + here. + +* To see all the open buffers: + + Use commands: :buffers + +* To know more on buffers: + + Use commands: :h :buffers + +* To change the buffer to another opened file + + :buffer + :buffer + + Note : Instead of :buffer, we can use :b. + +* To open to the next buffer of the current opened buffer. + + We can use: :bnext or :bn + + To do this in opposite direction we can use: + + :bprevious or :bp + +* To go to the first buffer. + + :bfirst or :bf + +* To go the last buffer. + + :blast or :bl + +* Shortcut key-binding to move to the previously editing buffer. + + CTRL + ^ + +* The %a and # symbol meaning. + + %a : Represent the active buffer and currently loaded. + # : Represent the previously editing buffer. + +* Another way to move back to the alternate buffer. + + :b# + +%% TIPS %% + +When we try to do the editing on the current buffer and check the +buffer list. +It will present a '+' indicating that the editing done is not saved. +And when we try to change the buffer, it wil throw error. + +We can still force to change the buffer by using '!'. + +------------------------------ + +There are three states of buffer. + +-> Active state and showing the buffer. + +-> Inactive state and not shown in the buffer. + +-> Inactive state but in the memory. (#h +) + + +* To allow the buffer to be hidden without writing it into the file. + We can use option: + :set hidden + + This allow to edit multiple buffer without necessarily writing it. + +* To abandone all the changes of all the buffer. + + :qall! + +* To save all the changes of all the buffer. + + :wall + +* To open another file without switching to that new window of the same file. + + :badd + +* To unload a currently active buffer. + + :bdelete or :bd -> This is optional if the buffer is not the current active file. + +* To delete range of buffer. + + :,bd + + and + To delete all the buffer. + :%bd + +* To execute a line command on each and every buffer. + + :bufdo set