vi

Will Emacs make me a better programmer? [closed]

三世轮回 提交于 2019-12-04 07:23:18
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Steve Yegge wrote a comment on his blog: All of the greatest engineers in the world use Emacs. The world-changer types. Not the great

How do I close all open tabs at once?

╄→гoц情女王★ 提交于 2019-12-04 07:23:17
问题 If I have 10 tabs opened, I have to close each one using ":q" separately. How can I close them all at once? 回答1: Shortest/simplest/fastest way would be: :qa To save work in all tabs and quit: :wqa 回答2: I often use :tabo ( :tabonly ) to close all other tabs. 回答3: That can be done with the following command (in normal or escape mode): :tabdo :q "tabdo" apparently executes the command for all the open tabs. 回答4: Adding to what fuentesjr said: :qa! Will force quit all tabs, if you don't care

/etc/apt/sources.list" E212: Can't open file for writing

左心房为你撑大大i 提交于 2019-12-04 07:20:35
问题 I am trying to edit sources.list using vi editor but getting the following error while saving the file: /etc/apt/sources.list" E212: Can't open file for writing 回答1: For some reason the file you are writing to cannot be created or overwritten. The reason could be that you do not have permission to write in the directory or the file name is not valid. Vim has a builtin help system. I just quoted what it says to :h E212 . You might want to edit the file as a superuser as sudo vim FILE . Or if

In vim, how do I go back to where I was before a search?

╄→гoц情女王★ 提交于 2019-12-04 07:18:59
问题 Programming in vim I often go search for something, yank it, then go back to where I was, insert it, modify it. The problem is that after I search and find, I need to MANUALLY find my way back to where I was. Is there an automatic way to go back to where I was when I initiated my last search? 回答1: Ctrl + O takes me to the previous location. Don't know about location before the search. Edit: Also, ` . will take you to the last change you made. 回答2: Use `` to jump back to the exact position you

How to display the current process tree of a bash session?

本小妞迷上赌 提交于 2019-12-04 06:37:24
I would like to create a bash alias that gives me the process tree from the current bash session I am using, up to init. The use case is to know whether I have used bash or vi 's :shell command. I am using MacOS X. I have heard about pstree , but it seems to only show children, not the relationship between init and the current process. I am sure with a a bit of google search, you can find how to get and download pstree for the Mac. However, you can do a poor man's version, using ps and ppid . eg ps -eo ppid,pid,cmd | awk '{p[$1]=p[$1]","$3}END{ for(i in p) print i, p[i]}' This is supported in

Repeating a navigation command in vi

孤街浪徒 提交于 2019-12-04 06:15:12
How do I repeat a navigation command in vi? For example, I execute the command 20j which moves the cursor down 20 lines, and I tried hitting . to repeat that command, but it says "No command to repeat". P.S. Also, what command goes to the next page in a document? There isn't a shortcut to repeat the last navigation command - you have to retype it, or set up some sort of shortcut of your own ( :map or similar). Page up (back) is Control-B ; page down (forward) is Control-F . Half-pages are Control-U (up) and Control-D (down). 来源: https://stackoverflow.com/questions/3671019/repeating-a

How to autocomplete at the KornShell command line with the vi editor

天大地大妈咪最大 提交于 2019-12-04 05:26:46
In the KornShell (ksh) on AIX UNIX Version 5.3 with the editor mode set to vi using: set -o vi What are the key-strokes at the shell command line to autocomplete a file or directory name? paxdiablo ESC\ works fine on AIX4.2 at least. One thing I noticed is that it only autocompletes to the unique part of the file name. So if you have the files x.txt, x171go and x171stop, the following will happen: Press keys: Command line is: x x <ESC>\ x 1 x1 <ESC>\ x171 g<ESC>\ x171go Brian Deterling Extending the other answers: <ESC>* will list all matching files on the command line. Then you can use the

How to pipe visually selected text to a UNIX command and append output to current buffer in Vim

ぃ、小莉子 提交于 2019-12-04 04:23:12
Using Vim, I'm trying to pipe text selected in visual mode to a UNIX command and have the output appended to the end of the current file. For example, say we have a SQL command such as: SELECT * FROM mytable; I want to do something like the following: <ESC> V " select text :'<,'>!mysql -uuser -ppass mydb But instead of having the output overwrite the currently selected text, I would like to have the output appended to the end of the file. You probably see where this is going. I'm working on using Vim as a simple SQL editor. That way, I don't have to leave Vim to edit, tweak, test SQL code. How

sort rows in 'VI' editor

喜夏-厌秋 提交于 2019-12-04 03:04:17
If i have to sort following rows on the basis of values on left of '='. But the sorting should expand the selection to column after '=' simultaneously. Thtz is we dnt have to sort column after '=' :: 50599=1000000 50454=00000054 50080=00005464 50098=00000875 50661=00000665 50788=10000035 50988=10000006 50994=10000656 57009=00000005 57022=10000008 57040=10000005 57000=10000005 57060=10000089 57067=10005640 57102=00000765 57190=00000867 This needs to be done in 'VI' editing the file. RESULT should be :: 50080=00005464 50098=00000875 ...etc. bjhaid This answer is coming 2 years late, but might

Some questions on .vimrc and vim configuration

回眸只為那壹抹淺笑 提交于 2019-12-04 02:40:06
Generally on a unix system, there is a global vimrc file in the directory /etc or /etc/vim . You can also have a .vimrc file in your home directory that can customize your vi session. Is it possible to have a .vimrc elsewhere in your directory tree so you can use different vi properties in different directories? This would be convenient because the editor properties that help you edit Python most quickly are different from those for editing, say, HTML. This sort of thing does not seem to work be default on my mac or linux lappies. Is there a way to make it happen? Vim has built functionality