You are not logged in.
Pages: 1
Hello! This is my first post and I'm new with Archlinux, sorry if this trouble is very simple but I'm a newbie...
The question... Vim color scheme only works fine when I use sudo or when I'm root...
I've put the color scheme in /usr/share/vim/vim73/colors and in ~/.vim/colors, and I've configured /etc/vimrc and ~/.vimrc
I don't know what's wrong...
Correct color scheme (with sudo):
Wrong color scheme (normal user):
Thank you very much!!
Last edited by Midnith (2012-03-27 11:58:48)
Offline
Hello! This is my first post and I'm new with Archlinux, sorry if this trouble is very simple but I'm a newbie...
The question... Vim color scheme only works fine when I use sudo or when I'm root...
I've put the color scheme in /usr/share/vim/vim73/colors and in ~/.vim/colors, and I've configured /etc/vimrc and ~/.vimrcI don't know what's wrong...
Correct color scheme (with sudo):
http://img838.imageshack.us/img838/7463/snapshot1x.pngWrong color scheme (normal user):
http://img839.imageshack.us/img839/3189/snapshot2w.pngThank you very much!!
Hi Midnith, welcome to the forum. Good job getting the images the right size .
If your colour scheme appears in /usr/share/vim/vim73/colors, you shouldn't need it in your user's .vim directory - you only need to set the colour in your .vimrc to the correct name.
Could you please post your ~/.vimrc? And where did you get the colour scheme?
Edit: also, have you tried other colours? And what is your terminal?
Last edited by /dev/zero (2012-03-27 00:58:32)
Offline
Hello Midnith!
I suggest you to start vim as root (sudo) and get the current color scheme with the help of the :colorscheme command without any parameters in vim.
Then start vim as normal user and try to set color scheme from root's vim:
:colorscheme <your_color_scheme>
where <your_color_scheme> is the name of the scheme you got from root's vim.
If this helps you can make it permanent by adding colorscheme <your_color_scheme> to ~/.vimrc
Hope that helps.
Offline
Hello again! Thanks for replying!
Could you please post your ~/.vimrc? And where did you get the colour scheme?
Edit: also, have you tried other colours? And what is your terminal?
· This is mi ~/.vimrc (and also my /etc/vimrc):
set cindent
set hlsearch
set ic
set incsearch
set number
syntax on
colorscheme gummybears
· I get my color scheme from here and I modified it to get off italics.
· I tried the default colors from vim and seems that are working fine. I realized that, whem I'm with sudo (or root), change to one default color and go back to gummybears, gummybears works wrong, as in normal user.
· I'm using the konsole from kde (bash).
Hello Midnith!
I suggest you to start vim as root (sudo) and get the current color scheme with the help of the :colorscheme command without any parameters in vim.
Then start vim as normal user and try to set color scheme from root's vim:
:colorscheme <your_color_scheme>
where <your_color_scheme> is the name of the scheme you got from root's vim.
If this helps you can make it permanent by adding colorscheme <your_color_scheme> to ~/.vimrc
Hope that helps.
Sorry, didn't work
----------------------
Thank you for helping me!
Offline
See if adding t_Co=256 to your vimrc before setting the colorscheme helps. (E.g.
set cindent
set hlsearch
set ic
set incsearch
set number
syntax on
t_Co=256
colorscheme gummybears
)
Also post the output from the following:
echo $TERM
#and
tput colors
edit: Also mention which terminal emulator you're using, xterm, (u)rxvt, etc. Thanks Karol, didn't catch it. (Konsole)
edit2: Not sure if this matters, but did you install gvim or vim?
Last edited by Earnestly (2012-03-27 10:28:06)
Offline
sed -i 's|scheme||' ~/.vimrc
Offline
edit: Also mention which terminal emulator you're using, xterm, (u)rxvt, etc.
I think he uses Konsole, as he said in the previous post.
Offline
Hi!
See if adding t_Co=256 to your vimrc before setting the colorscheme helps.
This gives me this output:
Error detected while processing /home/midnith/.vimrc:
line 8:
E14: Invalid address
Press ENTER or type command to continue
Also post the output from the following:
echo $TERM: xterm
tput colors: 8
edit2: Not sure if this matters, but did you install gvim or vim?
I had got installed gvim, but with the problem, I tried to remove it and install vim, with any successfull results.
sed -i 's|scheme||' ~/.vimrc
What should it do? Doesn't happen anything.
-----------------------------
Thank you again!
Offline
/dev/zero wrote:sed -i 's|scheme||' ~/.vimrc
What should it do? Doesn't happen anything.
It should remove the 'scheme' part of the word 'colorscheme'. Is your vim working now?
Edit:
I think you should add 'set t_Co=256' not just 't_Co=256'. Can you please try it?
Last edited by karol (2012-03-27 10:56:06)
Offline
/dev/zero wrote:sed -i 's|scheme||' ~/.vimrc
What should it do? Doesn't happen anything.
Karol got it. You might want to look up a tutorial on sed . You're lucky I didn't just give you a patch file to try and figure out .
I created a test user and gave them only your vimrc and the gummybear colour file. I sued in and tried vim. As you said, no colours. I changed "colorscheme" to "color" in your vimrc and then tried vim again. Now the colours worked.
Offline
Hi,
It should remove the 'scheme' part of the word 'colorscheme'. Is your vim working now?
Edit:
I think you should add 'set t_Co=256' not just 't_Co=256'. Can you please try it?
··· No, with only color instead of colorscheme still same
··· yes, you're right, is
set t_Co=256
But doesn't solve it. Now with normal user the view is this:
But the correct view is this other:
Thank you!
Offline
echo $TERM: xterm
tput colors: 8
There's your problem. xterm (as indicated by tput) only supports 8 colours.
If you're using Konsole, check the configuration and change the session to xterm-256color. Alternatively can set the environment variable within your ~/.bashrc file like so: export TERM=xterm-256color
(PS: To list all the terminals you can use with 256 colours try the following command: (Iirc there was a cleaner way to do this, but alas)
ls /usr/share/terminfo/*/* | grep 256
However, you should have xterm-256color by default.)
edit: Oh and sorry about earlier, I did mean "set t_Co=256" and not just "t_Co=256".
Last edited by Earnestly (2012-03-27 11:31:12)
Offline
I would also suggest changing the theme itself to only use colour >15, then it will stay consistent across terminals with different settings (since almost no one ever changes the colours <15)
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
Hi again!
There's your problem. xterm (as indicated by tput) only supports 8 colours.
If you're using Konsole, check the configuration and change the session to xterm-256color. Alternatively can set the environment variable within your ~/.bashrc file like so: export TERM=xterm-256color
It works! Thank you very much and sorry for the inconveniece
(PS: To list all the terminals you can use with 256 colours try the following command: (Iirc there was a cleaner way to do this, but alas)
ls /usr/share/terminfo/*/* | grep 256
The output:
/usr/share/terminfo/E/Eterm-256color
/usr/share/terminfo/d/darwin-256x96
/usr/share/terminfo/d/darwin-256x96-m
/usr/share/terminfo/g/gnome-256color
/usr/share/terminfo/k/konsole-256color
/usr/share/terminfo/m/mlterm-256color
/usr/share/terminfo/m/mrxvt-256color
/usr/share/terminfo/p/putty-256color
/usr/share/terminfo/r/rxvt-256color
/usr/share/terminfo/s/screen-256color
/usr/share/terminfo/s/screen-256color-bce
/usr/share/terminfo/s/screen-256color-bce-s
/usr/share/terminfo/s/screen-256color-s
/usr/share/terminfo/v/vte-256color
/usr/share/terminfo/x/xnuppc+256x96
/usr/share/terminfo/x/xnuppc-256x96
/usr/share/terminfo/x/xnuppc-256x96-m
/usr/share/terminfo/x/xterm+256color
/usr/share/terminfo/x/xterm-256color
How I put xterm-256color by default?
Offline
How I put xterm-256color by default?
Alternatively can set the environment variable within your ~/.bashrc file like so: export TERM=xterm-256color
Thank you very much and sorry for the inconveniece
No problem, that's what these forums are for . Don't forget to mark this as [SOLVED] so tourists from Google can see it.
Last edited by Earnestly (2012-03-27 11:57:01)
Offline
As Kaustic wrote you can put it right in your ~/.bashrc file
export TERM=xterm-256color
If possible it's better to just get your terminal to do this itself, but I know nothing about konsole. Check it's preferences and settings and see if it has an option for this. I suspect there isn't - so the bashrc setting would be the way to go.
EDIT: he beat me to it.
Last edited by Trilby (2012-03-27 11:57:50)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Setting TERM in .bashrc should _never_ be done _ever_
The TE/multiplexer itself should set the TERM correctly. Else it will just break the second you try to use some different TE, or a multiplexer like screen/tmux.
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
Setting TERM in .bashrc should _never_ be done _ever_
The TE/multiplexer itself should set the TERM correctly. Else it will just break the second you try to use some different TE, or a multiplexer like screen/tmux.
I get that, but this doesn't solve the issue of Vim and other tools not making use of 256 colours. How would you personally fix this without setting the TERM variable? For the sake of screen/tmux, I don't care, with Arch I know what's on my system and can easily adjust accordingly. (I use screen-256color)
However as you've mentioned some fairly obvious downsides (which I've experienced with tmux) I'd like to hear any suggestions you might have on this topic and how you might resolve it.
Thanks
edit: Do you essentially have to rely on application specific settings to force the option? (E.g. vim: set t_Co=256 & tmux: set -g default-terminal "screen-256color")
Last edited by Earnestly (2012-03-27 21:13:52)
Offline
If a terminal supports 256 colors it should set the TERM variable to something other applications can recognize as 256 color capable. But this can go wrong at 2 places: first, not all apps recognize all possible options of TERM, and seocnd not all terminal emulators set this variable properly. I'd recommending avoiding setting TERM in bashrc - but if Konsole doesn't have an option to set it properly then the bashrc method is a suitable workaround. This workaround may have some undesirable side-effects - but it gets the job done and seems the lesser of two evils in this case (until a good konsole user or dev can say how to do this properly).
Last edited by Trilby (2012-03-27 23:23:14)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
To set the $TERM variable for Konsole:
In Konsole, on the menu bar, click "Settings >> Configure Current Profile..."
In the dialog box, on the "General" tab, next to the word "Environment:", click the button, the only button, labeled "Edit".
In the text box that pops up, change "TERM=xterm" to "TERM=xterm-256color". Keep hitting the "OK" buttons to back out of all the dialog boxes, close the current konsole and start a new konsole session.
Now,
$ echo $TERM
xterm-256color
Now I'll go uninstall konsole.
Offline
Now I'll go uninstall konsole.
Taking one for the team!
cookie > thisoldman
Offline
To set the $TERM variable for Konsole
That's what I said, in far fewer words (playing around in a Mint KDE vm).
So essentially one must basically rely on the programs to correctly set the environment or configure each one to do so?
I can live with that, although using "screen-256color" has given me no trouble yet (rxvt-unicode-256color caused issues in tmux).
Offline
So essentially one must basically rely on the programs to correctly set the environment or configure each one to do so?
Setting the $TERM value by app is a better solution, I think, than setting it globally. If, for some reason, I need to use a tty, I want TERM=linux, not xterm. Most people soon settle into a favorite terminal emulator, so the editing of configuration files or settings probably isn't a great task. We're Arch users; we edit configuration files just out of curiosity. "I wonder what will happen if..."
Offline
Pages: 1