[Vim] Question about syntax highlighting

Hi all,

my sysadmin installed Vim packages (vim-enhanced-6.3-1 & vim-common-6.3-1) on an Aix system (7.1.0.0).

I log in using Putty (vs 0.54) and got an annoying underline issue. All strings and var names are underlined as you can see on the attached file

Is it possible to get rid of that functionnality ?

Thank You
Please find hereafter my vimrc configuration file :

set nocompatible        " Use Vim defaults (much better!)
set backspace=2         " allow backspacing over everything in insert mode
                        " Now we set some defaults for the editor
set autoindent          " always set autoindenting on
set textwidth=72        " Don't wrap words by default
set nobackup            " Don't keep a backup file
set viminfo='20,\"50    " read/write a .viminfo file, don't store more than
                        " 50 lines of registers
set history=50          " keep 50 lines of command line history
set ruler               " show the cursor position all the time

" Vim5 comes with syntaxhighlighting. If you want to enable syntaxhightlighting
" by default uncomment the next three lines.
" Patrick ... 3 lignes suivantes d�comment�es
if has("syntax")
  syntax on             " Default to no syntax highlightning
  hi Comment ctermfg=DarkMagenta
endif

set showcmd             " Show (partial) command in status line.
set showmatch           " Show matching brackets.
set ignorecase          " Do case insensitive matching
set noincsearch         " Incremental search
set autowrite           " Automatically save before commands like :next and :makeset nohlsearch
set nohlsearch
" set mouse=a
set shiftwidth=2

Change

if has("syntax")
  syntax on             " Default to no syntax highlightning
  hi Comment ctermfg=DarkMagenta
endif

to

" if has("syntax")
"  syntax on             " Default to no syntax highlightning
"  hi Comment ctermfg=DarkMagenta
" endif

Commenting these lines is worse.
All lines leading spaces are then underlined too.

Thank You

---------- Post updated 20th Nov 2012 at 02:47 PM ---------- Previous update was 19th Nov 2012 at 03:35 PM ----------

I've got some time spare today and look at vimdoc and that other page.

Adding these lines in my .vimrc does the job, no more undelined stuff in my scripts :

hi PreProc term=none
hi Identifier term=none
hi Constant term=none

:slight_smile:

1 Like

As i like my editor windows the same way as i like my steaks (that is: as rare as possible and not cooked at all) i once researched to make vim behave as close to vi as was possible. I'd still like to see a "vi-compatibility mode".

Colours in vim chave to be switched on/off in three different steps. All the following command can be tested (issue from the ":"-prompt lasts only this session) in a session or/and be put into .exrc for a lasting effect.

Syntax-Highlighting
is switched with the "syntax" parameter:

syntax on
syntax off

Search-Highlighting
searching with "/" causes the terms searched for to be highlighted regardless of syntax highlighting. It can be switched by:

set hlsearch
set nohlsearch

Colour-Scheme
Even with everything turned off there is still the class of non-printing characters (the "^M" in DOS-files for instance) which are displayed in some sort of stand-out mode. This will take care of that:

set t_Co=0

I hope this helps.

bakunin

1 Like

My scripts are now displayed without any underlined things.

Next step for me was to activate (if possible) syntax highlighting using colors.
The context is Putty 0.54 on XP, Vim on Aix 7.1.0.0 (rpm packages vim-enhanced-6.3-1 & vim-common-6.3-1).

The current situation is that only Vim directives for colors using term works. Directives for ctermfg and ctermbg do not produce any setup.
I guess my putty terminal can produce colors becauses all Vim groups which have term=bold are displayed in a Magenta color.
In my Putty confiuration (Window>Colors) Bolded text is a different colour is checked. I've tried to use the other checkbox (Attemps to use logical palettes, Use system colours), but it do not work too.

Searching the web, I've tried to pass some strings to Putty in Connection>Terminal-type string like Putty-256 ... putty-vt100 but Vim display a rapid message before opening the script :

Terminal entry not found in terminfo
'PUTTY-256COLOR' not know. Available builtin terminals are 
builtin_amiga
...
builtin_ansi
builtin_xterm

I've tried to pass xterm as Connection>Terminal-type string and now it works. :slight_smile:
Vim displays now my scripts in coloured mode (ctermfg and ctermbg are now effective). :b:

Hope this helps people who encounter the same issue
--
ps : using Connection>Terminal-type string setups your $TERM var

1 Like