{"id":11808,"date":"2014-02-13T14:47:57","date_gmt":"2014-02-13T09:17:57","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=11808"},"modified":"2014-02-13T14:53:49","modified_gmt":"2014-02-13T09:23:49","slug":"vim-all-you-need-to-know-about-it","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/vim-all-you-need-to-know-about-it\/","title":{"rendered":"VIM: All you need to know about it"},"content":{"rendered":"<p>Vim is an extremely practicable text editor which allows efficient text editing. It is considered as one of the most handy tools for programmers, allowing them to edit configure files and sometimes also considered as IDE. Though, it not just limited to editing configuring files, it also allows a user to edit text files and write emails etc.<\/p>\n<p>In this blog, I have discussed some of the most useful and frequently used commands that can save a lot of your time in development cycle.<\/p>\n<p>We will start with one of the most useful set of commands:<\/p>\n<p>&nbsp;<\/p>\n<p><strong>WORKING WITH MULTIPLE WINDOWS<\/strong><\/p>\n<p>1. Splitting window horizontally to load another file<\/p>\n<p><code>:split filename e.g :split file2.c<\/code><\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/02\/Working-with-Multiple-Windows-1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-11811\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/02\/Working-with-Multiple-Windows-1.png\" alt=\"\" width=\"289\" height=\"288\" \/><\/a><br \/>\n<strong><\/strong><\/p>\n<p><strong>Note :<\/strong> To switch between opened windows, use CTRL+ WW<\/p>\n<p>2. Splitting window vertically to load another file<\/p>\n<p><code>:vsplit filename e.g :vsplit file2.c<\/code><\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/02\/Working-with-Multiple-Windows-2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-11812\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/02\/Working-with-Multiple-Windows-2.png\" alt=\"\" width=\"477\" height=\"299\" \/><\/a><br \/>\n<strong><\/strong><\/p>\n<p><strong>Note :<\/strong> To switch to left buffer, use CTRL + W + H and to right buffer use CTRL + W + L<\/p>\n<p>3. To save all file from opened multiple windows and exit<\/p>\n<p><code>:wqa<\/code><\/p>\n<p>4. To close the current window<\/p>\n<p><code>:hide<\/code><\/p>\n<p>5. To close all the window except the current positioned window<\/p>\n<p><code>&#058;only<\/code><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Example of multiple windows<\/strong><\/p>\n<p><a href=\"\/blog\/wp-ttn-blog\/uploads\/2014\/02\/Example-of-Multiple-Windows.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-11813\" src=\"\/blog\/wp-ttn-blog\/uploads\/2014\/02\/Example-of-Multiple-Windows.png\" alt=\"\" width=\"974\" height=\"547\" \/><\/a><\/p>\n<h3><\/h3>\n<p><strong>ADDING VARIABLE TO \u00a0\/etc\/vim\/vimrc<\/strong><\/p>\n<p>1. Setting Number line for every file<\/p>\n<p><code>set nu<\/code><\/p>\n<p>2. Highlight your search<\/p>\n<p><code>set hlsearch<\/code><\/p>\n<p>3. Applying indentation to file<\/p>\n<p><code>set autoindent<\/code><\/p>\n<p>4. Enable mouse click to position cursor at any point<\/p>\n<p><code>set mouse=a<\/code><\/p>\n<p>5. Change the background and foreground color of Vim<\/p>\n<p><code>highlight Normal ctermfg=grey ctermbg=dark blue<\/code><\/p>\n<p>6. Show Real Time Search<\/p>\n<p><code>set incsearch<\/code><\/p>\n<p><strong>OTHER EASY TRICKS<\/strong><\/p>\n<p>1. Editing in Stream by transferring the output of any command to vim<\/p>\n<p><code>cat \/etc\/passwd | vim -<\/code><\/p>\n<p>2. Encrypt your file using vim<\/p>\n<p><code>vim -x filename<\/code><\/p>\n<p>While encryption, it will ask you for encryption key, you can use the same\u00a0key to decrypt the file or to read\/modify the contents of file.<\/p>\n<p>Hope these Vim commands will help you accelerate your development and save a lot of time.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Vim is an extremely practicable text editor which allows efficient text editing. It is considered as one of the most handy tools for programmers, allowing them to edit configure files and sometimes also considered as IDE. Though, it not just limited to editing configuring files, it also allows a user to edit text files and [&hellip;]<\/p>\n","protected":false},"author":100,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":0},"categories":[1],"tags":[260,1315],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/11808"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/100"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=11808"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/11808\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=11808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=11808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=11808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}