LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 04-28-2010, 12:13 PM   #1
sd||
Member
 
Registered: Oct 2009
Distribution: Arch Linux
Posts: 89

Rep: Reputation: 18
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.
 
Old 04-28-2010, 12:24 PM   #2
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 163Reputation: 163
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.

Last edited by rweaver; 04-28-2010 at 12:30 PM.
 
Old 04-28-2010, 12:36 PM   #3
sd||
Member
 
Registered: Oct 2009
Distribution: Arch Linux
Posts: 89

Original Poster
Rep: Reputation: 18
thank you very much for your suggestion.. i will install it as soon as i get a open internet connection
 
Old 04-28-2010, 12:38 PM   #4
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 163Reputation: 163
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
 
Old 04-29-2010, 03:26 AM   #5
sd||
Member
 
Registered: Oct 2009
Distribution: Arch Linux
Posts: 89

Original Poster
Rep: Reputation: 18
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??
 
Old 04-29-2010, 07:30 AM   #6
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,433

Rep: Reputation: 1879Reputation: 1879Reputation: 1879Reputation: 1879Reputation: 1879Reputation: 1879Reputation: 1879Reputation: 1879Reputation: 1879Reputation: 1879Reputation: 1879
Does it display any coloring at all or just the standard for that terminal?
 
Old 04-29-2010, 09:54 AM   #7
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

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


Reply

Tags
vim


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vim syntax highlighting Gortex Programming 1 08-18-2008 05:43 PM
VIM Syntax Highlighting JMJ_coder Programming 3 03-05-2008 04:37 PM
[SOLVED] vim without syntax highlighting lord_didger Debian 5 11-18-2006 01:29 PM
vim syntax highlighting MiniMe001 Linux - General 2 06-19-2005 11:08 AM
Vim syntax highlighting NSKL Linux - Software 2 11-09-2002 02:39 AM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration