vi

How can I stop VI from overlapping and hiding the last page of command line output?

狂风中的少年 提交于 2019-12-12 12:16:23
问题 Currently, when I start vi in a terminal window within screen, the vi program takes up the full screen and covers up any of the output history that was there, and then remains there upon exiting. Thus, when scrolling back through my terminal output at a later time, the output under the vi window is masked. I'm currently working around this with the following alias in my bashrc... alias vi='for i in $( seq 1 $LINES ); do echo ; done ; vi' This has worked just fine so far, but it strikes me as

vim in Cygwin replaces first character with 'g' on opening a file

爱⌒轻易说出口 提交于 2019-12-12 08:55:41
问题 I use vim in Cygwin terminal. It was working fine. Recently, I added a package in Cygwin which caused update of vim and some other components. Now when I open any file in vim, the first character in the file gets replaced with character 'g'. I tried removing .vimrc and all files in .vim folder in my home folder. But the problem persists. To understand the problem, I opened a file using 'vim -E'. On opening, I see the following at the bottom of the window: Entering Ex mode. Type "visual" to go

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

扶醉桌前 提交于 2019-12-12 08:49:13
问题 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. 回答1: 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

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

流过昼夜 提交于 2019-12-12 08:47:33
问题 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? 回答1: 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 回答2: Extending the other

sort rows in 'VI' editor

纵饮孤独 提交于 2019-12-12 08:27:33
问题 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

How use editor with “git commit”?

别说谁变了你拦得住时间么 提交于 2019-12-12 02:47:08
问题 I have installed fresh Ubuntu 12.04 and initialized some project with git . When I did git commit , it opened some file with nano editor for me to enter commit description. Questions: 1) Can I use vi instead of nano and how? 2) Should I append proposed content or replace it? 回答1: Others have indicated how to change the editor, but here are a couple more tips. Firstly, a blank commit message aborts the commit. This is handy if you realise you have forgotten something while typing your message.

Post your Vim config

那年仲夏 提交于 2019-12-12 01:15:37
问题 Merged with What is in your .vimrc? [closed]. Please share and vote for the best! Please do not close this. This is a subjective question, but is programming related and can be beneficial to people. 来源: https://stackoverflow.com/questions/1636771/post-your-vim-config

Vim编辑器基础

ⅰ亾dé卋堺 提交于 2019-12-11 19:09:25
简介   Vi是visual editor的缩写,是UNIX系统下最通用的文本编辑器。   Vi不是一个所见即所得的编辑器,如果要进行复制和格式化文本需要手动输入命令进行操作。   Vim是Vi的扩展版本,它比Vi更强大。 Vim的安装   在不同的操作系统中,Vim的安装不同,但是大致上是一样的。   例如Centos安装Vim的命令是yum install vim   Ubuntu安装Vim的命令是apt-get install vim Vim编辑器模式   Vim主要有两种模式,分别是“普通模式”和“插入模式”;也叫“命令模式”和“编辑模式”。   编辑模式可以进行字符的输入。   命令模式可以进行命令操作。例如在命令模式下按h键,光标会向左移动一个字符的位置。   编辑模式可以使用命令a或者i切换;命令模式使用Esc键切换。   切换到编辑模式下时,Vim会在窗口底部显示“--INSERT--”或者“--插入--”,表示当前是编辑模式。 Vim命令   插入     命令“a” 向后插入。     命令“i” 在当前位置插入。   移动光标     命令“h” 向左移动一个字符。     命令“j” 向下移动一行。     命令“k” 向上移动一行。     命令“l” 向右移动一个字符。     也可以通过方向键移动光标。   删除字符     命令“x”

How to append some command output at the end of each line in a Vi file?

Deadly 提交于 2019-12-11 17:56:00
问题 Suppose I have a vi file as the following: cat file1 abc 123 pqr lmn 234 rst jkl 100 mon I want to take the 2nd field of each line (viz, in this case is 123, 234 and 100) and append it to the end of that same line. How will I do that? The output should look like the following: abc 123 pqr 123 lmn 234 rst 234 jkl 100 mon 100 回答1: With awk : $ awk '{NF=NF+1; $NF=$2}1' file abc 123 pqr 123 lmn 234 rst 234 jkl 100 mon 100 It increments the number of field in one and sets the last one as the 2nd.