I was trying to set up vim to work with JavaScript (any links about that appreciated), though didn't even know what's .vimrc file. So I deleted it. After removing and installing vim for about 10 times... I now don't know what exactly should I do. I believe there was some default settings that I lost. If I google for it I find bunch of different vimrc files, and if I put their content in my vimrc - whenever I start vim I get a lot of errors (assuming because I don't have all the plug ins). also don't think that I should\can create one and fill it little by little.
so. 1. How do I restore my original vim state (if you think this is smtn I should do) - ? 2. How do I set it up to work nicely with JavaScript files? 3. Possibly good vim tutorial?
OS Ubuntu 12.04 32-bit Thank you guys. vim beginner.
I was trying to set up vim to work with JavaScript (any links about that appreciated), though didn't even know what's .vimrc file. So I deleted it. After removing and installing vim for about 10 times... I now don't know what exactly should I do. I believe there was some default settings that I lost. If I google for it I find bunch of different vimrc files, and if I put their content in my vimrc - whenever I start vim I get a lot of errors (assuming because I don't have all the plug ins). also don't think that I should\can create one and fill it little by little.
so. 1. How do I restore my original vim state (if you think this is smtn I should do) - ? 2. How do I set it up to work nicely with JavaScript files? 3. Possibly good vim tutorial?
OS Ubuntu 12.04 32-bit Thank you guys. vim beginner.
Share Improve this question edited Jun 21, 2014 at 22:36 AndreiMotinga asked Jun 21, 2014 at 22:05 AndreiMotingaAndreiMotinga 1,04317 silver badges25 bronze badges 1- 1 Could you tell us what OS you're using? If Linux, what distribution (Ubuntu, CentOS, etc...) This will help us track down what the original file was that you seem to have deleted. – IMSoP Commented Jun 21, 2014 at 22:31
3 Answers
Reset to default 4If you hadn't customised the file at all before you started, then if it existed at all, it must have been the default for new users.
When creating a new user account, the files in /etc/skel
are used to populate the new user's home directory; thus the file you deleted can probably be restored to its original state with the following mand:
cp /etc/skel/.vimrc ~/.vimrc
That is "copy the .vimrc
file from the skeleton directory into my home directory".
If that doesn't help, or if the file you deleted was actually the system-wide defaults (normally /etc/vimrc
or /etc/vim/vimrc
) then you can probably get hold of the original file from your OS's package archive.
Since you are running Ubuntu 12.04, the relevant file list seems to be this one: http://packages.ubuntu./precise/i386/vim-mon/filelist It doesn't seem to put anything into /etc/skel
, but it does install an /etc/vim/vimrc
which includes /usr/share/vim/vimcurrent/debian.vim
.
You can download the package manually from here - the .deb
file is just a .tar.gz
, so tar -xzvf foo.deb
will extract it for you to poke around. cd
to a new empty directory before doing that, or you'll get very confused by the directories it creates!
Another thing to double check is that Ubuntu actually has multiple different vim packages, e.g. vim-tiny
. See this question for how to check you've installed and selected the "full" version.
A .vimrc
file is optional, and without it vim will use all of its defaults.
These defaults, however, are a bit conservative. If I recall correctly, vim defaults to being patible with its predecessor (vi), which means no syntax highlighting, no line numbers, no ruler to tell you which mode you're in, no nothing.
Tim Pope's sensible vimrc is a good point to start off.
.vimrc
usually is a config file under your $HOME
directory. Itself is a vimscript too. You can put your config/mapping/plugin config/function... there, so that everytime you started your vim, the file would be automatically loaded. then you have a customized fortable editor opened.
without this .vimrc
, vim can start too, with default config though.
you can start vim and type :h vimrc
to see the help doc of vimrc
. You can take a vimrc from internet, try to understand the settings in the file. finally make your own vimrc. It will take veryveryvery long time to have a satisifed vimrc. I have used vim for about 10 years, last week I was still editing my vimrc file.
When you read others' vimrc settings, use :h foo
to find the help information. In this way, you know "why I set this", not "I don't know what's going on, just copied it".
The charm of vim is, it is highly customizable. You can change it into plain notepad or programming IDE or mp3 player...
enjoy editing!
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745303298a4621566.html
评论列表(0条)