vim

Change linux user default login directory

和自甴很熟 提交于 2019-12-25 06:47:43
问题 I have used the command usermod -d /home/matt /home/matt/Documents/docs/ to change my linux default login directory to /home/matt/Documents/docs/ , but when i use vim to edit my code, my own configuration about vim didn't work, for example, my tab will equal to 8 spaces not 4 spaces(defined in my .vimrc). The configuration file is .vimrc and is under /home/matt/.vimrc . The following is the content of my .vimrc: set hlsearch set backspace=2 set autoindent set ruler set nu set bg=dark syntax

gvim Windows 7 netrw open url under text cursor

浪尽此生 提交于 2019-12-25 06:44:01
问题 I've added this line to my vimrc file in order to be able to open a link with the command 'gx': let g:netrw_browsex_viewer = 'firefox' Unfortunately the only thing that happens is that a tiny DOS window flashes on the screen. Advice very welcome. GilF 回答1: On windows7, put the batch file expl2.cmd in your vim path. In vimrc put :let netrw_browsex_viewer='expl2.cmd' In gvim use gx on cfile to launch explorer.exe, it will launch correct viewer, e.g. powerpoint,firefox,chrome. Notes: The second

How to disable AutoComplPop completions in comments?

老子叫甜甜 提交于 2019-12-25 06:39:26
问题 I've recently started using AutoComplPop, but I find the popup annoying when I'm writing comments (as I usually don't need autocomplition when writing a comment). Is there a configuration option or a quick hack that can effectively disable AutoComplPop when the insertion point is in a comment? 回答1: To answer the question of performance when checking the syntax on every cursor move, I had to implement this myself, and made this into the OnSyntaxChange plugin. With this plugin, setting this up

saving/restoring buffers not working in vim

倖福魔咒の 提交于 2019-12-25 06:12:23
问题 I'm using vim 7.2 in iterm2 (Snow Leopard). I'd like to save/restore buffers between vim sessions automatically, and added this line to my vimrc: set viminfo+=% Now, I open a couple of files and quit vim. I expect them to be there, but I get the home screen. This is the output of :set viminfo viminfo='100,<50,s10,h,% Am I missing any step here? 回答1: What you need is reading :help mksession . And the Vim Wiki(a) has some tips to use it automatically. 来源: https://stackoverflow.com/questions

Find out vim executable name inside vimrc

前提是你 提交于 2019-12-25 06:00:01
问题 I share my ~/.vimrc file between different computers and use it with three different vims (macvim in mac, gvim in my Ubuntu desktop and plain old vim in the servers which I manage) Most of what I have in my ~/.vimrc file applies to all three instance, but I want to make some small changes based on which vim I am using (like removing certain plugins when invoked vim from console) My question is how do I distinguish different vim executables in my ~/.vimrc , so that I can have different

Vim - How to search and reaplace based on search [duplicate]

南楼画角 提交于 2019-12-25 04:07:28
问题 This question already has an answer here : VIM - Replace based on a search regex (1 answer) Closed 5 years ago . What i would like to do : Every time i find something based on s[w|l].*[0-9]\.\* replace the end of that string\search .* with %s/\.\*/\\\\\.\.\*/g Already tried with standard search and replace, but couldn't do it. Thanks 回答1: Just wrap your search pattern in escaped parentheses \(\) , and use a backreference \1 in the replacement string: :%s/\(s[w|l].*[0-9]\)\.\*/\1\\\\.*/g You

Vim color scheme similar to the one used in jsfiddle?

妖精的绣舞 提交于 2019-12-25 03:56:10
问题 I really like the color scheme used in jsfiddle. Is there any color scheme that it is similar? 回答1: I didn't see anything at your link, but why don't you judge for yourself? You can see most of the publicly available color schemes for Vim here: http://vimcolorschemetest.googlecode.com/svn/html/index-pl.html Just click on the name of any of the colorschemes to download. Try a bunch of them, modify to suit your tastes if you can't find one that's perfect for you. 来源: https://stackoverflow.com

Am I even using Exuberant ctags?

懵懂的女人 提交于 2019-12-25 03:34:51
问题 After downloading and installing exuberant ctags, I get some issues hinting that the ctags shell command isn't corresponding to my newly installed ctags. Directory_of_Scripts$ ctags usage: ctags [-BFadtuwvx] [-f tagsfile] file ... Directory_of_Scripts$ ctags -R ctags: illegal option -- R usage: ctags [-BFadtuwvx] [-f tagsfile] file ... Apparently the ctags i'm using does not have the option to collect files recursively (-R option) and it wants a file as an argument; the current exuberant

how to bind the prompt key to 2to3.py?

允我心安 提交于 2019-12-25 03:22:42
问题 I have write a vimsrcipt to bind F3 key to change python2 file into python3 file. map <f3> :w<cr>:! D:\Python34\python D:\Python34\Tools\Scripts\2to3.py -w %<cr> I feel that it should be improved for useage. It works in the steps: step1: open the test.py( in the form of python2) in gvim step2: press F3 step3: close the test.py( in the form of python2) step4: open the test.py(now ,it is in the form of python3) Now i want to make a little progress, when i press F3 ,the test.py will be changed

VIM how to replace “AA” to “BB” in a file

喜欢而已 提交于 2019-12-25 02:39:11
问题 I need to replace a file which has thousand of lines code. In the log, it has a specific word which I want to replace this work with some other words. Say, how to replace all "AA" to "BB" in this file? thanks 回答1: You want to use :%s/\<AA\>/BB/g % specifies that you want to replace on all lines. s tells vim that you want to do a substitution Between the first / and second / is what you want to replace (ie \<AA\> ). The \< and the \> are word boundaries , making sure that AA is matched but fAA