LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-04-2014, 06:30 PM   #1
slack_
Member
 
Registered: Oct 2013
Distribution: Slackware, Arch
Posts: 105

Rep: Reputation: Disabled
Vim colors


I created a ~/.vimrc which contains this:
Code:
colorscheme dante
Which refers to dante.vim located in /usr/share/vim/vim74/colors/

When I close the terminal and open a new one, and try to edit a file, the default colorscheme still shows up. I know it's not using the one I specified in .vimrc because after I edit the file I enter:
:colorscheme dante
And it changes to dante. People make it sound so simple, but the colorscheme specified in ~/.vimrc still only takes affect when I run the :colorscheme command. How do I get it to work even on reboot/new terminal?
 
Old 09-04-2014, 06:37 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,297
Blog Entries: 24

Rep: Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255
Is it possible that you have two colorscheme lines in your .vimrc, and the second is resetting the dante line?

It really is so simple, when you get all the little duckies in a row.

If not, could you post your ~/.vimrc and the dante.vim file for us.

Last edited by astrogeek; 09-04-2014 at 06:40 PM.
 
Old 09-04-2014, 07:20 PM   #3
GazL
LQ Veteran
 
Registered: May 2008
Posts: 7,010

Rep: Reputation: 5142Reputation: 5142Reputation: 5142Reputation: 5142Reputation: 5142Reputation: 5142Reputation: 5142Reputation: 5142Reputation: 5142Reputation: 5142Reputation: 5142
I'm not an expert but I think they must have changed the definitions needed for vim colour files at some point.

Check the colour file contains something like:
Code:
hi clear
set background=dark
if exists("syntax_on")
  syntax reset
endif
let g:colors_name = "gazl"
where g:colors_name is set to the name of the colour file. I've found that without this, vim won't load the colour scheme from a statement in vimrc, but it will work if loaded from within vim with :color.
 
Old 09-04-2014, 07:22 PM   #4
slack_
Member
 
Registered: Oct 2013
Distribution: Slackware, Arch
Posts: 105

Original Poster
Rep: Reputation: Disabled
Ok, I just noticed that the colorscheme DOES indeed take effect, when I run vim WITHOUT sudo. If I run it with sudo it doesn't load the colorscheme.
 
Old 09-04-2014, 07:31 PM   #5
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,297
Blog Entries: 24

Rep: Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255
You will need to have the root .vimrc also invoke the desired color scheme.

Surely you are not running Vim with sudo for normal uses are you?

Last edited by astrogeek; 09-04-2014 at 07:32 PM.
 
Old 09-04-2014, 08:14 PM   #6
slack_
Member
 
Registered: Oct 2013
Distribution: Slackware, Arch
Posts: 105

Original Poster
Rep: Reputation: Disabled
Ok that makes sense. No, I only run it using sudo when I need to edit, say, a /etc file that is write-protected or something.
 
Old 09-04-2014, 10:10 PM   #7
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,297
Blog Entries: 24

Rep: Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255Reputation: 4255
Ok, just wasn't sure from your other posts.

So, yes, when using Vim with sudo it will use /root/.vimrc instead of the user's ~/.vimrc.

If you are the only user or admin for the box, just copy your own .vimrc over to root and you will always be in a familiar environment - it's what I do, must be right!
 
  


Reply


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
Can't get vim colors working keyboard1973 Linux - Newbie 8 07-03-2008 11:29 AM
vim colors AndeAnderson Linux - Software 3 03-09-2007 06:41 AM
vim colors fw12 Linux - General 5 07-02-2006 11:49 PM
what controls colors in vi/vim? pfaendtner Linux - Software 3 03-24-2005 05:51 PM
vim colors Erik Thorsson Debian 1 02-09-2005 09:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:32 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration