Lines can be formatted using
set tw=80
and then the famous gq command.
Friday, April 06, 2007
Wednesday, January 31, 2007
Word macro to export comments
' This macro will export all the comments in the word doc to a new word doc.
' U can save the word doc as .txt.
' Change the extension to .csv
' Open the doc with excel and u have exported your comments to excel
Sub ExportComment()
Dim s As String
Dim cmt As Word.Comment
Dim doc As Word.Document
For Each cmt In ActiveDocument.Comments
s = s & cmt.Initial & cmt.Index & "," & cmt.Range.Text & vbCr
Next
Set doc = Documents.Add
doc.Range.Text = s
End Sub
' U can save the word doc as .txt.
' Change the extension to .csv
' Open the doc with excel and u have exported your comments to excel
Sub ExportComment()
Dim s As String
Dim cmt As Word.Comment
Dim doc As Word.Document
For Each cmt In ActiveDocument.Comments
s = s & cmt.Initial & cmt.Index & "," & cmt.Range.Text & vbCr
Next
Set doc = Documents.Add
doc.Range.Text = s
End Sub
Word macro for requirement table
Need word macro to parse a doc and get all the requirements in one table
Friday, January 05, 2007
MSWORD: Macro to add cross reference
Sub CreateCR()
' CreateCR Macro
' Macro recorded 1/5/2007 by Jay
' This macro converts selection copy to a cross reference - numbered item
Selection.Copy
Dim crossref
crossref = Selection
'MsgBox (crossref)
Dim pNumberedItem
pNumberedItem = ActiveDocument.GetCrossReferenceItems(wdRefTypeNumberedItem) For i = 1 To UBound(pNumberedItem)
'MsgBox (pNumberedItem(i))
If Selection = Trim(pNumberedItem(i)) Then
Selection.InsertCrossReference ReferenceType:="Numbered item", _ ReferenceKind:=wdNumberNoContext, ReferenceItem:= i, _
InsertAsHyperlink:=True, IncludePosition:=False
Exit For
End If
Next i
End Sub
' CreateCR Macro
' Macro recorded 1/5/2007 by Jay
' This macro converts selection copy to a cross reference - numbered item
Selection.Copy
Dim crossref
crossref = Selection
'MsgBox (crossref)
Dim pNumberedItem
pNumberedItem = ActiveDocument.GetCrossReferenceItems(wdRefTypeNumberedItem) For i = 1 To UBound(pNumberedItem)
'MsgBox (pNumberedItem(i))
If Selection = Trim(pNumberedItem(i)) Then
Selection.InsertCrossReference ReferenceType:="Numbered item", _ ReferenceKind:=wdNumberNoContext, ReferenceItem:= i, _
InsertAsHyperlink:=True, IncludePosition:=False
Exit For
End If
Next i
End Sub
Sunday, December 31, 2006
Windows: Adding button to IE
run gpedit.msc
go to Windows Settings InternetExplorerMaintenance
Browser User Interface Browser ToolBar Customizations
go to Windows Settings InternetExplorerMaintenance
Browser User Interface Browser ToolBar Customizations
Thursday, December 28, 2006
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
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
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
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
: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
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
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
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.
example:
watch --interval=10 mpstat
This shows the output of mpstat command every 10 secs in a window.
Sunday, December 24, 2006
VIM: File register %
Vim stores the name of the file in the register %
We can get the name of the file by keystrokes+%
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 ..;)
Subscribe to:
Posts (Atom)