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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
03-30-2005, 03:58 PM
|
#1
|
Member
Registered: Apr 2004
Location: I'm everywhere, Focker!
Distribution: Slackware
Posts: 53
Rep:
|
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.
|
03-30-2005, 04:02 PM
|
#2
|
LQ Guru
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,337
Rep:
|
You've to edit your /home/user/.vimrc file. In Windows, that would be somewhere at "C:\Program Files\Vim\_vimrc"
Good luck!
|
|
|
03-30-2005, 04:20 PM
|
#3
|
Member
Registered: Apr 2004
Location: I'm everywhere, Focker!
Distribution: Slackware
Posts: 53
Original Poster
Rep:
|
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
|
|
|
03-30-2005, 04:41 PM
|
#4
|
LQ Guru
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,337
Rep:
|
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.
|
|
|
03-31-2005, 12:51 PM
|
#5
|
Member
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601
Rep:
|
> 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?
|
|
|
03-31-2005, 01:25 PM
|
#6
|
Member
Registered: Apr 2004
Location: I'm everywhere, Focker!
Distribution: Slackware
Posts: 53
Original Poster
Rep:
|
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?
|
|
|
03-31-2005, 02:11 PM
|
#7
|
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 6,858
|
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.
|
04-02-2005, 01:18 AM
|
#8
|
Member
Registered: Apr 2004
Location: I'm everywhere, Focker!
Distribution: Slackware
Posts: 53
Original Poster
Rep:
|
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.
|
04-02-2005, 10:00 PM
|
#9
|
Member
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601
Rep:
|
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.
|
|
|
11-27-2008, 07:51 PM
|
#10
|
LQ Newbie
Registered: Feb 2007
Location: Australia
Distribution: ubuntu 8.04 LTS
Posts: 2
Rep:
|
Quote:
Originally Posted by simsjr
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.
|
|
|
12-30-2010, 09:24 PM
|
#11
|
LQ Newbie
Registered: Dec 2010
Posts: 1
Rep:
|
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
|
|
|
03-05-2012, 05:28 AM
|
#12
|
LQ Newbie
Registered: Mar 2012
Posts: 1
Rep: 
|
Watch out for the exclamation mark!!!!
Quote:
Originally Posted by johnMG
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!
|
|
|
06-13-2014, 02:16 AM
|
#13
|
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:
|
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)
|
|
|
07-03-2015, 05:45 AM
|
#14
|
LQ Newbie
Registered: Aug 2011
Posts: 2
Rep: 
|
Thanks
Quote:
Originally Posted by keefaz
|
Thanks for this post, really helpful.
|
|
|
04-28-2025, 08:25 AM
|
#15
|
LQ Newbie
Registered: Apr 2025
Posts: 1
Rep:
|
Once you make your _vimrc file via mkvimrc, you move that file to the directory that vim utilizes for settings. You can find where vim looks for the configuration file information via "help startup". Thank you and good luck!
|
|
|
All times are GMT -5. The time now is 12:14 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|