Sunday, December 31, 2006

Windows: Adding button to IE

run gpedit.msc
go to Windows Settings InternetExplorerMaintenance
Browser User Interface Browser ToolBar Customizations

Thursday, December 28, 2006

MSWORD: Link for creating keyboard shortcuts

http://www.oreilly.com/pub/h/2546

Windows: BookMarkelet to fill taxi requests

javascript:function jay(){var F = document.forms;var x=F[0].PURPOSE; x.options[x.selectedIndex].text='Late Stay';var y=F[0].LOC_TYPE; y.options[y.selectedIndex].text='Plot - 17';F[0].CHARGENO.value = 'STKL002',F[0].TO_PLACE.value='Gurgaon Patel Nagar',F[0].l_tele_no.value='9818203631';} jay();

You can find more information about book markelets from wikipedia

VIM: Auto commenting for function closing braces

You can use the following code to perform auto commenting. Put this in your .vimrc file.
This script will add the following comment after }//
}// end

" abbrevation for doing commenting at end of functin curly bracket end "}"
" use }// to comment the code
iab }// ^[:call CurlyBracket()^MA

function CurlyBracket()
let l:my_linenum = line(".")
let l:linenum = searchpair('{', '', '}', 'bW')
let l:line = getline(l:linenum - 1)
let l:str = strpart( line, 4 )
sil exe ":" . l:my_linenum
sil exe "normal a} // end " . str
endfunction

Tuesday, December 26, 2006

VIM: vimrc function to set file name

This function replaces the existing file name with the name of the file stored in register %.
The file should have the file name after "Module" word for this function to work properly.

function! ReadFileName()
let l:linenum = search("^// *[Mm]odule","w")
let l:filename = getreg("%")
let l:newline = '// Module : '.filename
sil exe ":call setline( linenum, newline)"
endfunction

VIM: moving quickly between split windows

Have following maps in your vimrc to frequently move between splitted windows:

:map [ctrl-v][ctrl-up arrow] :wincmd k [ctrl-v]enter
:map [ctrl-v][ctrl-down arrow] :wincmd j [ctrl-v]enter
:map [ctrl-v][ctrl-left arrow] :wincmd h [ctrl-v]enter
:map [ctrl-v][ctrl-right arrow] :wincmd l [ctrl-v]enter

To resize windows
:map [ctrl-v][+] :[ctrl -w]+ [ctrl-v]enter
:map [ctrl-v][-] :[ctrl -w]- [ctrl-v]enter

VIM: Indentation tip

map F10 ==j
and then just press F10 to indent your complete file
You should be having following set for having proper indentation
set ts=4
set sw=4

UNIX: Passwordless authentication

You can have passwordless authentication using the information in the given site

http://www.unixwiz.net/techtips/putty-openssh.html

MSWORD: Macro for Document Map

Word Macro to toggle Document Map using [control - D]. You can map this macro with [control-D] and then can hide/unhide document map using [control-D]. Remember that document maps are major reason for crash while saving doc, so take care that you unhide it while saving docs.

Sub DocumentMap()

If (ActiveWindow.DocumentMap) Then
ActiveWindow.DocumentMap = False
Else
ActiveWindow.DocumentMap = True
End If

End Sub

VIM: Getting names of file in the current directory

File names in the current directory can be obtained by key strokes: [control -x] +[control-f]

UNIX: watch command

Watch command is pretty helpful if you want to continuously view the output of a command.
example:

watch --interval=10 mpstat

This shows the output of mpstat command every 10 secs in a window.

Sunday, December 24, 2006

VIM: Word Completion

Word Completion in VIM can be achieved by
Control - x + Control - p

VIM: File register %

Vim stores the name of the file in the register %
We can get the name of the file by keystrokes +%

Brutal attack by fate on 22nd June

I guess I will fill this later in my life.....for the time being keeping you people guessing ..;)