##########################
# remove leading and trailing whitespaces
awk '{$1=$1}1' file.txt
# remove newline charactor
cat out.htm | awk '{printf "%s", $0}'
# add newline coma at end of each line
cat out.htm | awk '{printf "%s,\n", $0}'
######################### in top of Scripts
#!/bin/bash
################################ shellshock
http://techblog.willshouse.com/2014/09/26/how-to-update-bash-on-ubuntu-10-10-maverick-fix-shellshock/
############################## Upgrade BASH
git clone git://git.sv.gnu.org/bash.git
cd bash
./configure
make
make install
###########################################
## for loop_ filename with whitespaces
## http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for f in *
do
echo "$f"
done
IFS=$SAVEIFS
###########################################
###########################3
#
# Rip and Encode Audio CDs
#
###########################3
# get detailed information about drive and audio CD
cdparanoia -vsQ
# Rip Audio CD and Create .WAV Track Files
cdparanoia -B
# Encode To .MP3 Format
lame track01.cdda.wav
# Encode To .OGG Format
oggenc track01.cdda.wav
oggenc -b 500 track01.cdda.wav -o output01.ogg
# http://www.cyberciti.biz/faq/linux-unix-ftp-commands/
# mozilla
ftp://ftpUserName@ftp.nixcraft.net.in
ftp://ftp.freebsd.org/
ftp://ftp@ftp.freebsd.org/
ftp://userName:Password@ftp.nixcraft.net.in/
ftp://ftp:ftp@ftp.freebsd.org/
# ftp command:
ftp user@ftp.example.com
ftp ftp.freebsd.org
# Sample session:
Trying 87.51.34.132...
Connected to ftp.freebsd.org.
220 ftp.beastie.tdk.net FTP server (Version 6.00LS) ready.
Name (ftp.freebsd.org:vivek): ftp
331 Guest login ok, send your email address as password.
Password:
230 Guest login ok, access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
##############
ftp> ls
ftp> cd dirName
ftp> get resume.pdf
local: resume.pdf remote: resume.pdf
229 Entering Extended Passive Mode (|||55093|)
150 Opening BINARY mode data connection for 'resume.pdf' (53077 bytes).
100% |***************************| 53077 12.58 KiB/s 00:00 ETA
226 Transfer complete.
53077 bytes received in 00:04 (12.57 KiB/s)
##############
ftp> get data.tar.gz backup.tar.gz
# To change directory on your local system, enter:
ftp> lcd /path/to/new/dir
ftp> lcd /tmp
# Print local directory:
ftp> lpwd
ftp> pwd
# Download Multiple Files
ftp> mget *
ftp> delete output.jpg
# In this example, upload logo.jpg, enter:
ftp> put logo.jpg
# Upload Multiple Files
ftp> mput *
ftp> mput *.pl
ftp> mkdir dirName
ftp> rmdir dirName
# Set The Mode Of File Transfer
ftp> ascii
ftp> binary
# Connect To Another FTP Server
ftp> open ftp.nixcraft.net.in
# Exit the FTP Session
ftp> quit
ftp> bye
ftp> ?
ftp> help
ftp> help commandName
ftp> help chmod
chmod change file permissions of remote file
##################3
# http://readwrite.com/2013/09/30/understanding-github-a-journey-for-beginners-part-1
#
# https://guides.github.com/
#
##################
#download latest files
git clone www.github.com/username/project.git
#branch
#دایرکتوری های مختلف یک پروژه که حاوی تغییرات افراد مختلف است
#master
#دایرکتوری اصلی که از merg کردت branch ها تشکیل میشود
#commit
# وقتی commit میکنید یک snapshot از پروژه میسازید که میتوان از آنجا پروژه را restore کنید
#help
# list of 21 cimmnad
git help
#config
#simple configuration
#login automaticaly,this way:
git config --global user.name felan
git config --global user.email felan@beh.man
# start new repository
git init
# check the status of your repo &...
git status
#after U add files they are include in gits snapshot of repo
git add
#make snapshot after any change do this
git commit -m "hessage here..."
#make your own branch of proj called cats
git branch cats
#checks out repo that U R not currently inside
git checkout x
#to look at the master branch
git checkout master
#to look at another branch
git checkout cats
#When you’re done working on a branch,
#you can merge your changes back to the
#master branch, which is visible to all
#collaborators
git merge cats
#push local commit online on github
git push
#pull latest changes down to your computer
git pull
#################
#
# delete commits
#
delete all of our commits history,
but keep the code in its current state, try this:
# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH
# Add all the files:
git add -A
# Commit the changes:
git commit -am "Initial commit"
# Delete the old branch:
git branch -D master
# Rename the temporary branch to master:
git branch -m master
# Finally, force update to our repository:
git push -f origin master
#####################################################3
#
# link:
# http://www.selectorweb.com/grep_tutorial.html
# http://www.robelle.com/smugbook/regexpr.html
#
#####################################################3
#Ranges:
# [0-3] is the same as [0123]
# [a-k] is the same as [abcdefghijk]
# [A-C] is the same as [ABC]
# [A-Ca-k] is the same as [ABCabcdefghijk]
#There are also some alternate forms :
# [[:alpha:]] is the same as [a-zA-Z]
# [[:upper:]] is the same as [A-Z]
# [[:lower:]] is the same as [a-z]
# [[:digit:]] is the same as [0-9]
# [[:alnum:]] is the same as [0-9a-zA-Z]
# [[:space:]] matches any white space including tabs
grep -o http[^[:space:]]*.jpg
grep -o '' file.htm
#matches lines containing the "I am a cat" or "I am a dog".
grep "I am a \(cat\|dog\)"
################################################################
#
# Qemu
#
# virtual machin. multi Architecture Emulator
#
################################################################
# http://www.android-x86.org/documents/qemuhowto
# for beter performanc and activate KVM
# run qemu with root permision
#################################################################
#
# ANDROID
#
##################################
## Create 1 G-byte image for storage
qemu-img create ~/android-x86/android-4.0.img 1G
## start virtual machin based in AndroidLiveCD for installation
sudo modprobe kvm
kvm -m 512 -cdrom android-x86-4.3-20130725.iso -hda ./android4.3vm-qemu.img -boot d
## after installation you can start emulator just by this command
kvm -m 512 -hda ~/android-x86/android-4.0.img
## shared directory --this method dosnt work
mount -t 9p -o trans=virtio,version=9p2000.L tag ~/SHARED/
qemu -hda winxp.img -hdb fat:rw:~/SHARED/ -m 512M
-soundhw all
-cdrom /dev/cdrom
-net none
########################
#
# KVM
#
########################
https://software.intel.com/en-us/articles/qemu-boots-and-runs-very-slow-on-linux
########################
sudo modprobe –i kvm-intel
lsmod |grep kvm
#################################################################
#
# WINDOWS
#
##################################
## create image file
qemu-img create winxp.qemu.img 5G
## start qemu with installation CD iso
kvm -m 512 -cdrom windowsXP.iso -hda winxp.qemu.img -boot d
## start virtualy img file
kvm -m 512 -hda winxp.qemu.img
#samba file sharing
...
# networking USB & more ...
# http://alien.slackbook.org/dokuwiki/doku.php?id=slackware:qemu
# sharing samba
# http://resources.infosecinstitute.com/shared-folders-samba-qemu/
qemu-img allows you to create, convert and modify images offline
## make sure your virtual image file is in RAW format(QCOW to RAW):
qemu-img info winXP.qemu.img
######################################################
##
## http://wiki.linuxquestions.org/wiki/
## Qemu_transfer_files_between_host_and_guest_via_the_floppy_drive
##
######################################################
dd if=/dev/zero of=floppy.dd bs=1440K count=1
## mkfs.ext2 floppy.dd
qemu -boot c -net none -hda winXP.img -m 512 -fda ./floppy.dd
## format it in windows and copy your files
## now shotdown and mount image in linux
mount -o loop ./floppy.dd /mnt
##### nime kare
dd -f=/dev/zero 0f=disk1.dd bs=1G count=1
# set partition and fs on it
cfdisk disk1.dd
qemu -m 512 -hda winxp.img -hdb
#format it in windows
# mount it
# I found the answer was to offset the mount command because the image
# was partitioned (i.e. fdisked) and the filesystem further into the image:
mount -o loop,offset=32256 ./disk1.dd /mnt
# slax package manager
slaxpkg
# convert it to slax module
tgz2lzm filename.tgz filename.lzm
deb2lzm filename.deb filename.lzm
# finish & use it. just copy lzm module to 'slax>module
#################################
#
# steam
# game center from Valv vo.
#
#################################
#fix steam error on 64bit systems
http://ubuntuforums.org/showthread.php?t=2233005
## Configuration file for a typical Tor user
## Last updated 9 October 2013 for Tor 0.2.5.2-alpha.
## (may or may not work for much older or much newer versions of Tor.)
##
## Lines that begin with "## " try to explain what's going on. Lines
## that begin with just "#" are disabled commands: you can enable them
## by removing the "#" symbol.
##
## See 'man tor', or https://www.torproject.org/docs/tor-manual.html,
## for more options you can use in this file.
##
## Tor will look for this file in various places based on your platform:
## https://www.torproject.org/docs/faq#torrc
## Tor opens a socks proxy on port 9050 by default -- even if you don't
## configure one below. Set "SocksPort 0" if you plan to run Tor only
## as a relay, and not make any local application connections yourself.
#SocksPort 9050 # Default: Bind to localhost:9050 for local connections.
#SocksPort 192.168.0.1:9100 # Bind to this address:port too.
## Entry policies to allow/deny SOCKS requests based on IP address.
## First entry that matches wins. If no SocksPolicy is set, we accept
## all (and only) requests that reach a SocksPort. Untrusted users who
## can access your SocksPort may be able to learn about the connections
## you make.
#SocksPolicy accept 192.168.0.0/16
#SocksPolicy reject *
## Logs go to stdout at level "notice" unless redirected by something
## else, like one of the below lines. You can have as many Log lines as
## you want.
##
## We advise using "notice" in most cases, since anything more verbose
## may provide sensitive information to an attacker who obtains the logs.
##
## Send all messages of level 'notice' or higher to /var/log/tor/notices.log
#Log notice file /var/log/tor/notices.log
## Send every possible message to /var/log/tor/debug.log
#Log debug file /var/log/tor/debug.log
## Use the system log instead of Tor's logfiles
#Log notice syslog
## To send all messages to stderr:
#Log debug stderr
## Uncomment this to start the process in the background... or use
## --runasdaemon 1 on the command line. This is ignored on Windows;
## see the FAQ entry if you want Tor to run as an NT service.
#RunAsDaemon 1
## The directory for keeping all the keys/etc. By default, we store
## things in $HOME/.tor on Unix, and in Application Data\tor on Windows.
#DataDirectory /var/lib/tor
## The port on which Tor will listen for local connections from Tor
## controller applications, as documented in control-spec.txt.
#ControlPort 9051
## If you enable the controlport, be sure to enable one of these
## authentication methods, to prevent attackers from accessing it.
#HashedControlPassword 16:8776A3D701AD684053EC4C
#CookieAuthentication 1
############### This section is just for location-hidden services ###
## Once you have configured a hidden service, you can look at the
## contents of the file ".../hidden_service/hostname" for the address
## to tell people.
##
## HiddenServicePort x y:z says to redirect requests on port x to the
## address y:z.
#HiddenServiceDir /var/lib/tor/hidden_service/
#HiddenServicePort 80 127.0.0.1:80
#HiddenServiceDir /var/lib/tor/other_hidden_service/
#HiddenServicePort 80 127.0.0.1:80
#HiddenServicePort 22 127.0.0.1:22
################ This section is just for relays #####################
#
## See https://www.torproject.org/docs/tor-doc-relay for details.
## Required: what port to advertise for incoming Tor connections.
#ORPort 9001
## If you want to listen on a port other than the one advertised in
## ORPort (e.g. to advertise 443 but bind to 9090), you can do it as
## follows. You'll need to do ipchains or other port forwarding
## yourself to make this work.
#ORPort 443 NoListen
#ORPort 127.0.0.1:9090 NoAdvertise
## The IP address or full DNS name for incoming connections to your
## relay. Leave commented out and Tor will guess.
#Address noname.example.com
## If you have multiple network interfaces, you can specify one for
## outgoing traffic to use.
# OutboundBindAddress 10.0.0.5
## A handle for your relay, so people don't have to refer to it by key.
#Nickname ididnteditheconfig
## Define these to limit how much relayed traffic you will allow. Your
## own traffic is still unthrottled. Note that RelayBandwidthRate must
## be at least 20 KB.
## Note that units for these config options are bytes per second, not bits
## per second, and that prefixes are binary prefixes, i.e. 2^10, 2^20, etc.
#RelayBandwidthRate 100 KB # Throttle traffic to 100KB/s (800Kbps)
#RelayBandwidthBurst 200 KB # But allow bursts up to 200KB/s (1600Kbps)
## Use these to restrict the maximum traffic per day, week, or month.
## Note that this threshold applies separately to sent and received bytes,
## not to their sum: setting "4 GB" may allow up to 8 GB total before
## hibernating.
##
## Set a maximum of 4 gigabytes each way per period.
#AccountingMax 4 GB
## Each period starts daily at midnight (AccountingMax is per day)
#AccountingStart day 00:00
## Each period starts on the 3rd of the month at 15:00 (AccountingMax
## is per month)
#AccountingStart month 3 15:00
## Administrative contact information for this relay or bridge. This line
## can be used to contact you if your relay or bridge is misconfigured or
## something else goes wrong. Note that we archive and publish all
## descriptors containing these lines and that Google indexes them, so
## spammers might also collect them. You may want to obscure the fact that
## it's an email address and/or generate a new address for this purpose.
#ContactInfo Random Person
## You might also include your PGP or GPG fingerprint if you have one:
#ContactInfo 0xFFFFFFFF Random Person
## Uncomment this to mirror directory information for others. Please do
## if you have enough bandwidth.
#DirPort 9030 # what port to advertise for directory connections
## If you want to listen on a port other than the one advertised in
## DirPort (e.g. to advertise 80 but bind to 9091), you can do it as
## follows. below too. You'll need to do ipchains or other port
## forwarding yourself to make this work.
#DirPort 80 NoListen
#DirPort 127.0.0.1:9091 NoAdvertise
## Uncomment to return an arbitrary blob of html on your DirPort. Now you
## can explain what Tor is if anybody wonders why your IP address is
## contacting them. See contrib/tor-exit-notice.html in Tor's source
## distribution for a sample.
#DirPortFrontPage /etc/tor/tor-exit-notice.html
## Uncomment this if you run more than one Tor relay, and add the identity
## key fingerprint of each Tor relay you control, even if they're on
## different networks. You declare it here so Tor clients can avoid
## using more than one of your relays in a single circuit. See
## https://www.torproject.org/docs/faq#MultipleRelays
## However, you should never include a bridge's fingerprint here, as it would
## break its concealability and potentionally reveal its IP/TCP address.
#MyFamily $keyid,$keyid,...
## A comma-separated list of exit policies. They're considered first
## to last, and the first match wins. If you want to _replace_
## the default exit policy, end this with either a reject *:* or an
## accept *:*. Otherwise, you're _augmenting_ (prepending to) the
## default exit policy. Leave commented to just use the default, which is
## described in the man page or at
## https://www.torproject.org/documentation.html
##
## Look at https://www.torproject.org/faq-abuse.html#TypicalAbuses
## for issues you might encounter if you use the default exit policy.
##
## If certain IPs and ports are blocked externally, e.g. by your firewall,
## you should update your exit policy to reflect this -- otherwise Tor
## users will be told that those destinations are down.
##
## For security, by default Tor rejects connections to private (local)
## networks, including to your public IP address. See the man page entry
## for ExitPolicyRejectPrivate if you want to allow "exit enclaving".
##
#ExitPolicy accept *:6660-6667,reject *:* # allow irc ports but no more
#ExitPolicy accept *:119 # accept nntp as well as default exit policy
#ExitPolicy reject *:* # no exits allowed
## Bridge relays (or "bridges") are Tor relays that aren't listed in the
## main directory. Since there is no complete public list of them, even an
## ISP that filters connections to all the known Tor relays probably
## won't be able to block all the bridges. Also, websites won't treat you
## differently because they won't know you're running Tor. If you can
## be a real relay, please do; but if not, be a bridge!
#BridgeRelay 1
## By default, Tor will advertise your bridge to users through various
## mechanisms like https://bridges.torproject.org/. If you want to run
## a private bridge, for example because you'll give out your bridge
## address manually to your friends, uncomment this line:
#PublishServerDescriptor 0
#
#https://www.torproject.org/projects/obfsproxy-instructions.html.:
Bridge 000.000.000.00:443 4e836b3ee474078eb016d6ec94c170675cdf16c
Bridge 00.00.000.000:443 747c7bc923dfc9f601ebc7500f928c367d8556af4
Bridge 000.00.00.00:6027 4834743900fb63b60181e4a2fcd7a74aebcd53d8
Bridge 00.000.00.000:443 94be9ca2af3e57f8a8b0411b1012545a6668290d
#
UpdateBridgesFromAuthority 1
UseBridges 1
#http://www.2byts.com/2012/03/09/how-to-configure-the-exit-country-on-tor-network/
###
#StrictExitNodes 1
#ExitNodes {DE}
!#
#using vim utorial
$vim tutor
################################################
#install python-jedi plugin #auto-completing
aptitude install vim-python-jedi vim-addons-manager
vim-addons-manager instaal python-jedi
# vim.wikia.com/wiki/Dictionary_completions
:help "dictionary" #get help
:set dictionary-=/usr/share/dict/words dictionary+=/usr/share/dict/words
#in insert mode
# hitting CTRL-X while in insert mode. Next, use CTRL-K.
# Once in this mode the keys CTRL-N and CTRL-P will cycle through the matches.
#or
:set complete+=k
#ALSO ITS POSIBLE TO
#use filetype-specific dictionaries
# Completion for python/lua/etc keywords
################################################
[ctrl] + p Autocomplete
[ctrl] + N Autocomplete
_______________________________________________________________
http://www.gammon.com.au/smaug/vi.htm#progammertips
http://crossonline.blogspot.co.uk/2008/02/vi-shortcuts-autocomplete.html
# THE BASICS
vi Edit a file from command prompt
vi -R dit a file from command prompt for reading only
:e Edit a file from within vi
:e! Edit a new file from within vi, discard changes to current file
:e! Reload current file, discarding changes
Ctrl+F (or PgDn) Go forwards a page
Ctrl+B (or PgUp) Go backwards a page
Arrow keys Move around single lines or characters
:w Save changes
:w! Save changes and override protected (read-only) files
ZZ Save changes and exit vi
:q Quit
:q! Quit and discard changes
:help Get general help
:help set Get help on a command (eg. :set)
:set ro Set read-only mode
# GO TO LINES, FIND MATCHING TEXT
1234G Go to line 1234 (do not see typing)
:1234 Go to line 1234 (see typing)
1G Go to start of file
G Go to end of file
/swordfish Find (forwards) a line containing "swordfish"
/you see .* here Find (forwards) a line using a regular expression
n Repeat last search
N Repeat last search in opposite direction
?swordfish Find (backwards) a line containing "swordfish"
?you see .* here Find (backwards) a line using a regular expression
:set ic Search case insensitive (Ignore Case)
:set noic Search with case sensitivity
:set wrapscan Wrap searches back to start of file
:set nowrapscan Do not wrap searches
# LINE NUMBERS
:set nu Show line numbers on the left
:set nonu Do not show line numbers on the left
:.= Show the current line number
:= Show total lines in file
Ctrl+G Show file name, total lines, and current line number
:/pattern/= Show line number of first matching pattern
# UNDOING THINGS
u Undo last change
U Undo all changes on current line
:q! Quit editor without saving changes
:e! Reload current file, discarding changes
# INSERT TEXT
i Insert after cursor
a Insert before cursor
I Insert at beginning of line
A Insert at end of line (append)
o Open (start) new line below cursor
O Open (start) new line above cursor
# CHANGE EXISTING TEXT
r Replace next character
R Type over following characters
C Replace to end of line
# DELETE TEXT
x Delete character under cursor
X Delete character to left of cursor
D Delete to end of line
dd Delete entire line
# ADVANCED DELETION
5dd Delete next 5 lines
d$ Delete to end of line
d0 Delete to start of line
d/swordfish Delete to word "swordfish"
dfx Delete to the letter "x"
:10,20d Delete lines 10 to 20
:.,+5d Delete current line and another 5 lines
:%d Delete all lines
dw Delete current word
:/pattern/d Find line containing pattern, delete it
:/dog/,/cat/d Find line containing "dog", delete until "cat"
:.,/foo/d Delete from current line to line containing "foo"
# COPYING, CUTTING AND PASTING
p Paste after cursor
P Paste before cursor
y$ Yank to end of line
y0 Yank to start of line
y/swordfish Yank to word "swordfish"
yfg Yank to letter "g"
Y Yank entire line
5,10y Yank lines 5 to 10
# ADVANCED MOVEMENT COMMANDS
w Go forwards a word
b Go backwards a word
e Go to end of word
0 Go to start of line
$ Go to end of line
H Go to top of screen
M Go to middle of screen
L Go to bottom of screen
fx Go (forwards) to letter "x" on current line
Fx Go (backwards) to letter "x" on current line
* Go to next occurrence of word under cursor
# Go to previous occurrence of word under cursor
/(Ctrl+V)(Tab) Find a control character (eg. Tab)
( Go backwards a sentence
) Go forwards a sentence
{ Go backwards a paragraph
} Go forwards a paragraph
# REPEAT COUNTS
5dd Delete 5 lines
5x Delete 5 characters
Delete 5 words 5dw
5r Replace next 5 characters
7Y Yank (copy) next 7 lines
Go to line 1000 1000G
10p Paste copy buffer 10 times
40i- Insert 40 hyphens
10oswordfish Insert the line "swordfish" 10 times
5/swordfish Find the 5th occurrence of "swordfish"
# SPLITTING AND JOINING LINES
i Split a line (insert a return)
J Join two lines (current and next)
10J Join next 10 lines
:10,20j Join lines 10 to 20
# SEARCH AND REPLACE
:s/nick/fred/ Change "nick" to "fred" on current line
:.,+4 s/nick/fred/ Change "nick" to "fred" on the next 5 lines
:100,200 s/nick/fred/g Change "nick" to "fred" on lines 100 to 200, all occurrences
:% s/\<./\u&/g Capitalise every word in the entire file
:% s/^/>/ Insert ">" at the start of every line
:% s;$;// nick; Insert "// nick" at the end of every line
# APPLYING COMMANDS TO CERTAIN LINES
:g/fruit/s/apple/orange/g Find lines containing "fruit" and change "apple" to "orange" on them
:g/^$/d Delete all blank lines
:g! /nick/normal A oops Find lines NOT containing "nick", append "oops" to them
# SHELL AND FILTER COMMANDS
:! ls List directory
:! ps See processes
:20,30 ! sort Sort lines 20 to 30
!G sort Sort entire file
!) tr '[a-z]' '[A-Z]' Translate next sentence to upper case
:!wc % Word count file (save first)
:!man strstr Look up manual entry for strstr
:r !ls Insert "ls" command output into window
# TAGS
Ctrl+] Go to function under cursor
Ctrl+T Go back
:tag xyz Go to function xyz
# AUTOMATING THINGS
:w Save file
:make Run "make"
:cn Go to next error
:cp Go to previous error
# MAPPING ACTIONS TO FUNCTION KEYS
After entering the above commands you could compile
by simply hitting F8, then look at each error by hitting F6.
:map :cnext Map the action :cnext to
:map :cprevious Map the action :cprevious to
:map :make Map the action :make to
:map :close Map the action :close to
# MORE USEFUL TIPS FOR PROGRAMMERS #####
gd Go to definition of word under cursor
gD Go to global definition
% Find matching bracket, brace, #if, #endif
:grep foo *.c Do a grep
:cn After grep, go to next occurrence
gf Get a file (eg. an #include file) whose name is under cursor
Ctrl+X Ctrl+N Auto complete (in insert mode) - match forwards
Ctrl+X Ctrl+P Auto complete (in insert mode) - match previous
:ab cca const char * Make an abbreviation (eg. cca = "const char *")
:syntax on Turn syntax colouring on
:syntax off Turn syntax colouring off
:! command Execute any shell command
= Indent selected lines with C-style indenting
# SPELLCHECK FILE
:w! Save file first
:! ispell % Spell check it
:e % Edit fixed file
# TAB MANAGEMENT
:set ts=4 Set tabs to every 4 characters
:set et Convert tabs to spaces in future
:set noet Do not expand tabs
:%retab Fix existing tabs (convert to spaces)
:set list Show tabs visually, and end-of-lines
:set nolist Do not show tabs and end-of-lines
# VISUAL MODE
v Character mode
V Line mode
Ctrl+V Block mode
gv Re-mark previous block
(see below) Do some command
Esc Cancel visual mode
o Go to other end of block
vaw A word (with white space)
viw Inner word
vaW A WORD (with white space)
viW Inner WORD
vas A sentence (with white space)
vis Inner sentence
vap A paragraph (with white space)
Inner paragraph vip
vab A ( ... ) block (includes brackets)
vib Inner ( ... ) block
vaB A { ... } block (includes braces)
viB Inner { ... } block
# VISUAL MODE COMMANDS
~ Switch case
d Delete
c Change (4)
y Yank
> Shift right (4)
< Shift left (4)
! Filter through external command (1)
= Filter through 'equalprg' option command (1)
gq Format lines to 'textwidth' length (1)
: Start ex command for highlighted lines (1)
r Change (4)
s Change
C Change (2)(4)
S Change (2)
R Change (2)
x Delete
D Delete (3)
X Delete (2)
Y Yank (2)
J Join (1)
U Make uppercase
u Make lowercase
Ctrl+] Find tag
I Block insert
A Block append
# MARKING YOUR WORK
mx Mark current position as "x"
`x Go to position "x"
:marks Show list of known marks
# RECORDING COMMANDS
q(letter)(commands)q Record a sequence
@(letter) Play back sequence
:reg See what is in registers