Showing posts with label vi editor. Show all posts
Showing posts with label vi editor. Show all posts

Wednesday, 9 October 2019

VIM editor series II

Here is second post on the vi editor commands.
Insert a file content

:r file_name or file_path

example: Need to paste the info from file B to A      

           Copied the content to file A from file B using command :r B 

Repeat the Last Action 

. (dot or aka period or full stop)

  • Suppose you press dd to delete the line. Next if  you want to delete the next line you press dd or .(dot)
  • Suppose you press Hi and you like to repeat the action then just press .(dot) in normal mode of vi editor

Display the line numbers
enable the line number 

:set number or :set nu 

disable the line numbers

:set nonumber or :set nonu

Reversing the Order of lines 

:g/^/m0

:—- start the command line mode

g—- action will be taken all lines in the files
^—-matches the starting of the line
m—moves the elements
0—Is the destination line, beginning of the buffer

If i need to reverse the lines between a certain range(like between 30 and 40 lines), then we can use the following command
:30,40g/^/m29

To control the position of split window
:set splitbelow or splitright

Undo and Redo
In normal mode conditions

  • use u for undo the action
  • cntrl+r for redo the action 

Sunday, 6 October 2019

VIM editor series I

Search A Pattern

  • Press Esc
  • Then type / or ? and the pattern need to search

To do Substitution

:%s/Old String/New String/g 

Converting the Tab to Spaces

:set expandtab 


To control the number of space character need to be inserted when the tab was used

:set tabstop=4 

After the expandtab option is set all the new tab characters entered will be changed to spaces. This will not affect the exiting tab characters. To change all the existing tab characters to match the current tab settings use

:retab 

Display the line numbers
enable the line number

:set number or :set nu 

disable the line numbers

:set nonumber or :set nonu 

Reversing the Order of lines

:g/^/m0


:—- start the command line mode
g—- action will be taken all lines in the files
^—-matches the starting of the line
m—moves the elements
0—Is the destination line, beginning of the buffer

If i need to reverse the lines between a certain range(like between 30 and 40 lines), then we can use the following command

:30,40g/^/m29 

To control the position of split window

:set splitbelow or splitright 

Undo and Redo
        In normal mode conditions

  • use u for undo the action
  • cntrl+r for redo the action        

Physical Cells :TAP CELLS, TIE CELLS, ENDCAP CELLS, DECAP CELLS

Tap Cells (Well Taps) :  These library cells connect the power and ground connections to the substrate and n­wells, respectively.  By plac...