vim

Efficient way to refactor a class/method/string within a directory using vim

做~自己de王妃 提交于 2019-12-20 09:39:52
问题 So far, I have been manually refactoring code by using the find-and-replace operation %s:/stringiwanttoreplace/newstring/g in vim. But this is a slow and laborious process if I have stringiwanttoreplace in many files inside a specific directory. My current/typical slow and laborious process involves a grep:- grep -rn "stringiwanttoreplace" . in my terminal to reveal all the locations/filenames where stringiwanttoreplace are; and now that I know which files contain stringiwanttoreplace , I

leave vim split window in insert mode

走远了吗. 提交于 2019-12-20 09:39:09
问题 I want to view the output of a bash command in a vim split window :split . To this end I installed "Conque Shell" which displays bash in a split window upon :ConqueTermSplit bash . I can then run my shell command and watch the output in insert mode. However, to return to the other window I need to type <CTRL-W> <Up> in command mode, so I need to leave insert mode. Hence the display of the command output freezes and continues only if I return to this window and enter insert mode. So how can I

gccsense vs. clang_complete

末鹿安然 提交于 2019-12-20 09:38:39
问题 I've been using omniCppComplete + ctags for a while, and want to make a further improvement on the code completion. According to the suggestion in here [1], gccsense and clang_complete seems to be alternatives. However, I am not sure which one is better. Any idea on their performance? Thanks! Update: After I tried clang_complete, I found the completion speed extremely unacceptable. I then tried it using libclang.dylib, which speeds up a lot but still make one feels lagging. I think I should

VIM: is there an easy way to manage Visual Studio solutions / makefile projects from Vim? [closed]

↘锁芯ラ 提交于 2019-12-20 09:38:10
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 months ago . I tried using Visual Studio instead of VIM(+plugins), but to be honest - the only advantage of VS over VIM is it's ability to automatically manage my project. I know of existence of ViEmu for VS, but I would like to do the opposite - is there any way to manage projects from

Insert a newline without entering in insert mode, vim

匆匆过客 提交于 2019-12-20 09:33:26
问题 I want insert newlines in normal mode in vim using Shift-Enter and Ctrl-Enter . I try some solutions and mixing solutions from Vim Wikia - Insert newline without entering insert mode but Shift-Enter and Ctrl-Enter didn't respond: " put a new line before or after to this line nnoremap <S-CR> m`o<Esc>`` nnoremap <C-CR> m`O<Esc>`` " reverse J command nnoremap <C-J> vaW<Esc>Bi<CR><Esc>k:s/\s\+$//<CR>$ 回答1: My alternative is using oo (resp. OO ) to insert a new line under (resp. over) the current

Find the next occurrence of a variable in vim

倖福魔咒の 提交于 2019-12-20 09:33:16
问题 I would like to know if/how I can make vim look for the next occurrence of a variable. Let's say the variable's name is simply 'n', then /n would give me all occurrences of that letter, which isn't always terribly helpful. I guess I could create a regex to solve the problem, but I wondered whether there was some command/keystroke I simply don't yet know about; and as all my googling has been to no avail I decided to put a question on here. Thanks a lot for your help! 回答1: If you have the

Using VIM as a HTML editor

孤人 提交于 2019-12-20 09:29:23
问题 You know how Notepad++ has this feature that when you click on a tag (say ) it automatically highlights the ending tag () as well? What's it called? And how do you tweak VIM to have this feature as well? And any more ways you can turn VIM into a powerful and efficient HTML editor? 回答1: I do all of my HTML editing in vim. The three plugins I find most helpful for editing HTML and XML in vim are matchit, surround, and allml. Matchit will allow you to jump to the start/end tag with '%'. Surround

Is it possible to get gVim to remember window size?

ぃ、小莉子 提交于 2019-12-20 09:28:49
问题 I know how to set the initial window size in gVim, but how do I get it to automatically restore the window dimensions from last session? Is this even possible? 回答1: Edit: Corrected my answer. The mentioned winsize sessionoption only refers to the vim internal window layout, not the external dimensions. If you use :mksession and load the session on vim startup with gvim -S Session.vim you can include the window position and size into the session by including winpos and resize in the

How to save all files in tabs on Vim?

谁说胖子不能爱 提交于 2019-12-20 09:28:19
问题 If I have multiple files in tabs on VIM and I edit few of them. How to save them with one command? 回答1: The command wa (short for wall ) will write all changed buffers. You can also use :tabdo w , which is definitely exactly what you want, and generalizes nicely. 回答2: Just do :wa (followed by return) which is a shorthand for :wall Also to "save everything and exit" you can do :wqa or :xa (="write-quit-all") 回答3: To save all the files just use an a after the write command to write all the

Vim - how to start inserting at the end of the file in one step

时光总嘲笑我的痴心妄想 提交于 2019-12-20 09:26:26
问题 Is there a single shortcut to start inserting in the new line at end of the file? I'm aware of G + o combo. 回答1: There's also the command line option "+": vim + myfile.txt Will open myfile.txt and do an automatic G for you. 回答2: Not that I know of - G + o is what I would have suggested too, but that is 2 steps :) You could always create a macro which does G + o , and then you can invoke the macro which will be 1 step. 回答3: Adding the following into ~/.vimrc will create one for you: :nmap ^A