---Use, turn coloring on/off for easy viewing: VIM ':colorscheme default' OR VI ':sytnax on' --VI coloring may not work with remote SSH, use VIM instead---
###################---How to Use VIM---
---Quick Use and Recommended Settings---
##How and What They Do
NORMAL Mode ##Press 'ESC' key, for editing and VIM commands, MUST be in this mode before changing to other modes
INSERT Mode ##Press 'i' key, for entering text into file
VISUAL Mode ##Press v, VISUAL mode is for copy and pasting text. Use 'h,j,k,l' or arrow keys to select text.
###Not the text you wanted? Hit 'ESC' twice and move cursor to new start position, then 'CTRL+v' to select again
####After you have selected the text you want: 'y' is for yank (copy), 'x' cut, 'p' paste
: ##Press 'ESC' then type ':', for entering VIM COMMAND Mode, ex. ':w!' means write (save) file
------------------------------
:45 ##Navigate to VIM commands
:108 --------------------- ##System Utilities and Tweaks
:164 ##SNMP Commands
:175 --------------------- ##mySQL Commands
:208 ##ImageMagick Commands
:214 --------------------- ##Process Commands
:226 ##File System Commands
:255 --------------------- ##Services Commands
:290 ##Keyboard Shorcuts
:297 --------------------- ##Grep, Find, SED and AWK Commands, look for stuff
:328 ##Network Commands
:398 --------------------- ##SSH Setup and SFTP
:436 ##Yum and RPM Commands, set local repository
:540 --------------------- ##iperf Commands
:549 ##Apache Commands
:558 --------------------- ##FTP using Curl command
:576 ##GRUB and Kernel
:594 --------------------- ##Format and Mount Hard Drive
---My VIM Config-place in ~/.vimrc -create it if it does not exist---
:setcolorscheme default ##for easy to read text coloring
:set virtualedit+=block ##sets VIRTUAL BLOCK mode to allow cursor to not be limited to line columns
:set tabstop=4 ##tabs are '4' columns wide
:set softtabstop=4 ##when you insert a new tab it is '4' columns wide
:set expandtab ##convert tabs to spaces, don't use tabs, they suck
:set cursorline ##shows a line under current line for easy visual cursor pickup
:set wildmenu ##show autocompletion menu in COMMAND mode
:nnoremap > $ ##remap '$' to '>', used in NORMAL mode to skip to end of line
:nnoremap < ^ ##remap '^" to '<', used in NORMAL mode to skip to beginning of line
:nnoremap W
----------------------------------------------------------------------
---VIM Junk---
---MODES---
ESC ##NORMAL mode (escape mode), used for editing text and must be in this mode to switch to COMMAND, INSERT, VISUAL
: ##COMMAND mode, press ESC key then type ':
---MODE USAGE---
dd ##NORMAL mode, delete line, also copies the deleted text into buffer, use 'p' or :put to paste the text
d$ ##NORMAL mode, delete from cursor to the end of the line
D ##NORMAL mode, delete from cursor to end of line
$ ##NORMAL mode, skip to end of line
0 ##NORMAL mode, 0 (zero) moves to beginning of line
h,j,k,l ##NORMAL mode, navigate with keys, left, down, up, right respectively
gg ##NORMAL mode, move to beginning of file
G ##NORMAL mode, move to end of file
u ##NORMAL mode, undo
o ##NORMAL mode, insert line below cursor, then enters INSERT mode
O ##NORMAL mode, insert line above cursor, then enters INSERT mode
nG ##NORMAL mode, move to line number n, ex. 10G would move to line 10
g then CTRL+g ##NORMAL mode, show file statistics, word, character count, etc. press 'g' them 'CTRL+g'
/matchingstring ##COMMAND mode, find and highlight all words that match a string, in this case 'matchingstring', pressing 'n' scrolls down matching words, 'N' scrolls up, use :noh to turn off highlighting
:vsplit ##COMMAND mode, vertical split screen for editing two files, just using the vsplit command will open a duplicate of current file, ctrl+w then 'h' or 'l' (or arrow keys) will move between screens
:split ##COMMAND mode, horizontal split screen for editing two files, just using the vsplit command will open a duplicate of current file, ctrl+w then 'j' or 'k' (or arrow keys) will move between screens
##adding a filename after vsplit or split will open that file in the split
:q! ##COMMAND mode, quit VIM WITHOUT saving
:w! ##COMMAND mode, save the file
:w /foo/bar/file ##COMMAND mode, save to file to /foo/bar/file
:wq! ##COMMAND mode, will save the file, then quit VIM
:syntax on ##COMMAND mode, turn syntax on in vi to make it easier to browse this document, hightlights text, use :colorscheme default in vim
:colorscheme default ##COMMAND mode, used in vim to color syntax for easy human interpretation of text. You can enter :colorscheme and use the up and down arrows to scroll through the available schemes, similar to 'syntax on' in vi
:set number ##COMMAND mode, show line numbers
:set paste ##COMMAND mode, paste INSERT mode, for pasting text WITHOUT auto formatting, e.g. auto comments, auto indenting
:noh ##COMMAND mode, turn off highlighting
:%s/foo/bar/gc ##COMMAND mode, '%s' substitute, find 'foo' and replace with 'bar', 'g' global, find all that match 'foo','c' confirm before replacing
:set spell spelllang=en_us ##COMMAND mode, turn on spell checking
:set nospell ##COMMAND mode, turn off spell checking
:set formatoptions-=r ##COMMAND mode, diable auto-commenting '#"' or '##', use for cutting and pasting multi-line text/code
:%s/foo/bar ##COMMAND mode, search for 'foo' and replace all with 'bar', use ':noh' to stop highlighting after the search is complete
:%s/foo/bar/c ##COMMAND mode, search for 'foo' and replace with 'bar', ask for confirmation for each matching 'foo' before the string is replaced, use ':noh' to stop highlighting after search is complete
:22,39s/^/#/g ##COMMAND mode, comment out a section of code using '#', from line 22 through 39
:22,39s/^#//g ##COMMAND mode, uncomment out a section of code matching first '#' of line, from line 22 through 39
:%s/^/#/g ##COMMAND mode, uncomment all lines, be careful...
:set virtualedit+=block ##COMMAND mode, by default VISUAL BLOCK mode will allow you to select multiple lines that are NOT the same length. If the cursor starts on a short line then ends up on a long line you can't select the whole long line, this fixes that VIM behavior
:hi Search cterm=NONE ctermfg=white ctermbg=green ##COMMAND mode, set search highlighting to characters 'white' and background 'green'
y ##VISUAL mode, copy text, you can switch between other modes and the text will still be stored for later usage
x ##VISUAL mode, cut text
p ##VISUAL mode, paste text
:put ##COMMAND mode, put copied text from VISUAL mode starting on the line below the cursor