vi

Replacing quote marks around strings in Vim?

被刻印的时光 ゝ 提交于 2019-12-03 03:06:42
问题 I have something akin to <Foobar Name='Hello There'/> and need to change the single quotation marks to double quotation marks. I tried :s/\'.*\'/\"\0\" but it ended up producing <Foobar Name="'Hello There'"/> . Replacing the \0 with \1 only produced a blank string inside the double quotes - is there some special syntax I'm missing that I need to make only the found string ("Hello There") inside the quotation marks assign to \1 ? 回答1: You need to use groupings: :s/\'\(.*\)\'/\"\1\" This way

how to change editor behavior in intellij idea

删除回忆录丶 提交于 2019-12-03 03:01:31
问题 I have installed IntelliJIdea 14.0.2 just now. I do not know its default editor but it is opening my source files in vi option now. So, not letting me do default action like Ctrl + v , Ctrl + d which was present before and I used to like it. So, how to change this behavior like present in sublime - editors ? 回答1: If you don't need vi keybindings, uninstall the IdeaVIM plugin. 回答2: disable below option in menu bar. Tools -> VimEmulator(Ctrl + Alt + V) 回答3: If you don't want to uninstall vi,

Bash's vim mode, not vi

人盡茶涼 提交于 2019-12-03 02:42:42
I was fascinated when I discovered vi-like bash's editing mode. One can easily toggle it by issuing set -o vi command. But is there any way to toggle vim-like mode? I mean when you are in a vi-like mode you can press v key and edit your commands in a fully functional vi editor's window but I would like to know how to force bash to start vim editor instead of vi because of the perks vim provides us (visual selection, additional commands etc)? Kent If you set EDITOR variable, in bash you can press Ctrl-x ctrl-e to edit your current command line in your EDITOR e.g. vim EDIT the ctrl-x ctrl-e is

remap NERDTree Double Click to 'T'

此生再无相见时 提交于 2019-12-03 02:42:25
Using VIM NERDTree Plugin. Is there any way to remap the Double Click on a File action to open the file silently in a new tab ( T )? 1 Introduction This works for NERD tree version 4.2.0 . 2 Open directories and files in a new tab If you would like to open directories and files in a new tab you can simply add the following line to your ~/.vimrc . let g:NERDTreeMapOpenInTabSilent = '<2-LeftMouse>' 3 Only open files in a new tab If you only want to open files in a new tab you have to do something more sophisticated. Add this function somewhere in NERD_tree.vim : " opens a file in a new tab "

Python Interpreter Shell with Vi(m) integration possible?

拟墨画扇 提交于 2019-12-03 02:28:58
I love to use bpython but in Ruby there is a gem called interactive_editor that makes it possible to combine Vi(m) with the Ruby shell which makes the Development process much more comfortable. A good introduction to interactive_editor: http://vimcasts.org/episodes/running-vim-within-irb/ Are there any tools (like interactive_editor for Ruby) available to combine the Python shell with Vi(m)? You could have a look at the vim-ipython vim plugin: https://github.com/ivanov/vim-ipython This requires you to install the ipython shell (but I recommend doing this anyway as it adds a lot of

What is a way to read man pages in vim without using temporary files

我与影子孤独终老i 提交于 2019-12-03 02:25:55
问题 I want to be able to read man pages in vim. For some reason, it seems that vim isn't able to read the output of programs through piping (i.e '(man ls) | vi' doesn't seem to work, bonus points to somebody who can explain why), and to get around this, I've been using the following little script: tempo = `mktemp` man $1 > $tempo ; vi $tempo This script uses temporary files which I guess works fine, but I was wondering if there was a good way to read man pages in vim without resorting to making

Force Vi/Vim to use leading tabs only on retab!

谁都会走 提交于 2019-12-03 02:13:38
Is there a way to force vim to use tabs to do the initial indent, but when running the retab! command NOT replace inner word spacing with tabs? In my experience the best way to do this is with a custom function: " Retab spaced file, but only indentation command! RetabIndents call RetabIndents() " Retab spaced file, but only indentation func! RetabIndents() let saved_view = winsaveview() execute '%s@^\( \{'.&ts.'}\)\+@\=repeat("\t", len(submatch(0))/'.&ts.')@' call winrestview(saved_view) endfunc You can then use: :RetabIndents to replace all leading spaces as tabs but not to affect tabs after

How can I delete multiple lines in vi?

萝らか妹 提交于 2019-12-03 01:48:36
问题 I have tried to follow the following: How to delete selected text in VI editor but 5dd gives E492: Not an editor command: 5dd I then tried: 5d Which only deletes a single line. How can I delete multiple lines? 回答1: Sounds like you're entering the commands in command mode (aka. "Ex mode"). In that context :5d would remove line number 5, nothing else. For 5dd to work as intended -- that is, remove five consequent lines starting at the cursor -- enter it in normal mode and don't prefix the

Running vi in adb under Windows

匿名 (未验证) 提交于 2019-12-03 01:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Very occasionally, I will want to edit a file, say /system/build.prop or /etc/hosts on my Android device. I find that the easiest way to do it is: c:\> adb shell $ su # vi /etc/hosts This works fine if I'm using Linux. However, attempting to run vi on my phone when using Windows results in a borked vi screen with strange characters. I'm assuming this is because cmd doesn't support ANSI control characters. Is there any way to fix this (e.g., a cmd alternative that does the job)? 回答1: You can do it with PuTTYTray . It's an improved version of

Find and Replace within selection in `vi`

不想你离开。 提交于 2019-12-03 01:35:29
问题 How do I do a Find and Replace within a selection in vi ? 回答1: Select the text in visual mode (I assume that's what you're doing), then press : to start typing a command, you'll see something like this appear in the command line: :'<,'> That means that the command will apply to the selection. Then type s/search/replace/ and hit enter. (Add a g after the third slash if you want to replace all matches, and a c if you want a confirmation for every replace) 回答2: Most of the other solutions