LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-30-2005, 03:58 PM   #1
simsjr
Member
 
Registered: Apr 2004
Location: I'm everywhere, Focker!
Distribution: Slackware
Posts: 53

Rep: Reputation: 16
How to Save gVIM Settings!


Hi Everyone,

I'm using gVIM at work (sadly, on a Windows machine) and want to know how to save my color theme, window size, and font settings so that I don't lose them when I close the program.

Anyone know how I can do this?
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 03-30-2005, 04:02 PM   #2
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
You've to edit your /home/user/.vimrc file. In Windows, that would be somewhere at "C:\Program Files\Vim\_vimrc"

Good luck!
 
Old 03-30-2005, 04:20 PM   #3
simsjr
Member
 
Registered: Apr 2004
Location: I'm everywhere, Focker!
Distribution: Slackware
Posts: 53

Original Poster
Rep: Reputation: 16
I found that config file, but I have no clue what lines I need to add to save my environment settings. My _vimrc file looks like this:

set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
if &sh =~ '\<cmd'
silent execute '!""C:\Program Files\Vim\vim63\diff" ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . '"'
else
silent execute '!C:\Program" Files\Vim\vim63\diff" ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
endif
endfunction
 
Old 03-30-2005, 04:41 PM   #4
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
I don't know exactly what you want to modify/save. I simply use the default collors and then only modifications I did to that file was to add:

set tabstop=4
set shiftwidth=4
set expandtab
set textwidth=8

To when I program . Take a look into vim's homepage for some rcvim examples.
 
Old 03-31-2005, 12:51 PM   #5
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Rep: Reputation: 32
> I don't know exactly what you want to modify/save.

1. font

2. color scheme

I'd like to learn how to do this as well. When I used to use gvim, I tended to run the program multiple times per day, and would have liked my font and color scheme settings to stick.

Anyone?
 
Old 03-31-2005, 01:25 PM   #6
simsjr
Member
 
Registered: Apr 2004
Location: I'm everywhere, Focker!
Distribution: Slackware
Posts: 53

Original Poster
Rep: Reputation: 16
Yeah, this should be very simple. Yet, no one seems to know how to do this, and I haven't found answers at vim.org.

Can someone share their _vimrc file with color theme and font settings baked in?
 
Old 03-31-2005, 02:11 PM   #7
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
look at this thread:
http://www.linuxquestions.org/questi...ght=gvim+color

for the font:
set guifont=-b&h-lucidatypewriter-medium-r-normal-*-*-140-*-*-m-*-iso8859-15
 
1 members found this post helpful.
Old 04-02-2005, 01:18 AM   #8
simsjr
Member
 
Registered: Apr 2004
Location: I'm everywhere, Focker!
Distribution: Slackware
Posts: 53

Original Poster
Rep: Reputation: 16
Ok folks, I found an easy way to save your font and color scheme settings in gVIM. Here goes:

First, specify your font by going to Edit > Select Font (btw, I'm on a Windows machine, so maybe the Linux menus are different).

Second, after you've selected your font, enter the command :mkvimrc!. This will write your font choice (and key mappings, etc) to your _vimrc file. This will NOT save your color settings if you're using a theme, however. To tell gVIM to use a color theme at startup, go to the next step.

Third, to specify your color theme, enter the command :e _vimrc. This will open your VIM settings file for editing. Scroll to the bottom of the file and add the line "colors blue". You can specify whatever color theme you want in place of "blue", provided you use the name of the theme itself. No file references are necessary. And it's case-insensitive too, so you could enter "colors Elflord" or "colors elflord" and be fine either way. Just make sure you write the file to disk before you quit gVIM.

Now, restart gVIM to see the fruits of your labor.

Hope this helps. If anyone can figure out how to preseve window sizes, I'd love to know.
 
2 members found this post helpful.
Old 04-02-2005, 10:00 PM   #9
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Rep: Reputation: 32
Thanks simsjr!

One minor addition:
Quote:
Second, after you've selected your font, enter the command :mkvimrc!. This will write your font choice (and key mappings, etc) to your _vimrc file.
Well, I found that it writes it to a .vimrc file (_vimrc on MS OS's) -- specifically, it creates one in your current working directory.

BTW -- why the exclamation point after the :mkvimrc? It doesn't see to make a difference for me whether I include it or not.

Thanks again.
 
Old 11-27-2008, 07:51 PM   #10
penno
LQ Newbie
 
Registered: Feb 2007
Location: Australia
Distribution: ubuntu 8.04 LTS
Posts: 2

Rep: Reputation: 0
Quote:
Originally Posted by simsjr View Post
Hope this helps. If anyone can figure out how to preseve window sizes, I'd love to know.
If ya still curious,

Quote:
You can put these command into your .vimrc

set lines=50
set columns=120
From a nice user on nabble.
 
Old 12-30-2010, 09:24 PM   #11
baskint
LQ Newbie
 
Registered: Dec 2010
Posts: 1

Rep: Reputation: 0
how about StartUp settings

I wanted to see the line numbers and turn the color scheme on to "slate" on start up.

To do just that, I entered two lines in the StartUp settings which in effect modifies your associated config file. Simply enter

:set number
:color slate

Save, and restart Gvim. You should see your changes.


Cheers!

Baskin
 
Old 03-05-2012, 05:28 AM   #12
evilfish11
LQ Newbie
 
Registered: Mar 2012
Posts: 1

Rep: Reputation: Disabled
Watch out for the exclamation mark!!!!

Quote:
Originally Posted by johnMG View Post
Thanks simsjr!
One minor addition:
[...]
BTW -- why the exclamation point after the :mkvimrc? It doesn't see to make a difference for me whether I include it or not.
Da di da ba doo doo, hmmm? what? the exclamation mark? Oh yea, it OVERWRITES your .vimrc file. You know, the one you've been crafting for months!!!

Always back up your stuff!
 
Old 06-13-2014, 02:16 AM   #13
martianpackets
LQ Newbie
 
Registered: Dec 2004
Location: Richmond, Virginia, USA
Distribution: $ uname -snrvmo Linux martianpackets 3.13.0-29-generic #53-Ubuntu SMP Jun 4 2014 x86_64 GNU/Linux
Posts: 13

Rep: Reputation: 0
Cool don't lose hand-inserted colorscheme, etc when using mkvimrc (how?)

Howdy Folks... I read this aged thread and I cannot figure out one thing in particular. I set the colorscheme in gvim as

colorscheme Elflord

which works awesome from the command line (ie the : prompt), and so I put the same value near the bottom of the .gvimrc file (which I put in $HOME)... well, when I issue

: mkvimrc! $HOME/.gvimrc

it overwrites the existing gvimrc file as I wish, but even though I explicitly put in the colorscheme directive (or is it a command?), the colorscheme directive is removed!

Any idea how to put non-set statements (statements that arent of the form: set tabstop=4) into my gvimrc file and then issue mkvimrc! $HOME/.gvimrc without my non-set statements being removed? I know this is an old thread and it would be so awesome if we could reopen it and discuss the best solution. Thanks in advance!

;-) (emoticon for Kieran)
 
Old 07-03-2015, 05:45 AM   #14
karunakarhv
LQ Newbie
 
Registered: Aug 2011
Posts: 2

Rep: Reputation: Disabled
Thumbs up Thanks

Quote:
Originally Posted by keefaz View Post
look at this thread:
http://www.linuxquestions.org/questi...ght=gvim+color

for the font:
set guifont=-b&h-lucidatypewriter-medium-r-normal-*-*-140-*-*-m-*-iso8859-15
Thanks for this post, really helpful.
 
  


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
Save Sound settings? LouKaNiKo SUSE / openSUSE 1 03-02-2005 08:45 PM
How do I save my settings? laverscheval DamnSmallLinux 2 10-08-2004 08:44 PM
gvim settings file ? moetman Linux - Software 1 03-02-2004 02:02 PM
How to save the setting of gVim? ICO Linux - Software 4 02-07-2004 05:58 PM
Gvim font and tabwidth settings kazuni Linux - Software 2 11-16-2003 10:04 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:29 PM.

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