new info!

This commit is contained in:
gre-ilya 2025-06-22 20:08:10 +05:00
parent 23ae985636
commit 1ee1d875da

View File

@ -196,13 +196,13 @@ Commands:
Clever tricks (12): Clever tricks (12):
Doe, John => John Doe -- :%s/\([^,]*\), \(.*\)/\2 1/ Doe, John => John Doe -- :%s/\([^,]*\), \(.*\)/\2 1/
VISUAL SELECT -> :!sort -- will sort lines VISUAL SELECT -> :!sort -- will sort lines
K -- opens "man" program on the word K -- opens "man" program on the word
:%s/\s\+$// -- deletes white spaces in the end of lines :%s/\s\+$// -- deletes white spaces in the end of lines
vim `grep -l frame_counter *.c -- open files with "frame_counter" var vim `grep -l frame_counter *.c -- open files with "frame_counter" var
use :next and :first to browse through the files use :next and :first to browse through the files
:grep error_string *.c -- open files with concrete variable. :grep error_string *.c -- open files with concrete variable.
use :cn(ext), :cp(rev), :cl(ist), :copen, :cfirst, :clast, :ccNUM goto use :cn(ext), :cp(rev), :cl(ist), :copen, :cfirst, :clast, :ccNUM goto
@ -211,12 +211,47 @@ Commands:
other direction. other direction.
Type few letters in command mode and press CTRL-D to see overview. Type few letters in command mode and press CTRL-D to see overview.
:se<Up> -- go to previous command which starts with se :se<Up> -- go to previous command which starts with se
CTRL-Z -- suspends vim, after that you can use `fg` to restore vim
'0 '1 ... -- Come back to the place, where you left Vim previous time Go away and come back (21):
:oldfiles than :e #<2 to edit the second file CTRL-Z -- suspends vim, after that you can use `fg` to restore vim
:!{program} -- execute program
:r !{program} -- execute program and print its output to vim
'0 '1 ... -- Come back to the place, where you left Vim previous time
:oldfiles than :e #<2 to edit the second file; :split #<3
:browse oldfiles than q than number of file -- to open previous file :browse oldfiles than q than number of file -- to open previous file
:wviminfo! ~/tmp/viminfo in 1 vim than :rviminfo ~/tmm/viminfo in 2 vim :wviminfo! ~/tmp/viminfo in 1 vim than :rviminfo ~/tmm/viminfo in 2 vim
-- to save and restore information while still running Vim -- to save and restore information while still running Vim
:mksession vimbook.vim -- create a session file
:source vimbook.vim or vim -S vimbook.vim -- restore session
Example of project switching:
:wall
:mksession! ~/.vim/secret.vim
:source ~/.vim/boring.vim
Finding the file to edit (22):
edit . -- browse current directory
:cd -- changes current directory
:pwd -- show current directory
:lcd -- to change current directory, unti :lcd usage all windows points
to same directory
gf -- finds file with same name in current directory or in the PATH
:buffers -- list active buffers
:ls -- -||-
There is also information about buffer editing and switching over them,
but I'am too lazy to conspect it.
Editing other files:
vim -x exam.txt -- create, edit and save encrypted file
:set key= -- to turn off encryption
:X -- encrypt current file
Change binary file example:
vim -b datafile -- open file for binary editing
:%!xxd -- translate to HEX view
:%!xxd -r -- back to raw binary view
BTW it's possible to edit compressed formats (.Z, .gz, .bz2)
Hints: Hints:
There is lowercase and uppercase marks. Uppercase marks are global, they There is lowercase and uppercase marks. Uppercase marks are global, they
can help you to switch between the files. Lowercase marks are local for can help you to switch between the files. Lowercase marks are local for