vim

vim highlighting everything in red

旧城冷巷雨未停 提交于 2019-12-23 12:22:45
问题 I added a print line to a python script while the script was executing, and now all the text is highlighted in red when I open the file. Opening and closing the file doesn't get rid of it. Opening a second python file momentarily fixed the problem, but then closing file and reopening brought the problem back. Now it wont go away at all. Any body know what could cause this? 回答1: This happens sometimes in vim when it goes to highlight syntax on multi-line comments. Occasionally everything after

Is there a command in Vimscript to get the current Operating System?

大憨熊 提交于 2019-12-23 11:36:09
问题 What the title says. I can think of some hackish ways to do it, but is there a correct way to do this? 回答1: To check for Windows, most scripts I have seen use the following: let s:win = has("win16") || has("win32") || has("win64") If none of these are defined, then it is a non-windows system and you can try the uname suggestion by Martín Fixman. 回答2: If you are sure you will use Unix-like operating system, you can use let os = substitute(system('uname'), "\n", "", "") if os == "SunOS" " Do

extract text using vim

◇◆丶佛笑我妖孽 提交于 2019-12-23 10:58:22
问题 I would like to extract some data from a text with vim.. the data is of this kind: 72" title="(168,72)" onmouseover="posizione('(168,72)');" onmouseout="posizione('(-,-)');">> 72" title="(180,72)" onmouseover="posizione('(180,72)');" onmouseout="posizione('(-,-)');">> 72" title="(192,72)" onmouseover="posizione('(192,72)');" onmouseout="posizione('(-,-)');">> 72" title="(204,72)" onmouseover="posizione('(204,72)');" onmouseout="posizione('(-,-)');">> The data I need to extract is contained in

Vim supertab and jedi-vim

怎甘沉沦 提交于 2019-12-23 10:56:35
问题 Posting as a follow up to How to check if SuperTab and jedi-vim is activated? and have done what Ingo Karkat proposed. Now I wonder what is broken and how I fix it. Here is the output: :verbose imap <tab> i <Tab> <Plug>SuperTabForward Last set from ~/.vim/bundle/supertab/plugin/supertab.vim Which looks allright to me, and... :scriptnames 1: /etc/vimrc 2: /usr/share/vim/vim72/syntax/syntax.vim 3: /usr/share/vim/vim72/syntax/synload.vim 4: /usr/share/vim/vim72/syntax/syncolor.vim 5: /usr/share

using rails.vim Rake run spec in MacVim, how to get colored output

陌路散爱 提交于 2019-12-23 10:54:28
问题 when using Rake to run a spec, the output in quickfix is not colored, meaning, it doesn't have green for passing specs and red for failing specs. Is this something solvable? Thanks for any hints. 回答1: According to Tim Pope, the author of rails.vim, not much that can be done about that; Vim doesn't support ANSI color codes. 回答2: It may be possible by recompiling vim as this plugin suggest. I haven't tried it myself. http://www.vim.org/scripts/script.php?script_id=302 来源: https://stackoverflow

How to write each line of the result of a a system() call into a list in Vimscript?

旧城冷巷雨未停 提交于 2019-12-23 10:28:09
问题 I'd like to loop over the files in a directory using Vimscript. Reading usr_41.txt and having searched around, the best I can come up with is something like let dir_contents = system('ls') But since system() isn't returning a list, I can't loop over it. Is there either a way I can save the results of a system call as a list, or a Vim command or function that does so already? 回答1: You can get a list with split(system('ls'), '\n') , which will give you a list of files providing you don't have

(Python) YouCompleteMe is ignoring my code and pip packages

不羁岁月 提交于 2019-12-23 10:09:35
问题 I am using YouCompleteMe on MacVim (vim 7.4 on OSX 10.9.4) for Python code auto-completion. YCM works perfectly when referencing Python built-in functionality (like os.* stuff), but it doesn't seem to be able to auto-complete identifiers written by me or from various packages installed using pip. According to its documentation, YouCompleteMe uses Jedi for Python code completion, and the Jedi GitHub page clearly states that Jedi can auto-complete any code, not just standard library identifiers

Vim wrong syntax highlighting in Groovy

南楼画角 提交于 2019-12-23 09:50:28
问题 when I do the single slash ( / ) when typing some arithmetic expression (like val1 / val2 ), my vim treats it as a comment for multiple lines ( /* ). The result looks like: I now I can escape it by typing ;/ at the end of that line (which closes the comment), but it is still annoying and I'd like for my vim to behave properly :). I've tried using another vim syntax highlighting package for groovy, I've tried :filetype plugin off in my .vimrc, I've tried purging vim with my settings and

Force GVim to prompt before close

▼魔方 西西 提交于 2019-12-23 09:38:38
问题 I've been making a transition to GVim lately, because I find it to be more aesthetically pleasing and a little bit faster then vim in the terminal. I have this really bad habit that I'm trying to break. When I used vim from the command line my work flow was like this: vim filename.txt # make some edits ZZ # do other stuff vim otherfile.txt # make some edits ZZ Now using GVim, I end up closing the editor far too frequently. I'm wondering if there is a way to force just GVim to either prompt me

Why does the “script” command generate ^[ and ^M characters and how to remove them with vim search and replace?

冷暖自知 提交于 2019-12-23 09:32:13
问题 On linux, using the bash shell, when I use the script command, the generated file is called typescript. When I open that file with vim, each line contains the ^M character, and several lines (due to my colored command prompt) contain a character ^[ . I would like to replace these characters with nothing, effectively removing them from the generated script. First, I tried :%s/^[//gc , :%s/\^[//gc , :%s/\^\[//gc , and a few other variants. None of them matched the ^[ character, so the search