LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   vim syntax highlighting issues (https://www.linuxquestions.org/questions/linux-newbie-8/vim-syntax-highlighting-issues-804794/)

sd|| 04-28-2010 12:13 PM

vim syntax highlighting issues
 
i am a VIM used,

recently i have started programming in python and felt like need of syntax highlighting, made a configuration file .vimrc and saved

Code:

syntax on
into it.

still then there is no syntax highlighting and i opened python file and used following key combination still there is not success

Code:

[ESC] :syntax on
please suggest me how can i make it working, or and probable mistakes i have done.

rweaver 04-28-2010 12:24 PM

What linux distribution are you using? Did you install the full version of vim or are you using vim-tiny/small/etc?

In debian/ubuntu you probably want:
Code:

apt-get install vim-full vim-scripts vim-common vim-runtime
for fedora/redhat/centos:
Code:

yum install vim-enhanced vim-common
Once you do that :syntax on or adding it to the rc file should work ~provided~ the files are named appropriately (ending in .py) or alternately have the correct #!/path/interpreter notation at the top.

sd|| 04-28-2010 12:36 PM

thank you very much for your suggestion.. i will install it as soon as i get a open internet connection :)

rweaver 04-28-2010 12:38 PM

Oh and I like these in my .vimrc
Code:

set nocompatible
syntax on
set background=dark
filetype plugin indent on
set showcmd
set showmatch
set ignorecase
set smartcase
set incsearch

Now mind, I don't use this but a friend has used this for a year or so doing python and says he can't live without it(leaving out his perl and ruby additions which make it absurdly long)
Code:

set nocompatible
syntax on
set background=dark
au BufRead,BufNewFile *py,*pyw,*.c,*.h set tabstop=8
au BufRead,BufNewFile *.py,*pyw set shiftwidth=4
au BufRead,BufNewFile *.py,*.pyw set expandtab
fu Select_c_style()
    if search('^\t', 'n', 150)
        set shiftwidth=8
        set noexpandtab
    el
        set shiftwidth=4
        set expandtab
    en
endf
au BufRead,BufNewFile *.c,*.h call Select_c_style()
au BufRead,BufNewFile Makefile* set noexpandtab
highlight BadWhitespace ctermbg=red guibg=red
au BufRead,BufNewFile *.py,*.pyw match BadWhitespace /^\t\+/
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h set textwidth=79
au BufRead,BufNewFile *.c,*.h set formatoptions-=c formatoptions-=o formatoptions-=r
au BufNewFile *.py,*.pyw,*.c,*.h set fileformat=unix
set ignorecase
set incsearch


sd|| 04-29-2010 03:26 AM

Sir, I have installed all necessary packages, now syntax highlighting and other vim features are working on konsole but its not working for yakuake! how can i make it work over there??

grail 04-29-2010 07:30 AM

Does it display any coloring at all or just the standard for that terminal?

rweaver 04-29-2010 09:54 AM

What does it do in Yakuake? Can you see other colors in console output (like the output of ls?)


All times are GMT -5. The time now is 02:34 AM.