vim

Vim regex matches unicode characters are as non-word

馋奶兔 提交于 2019-12-24 03:34:37
问题 I have the following text: üyü The following regex search matches the characters ü: /\W Is there a unicode flag in Vim regex? 回答1: Unfortunately, there is no such flag (yet). Some built-in character classes (can) include multi-byte characters, others don't. The common \w \a \l \u classes only contain ASCII letters, so even umlaut characters aren't included in them, leading to unexpected behavior! See also https://unix.stackexchange.com/a/60600/18876. In the 'isprint' option (and 'iskeyword' ,

Terminal Vim redraw issues in OS X Lion

北城余情 提交于 2019-12-24 03:28:01
问题 Recently switched from MacVim to standard vim so I can force myself to move around in vim without the help of the MacVim wrapper. Since doing so, I'm having some weird redraw issues. I've tested this in both iTerm2 and standard Terminal in Lion. When I'm editing files, opening NERDTree etc, fragments of the last window appear in my current buffer. Sometimes the ".. (up a dir)" gets left in the new buffer. The bottom status bar duplicates itself. The only thing that seems to get rid of this is

Starting a syn region with a keyword

梦想与她 提交于 2019-12-24 03:16:36
问题 I would like to start a region with "virtual" to highlight all virtual methods with a different color, but being virtual already defined as keyword in the cpp.vim file, the region matching is never performed. I tried the following syn region cVirtualMethod start="virtual" end=";" contains=cppType hi cVirtualMethod ctermfg=red but it does not work. It does however, if I remove virtual from cppType, but it highlights the whole line (fair enough, I'd prefer just the method name, but it's good as

VIM: hack ctags or tweak tagbar for better PHP support

亡梦爱人 提交于 2019-12-24 03:14:14
问题 Recently, i gave up Taglist for Tagbar . Tagbar works as expected for all languages except PHP. It lists class, methods and variables into their respective categories instead of displaying methods and variables into their respective scope. I came to know that ctags has poor support for PHP. Is there any way to improve ctags and Tagbar's support for PHP? I am hopping for some kind of hack or tweak, or any other way around. 回答1: I have just using PHP_Parser as syntax parsing backend written a

Setup a shortcut to replace easily selected strings in VIM

六眼飞鱼酱① 提交于 2019-12-24 02:57:09
问题 I have a lot of php/html files with many strings that should be internationalized with gettext. Therefore, I have to go through each file, spot the "message" strings and replace each one by <?= _("<my string>") ?> I use vim and would like to setup a shortcut (map) to do it easily in insert mode (With Ctrl R for instance). Do you know how to achieve that ? 回答1: I would use Tim Pope's wonderful surround plugin to accomplish this. Add the following to your ~/.vim/after/ftplugin/php.vim file: let

How do I manipulate character case in search and replace in vim?

可紊 提交于 2019-12-24 02:52:40
问题 for example, I have: double foo = 0.0; double bar = 0.0; and I want to write some sort of search to find each variable and change it to: double Foo = 0.0; double Bar = 0.0; I dont want to do these one variable at a time (e.g. :%s/foo/Foo/g) but rather all at once, something close to :%s/ double \(\w\+\)/ double \1/c (and somehow capitialize the first character of \1) 回答1: Use the \u prefix for the match in the replace clause: For one at a time: :%s/ double \(\w\+\)/ double \u\1/c For all at

How do I manipulate character case in search and replace in vim?

佐手、 提交于 2019-12-24 02:51:26
问题 for example, I have: double foo = 0.0; double bar = 0.0; and I want to write some sort of search to find each variable and change it to: double Foo = 0.0; double Bar = 0.0; I dont want to do these one variable at a time (e.g. :%s/foo/Foo/g) but rather all at once, something close to :%s/ double \(\w\+\)/ double \1/c (and somehow capitialize the first character of \1) 回答1: Use the \u prefix for the match in the replace clause: For one at a time: :%s/ double \(\w\+\)/ double \u\1/c For all at

Vim and snipMate (plugin) - adding new snippet won't work

╄→гoц情女王★ 提交于 2019-12-24 02:50:35
问题 I am trying to create a new snippet to my snipMate plugin. I work with some files called (i.e.) myfile.endfile All .endfile files should have the same "snippet" like .html files. So I did cp html.snippet endfile.snippet in my ~/.vim/snippets directory. SnipMate is working with all present snippets, but not with my new created one. Any suggestions for this problem? (Btw: after creating the new .snippet file, I ran :helptags ~/.vim/doc command in an vim instance.) 回答1: It is because Snipmate

vim buffer Trying char-by-char conversion

痴心易碎 提交于 2019-12-24 02:42:41
问题 It could be a windows saved file opened in unix/linux problem and I am not quite sure how to solve it. When I open a file which was previously saved by another developer using windows, my vim buffer some times shows Trying char-by-char conversion... In the middle of my file and I am unable to edit the code/text/characters right below this message in my buffer. Why does it do that and how do I prevent this from happening? 回答1: This message comes from the Vim function mac_string_convert() in

Increment and decrements numbers

﹥>﹥吖頭↗ 提交于 2019-12-24 02:26:07
问题 I have this text with numbers: My numbers are 04, and 0005 My numbers are 05, and 0006 My numbers are 06, and 0035 My numbers are 07, and 0007 My numbers are 08, and 0009 This is the code I always used to increment or decrement numbers in a selection/block selection/column: p.e. increment the last 4 numbers in above text with 8: '<,'>s/\%V\<\d\{4}\>/\=submatch(0)+8/g but I noted today that it does strange things. This is the output: My numbers are 04, and 13 My numbers are 05, and 14 My