Softpanorama

May the source be with you, but remember the KISS principle ;-)
Contents Bulletin Scripting in shell and Perl Network troubleshooting History Humor

Vimorama 2003

TagsMenu for Vim, version 0.93

Simply, it makes a menu of all the tags in the current file, where each menu item is a link to that tag.

Have a look at it in action. In this picture, you can see a Java file. Note the addition of a menu called Tags. The contents of the menu are tag types, where each type is a submenu. In each submenu, you can see a listing of all tags of that type. In the previous picture, the compareTo method is about to be clicked. When it is, the cursor will go to this method.

The TagsMenu plugin uses a tool to get a list of the current file's tags. (This is a tool that almost every coder should use: Exuberant CTags. CTags makes tag files that are used by Vim for tag navigation (see :help tags). Very useful in of itself.) TagsMenu then parses through ctags output and makes a menu item for each tag found, where the action for that menu item is the appropriate search for that tag.

TagsMenu is setup to work automatically. When a filetype on a buffer is set, the plugin is triggered into action. If the filetype is one that is recognized by ctags, then ctags is executed and the results turned into a menu. Voila!

The requirements are very simple: Vim 6.x, Exuberant CTags 5.0.1 or greater, and this script. That's pretty simple, isn't it?

Cscope Home Page

Cscope support is built into Vim (so long as it is compiled with the '--enable-cscope' option--this is the case for most binary distributions). The Vim interface, and a set of key mappings you may find useful, is documented in our Vim/Cscope Tutorial.
 

perl.vim - Perl compiler script vim online

created by Lukas Zapletal This is compiler script that runs perl -Wc and parses all error and warnings. For more information how to use compilers in VIM read help.

This version has workaround with redirecting stderr on windows platform so it can run either on unixes or windows.

perl-support.vim - Write and run Perl-scripts using menus and kotkeys vim online

script type
utility
 
description
- insert various types of comments
- insert complete but empty statements (e.g. 'if {} else {}' )
- insert often used code snippets (e.g. declarations, the opening of files, .. )
- insert the names of file tests, character classes, special Perl-variables and POSIX-signals
- read, write, maintain your own code snippets in a separate   directory
- run scripts or run syntax check from within the editor
- show compilation erros in a quickfix window; navigate with hotkeys
- read perldoc for functions and modules

Here are some screen shots : http://lug.fh-swf.de/vim/vim-perl/screenshots-en.html

Cscope Home Page -- Cscope is a developer's tool for browsing source code. It has an impeccable Unix pedigree, having been originally developed at Bell Labs back in the days of the PDP-11. Cscope was part of the official AT&T Unix distribution for many years, and has been used to manage projects involving 20 million lines of code! In April, 2000, thanks to the Santa Cruz Operation, Inc. (SCO) (since merged with Caldera), the code for Cscope was open sourced under the BSD license.

Cscope support is built into Vim (so long as it is compiled with the '--enable-cscope' option--this is the case for most binary distributions). The Vim interface, and a set of key mappings you may find useful, is documented in our Vim/Cscope Tutorial.

The Berkeley Vi editor (nvi) also works with cscope. See also cbrowser

Massconfusion Tim

My VIMRC file

Here's my _vimrc/.vimrc file. I do not keep a separate _gvimrc file and in general use this file for both UNIX and Windows NT VIM initialization - hence the weird backupdir line.

Notes on Options:
set viminfo='100,\"50,n~/.viminfo

It's easier to view the help on your options here (:help viminfo). The viminfo file maintains your histories (search, commandline, registers etc...) between file edits. It'll be like you never left VIM! :)

set statusline=%1*%F%*\ %y\ %2*%r%m%*\ %=%l/%L\ (%p%%)
set laststatus=2

My status line has filepath, ReadOnly Status (RO), Modified Status(+), Current Line / Total Lines, and percentage of file traversed. If you use my highlightings, the RO and + should appear in red. :set laststatus=2 ensures that all my windows will have statuslines.

if &term == "xterm-color"
set t_kb=^H
fixdel
endif

Take note that the ^H there is really a CTRL-H, so make sure you prepend a CTRL_V during your insertion of it in your vimrc file (hit CTRL-V CTRL-H so a literal control character is inserted). Depending on your terminal, this might fix your backspace problem. Do a help :term to see some specific terminal issues - this one can drive you batty!

:map <F2> :!p4 edit %<CR> :e! <CR>
:map <F3> :!p4 diff %<CR>
:map <F7> :!perl -c %<CR>
:map <F11> :!p4 add %<CR>
:map <F12> :!p4 submit %<CR>

These options are only useful if you are a Perl developer or use Perforce for source control. You can map them to whatever key you want. I've chosen <F7> here to stay consistent with the "compile" key in Windows/Dos compilers. Based on these I'm sure you can come up with the right command to map things for CVS as well.

If you are setting them explicitly in command mode during a VI session, after you type :map you can type the key you want to map it to. If the keyname doesn't appear, your terminal might not support that keystroke. Do a :set termcap to see what VIM thinks your terminal settings are.


Other Useful Initiations

These are some initiations that are not explicitly in my _vimrc/.vimrc startup file but that I cinlude from time to time. Put it in a file wherever you want and when you want to use just :source your_filename from the VIM command line.

function InitWin32Gui()
winpos 600 0
set guifont=Lucida_Console:h10
set lines=76
map <F6> :!form.pl %<CR>:e!<CR>
menu PopUp.-SEP3- :
menu PopUp.Format\ From\ Here gqG
endfunction

:autocmd GUIEnter * call InitWin32Gui()

This actually is in my NT _vimrc file, my only exception to the "one vimrc" file rule. And the only reason why is because I haven't figured out how to only call this in Windows. If someone knows, please let me know! :)

The :winpos 600 0 call explicitly sets the VIM windows position and the :set lines=76 explicitly sets the window size.

map <C-F3> :%s/<FORM .*>\|<INPUT .*>\|<SELECT .*>\|<OPTION .*>/&/gi

Occasionally I'll map this key. Basically if I'm trying to put together a script for an HTML page, this is useful when I have the HTML page in another window. Since I have :set hlsearch (highlight searches) it makes it easy to pick out various FORM tags. This command does a global search on the pattern and replaces the pattern with itself (&). I use the :%s instead of / because / doesn't implement the trailing /i option to ignore case. Hopefully they'll implement that soon.


Perl Tagging

This information was not the easiest to dig up. But if you want more information do a :help perl_info and some information should be there with additional links on where you can dig up more.

In general there are two things to do:

find /usr/lib/perl5 -name *.pm -type f -exec ptags.pl -m -t path_to_tags_file {} \;

Limitations of Perl tagging (at least with the script here): Tagging uses the first match found in the tagging file. As a result only unique function names can be found (usually not a problem) but with the advent of Perl OO common functions like "new" do not work well with tagging. Also explicit object referencing via :: also does not work. However most function names are unique so this often is not a problem. It certainly makes life easier when going through a lot of perl files!


VIM Commands and Tips

Getting around faster:

*/# (forward/backward) searches for the word under your cursor
| Goes to 0th column
gf Goto Filename under cursor. Uses isfname option to determine what characters are filenames. Useful if you're editing HTML.

Quick Windowing Commands:

CTRL W n Start a new window
CTRL W c Close a window
CTRL W j Goto next window
CTRL W k Goto previous window

Other Useful Commands:

ga or :as Prints out the ascii value of the chacter under the cursor in decimal, hex, and octal.
CTRL-V [keystroke] Will insert the next chacter literally (useful for inserting raw CTRL characters).

Tips:


Looking for a Visual/Graphical Diff?

Look no further than the VIM package itself. I don't see this reference anywhere in the formal documentation but if you go poking around in the shared VIM directories you'll find a program called gvimdiff. On my system, I find it here:

/usr/local/share/vim/vim55/tools/gvimdiff

This is a csh script that uses diff and gvim to produce a great visual diff. It works in console mode as well if you can't run gvim, just symbolic link vimdiff to gvimdiff and it'll figure things out.

 

[Aug 29, 2003] The Text Editor Sam by Rob Pike. An interesting attempt to modernize vi. This paper is reprinted from Software­Practice and Experience, Vol 17, number 11, pp. 813-845, November 1987. If you want to play with it there is a UNIX version at:
ftp://netlib.bell-labs.com/netlib/research/sam.shar.gz
and a Windows version (currently distributed in binary form only) at:
ftp://netlib.bell-labs.com/netlib/research/sam.exe

the editor has some interesting features, for example more flexible piping constructs:

There are also three commands that apply programs to text:

< UNIX program

replaces dot by the output of the UNIX program. Similarly, the > command runs the program with dot as its standard input, and | does both. For example,

| sort

replaces dot by the result of applying the standard sorting utility to it. Again, newlines have no special significance for these sam commands. The text acted upon and resulting from these commands is not necessarily bounded by newlines, although for connection with UNIX programs, newlines may be necessary to obey conventions.

[Jun 21, 2003] allfold - View selected lines by folding away the rest vim online. A very interesting emulation  of Xedit all command in vim 6  by Marion Berryman. Highly recommended.

The allfold scripts implement a feature set which allows VIM users to view ALL interesting lines in a buffer and FOLD the rest away.  Lines are selected to be interesting in one of the two following ways:

1. They match a regular expression pattern.
2. They are in a block of lines delimited inclusively by a line that matches
   a beginning RE pattern and a line that matches an ending RE pattern.

Sets of lines matching different selection criteria can be combined using logical "and" and "or" operations. The selections may be inverted so that lines not matching the selection criteria are actually selected.

Beyond these basics other features do such things as manipulating lists of selection commands and using the raw selection "bit-map" directly to enhance the capabilities and ease of use of the scripts.

Continued


Etc

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available in our efforts to advance understanding of environmental, political, human rights, economic, democracy, scientific, and social justice issues, etc. We believe this constitutes a 'fair use' of any such copyrighted material as provided for in section 107 of the US Copyright Law. In accordance with Title 17 U.S.C. Section 107, the material on this site is distributed without profit exclusivly for research and educational purposes.   If you wish to use copyrighted material from this site for purposes of your own that go beyond 'fair use', you must obtain permission from the copyright owner. 

ABUSE: IPs or network segments from which we detect a stream of probes might be blocked for no less then 90 days. Multiple types of probes increase this period.  

Society

Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers :   Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism  : The Iron Law of Oligarchy : Libertarian Philosophy

Quotes

War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda  : SE quotes : Language Design and Programming Quotes : Random IT-related quotesSomerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose BierceBernard Shaw : Mark Twain Quotes

Bulletin:

Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 :  Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method  : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law

History:

Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds  : Larry Wall  : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOSProgramming Languages History : PL/1 : Simula 67 : C : History of GCC developmentScripting Languages : Perl history   : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history

Classic books:

The Peter Principle : Parkinson Law : 1984 : The Mythical Man-MonthHow to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Hater’s Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite

Most popular humor pages:

Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor

The Last but not Least


Copyright © 1996-2016 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License.

The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to make a contribution, supporting development of this site and speed up access. In case softpanorama.org is down you can use the at softpanorama.info

Disclaimer:

The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.

Last modified: June 04, 2016