Basic VIM commands to made programming easy


VIM COMMANDS

Basics

:e filenameOpen filename for edition
:wSave file
:qExit Vim
:q!Quit without saving
:xWrite file (if changes has been made) and exit
:sav filenameSaves file as filename
.Repeats the last change made in normal mode
5.Repeats 5 times the last change made in normal mode

Moving in the file

k or Up Arrowmove the cursor up one line
j or Down Arrowmove the cursor down one line
emove the cursor to the end of the word
bmove the cursor to the begining of the word
0move the cursor to the begining of the line
Gmove the cursor to the end of the file
ggmove the cursor to the begining of the file
Lmove the cursor to the bottom of the screen
:59move cursor to line 59. Replace 59 by the desired line number.
20|move cursor to column 20.
%Move cursor to matching parenthesis
[[Jump to function start
[{Jump to block start

Cut, copy & paste

yCopy the selected text to clipboard
pPaste clipboard contents
ddCut current line
yyCopy current line
y$Copy to end of line
DCut to end of line

Search

/wordSearch word from top to bottom
?wordSearch word from bottom to top
*Search the word under cursor
/\cstringSearch STRING or string, case insensitive
/jo[ha]nSearch john or joan
/\< theSearch the, theatre or then
/the\>Search the or breathe
/\< the\>Search the
/\< ¦.\>Search all words of 4 letters
/\/Search fred but not alfred or frederick
/fred\|joeSearch fred or joe
/\<\d\d\d\d\>Search exactly 4 digits
/^\n\{3}Find 3 empty lines
:bufdo /searchstr/Search in all open files
bufdo %s/something/somethingelse/gSearch something in all the open buffers and replace it with somethingelse

Replace

:%s/old/new/gReplace all occurences of old by new in file
:%s/onward/forward/giReplace onward by forward, case unsensitive
:%s/old/new/gcReplace all occurences with confirmation
:2,35s/old/new/gReplace all occurences between lines 2 and 35
:5,$s/old/new/gReplace all occurences from line 5 to EOF
:%s/^/hello/gReplace the begining of each line by hello
:%s/$/Harry/gReplace the end of each line by Harry
:%s/onward/forward/giReplace onward by forward, case unsensitive
:%s/ *$//gDelete all white spaces
:g/string/dDelete all lines containing string
:v/string/dDelete all lines containing which didn’t contain string
:s/Bill/Steve/Replace the first occurence of Bill by Steve in current line
:s/Bill/Steve/gReplace Bill by Steve in current line
:%s/Bill/Steve/gReplace Bill by Steve in all the file
:%s/^M//gDelete DOS carriage returns (^M)
:%s/\r/\r/gTransform DOS carriage returns in returns
:%s#<[^>]\+>##gDelete HTML tags but keeps text
:%s/^\(.*\)\n\1$/\1/Delete lines which appears twice
Ctrl+aIncrement number under the cursor
Ctrl+xDecrement number under cursor
ggVGg?Change text to Rot13

Case

VuLowercase line
VUUppercase line
g~~Invert case
vEUSwitch word to uppercase
vE~Modify word case
ggguGSet all text to lowercase
gggUGSet all text to uppercase
:set ignorecaseIgnore case in searches
:set smartcaseIgnore case in searches excepted if an uppercase letter is used
:%s/\<./\u&/gSets first letter of each word to uppercase
:%s/\<./\l&/gSets first letter of each word to lowercase
:%s/.*/\u&Sets first letter of each line to uppercase
:%s/.*/\l&Sets first letter of each line to lowercase

Read/Write files

:1,10 w outfileSaves lines 1 to 10 in outfile
:1,10 w >> outfileAppends lines 1 to 10 to outfile
:r infileInsert the content of infile
:23r infileInsert the content of infile under line 23

File explorer

:e .Open integrated file explorer
:SexSplit window and open integrated file explorer
:Sex!Same as :Sex but split window vertically
:browse eGraphical file explorer
:lsList buffers
:cd ..Move to parent directory
:argsList files
:args *.phpOpen file list
:grep expression *.phpReturns a list of .php files contening expression
gfOpen file name under cursor

Interact with Unix

:!pwdExecute the pwd unix command, then returns to Vi
!!pwdExecute the pwd unix command and insert output in file
:shTemporary returns to Unix
$exitRetourns to Vi

Alignment

:%!fmtAlign all lines
!}fmtAlign all lines at the current position
5!!fmtAlign the next 5 lines

Tabs/Windows

:tabnewCreates a new tab
gtShow next tab
:tabfirstShow first tab
:tablastShow last tab
:tabm n(position)Rearrange tabs
:tabdo %s/foo/bar/gExecute a command in all tabs
:tab ballPuts all open files in tabs
:new abc.txtEdit abc.txt in new window

Window spliting

:e filenameEdit filename in current window
:split filenameSplit the window and open filename
ctrl-w up arrowPuts cursor in top window
ctrl-w ctrl-wPuts cursor in next window
ctrl-w_Maximize current window vertically
ctrl-w|Maximize current window horizontally
ctrl-w=Gives the same size to all windows
10 ctrl-w+Add 10 lines to current window
:vsplit fileSplit window vertically
:sview fileSame as :split in readonly mode
:hideClose current window
:­nlyClose all windows, excepted current
:b 2Open #2 in this window

Auto-completion

Ctrl+n Ctrl+p (in insert mode)Complete word
Ctrl+x Ctrl+lComplete line
:set dictionary=dictDefine dict as a dictionnary
Ctrl+x Ctrl+kComplete with dictionnary

Marks

m {a-z}Marks current position as {a-z}
' {a-z}Move to position {a-z}
''Move to previous position

Abbreviations

:ab mail mail@provider.orgDefine mail as abbreviation of mail@provider.org

Text indent

:set autoindentTurn on auto-indent
:set smartindentTurn on intelligent auto-indent
:set shiftwidth=4Defines 4 spaces as indent size
ctrl-t, ctrl-dIndent/un-indent in insert mode
>>Indent
<<Un-indent
=%Indent the code between parenthesis
1GVG=Indent the whole file

Syntax highlighting

:syntax onTurn on syntax highlighting
:syntax offTurn off syntax highlighting
:set syntax=perlForce syntax highlighting

Top Mobile Operating System


TOP MOBILE OS

Quantcast
Android
On 20th September 2008, Google released it’s First and only version of Android OS and named it as “Astro”. No one knew that this is one of the decisive OS that will leave behind all the OS in no time and Today Android is the most popular OS that account for more than 51% of Operating System in US.


Google kept on rolling upgraded version likes “Bender” and “Cupcake”. Later Google tried something different while naming their updated Android version inspired by the names of any Dessert or Sweets and that too in alphabetical order.
The further Android version releases names are:-
  • Donut,
  • Éclair,
  • Froyo,
  • Gingerbread,
  • Honeycomb,
  • Ice Cream Sandwich,
  • Jelly Bean.
Jelly Bean is the latest updated version of Android released by Google on 9th July 2012. The one of the major reason for the popularity of Android OS is that the platform is not closed unlike iOS, which ultimately gives the opportunity to developers to create great android applications.
Android is the only Operating system which became popular as soon as it entered the smartphone and Tablet categories due to superior graphical user interface, efficient working and the variety of applications available.
Google Play is an authorized app market which allows users to download different games and apps on their android devices. Samsung, HTC, Motorola, Sony are Top manufactures that rely on and also prefer Android OS in their smartphones and tablets due its popularity and because of the vast variety of applications accessible on this platform. Android is the leading operating systems in the world and is preferred by top smartphone manufacturers and is definitely a threat for iPhone.
Top smartphones having Android Operating System:-
  • HTC Desire,
  • Motorola Droid Razr,
  • Samsung Galaxy S3,
  • Sony Xperia,
  • LG Optimus.

Apple iOS

Apple released the iOS operating system which is used in iPhone was launched on 29th June 2007 when the iPhone was developed. Since then there were many updates of iOS and the latest one is the iOS 6. Apple iOS is unique and is only for Apple iPhone & iPad and no other manufacturer can use this operating system platform.
 
Apple is determined to work upon the performance of its device rather than looks. This is the cause that the central appearance of iOS is not very different as it was in the year 2007. In general the interface of iOS is very friendly and with its shear looks and performance it can be considered as one of the top OS available today.
Devices working on Apple’s iOS
  • iPhone,
  • iPhone 2G,
  • iPhone 3G,
  • iPhone 4,
  • iPhone 4S,
  • iPad,
  • iPad2,
  • iPad3.

BlackBerry OS

Blackberry OS developed by Research In Motion (RIM) and was released in 1999. BlackBerry Os is running on every smartphone which is designed by RIM and the strange part is that Blackberry OS is totally dissimilar from other operating systems.
 
BlackBerry is considered as one of the Best Business Smartphone of the year. The interface techniques as well as the Smartphone designs are diverse with a trackball and a QWERTY keyboard.  Like Android, Blackberry Operating System is a close source OS which means that this OS is not obtainable for any other producer. BlackBerry OS 7.1 is the latest OS which is available for users since May 2011 and used in many devices such as BlackBerry Bold 9930. BlackBerry OS 7 is considered to be the most secure OS and it is used by more than 50% of U.S and U.K government officials
Major line up of Smartphones running on Blackberry OS: -
  • Blackberry Bold,
  • Blackberry Curve,
  • Blackberry Torch.
BlackBerry Porsche Design P’9981 was awarded the smartphone of the year and it is world’s most expensive Smartphone and is running on BlackBerry OS and BlackBerry10 OS will be the market decider which is the only hope for RIM after the entry and the rising competition due to Android and iOS. This BlackBerry 10 OS is due to be released in the First Quarter of the year 2013

Windows OS

Windows OS is widely known OS as this is used in our desktop and Laptop computers but not everyone knows about Windows OS in detail because it is used in computers all over the world, but Windows OS running on Computer and mobile phone are totally different things.
 
Last year Nokia and Windows OS had the deal to work together and now this OS has become official OS of Nokia but ordinary mobile phone users find it a bit tricky to work on Windows OS is getting very popular among people who were used to it and their hottest release is Lumnia . Lumnia succession by Nokia is entirely windows based mobile phones. Samsung and HTC keep on releasing Windows based phones time to time but they are unable to gather the attention of smartphone users due to the popularity of Android OS.
 Some of the latest Windows Phones are
  • Nokia Lumia 800,
  • Nokia Lumia 900,
  • Samsung Focus,
  • HTC Titan 2.

Symbian

Symbian OS is formally the possessions of Nokia. If any company wants to work on this OS will have to take consent from Nokia. Nokia was a leader in the mobile market, so after Java symbian was ultimately widely used mobile phone some time ago when iOS and Android were not in the picture. Till now Symbian is generally used in basic mobile phones but due to continuously decreasing demand it is now being looked upon.
 

Symbian’s ANNA & BELLE were the 2 latest updates which are still used in Nokia’s smartphones. On the whole, the Symbian OS is outstandingly planned and is user-friendly too. Regrettably, Symbian OS graph is going down due to many factors but the major factor is the competition against the popular OS Android and iOS.
There are many Nokia Smartphones still running on Symbian OS: -
  • Nokia E6
  • Nokia 808 Pure view
  • Nokia 701
  • Nokia C 6

BADA

Exactly like Nokia Samsung also has own operating system named as BADA. It was intended for high and Low end smartphones. Bada is a user friendly, effective & efficient operating system, Strange thing is that Samsung do not use Bada OS on a big scale for its handsets instead Samsung too uses Android on a immense scale for some unidentified reasons.
 
The most recent version for Bada was 2.0.5 which was released on 15th March 2012. At present there are just 3 mobile phones which are running on Bada operating system.
  • Samsung Wave,
  • Samsung Wave2,
  • Samsung Wave3.

Palm OS (Garnet OS)

Palm OS was created by Palm Inc in the year 1996 in particular for PDAs (Personal Digital Assistance) and is used my many huge companies like Lenovo and IBM. Palm OS was originally intended to work on touchscreen Graphic User Interface. It was updated few years later and was able to work with and sustain smartphones. Unluckily Palm OS was not able to do well in the market & due to that it is not being used in any of the latest top devices.

 

Open WebOS

Open WebOS or Hp WebOS or just WebOS which was originally created and promoted by Palm Inc in the year 2009 but years later this OS was acquired by Hewlett Packard. At that time this OS was used in several Smartphones & tablets.
 
Hp endorsed WebOS at a very rigorously by using it in high end smartphones and tablets. The most recent device running on WebOS was the Hp Touch Pad. With the dominance of Android in the market, sales of tablets running on Hp WebOS were decreased. At last Hp was forced to terminate WebOS process and its based devices, but keeping all the existing users, company guaranteed that they will be getting updates of the operating system.

Maemo

Nokia & Maemo both companies came together to create an operating system for smartphones & internet tablets, named as Maemo. Similar to other devices the user interface of Maemo also contains a menu which provides user an access from which the user can go to any location.

 

For instance, in Android OS the home screen is separated into manifold sections which displays various shortcut icons including RSS Feed & other such things. Later in the yer 2010 at the Mobile World Congress it was discovered that now Maemo development will be combined with Mobilin to produce a brand new operating system known as MeeGo.

MeeGo

MeeGo was fundamentally called as a mobile platform but it was in reality intended to run several electronic devices which includes handhelds, in car devices, television sets & in even net books. All the devices on which MeeGo OS can operate although have the similar core but difference lies entirely in the interface according to the device.


Nokia N9, which is one of the popular device is operating on MeeGoOS.

Android Versions


ANDROID VERSIONS

               Did you know Each version of Android since 1.5 has been developed with a specific codename. These codenames are chosen alphabetically, and have thus far all been dessert items (or, generically, sweet/sugary foods). Some codenames are associated with more than one version number, while others are limited to only a specific one, and the reason for this inconsistency is not currently known. The naming typically appears to correspond to changes in the developer API levels, but this is not always true (example: 3.0 and 3.1 are both "Honeycomb" but they have different API levels).
The following names are used for the currently existing Android releases. Note that versions 1.0 and 1.1 were not publicly named. However, Android 1.1 was internally referred to as "Petit-Four".


Cupcake:
  • Android 1.5
Donut:
  • Android 1.6
Eclair:
  • Android 2.0, also 2.0.1
  • Android 2.1
  • Android 2.1-update1
Froyo: (short for "frozen yogurt")
  • Android 2.2, also 2.2.x updates
Gingerbread:
  • Android 2.3, also 2.3.x updates
Honeycomb:
  • Android 3.0, also 3.0.x updates
  • Android 3.1
  • Android 3.2
Ice Cream Sandwich:
  • Android 4.0
Jelly Bean
  • Android 4.1
  • Android 4.2
Future Versions

Testing your site on mobile device




TOP 10 TOOLS TO TEST YOUR SITE ON MOBILE DEVICE ONLINE.

1. iPhoney

iPhoney
An excellent free iPhone tester, iPhoney isn’t exactly an emulator, but allows developers to create 320x480px websites for use on the iPhone. It allows you to test images and code in a pixel-perfect Apple-Safari-powered environment, with all the normal features including Portrait and Landscape modes, fullscreen, zoom and plugins.

2. W3C mobileOK Checker

W3C mobileOK Checker
This checker is a web-based automated validation tool that checks to see how mobile-device-friendly your website is. The tests are checked against the W3C mobileOK Basic Tests specification developed by W3C.

3. iPad Peek

iPad Peek
This handy web-based tool allows you to see how your websites look when rendered on the iPad. It’s recommended that you use a WebKit-based browser such as Apple Safari or Google Chrome to have as accurate a simulation as possible — or at the very least, a CSS3-capable browser that supports transformation properties (like Opera) because it uses them to render the page in Portrait mode.

4. Modify Headers Add-on for Firefox

Modify Headers Add-on for Firefox
There are add-ons for Firefox that can manipulate the data sent to servers to make it seem as if the user agent is browsing on a mobile device, even when they’re not. To do this, you need an add-on called Modify Headers (for Firefox).
Once you have downloaded and installed this add-on, the new options, Tools > Default User Agent and Tools > Modify Headers should appear in your browser.
To emulate browsing on a mobile device, you need to find the User Agent Profile (UAProf) value of your mobile device, which can be found with a quick search on Google for "user agent" followed by the model of your phone (e.g. see Google results for "user agent ipad"). Alternatively, check out this list of UAProf values.
Once you have located the UA Profile value for the phone you want, enter it into the Modify Header dialog box, and bingo, you will see how it’s like to browse from that device.
For Google Chrome, you can try out the User-Agent Switcher extension.
For a browser-independent desktop application that works on virtually any internet-enabled app, try out Fiddler Web Debugger that lets you modify HTTP requests, among other things.

5. Adobe Device Central CS5

Adobe Device Central CS5
As part of the latest Adobe Creative Suite, Device Central emulates the operation of mobile devices on your desktop allowing you to test HTML and Flash from the comfort of your desktop.
To open a page or site, select Device Profiles > Browse Devices, then right-click and choose Add To Test Devices. Now that you’ve added a device, simply go to File > Open (for local testing) or File > Open URL (for remote testing).
Though far from being free, if you’re a professional designer or developer, you’ll have a high chance of being able to access Adobe’s creative suite of applications.

6. Google Mobilizer

Google Mobilizer
Google Mobilizer is a simple web tool that lets you input a web page address and then makes the page mobile-web-friendly by trimming the content down to its bare essentials. This is an excellent tool for seeing where you can make performance optimizations on your site.

7. Gomez

Gomez
Gomez mobile readiness test gives you a score between 1 and 5 based on an analysis of over 30 proven mobile web development techniques, ranging from stylesheet use (e.g. media queries) to caching techniques and standards-compliant code. The results are displayed in an easy-to-understand document that offers advice on how to make your site better.
Unfortunately, to be able to test your site, you must enter in a bunch of information including your email address, country, zip code, and phone number.

8. MobiReady

MobiReady
In the same vein as Gomez, MobiReady is another online testing site that allows you to enter a URL so that it can perform a set of evaluations, including Page Test, Markup Test and Site Test of the web page. This is a slightly more detailed version of Gomez above and provides a comprehensive test result page including dotMobi compliance, W3C mobileOk tests, device emulators, detailed error reports, HTTP tests and a code checker.
However, the results aren’t as succinct as Gomez’s results, a disadvantage when it comes to presenting your information to your less technically astute clients/employers.

9. DotMobi Emulator

DotMobi Emulator
The dotMobi emulator gives you a live preview of your site from a (fairly small, to be honest) range of different mobile phones. This mobile testing tool is great if you need to test your page on older mobile devices.
What can be annoying to potential users of this tool is that it requires the Java browser plugin for it to work.

10. Opera Mini Simulator

Opera Mini Simulator
With over 120 million smartphones sold that has Opera pre-installed[1] and an edition available for almost any OS, making sure that your site works on Opera Mini (the mobile version of the Opera web browser) is a good practice to include in your testing workflow.
Thankfully, Opera has obliged us by offering a free web-based emulator for testing and evaluating your web design on a mobile device that uses Opera Mini.
This tool requires the Java browser plugin to function.