Some interesting things !!

1 view
Skip to the first unread message

lokesh walase

unread,
30 Oct 2011, 15:28:0930/10/2011
to cof...@googlegroups.com
**MILES TO GO BEFORE  WE SLEEP....

1.I always wished that as a programmer , I should not waste my time in writing the trivial stuff, the one I require every time I sit to write the program. For example, while writing any C-program, we have the general format of #include<...> & then main() {  ... return 0 ; }
What if every time I start writing the program, this format is ready for me ?? Well thats possible, atleast with "vim".

Create the standard format of the file you want , lets say at <~/format> is the path.

Now start vim : vim <file_name.c> ,& then type , in command-mode ---> :r ~/format ,thats all , whatever is in the file <~/format> will be simply pasted .

I have created the file : <~/lic.c> , it contains the GNU GPL disclaimer. Now after I finish writing the program , I just have to say ( in command mode ) --> :r ~/lic.c , thats all, the license-terms get pasted .
It looks like this :
/* ########################################################################
 *
 *LAST UPDATED :

 *Copyright (C) 2011 Lokesh Walase <loke...@gmail.com>
 *
 * Released under GNU General Public License v2.0+ .
 * FOR DETAILED LICENSE, SEE THE END OF THIS PROGRAM.
 *
 *########################################################################
 */


/*####################################################################################################################
*
*This program is free software; you can redistribute it and/or modify
*it under the terms of the GNU General Public License as published by
*the Free Software Foundation; either version 2 of the License, or
*(at your option) any later version.
*
*This program is distributed in the hope that it will be useful,
*but WITHOUT ANY WARRANTY; without even the implied warranty of
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*GNU General Public License for more details.
*
* Visit <http://www.gnu.org/copyleft/gpl.html>
*
*To  receive a copy of the GNU General Public License
* write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, *Boston, MA  02110-1301  USA

*The GNU General Public License does not permit incorporating this program
*into proprietary programs.
*
* ########################################################################################################################
*/


2.As you might have noticed , the <~/lic.c> has the field --> LAST UPDATED :  , now to put the date & time here , go to that line, & in command mode ---> :r !date .

3.Well, if that didnt really raise your eyebrows, here's somemore . What is the best thing of the "terminal" ?? Yes, it "auto-completes" the commands by '\t' key. Now what if the same feature of "auto-completion" is present everywhere & not only in the "terminal" ?? Well thats possible, (again) atleast with "vim" .

Create a new <.vimrc> file in your home-folder . Say : vim .vimrc , at your home-folder & then copy paste this code( I found it on net ) :

        function! Tab_Or_Complete()
         if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w'
                 return "\<C-N>"
            else
                        return "\<Tab>"
               endif
        endfunction
         :inoremap <Tab> <C-R>=Tab_Or_Complete()<CR>
         :set dictionary="/usr/dict/words"

Pls be sure of the indentation ,everything has to be strictly indented . I dont know what exactly it is doing .
Now vim will "auto-complete" any words you type , press '\t' for the same . Its indeed cool ........proud to be a "vimmer" !! ;)

4.Now whats next ?? Well, enough of vim. Recently I came to know of the command that can convert .pdf files to text-files, post-script files , html-files & many more. Just type <pdf> in the terminal & then you press '\t' twice to see all the options .
Reading man pages is boring , so u may convert a lengthy man-page to a html file & get a nice look & feel to read it , I did it for "info flex" .
Type : info flex > flex.odt . Now open flex.odt & get its pdf format , & then use command --> pdftohtml flex.pdf flex.html


Indeed , we have miles to go ...........!!!

---Lokesh  Walase ( TY-Comp , Coep )

akshay khole

unread,
31 Oct 2011, 01:08:4831/10/2011
to cof...@googlegroups.com
Thank you for sharing this. 
A good article indeed!

regards, 
arkiver

ABHIJAY PATNE

unread,
31 Oct 2011, 16:52:5831/10/2011
to cof...@googlegroups.com
Nice one !!
 
 -- Regards 
 Abhijay Patne
 T. Y. B. Tech. Comp. 
 College of Engineering, Pune
 Shivaji Nagar, Pune - 411005.

Disclaimer: Email and any files transmitted with it are intended solely for the use of the addressee(s) only and may contain confidential and/or privileged information. If you are not the addressee, then this message is not intended for you and be advised that you have received this email in error. In such case please notify the sender and delete this email and any attachments with it from your system immediately. In case of security concern, please notify the sender immediately & forward a copy of this to oxyg...@gmail.com .

Shakthi Kannan

unread,
31 Oct 2011, 21:25:4131/10/2011
to cof...@googlegroups.com
Hi,

--- On Tue, Nov 1, 2011 at 2:22 AM, ABHIJAY PATNE <oxyg...@gmail.com> wrote:
| Disclaimer: Email and any files transmitted with it are intended solely for
| the use of the addressee(s) only and may contain confidential and/or
| privileged information.
|

| ...
\--

Such disclaimers are against the principles of free/open source
software. Kindly remove them from your e-mail composition. For
reference:

http://shakthimaan.com/downloads.html#mailing-list-guidelines

SK

--
Shakthi Kannan
http://www.shakthimaan.com

Reply all
Reply to author
Forward
0 new messages