Self Inflicted Gyaan


Useful Vim Commands

nG
After a search when you have reached the first match gets you back to where you were before searching.
set expandtab
:retab
You have managed to get your code to look pretty with extensive use of tabs. Converts the tab spaces in the code to equivalent spaces.
:x,y!sort
Sorts line numbers x to y alphabetically.
~
When in visual block select mode(ctrl+v), changes the case of selected text.


zf#j creates a fold from the cursor down # lines.
zf/string creates a fold from the cursor to string .
zj moves the cursor to the next fold.
zk moves the cursor to the previous fold.
zo opens a fold at the cursor.
zO opens all folds at the cursor.
zm increases the fold-level by one.
zM closes all open folds.
zr decreases the foldlevel by one.
zR decreases the foldlevel to zero -- all folds will be open.
zd deletes the fold at the cursor.
zE deletes all folds.
[z move to start of open fold.
]z move to end of open fold.


Regexes for converting Verilog port declaration to VHDL:
%s/input\s\+\[\(\d\+\):\(\d\+\)]\s\+\(\w\+\)/\3\t\t:IN STD_LOGIC_VECTOR(\1 downto \2)/g
%s/input\s\+\(\w\+\)/\1\t\t:IN STD_LOGIC/g

From VHDL to verilog:
%s/\(\w\+\)\s*:\s*IN\s*STD_LOGIC_VECTOR(\(\d\+\)\s*DOWNTO\s*\(\d\+\)\s*)\s*;.*/\tinput\t[\2:\3]\t\1\t,/g

%s/\(\w\+\)\s*:\s*IN\s*STD_LOGIC\s*;.*/\tinput\t\t\t\1\t,/g

mishrav's shared items