From 1ee1d875da643d5a80139c9d961488b5d8264e29 Mon Sep 17 00:00:00 2001 From: gre-ilya Date: Sun, 22 Jun 2025 20:08:10 +0500 Subject: [PATCH] new info! --- new-info.txt | 51 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/new-info.txt b/new-info.txt index d1a250f..6793310 100644 --- a/new-info.txt +++ b/new-info.txt @@ -196,13 +196,13 @@ Commands: Clever tricks (12): - Doe, John => John Doe -- :%s/\([^,]*\), \(.*\)/\2 1/ + Doe, John => John Doe -- :%s/\([^,]*\), \(.*\)/\2 1/ VISUAL SELECT -> :!sort -- will sort lines - K -- opens "man" program on the word - :%s/\s\+$// -- deletes white spaces in the end of lines + K -- opens "man" program on the word + :%s/\s\+$// -- deletes white spaces in the end of lines vim `grep -l frame_counter *.c -- open files with "frame_counter" var 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 @@ -211,12 +211,47 @@ Commands: other direction. Type few letters in command mode and press CTRL-D to see overview. :se -- 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 - :oldfiles than :e #<2 to edit the second file + + Go away and come back (21): + 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 :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: There is lowercase and uppercase marks. Uppercase marks are global, they can help you to switch between the files. Lowercase marks are local for