vim

Ruby 1.9 - Invalid multibyte character (utf-8)

馋奶兔 提交于 2019-12-23 04:01:12
问题 I have a ruby file with only these two lines: # encoding: utf-8 puts "—" When I run it with ruby test_enc.rb it fails with: test_enc.rb:2: invalid multibyte char (UTF-8) test_enc.rb:2: unterminated string meets end of file I don't know how to properly specify the character code of — (emdash), but vim tells me it is 151, Hex 97, Octal 227 . It fails the same way with other characters like ã as well, so I doubt it is related specifically to that character. I am running on Windows XP and the

Trigger cursor positioning and selection on going to Normal mode or ESC map

三世轮回 提交于 2019-12-23 03:22:25
问题 Anyone knows how can I trigger cursor positioning and selection from python when going to Normal? This is the script and I had to comment out the ESC mapping in this commit. Relevant plugin source code is bellow: # -*- coding: utf-8 -*- import re import vim #How can we fetch the first param on going to normal Mode without problems?! vim.command( "inoremap <silent> <buffer> <esc> <c-\><c-n>:py clang_complete.firstParam()<cr>" ) r = re.compile( "@[^@]+\$" ) def firstParam(): line = vim.current

(g)Vim -> show 4 spaces, but save 2 spaces (tabs)

会有一股神秘感。 提交于 2019-12-23 03:09:55
问题 Is it possible to open files that are indented with 2 spaces, but show me 4 space indentation, and when I make 4 spaces, it saves in a 2 space format? Edit It turns out I also need to be able to ensure that it works if the file has a mix of tabs, 2 spaces, and 4 spaces. Edit 2 So, here is my current solution. I'm having to remap my (originally mapped to :w) so that I can place my cursor back where it was (and give me one "history back" as far as cursor positions when I do a save. Is there a

when using “pyfile s:pyscript” it seems vim doesn't interpret “s:pyscript” as a variable

泄露秘密 提交于 2019-12-23 02:51:01
问题 A vim-script file calls a python script through: let s:pyscript = resolve(expand('<sfile>:p:h:h')) . '/pyscript/deploy.py' echom "sourcing " . s:pyscript pyfile s:pyscript the echom-command shows me the expansion points to the correct file, but the following pyfile s:pyscript results in an error: Traceback (most recent call last): File "<string>", line 1, in <module> IOError: [Errno 2] file or directory not found: '&s:pyscript' Which let's me conclude, that everythin after pyfile is

“Google” python style script not working

夙愿已清 提交于 2019-12-23 02:47:13
问题 I'm trying to use the Google python indentation script, but it's not working for me. I want it to indent as follows: very_long_function_name( first_param, I pasted its text onto the end of this vim script: and put it into ~/.vim/indent/python.vim . Not sure why it's not working. Edit: FIXED. I modified the indent file as follows: function GetGooglePythonIndent(lnum) " Indent inside parens. " Align with the open paren unless it is at the end of the line. " E.g. " open_paren_not_at_EOL(100, "

Indicator to see from which function a search string comes

谁都会走 提交于 2019-12-23 02:06:17
问题 I have a number of functions that create search strings @/ I would like to know from which functions comes the search string. Is it possible to add an indicator to the search string that doesn't influence the search string but what allows me to check from which function it comes? p.e. /[indicator]search string 回答1: You can add a regexp branch that never matches, e.g. /\%$indicator\|search string \%$ is a special Vim atom matching the end of the file. Since that will never match when followed

Indicator to see from which function a search string comes

烂漫一生 提交于 2019-12-23 02:05:42
问题 I have a number of functions that create search strings @/ I would like to know from which functions comes the search string. Is it possible to add an indicator to the search string that doesn't influence the search string but what allows me to check from which function it comes? p.e. /[indicator]search string 回答1: You can add a regexp branch that never matches, e.g. /\%$indicator\|search string \%$ is a special Vim atom matching the end of the file. Since that will never match when followed

Vim: regex to match words inside angle brackets?

我是研究僧i 提交于 2019-12-23 01:56:22
问题 I want to match words inside angle brackets (html tags): <MatchedWord></MartchedWord> This is what I have so far: /\v\<\w+\> The problem is that it matches the <> too and the / . How to do it so it only matches the word? 回答1: You can assert matching before and after text without including that in the match via Vim's special \zs (match start) and \ze (match end) atoms: /<\/\?\zs\w\+\ze\/\?> I've included an optional ( \? ) slash on both side (e.g. </this> and <this/> . Also note that \w\+ isn

Vim 字符编码

 ̄綄美尐妖づ 提交于 2019-12-23 01:39:51
vim 编码方式的设置 转载:http://www.cnblogs.com/freewater/archive/2011/08/26/2154602.html 和所有的流行文本编辑器一样,Vim 可以很好的编辑各种字符编码的文件,这当然包括UCS-2、UTF-8 等流行的 Unicode 编码方式。然而不幸的是,和很多来自 Linux 世界的软件一样,这需要你自己动手设置。 Vim 有四个跟字符编码方式有关的选项,encoding、fileencoding、fileencodings、termencoding (这些选项可能的取值请参考 Vim 在线帮助 :help encoding-names),它们的意义如下: * encoding: Vim 内部使用的字符编码方式,包括 Vim 的 buffer (缓冲区)、菜单文本、消息文本等。默认是根据你的locale选择.用户手册上建议只在 .vimrc 中改变它的值,事实上似乎也只有在.vimrc 中改变它的值才有意义。你可以用另外一种编码来编辑和保存文件,如你的vim的encoding为utf-8,所编辑的文件采用cp936编码,vim会 自动将读入的文件转成utf-8(vim的能读懂的方式),而当你写入文件时,又会自动转回成cp936(文件的保存编码). * fileencoding: Vim 中当前编辑的文件的字符编码方式

Problems making an accurate Visual Studio scheme for Vim (vim scheme specialist needed)

末鹿安然 提交于 2019-12-23 01:24:51
问题 I'm trying to make an accurate Visual Studio scheme. I set hi function to blood color ( #9A1102 ) for the "CSS function" (e.g. #thisisanid). But now the brackets with properties (id, class) in html elements also have blood color : (ironically the same color here in Stackoverflow). But I want them blue ( #2902FC ) e.g.: Sample of code: " Syntax highlighting hi Comment guifg=#777777 gui=none hi Todo guifg=#8f8f8f gui=none hi Constant guifg=#e5786d gui=none hi String guifg=#2902FC gui=none hi