VIM custom settings.

rajeshkumar created the topic: VIM custom settings.

I was required to set my tab to 4 space. I got some inputs and based on google search i found good reference which can used to customize your VIM editor. Please create one .vimrc file and save in your home directory. .vimrc file will contain following info which can be modify depends on your requirement….

" Michael's standard settings
" Author: Michael Geddes
" Version: 0.1

" Smart tabbing / autoindenting
set undolevels=100
set nocompatible
set autoindent
set smarttab
" Allow backspace to back over lines
set backspace=2
set exrc
set shiftwidth=4
set tabstop=4
set cino=t0
" I like it writing automatically on swapping
set autowrite
set noshowcmd
if exists('&selection')
set selection=exclusive

if has("gui_running")
" set the font to use
set guifont=Courier_New:h10
" Hide the mouse pointer while typing
set mousehide

"Special error formats that handles borland make, greps
"Error formats :
" line = line number
" file = file name
" etype = error type ( a single character )
" enumber = error number
" column = column number
" message = error message
" _ = space

" file(line)_:_etype [^0-9] enumber:_message
" [^"] "file" [^0-9] line:_message
" file(line)_:_message
" [^ ]_file_line:_message
" file:line:message
" etype [^ ]_file_line:_message
" etype [^:]:__file(line,column):message = Borland ??
" file:line:message
" etype[^_]file_line_column:_message
set efm=%*[^\ ]\ %t%n\ %f\ %l:\ %m,%\\s%#%f(%l)\ :\ %t%*[^0-9]%n:\ %m,%*[^\"]\"%f\"%*[^0-9]%l:\ %m,%\\s%#%f(%l)\ :\ %m,%*[^\ ]\ %f\ %l:\ %m,%f:%l:%m,%t%*[^\ ]\ %f\ %l:\ %m,%t%*[^:]:\ \ %f(%l\\,%c):%m,%f:%l:%m,%t%*[^\ ]\ %f\ %l\ %c:\ %m
" This changes the status bar highlight slightly from the default
" " set highlight=8b,db,es,mb,Mn,nu,rs,ss,tb,vr,ws

"I like things quiet
set visualbell
" Give some room for errors
set cmdheight=2
" always show a status line
au VimEnter * set laststatus=2
set ruler
" Use a viminfo file
set viminfo='20,\"50
"set path=.,d:\wave,d:\wave\include,d:\wave\fdt
set textwidth=80 " always limit the width of text to 80
set backup " keep a backup file
set backupext=.bak
" Like having history
set history=100

" Map Y do be analog of D
map Y y$
" Toggle paste
map zp :set paste! paste?

" From the vimrc of 'Peppe'

" So I can get to ,
noremap g, ,
" Go to old line + column
noremap gf gf`"
noremap `"

" Switch off search pattern highlighting.
set nohlsearch
"Toggle search pattern hilighting and display the value
if v:version >=600
map :nohlsearch
map :set hlsearch! hlsearch?

"Ctags mapping for and
map :cnz.:cc
map :cpz.:cc
set shellpipe=2>&1\|tee
"set shellpipe=\|grep\ -v\ NOTE:\|tee

" Set nice colors
" background for normal text is light grey
" Text below the last line is darker grey
" Cursor is green
" Constants are not underlined but have a slightly lighter background
" highlight Normal guibg=grey95
highlight Cursor guibg=Red guifg=NONE
highlight Visual guifg=Sys_HighlightText guibg=Sys_Highlight gui=NONE
" highlight NonText guibg=grey90
" highlight Constant gui=NONE guibg=grey95
" highlight Special gui=NONE guibg=grey95

if has("gui_running")
"if &columns < 90 && &lines < 32 " win 90 32 au GUIEnter * win 90 32 " endif " Make external commands work through a pipe instead of a pseudo-tty set noguipty endif " Map control-cr to goto new line without comment leader imap o

" Look at syntax attribute
nmap :echo synIDattr(synID(line("."), col("."), 1), "name")
nmap :echo synIDattr(synID(line("."), col("."), 0), "name")
" delete the swap file
nmap \\. :echo strpart("Error Deleted",7*(0==delete(expand("%:p:h")."/.".expand("%:t").".swp")),7)

" delete prev word

set joinspaces

" Today
if !exists('usersign')
let usersign=$username
imap =strftime("%d%b%Y")." ".usersign.":"
if has("menu")
imenu 35.60 &Insert.&DateF2 =strftime("%d%b%Y")." ".usersign.":"
menu 35.60 &Insert.&DateF2 "=strftime("%d%b%Y")." ".usersign.":"p
imenu 35.60 &Insert.Date\ and\ &Username =strftime("%d%b%Y")
menu 35.60 &Insert.Date\ and\ &Username "=strftime("%d%b%Y")p

set listchars=eol:¶,tab:›…,trail:_
" Enable 'wild menus'
set wildmenu
set showfulltag
set display+=lastline
set printoptions=syntax:y,wrap:y

" Switch on syntax highlighting.
syntax on

Rajesh Kumar
Twitt me @

Tagged :

Top 5 Code Editors for the Software Programmers | Best Code Editor | scmGalaxy

This is the age of programming and coding and in the last few years software industry changes a lot. We can see a lot of automation and different kind of tools used by programmers and developers to perform their tasks and projects, and it’s necessary too  because a right tool can simplify your work environment and same time it improves your productivity. So, today we are going to talk about “Code Editors” tools, which play a vital role in programmer’s workspace.
So first, Let’s see , What is code Editor?
The formal definition is: A code editor is a type of program used for editing plain text files.
In our language we can say: A code editor is a program in our systems or computer that allows us to write, create and edit a range of programming languages codes on them very easily and it’s also assist programmers to avoid some of the common mistakes in coding by providing them instant detailing of the code, which increase their efficiency.

So, this is very much important to use good code editors which comes with some common features which are necessary to make best use of it.

Let’s look on to the common features in Code Editor you should look for.
  • User-Friendly — It should be easy to use and navigate.
  • Search & Replace — This is one feature through which you can easily search words and replace them with few clicks.
  • Copy & Paste —This feature is no doubt one the most important feature because without cut,copy and paste we can not think to even write these days.
  • Syntax highlighting — Only a programmer knows, how it feels when a single “;” (semi-colon) missed in a code of thousand lines results in a failed program execution. So, Code editor should contain syntax highlighting feature, it helps to read and pick up code errors easily.
  • UTF-8 — Code editors should able to deal with UTF-8 encoded text.
  • Extensions — When choosing a text editor one should also check plugins availability to the editor. It allows you to use it with additional features.

Now, comes the real problem


There are so many Code editors available but to choose from them can be a challenging task. It requires time, experiment and research to find out the best code editors. To help you out we have done all these things for you and compile a list of top 10 code editors. So without wasting any time let’s start.

1. Notepad++


Notepad ++ is an open source code editor which is one of the most popular editor which compatible with windows but can be use on Linux, Unix, Mac or OS with the help of Wine. This application supports large numbers of programming, scripting and markup languages but works best with HTML, CSS, JavaScript and PHP. It is very easy to use and very lightweight application which can manage huge files without any major lags or crashes.
It’s features:-
  • Supports syntax highlighting
  • Tabbed editing
  • External Plugins Support
  • Auto indentation
  • Auto-completion of words & functions.
  • Compiler Integration
  • File Transfer Protocol (FTP) support
  • Search and Replace
Sublime is also one of the most popular editor tool. The sublime editor is not available for free but you can use free trial offer. This editor works on Mac, Windows, and Linux operating systems and they have an advanced interface which is really good for server side programming. It is also lightweight but powerful editor which provides IDE-like features along with Python Scripting. This editor can be an alernative for Integrated Development Environment (IDE). This editor also allows you to use it without any complications. Easy to use and navigate.
It’s features
  • Lightning fast project switching
  • Multiple line selection and editing
  • Syntax highlighting
  • Can be completely customized
  • Programmers friendly Plugins support
  • Side by side file comparisons
  • cross platform support
  • Distraction free mode (Black screen)

3. Vim


Vim is an open source free to use editor which is one of the oldest code editor of the industry. This editor works on windows, Linux, Mac os, Android and in iOS platforms. This editor supports large number of plugins which makes it fully customizable. This is one of the most powerful editor you can use but it demands your mastery due to its overtly techie nature but once you get it, you can find no other better options than this editor.
It’s features
  • Work very well with large files
  • Supports complete keyboard operations
  • Supports large numbers of plugins
  • Useful in a remote development environment using a terminal over SSH
  • It can be customized to heart’s content using .vimrc dotfile & VimScript
  • Charityware (Donations go to charities)
4. Atom
Atom is also amongst open source free to use editors which was invented by GitHub. Atom is a quite new in this industry which was introduced as “hackable text editor for the 21st century”. It’s designed very simple but can be easily customize with the help of packages. This one is resemblance of sublime text editor. It’s work on OSX 10.8 or later, Windows and Linux platforms.
It’s features
  • Very easy to use
  • Auto-completion
  • Highly customizable
  • Offers git control and package management features
  • Updates on regular basis with new functionalities and bug fixes
  • Supports Command Palette
  • Easy to Customise UI

5. Komodo Edit


komodo edit
Komodo edit is also amongst one of the powerful editor which is available in open source and free to use that works on Windows, Mac OS X and Linux. Komodo edit supports few programming languages which are HTML5, TCL, XML, JavaScript, Ruby, Python, Perl, CSS3, and PHP. This editor is preferred by advanced programmers , so if you are just starting out than it will take some time to understand it’s interface and navigations.
It’s features
  • Syntax highlighting
  • Auto indentation
  • Code folding
  • Auto completion
  • Extension support and macros
  • Multiple selections
  • Code snippets
  • Komodo IDE for Teams (you can upgrade for advance features)
In the end I would just say, the best text editor is the one you work most effectively with. You simply need to discover the editor that gets you there the fastest.
So, this is our selection of top editors for software programmer, we have tried our best to make this list but, if you used or using any other editors and find it better than the above mentioned list then let us know in the comment box below with it’s key features.
Tagged : / / / / / / / / / / / / / /

VI/VIM editor Commands | VI/VIM editor commands reference | Cheat Sheet


  • what will happen ?

“man ls |col -b > ” will give the text file same as man ls.

  • what is VI-editor ?

While in vi you can run AIX commands without exiting the editing session. The! creates a
shell to execute the command that follows.
1. :!ls will create a shell
2. All files in the current directory are listed. Press return to exit the shell and return to the
vi session or…
3. While still in command mode, issue the :r snacks command
4. The contents of snacks, in this case, are read into the vi file. By default, it will appear
after the current line.
If you need to run a series of commands without returning to vi after the first command is
executed, enter :sh. When you have run all the commands, press to exit the shell
and return to vi.

  • VI Options:-

vi has many modes of operation. Some of these will affect the way text is presented, while
others will make editing easier for novice users.
:set all display all settings
:set display settings different than the default
:set ai sets autoindent on
:set noai turns autoindent mode off
:set nu enables line numbers
:set nonu turns line numbers off
:set list displays non-printable characters
:set nolist hides non-printable characters
:set showmode shows the current mode of operation
:set noshowmode hides mode of operation
:set ts=4 sets tabs to 4-character jumps
:set ic ignores case sensitivity
:set noic case sensitive

  • Search

/word     Search “word” from top to bottom
?word     Search “word” from bottom to top
/jo[ha]n     Search “john” or “joan”
/\< the     Search “the”, “theatre” or “then”
/the\>     Search “the” or “breathe”
/\     Search “the”
/\     Search all words of 4 letters
/\/     Search “fred” but not “alfred” or “frederick”
/fred\|joe     Search “fred” or “joe”
/\     Search exactly 4 digits
/^\n\{3}     Find 3 empty lines
:bufdo /searchstr/     Search in all open files

  • Replace

:%s/old/new/g     Replace all occurences of “old” by “new” in file
:%s/old/new/gw     Replace all occurences with confirmation
:2,35s/old/new/g     Replace all occurences between lines 2 and 35
:5,$s/old/new/g     Replace all occurences from line 5 to EOF
:%s/^/hello/g     Replace the begining of each line by “hello”
:%s/$/Harry/g     Replace the end of each line by “Harry”
:%s/onward/forward/gi     Replace “onward” by “forward” , case unsensitive
:%s/ *$//g     Delete all white spaces
:g/string/d     Delete all lines containing “string”
:v/string/d     Delete 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/g     Replace “Bill” by “Steve” in current line
:%s/Bill/Steve/g     Replace “Bill” by “Steve” in all the file
:%s/\r//g     Delete DOS carriage returns (^M)
:%s/\r/\r/g     Transform DOS carriage returns in returns
:%s#]\+>##g     Delete HTML tags but keeps text
:%s/^\(.*\)\n\1$/\1/     Delete lines which appears twice
Ctrl+a     Increment number under the cursor
Ctrl+x     Decrement number under cursor
ggVGg?     Change text to Rot13


  • Case

Vu     Lowercase line
VU     Uppercase line
g~~     Invert case
vEU     Switch word to uppercase
vE~     Modify word case
ggguG     Set all text to lowercase
:set ignorecase     Ignore case in searches
:set smartcase     Ignore case in searches excepted if an uppercase letter is used
:%s/\<./\u&/g     Sets first letter of each word to uppercase
:%s/\<./\l&/g     Sets 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 outfile     Saves lines 1 to 10 in outfile
:1,10 w >> outfile     Appends lines 1 to 10 to outfile
:r infile     Insert the content of infile
:23r infile     Insert the content of infile under line 23

  • File explorer

:e .     Open integrated file explorer
:Sex     Split window and open integrated file explorer
:browse e     Graphical file explorer
:ls     List buffers
:cd ..     Move to parent directory
:args     List files
:args *.php     Open file list
:grep expression *.php     Returns a list of .php files contening expression
gf     Open file name under cursor

  • Interact with Unix

:!pwd     Execute the “pwd” unix command, then returns to Vi
!!pwd     Execute the “pwd” unix command and insert output in file
:sh     Temporary returns to Unix
$exit     Retourns to Vi

  • Alignment

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

  • Tabs

:tabnew     Creates a new tab
gt     Show next tab
:tabfirst     Show first tab
:tablast     Show last tab
:tabm n(position)     Rearrange tabs
:tabdo %s/foo/bar/g     Execute a command in all tabs
:tab ball     Puts all open files in tabs

  • Window spliting

:e filename     Edit filename in current window
:split filename     Split the window and open filename
ctrl-w up arrow     Puts cursor in top window
ctrl-w ctrl-w     Puts cursor in next window
ctrl-w_     Maximise current window
ctrl-w=     Gives the same size to all windows
10 ctrl-w+     Add 10 lines to current window
:vsplit file     Split window vertically
:sview file     Same as :split in readonly mode
:hide     Close current window
:only     Close all windows, excepted current
:b 2     Open #2 in this window

  • Auto-completion

Ctrl+n Ctrl+p (in insert mode)     Complete word
Ctrl+x Ctrl+l     Complete line
:set dictionary=dict     Define dict as a dictionnary
Ctrl+x Ctrl+k     Complete with dictionnary

  • Marks

mk     Marks current position as k
‘k     Moves cursor to mark k
d’k     Delete all until mark k
:ab pr printf(“This is a Demo Ver \n”);    Define pr as abbreviation of printf(“This is a Demo Ver \n”);

  • Text indent

:set autoindent     Turn on auto-indent
:set smartindent     Turn on intelligent auto-indent
:set shiftwidth=4     Defines 4 spaces as indent size
ctrl-t, ctrl-d     Indent/un-indent in insert mode
>>     Indent
<<     Un-indent

  • Syntax highlighting

:syntax on     Turn on syntax highlighting
:syntax off     Turn off syntax highlighting
:set syntax=perl     Force syntax highlighting

  • How to Exit

:q[uit]     Quit Vim. This fails when changes have been made.
:q[uit]!     Quit without writing.
:cq[uit]     Quit always, without writing.
:wq     Write the current file and exit.
:wq!     Write the current file and exit always.
:wq {file}     Write to {file}. Exit if not editing the last
:wq! {file}     Write to {file} and exit always.
:[range]wq[!]     [file] Same as above, but only write the lines in [range].
ZZ     Write current file, if modified, and exit.
ZQ     Quit current file and exit (same as “:q!”).

  • Editing a File

:e[dit]     Edit the current file. This is useful to re-edit the current file, when it has been changed outside                 of Vim.
:e[dit]!     Edit the current file always. Discard any changes to the current buffer. This is useful if you want                 to start all over again.
:e[dit] {file}     Edit {file}.
:e[dit]! {file}     Edit {file} always. Discard any changes to the current buffer.
gf     Edit the file whose name is under or after the cursor. Mnemonic: “goto file”.

  • Inserting Text

a     Append text after the cursor [count] times.
A     Append text at the end of the line [count] times.
i     Insert text before the cursor [count] times.
I     Insert text before the first non-blank in the line [count] times.
gI     Insert text in column 1 [count] times.
o     Begin a new line below the cursor and insert text, repeat [count] times.
O     Begin a new line above the cursor and insert text, repeat [count] times.

  • Inserting a file

:r[ead] [name]     Insert the file [name] below the cursor.
:r[ead] !{cmd}     Execute {cmd} and insert its standard output below the cursor.

Tagged : / / / / / / / / / / / / / / / / / / / / / / / / / / / / /