vim

How to compile a cpp file directly from vim editor in Windows?

时光总嘲笑我的痴心妄想 提交于 2020-12-27 05:27:44
问题 I've recently installed a vim editor in my Windows operating system. I only know the conventional procedure i.e, creating the source file in the editor and running it from the command line. But, I don't quite understand how to compile a CPP program directly from the vim editor. when I run the command :!g++ hello.cpp -o hello from the vim command line, I get the following message C:\WINDOWS\system32\cmd.exe /c (g++ hello.cpp -o hello) Hit any key to close this window... 回答1: I assume your

In Vim, how can I delete everything between quotes including the quotes?

心已入冬 提交于 2020-12-24 06:53:30
问题 For example, in the following: Testing "deleting" within quotes With the cursor inside of deleting, how can I delete the text within the quotes and include the quotes, leaving: Testing within quotes 回答1: You can use the following sequence: da" Keep in mind this only works on a single line, and will remove any trailing spaces after the last quote. Edit As pointed out by @James in the comments below, you can also use the di" sequence ( delete inside ) to delete the characters within the quotes

In Vim, how can I delete everything between quotes including the quotes?

别说谁变了你拦得住时间么 提交于 2020-12-24 06:36:37
问题 For example, in the following: Testing "deleting" within quotes With the cursor inside of deleting, how can I delete the text within the quotes and include the quotes, leaving: Testing within quotes 回答1: You can use the following sequence: da" Keep in mind this only works on a single line, and will remove any trailing spaces after the last quote. Edit As pointed out by @James in the comments below, you can also use the di" sequence ( delete inside ) to delete the characters within the quotes

Vim 分屏

China☆狼群 提交于 2020-12-18 21:18:46
本篇文章主要教你如何使用 Vim 分屏功能。 分屏启动Vim 使用大写的O参数来垂直分屏。 vim -On file1 file2 ... 使用小写的o参数来水平分屏。 vim -on file1 file2 ... 注释: n是数字,表示分成几个屏。 关闭分屏 关闭当前窗口。 Ctrl+W c 关闭当前窗口,如果只剩最后一个了,则退出Vim。 Ctrl+W q 分屏 上下分割当前打开的文件。 Ctrl+W s 上下分割,并打开一个新的文件。 :sp filename 左右分割当前打开的文件。 Ctrl+W v 左右分割,并打开一个新的文件。 :vsp filename 移动光标 Vi中的光标键是h, j, k, l,要在各个屏间切换,只需要先按一下Ctrl+W 把光标移到 右边 的屏。 Ctrl+W l 把光标移到 左边 的屏中。 Ctrl+W h 把光标移到 上边 的屏中。 Ctrl+W k 把光标移到 下边 的屏中。 Ctrl+W j 把光标移到 下一个 的屏中。. Ctrl+W w 移动分屏 这个功能还是使用了Vim的光标键,只不过都是大写。当然了,如果你的分屏很乱很复杂的话,这个功能可能会出现一些非常奇怪的症状。 向右移动。 Ctrl+W L 向左移动 Ctrl+W H 向上移动 Ctrl+W K 向下移动 Ctrl+W J 屏幕尺寸 下面是改变尺寸的一些操作,主要是高度

Vim: disable autocmd BufRead (modeline)

梦想的初衷 提交于 2020-12-13 03:34:03
问题 From this answer I executed: :set modeline | doautocmd BufRead Since then, I cannot disable the BufRead . I can open a file and unset the modeline : :set nomodeline :e! :wq But when I reopen the same file, its modeline is again auto executed. I tried noautocmd - autocmd-remove: :noautocmd w BufRead :noautocmd BufRead :exe "au! BufRead *" :au! BufRead Note I want to disable all auto executed because of BufRead , not just a single event set by it like here explained: https://stackoverflow.com/a

vim let search and replace with increment

淺唱寂寞╮ 提交于 2020-12-09 06:38:59
问题 i wanted to search and replace, implement after the thread here, unfortunately it does not work. gVim find/replace with counter Can anyone help me? Working :let n=[0] | %s/|-\n|/\=map(n,'v:val+1')/g Not working :let n=[0] | %s/|-\n|/BLABLA\=map(n,'v:val+1')/g Why? how do I mask the functionon? Example {| class="wikitable" ! Number ! Name ! Type ! Default Value ! Duration ! Activation ! Status ! EDIT |- | | Adobe-Dummy-Cart-Total | Custom Script | | Pageview | Active | Approved | Edit |- | |

Mapping command s to :w in vim

给你一囗甜甜゛ 提交于 2020-12-08 10:40:56
问题 How can I map Command S to :w in vim? I have tried everything from other threads but nothings seems to work in Mac OS X El Capitan. This supposedly worked in previous versions, but I tried it, and had no success. noremap <silent> <C-S> :update<CR> vnoremap <silent> <C-S> <C-C>:update<CR> inoremap <silent> <C-S> <C-O>:update<CR> Everything on this topic that I could find is several years old and doesn't work anymore. I could find this thread or this thread, but they are both more than three

Mapping command s to :w in vim

元气小坏坏 提交于 2020-12-08 10:39:27
问题 How can I map Command S to :w in vim? I have tried everything from other threads but nothings seems to work in Mac OS X El Capitan. This supposedly worked in previous versions, but I tried it, and had no success. noremap <silent> <C-S> :update<CR> vnoremap <silent> <C-S> <C-C>:update<CR> inoremap <silent> <C-S> <C-O>:update<CR> Everything on this topic that I could find is several years old and doesn't work anymore. I could find this thread or this thread, but they are both more than three

How to open a terminal in new tab from VIM?

北战南征 提交于 2020-12-08 07:32:47
问题 When I'm working with lets say 4 files, all are open in tabs(VIM). I want to save the changes and compile it without having to close the tabs, i.e I want to open a terminal in new tab along with the existing 4? How should I do this in VIM? 回答1: I would suggest looking at tmux or screen. I use tmux myself and along with vim-tmux-navigator moving between the terminal and vim is very easy. 回答2: :tab ter should open a terminal in a new tab instead of opening it in a new window as :ter does. You

How to open a terminal in new tab from VIM?

时间秒杀一切 提交于 2020-12-08 07:32:46
问题 When I'm working with lets say 4 files, all are open in tabs(VIM). I want to save the changes and compile it without having to close the tabs, i.e I want to open a terminal in new tab along with the existing 4? How should I do this in VIM? 回答1: I would suggest looking at tmux or screen. I use tmux myself and along with vim-tmux-navigator moving between the terminal and vim is very easy. 回答2: :tab ter should open a terminal in a new tab instead of opening it in a new window as :ter does. You