Visual Tabs in Vim (was: Why whitespace denotation of blocks doesn't work.)

Rod Haper Rod.Haper at sage.nelesautomation.com
Wed Jun 21 17:59:04 EDT 2000


The following is an improvement to the autocmds block:

if !("autocommands_loaded")
    let autocommands_loaded = 1
    autocmd BufNewFile,BufRead,BufEnter *.py set list
    autocmd BufLeave *.py set nolist
endif

Now this will automatically turn off list mode when you exit a Python
filetype buffer.
I also forgot to mention that the mapping of the F8 function key below
is all one line.


Rod Haper wrote:
> 
> Add the lines below  to your .vimrc file to show <TAB> characters as "»"
> when vim list mode is on, automatically switch on list mode when
> entering a Python filetype buffer and allow taggling of list mode using
> the F8 function key:
> 
> set lcs=tab:»\
> set nolist
> if !("autocommands_loaded")
>     let autocommands_loaded = 1
>     autocmd BufNewFile,BufRead *.py set list
> endif
> map <F8> :if &list <Bar> set nolist <Bar> else <Bar> set list <Bar>
> endif <CR>
> 
> Neil Schemenauer wrote:
> >
> > Toby J Sargeant <tjs at cs.monash.edu.au> wrote:
> > >:set lcs=tab:»\
> > >:set list
> >
> > Unfortunately both those settings are global instead of per
> > buffer.  I guess you could hack some macro to change them when
> > you enter a .py buffer.

-- 
+----------------------------------------------------------------------+
| Rod Haper, Senior Systems Analyst      |  Neles Automation           |
| Phone: 713-346-0652 - direct           |  SCADA Solutions, Inc.      |
|        713-939-0393 - fax              |  7000 Hollister             |
| Rod.Haper at sage.nelesautomation.com     |  Houston, Texas 77040, USA  |
+----------------------------------------------------------------------+



More information about the Python-list mailing list