vim

assembly vim syntax highlighting

一世执手 提交于 2020-05-09 17:46:08
问题 The default assembly syntax file didn't work well and searching the web about gas assembly I found nothing about a gas (AT&T) syntax file for vim. Has anyone found this? I can't write my own syntax file. http://img168.imageshack.us/img168/46/nasm.png ft=nasm http://img160.imageshack.us/img160/5857/asm.png ft=asm(default) http://img164.imageshack.us/img164/8476/tasm.png ft=tasm 回答1: This may get you started. Is that more like what you're looking for? Just had a quick search - it looks like

Opening files in Vim using Fuzzy Search

|▌冷眼眸甩不掉的悲伤 提交于 2020-05-09 17:44:05
问题 I'm looking for a way to make Vim have the ability to open a file by fuzzy-searching its name. Basically, I want to be able to define a project once, and then have a shortcut which will give me a place to type a file name, and will match if any letters match up. This kind of functionality exists in most editors I've seen, but for the life of me I can't understand how to get Vim to do this. Note that I'm looking for something that won't require me to have any idea where in my directory tree a

Vim Macro on Every Line of Visual Selection

瘦欲@ 提交于 2020-05-09 17:33:22
问题 I'd like to run a macro on every line in a selection, rather than totalling up the number of lines in my head. For instance, I might write a macro to transform: Last, First Into First Last and I'd like it to run on all these lines: Stewart, John Pumpkin, Freddy Mai, Stefan ... Any ideas Vim gurus? EDIT: This is just an example, obviously this is trivialy regexable, but there are other instances that come up that aren't quite so easy that I'd prefer to use macros. 回答1: Suppose you had a macro

Open a buffer as a vertical split in VIM

ぐ巨炮叔叔 提交于 2020-05-09 17:31:20
问题 If you are editing a file in VIM and then you need to open an existing buffer (e.g. from your buffer list: :buffers ) how can you open it in a vertical split? I know that you already can open it with a normal split like: :sbuffer N Wehere N is the buffer number you want, however, the above opens that N buffer horizontally, not vertically. I'm also aware that you can change the window placement after opening and have a Vertical Split like so: Ctrl-W H Ctrl-W L Which will vertically split the

How can I cause the QuickFix window to close after I select an item in it?

有些话、适合烂在心里 提交于 2020-05-09 04:36:12
问题 I got the wonderful bookmarks.vim plugin to my vim. I especially like the named bookmarks and using the QuickFix window to list them. In the code to show the bookmark list I'd like to add something that causes the QuickFix window to close after I select a choice. How do I do that? " Open all bookmarks in the quickfix window command! CopenBookmarks call s:CopenBookmarks() function! s:CopenBookmarks() let choices = [] for [name, place] in items(g:BOOKMARKS) let [filename, cursor] = place call

linux命令(二)vim常用命令

爷,独闯天下 提交于 2020-04-22 02:38:14
vim 常用命令汇总 文本替换 :s/原文本/替换文本 语法为 :[addr]s/源字符串/目的字符串/[option] 全局替换命令为::%s/源字符串/目的字符串/g <pre> - [addr]: 表示检索范围,省略时表示当前行。 如:“1,20” :表示从第1行到20行; “%” :表示整个文件,同“1,$”; “. ,$” :从当前行到文件尾; s :表示替换操作 -[option] :表示操作类型 如 g 表示全局替换; c 表示进行确认 p 表示替代结果逐行显示(Ctrl + L恢复屏幕); 省略option时仅对每行第一个匹配串进行替换; 如果在源字符串和目的字符串中出现特殊字符,需要用”\”转义 </pre> 复制行 复制 1)单行复制 在命令模式下,将光标移动到将要复制的行处,按“yy”进行复制; 2)多行复制 在命令模式下,将光标移动到将要复制的首行处,按“nyy”复制n行;其中n为1、2、3…… 粘贴 在命令模式下,将光标移动到将要粘贴的行处,按“p”进行粘贴 来源: oschina 链接: https://my.oschina.net/u/3801804/blog/2248245

In VIM, How to wrap all English words with space when save file?

时光怂恿深爱的人放手 提交于 2020-04-17 22:07:44
问题 There are some words in vim like this: 你好hello 你好hello你好 hello你好 你好hi-hello你好 hi_hello你好 I want to automatically separate English words from Chinese words when saving the file with one space. The final format like this: 你好 hello 你好 hello 你好 hello 你好 你好 hi-hello 你好 hi_hello 你好 I tried to use this command without success: :%s/\(\w\+[_-]*\w*\)/ \1 /g With this command, there are two things that can't be done: Lines beginning with English words should not have spaces at the beginning Repeat

In VIM, How to wrap all English words with space when save file?

陌路散爱 提交于 2020-04-17 22:06:08
问题 There are some words in vim like this: 你好hello 你好hello你好 hello你好 你好hi-hello你好 hi_hello你好 I want to automatically separate English words from Chinese words when saving the file with one space. The final format like this: 你好 hello 你好 hello 你好 hello 你好 你好 hi-hello 你好 hi_hello 你好 I tried to use this command without success: :%s/\(\w\+[_-]*\w*\)/ \1 /g With this command, there are two things that can't be done: Lines beginning with English words should not have spaces at the beginning Repeat

Sort numbers in vimscript

淺唱寂寞╮ 提交于 2020-04-17 21:29:50
问题 Experimenting with vimscript and reading the wonderful Learn Vimscript the Hard Way (LVTHW), I realized that Vim wasn't sorting numbers the way I wanted it to. For example this function from LVTHW function! Sorted(l) let new_list = deepcopy(a:l) call sort(new_list) return new_list endfunction surprised me when I called it with Sorted([3, 1, 11, 2]) : It returned [1, 11, 2, 3] . I think Vim sorts those numbers in alphabetical order. But I'd expect the function to return the numbers in natural

Auto-save in VIM as you type

随声附和 提交于 2020-04-12 19:52:09
问题 As the question title mentions. I'm looking to automatically get the file saved as I type in VIM (insert mode). Is this possible? How to achieve it? 回答1: You can use AutoSave plugin to perform that: https://github.com/907th/vim-auto-save Please notice that AutoSave is disabled by default, run :AutoSaveToggle to enable/disable it. 回答2: I recommend to save the buffer whenever text is changed: autocmd TextChanged,TextChangedI <buffer> silent write I found it here. It works for me. 回答3: There is