vim

Vim syntax conceal in context

守給你的承諾、 提交于 2019-12-23 09:24:06
问题 I want to conceal variables with names based on Greek symbols and turn them into their Unicode equivalent symbol, similarly to how vim-cute-python works. So for instance, I have this syntax match scalaNiceKeyword "alpha" conceal cchar=α defined in a file for concealing within Scala files which works great except that it's overly aggressive. If I write alphabet it then gets concealed to become αbet , which is noticeably wrong. How can I modify/expand this conceal statement so that it only

Vim练级打怪

拈花ヽ惹草 提交于 2019-12-23 09:20:03
目录 Level 1: Level 2: Level 3: Level 1: 首先说明,这是在对一些基本命令的熟悉的情况下进行的升级操作 vim有两种模式分别为 Normal 和Insert 启动vim后即进入Normal模式 <enter> i: 进入Insert模式 <enter> esc : 退出Insert模式,返回Normal模式 i:进入Insert模式,按ESC返回Normal模式 x:删除当前光标所在的一个字符 :wq :存盘 + 退出(:w 后可跟文件名) dd:删除当前行,并把删除的行存到剪贴板里 p:粘贴剪贴板 推荐: h j k l <==> ← ↓ ↑ → (光标键) :help <command> :显示相关命令的帮助 (退出帮助输入 :q) Level 2: 一.各种插入模式 a: 在光标后插入 o : 在当前行后插入一个新行 O: 在当前行前插入一个新行 c+w:替换从光标所在位置后到一个单词结尾的字符 二.简单的移动光标 0 (数字): 到行头 ^ : 到本行第一个不是blank字符的位置(blank字符就是空格、tab、换行、回车等) $ : 到本行行尾 g_ : 到本行最后一个不是blank字符的位置 /pattern (Normal模式下) :搜索 pattern 的字符串(如果搜索出多个匹配的结果,按 n 键可以到下一个) 三.拷贝/粘贴

Unable to count the number of matches in Vim

倖福魔咒の 提交于 2019-12-23 08:00:07
问题 How can you count the number of matches in Vim? For instance, for the text <? 回答1: :%s/<?//ng See :h count-items . 回答2: Count-items describes what you are after. :%s/<?/whatever/ng This is the substitution command, but the n flag avoids the actual substitution. 回答3: :help count-items In VIM 6.3, here's how you'd do it: :set report=0 :%s/<?/&/g # returns the count without substitution In VIM 7.2, here's how you'd do it: :%s/<?/&/gn # returns the count without substitution 来源: https:/

vim's tab length is different for .py files

我与影子孤独终老i 提交于 2019-12-23 08:00:07
问题 In my ~/.vimrc I set tab to me 2 spaces long set shiftwidth=2 set tabstop=2 However when I open a .py file, tabs are 4 spaces long. I don't have specific configuration for python files. ~/.vim/after is empty and searching for py doesn't raise any suspect lines. Have you ever experienced that? How to solve such a behaviour? 回答1: It’s defined in the general Python filetype plugin file ( $VIMRUNTIME/ftplugin/python.vim ): " As suggested by PEP8. setlocal expandtab shiftwidth=4 softtabstop=4

Vim: “E185: Cannot find color scheme solarized”

笑着哭i 提交于 2019-12-23 07:40:10
问题 Setting up a new machine and trying to get Solarized running in Vim. Getting the following error when I run vim: E185: Cannot find color scheme solarized Tried to follow Pathogen install instructions from the Solarized README on the official repo. Checked this similar question & answer, which solved the problem by actually having the proper files in the directory, but as you can see below, my directory is indeed full of goodies (I just cloned it). Details iTerm2 .vimrc is loading, and other

How to select SuperTab completion suggestion without creating new line?

空扰寡人 提交于 2019-12-23 07:39:17
问题 When I hit Enter on SuperTab's popup suggestion, it automatically creates a new line at the end of the inserted keyword. Is it possible to select an option in the SuperTab popup without creating a new line? More specifically, is there a way for me to configure space as the method of selecting the code completion suggestion? 回答1: inoremap <expr> <Space> pumvisible() ? "\<C-y>" : " " Note the <C-y> that accepts currently selected option, you may want to use it directly instead of remapping

vim - call function inside 'replace' expression

大憨熊 提交于 2019-12-23 07:28:30
问题 I understand you can call a function in a vim search/replace operation. For example: %s/regex/\=localtime()/g will replace anything matching 'regex' with the current epoch time. The problem is, I can't add anything else to the 'replace' expression. For example: %s/regex/epoch: \=localtime()/g does not treat 'localtime' as a function anymore. Rather it just prints 'epoch: =localtime()' as a string in the replacement text. The intention is for it to print 'epoch: 1353085984' instead. Is there

vim system register * and + not working

江枫思渺然 提交于 2019-12-23 07:28:07
问题 :echo has('clipboard') returns 1, but whenever I execute "+yy" or "*yy" nothing seems to be in those registers. If I use regular yy to copy another line of text, then try to paste from the register using CONTROL+V nothing happens. If I try "+p vim pastes the line of text I copied using the regular yy command. What's going on here? I'm on FreeBSD by the way. 回答1: Your vim version may not be compiled with X11 clipboard integration. In vim run the :version command and look for xterm_clipboard in

alt+backspace to delete words in vim

帅比萌擦擦* 提交于 2019-12-23 07:27:10
问题 How can I remap alt+backspace to delete words like native *NIX text manipulation? I checked out this thread: Using alt+backspace key in vim command line to delete by words And the examples like: cmap <a-bs> <c-w> and :imap <A-BS> <C-W> don't do anything. And the accepted answer was actually to not even remap it, but to use ctrl+w . Since VIM's alt+backspace doesn't do anything I'd rather remap it to something I'm used to. I'm using terminal based VIM (specifically in iTerm) 回答1: The Alt/Meta

alt+backspace to delete words in vim

[亡魂溺海] 提交于 2019-12-23 07:27:05
问题 How can I remap alt+backspace to delete words like native *NIX text manipulation? I checked out this thread: Using alt+backspace key in vim command line to delete by words And the examples like: cmap <a-bs> <c-w> and :imap <A-BS> <C-W> don't do anything. And the accepted answer was actually to not even remap it, but to use ctrl+w . Since VIM's alt+backspace doesn't do anything I'd rather remap it to something I'm used to. I'm using terminal based VIM (specifically in iTerm) 回答1: The Alt/Meta