vi

Linux vim常用命令

自作多情 提交于 2019-12-01 22:12:25
Linux vim常用命令 什么是 vim? Vim是从 vi 发展出来的一个文本编辑器。代码补完、编译及错误跳转等方便编程的功能特别丰富,在程序员中被广泛使用。 简单的来说, vi 是老式的字处理器,不过功能已经很齐全了,但是还是有可以进步的地方。 vim 则可以说是程序开发者的一项很好用的工具。 连 vim 的官方网站 ( http://www.vim.org ) 自己也说 vim 是一个程序开发工具而不是文字处理软件。 vim 键盘图: vi/vim 的使用 基本上 vi/vim 共分为三种模式,分别是 命令模式(Command mode) , 输入模式(Insert mode) 和 底线命令模式(Last line mode) 。 这三种模式的作用分别是: 命令模式: 用户刚刚启动 vi/vim,便进入了命令模式。 此状态下敲击键盘动作会被Vim识别为命令,而非输入字符。比如我们此时按下i,并不会输入一个字符,i被当作了一个命令。 以下是常用的几个命令: i 切换到输入模式,以输入字符。 x 删除当前光标所在处的字符。 : 切换到底线命令模式,以在最底一行输入命令。 若想要编辑文本:启动Vim,进入了命令模式,按下i,切换到输入模式。 命令模式只有一些最基本的命令,因此仍要依靠底线命令模式输入更多命令。 输入模式 在命令模式下按下i就进入了输入模式。 在输入模式中

Vim配置

送分小仙女□ 提交于 2019-12-01 20:44:45
检测已经安装的vim rpm -qa | grep vi 安装vim yum -y install vim-enhanced 用vim 替换 vi vi ~/.bashrc #需要重启 或者使用source进行刷新 //添加内容 alias vi=vim 设置行号与缩进 vi /etc/vimrc set number set tabstop=4 //tab键使用的空格数量 设置光标和行高亮 set gcr=n-v-c:ver25-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor //行高亮 set cursorline highlight CursorLine cterm=NONE ctermbg=black ctermfg=green guibg=NONE guifg=NONE //括号匹配 highlight MatchParen cterm=NONE ctermbg=black ctermfg=red guibg=NONE guifg=NONE 来源: https://www.cnblogs.com/2019PawN/p/11717397.html

Calling vim or TextMate from emacs

天涯浪子 提交于 2019-12-01 20:44:06
问题 I've been using vi quite a while, and with a Mac, I sometimes use TextMate, and finally, I found the greatness of emacs. And, it's very likely that I settle in emacs. The problem is, I sometimes need the other (vi/TextMate) editor for doing something. It's not that emacs doesn't have the feature, it's just that I need the feature right now, and I know how to do that with the 'other' editor. And the same is true with the other editor. My question is how can I launch the one editor from the

Calling vim or TextMate from emacs

廉价感情. 提交于 2019-12-01 19:31:59
I've been using vi quite a while, and with a Mac, I sometimes use TextMate, and finally, I found the greatness of emacs. And, it's very likely that I settle in emacs. The problem is, I sometimes need the other (vi/TextMate) editor for doing something. It's not that emacs doesn't have the feature, it's just that I need the feature right now, and I know how to do that with the 'other' editor. And the same is true with the other editor. My question is how can I launch the one editor from the other. It's not just launching an app, but launching an app with the file that I'm editing. How can I

liunx中vi快捷键编辑

自闭症网瘾萝莉.ら 提交于 2019-12-01 19:22:42
操作系统快捷方式 1) 利用方向键 ↑ ↓ --- 快速调取历史命令 (输入命令都会临时保存在内存中 --> 保存在磁盘文件) 2) 快速移动光标 ctrl + a --- 将光标快速移动到行首 ctrl + e --- 将光标快速移动到行尾 ctrl + ← → --- 将光标按照单词进行左右快速移动 3) 快速操作命令信息 ctrl + u --- 将光标之前的内容进行剪切 ctrl + k --- 将光标之后的内容进行剪切 ctrl + w --- 以空格作为分隔 剪切每个字符串信息 ctrl + y --- 将剪切的内容进行粘贴 4) 特殊功能快捷方式 ctrl + c(cancel) --- 中断或取消命令执行过程 ctrl + l(clear) --- 清屏操作 ctrl + s --- 进入锁定状态 ctrl + q --- 退出锁定状态 编辑命令使用方法 vi/vim 1) 编辑命令模式信息 命令模式: 可以实现特殊功能操作 编辑模式: 可以编辑文件内容信息 底行模式: 可以输入特殊命令信息 wq q wq! q! 命令模式 -i-> 编辑模式 -esc-> 命令模式 命令模式 -:-> 底行模式 -esc-> 命令模式 2) 命令模式 ---> 编辑模式 i --- 在光标所在位置直接进入编辑模式 I --- 将光标切换到行首进入编辑模式 a ---

How do you prevent vim from showing an at symbol (@) when a line doesn't fit on screen?

只愿长相守 提交于 2019-12-01 15:39:00
In vim, when I have a line that can not be entirely shown on screen, the line appears as an at symbol "@" all the way down to the bottom of the screen. For example, if I have a file as such: 1 Hello World 2 Really long sentence that doesn't fit on one line. And I am at the beginning of the document, with a screen height of 3 lines, vim shows the following: 1 Hello World @ @ I would rather have vim show the following: 1 Hello World 2 Really long sentence that doesn't fit on Is this possible? Add set display+=lastline to your ~/.vimrc From :help 'display' : lastline When included, as much as

Automatic “fancy” comment insertion with Vim

一曲冷凌霜 提交于 2019-12-01 12:35:58
I like to have comments like this in my C code: /******************************************************** * Blah ********************************************************/ But I get tired of typing all those asterisks, and copy/pasting can also get annoying. I was wondering if I could possibly create a macro with Vim so that if I press (for example) CTRL+L , it'll automatically insert that structure in my code and align the cursor in the middle (where the actual comment is written). Any advice would be appreciated. Thanks! Take a look at snipmate , a vim plugin for TextMate-like snippets. https

vi命令练习

寵の児 提交于 2019-12-01 10:37:38
vi编辑器有两种工作模式: 命令模式和文本输入模式 在命令模式下输入的字符被解释为命令; 在文本输入模式下输入的为编辑内容。 在编辑模式下,按 Esc 切换到命令模式。 1.保存和退出类的命令 命令 说明 :wq 保存并退出Vi,“:wq!”不保存强制退出 :q 不保存退出vi,“:q!”强制退出 :w 保存但不退出vi;“:w!”强制保存; “:w filename”,将修改保存到filename中,相当于另存为 2.移动光标类的命令 命令 说明 h or Backspace 左移一个字符 L 右移一个字符 j or Ctrl+n 下移一个行 k or Ctrl +p 上移一个行 Enter 换行 3.插入与删除文本类命令 命令 说明 i 在光标前插入文字 a 在光标后插入文字 o(小写) 在当前行的下面新开一行 O(大写) 在当前行的上面新开一行 r 替换光标在的字符,输入r命令后,在键盘上输入需要替换的新字符即可完成替换 x 删除光标所在的字符 dd 删除光标所在行 yy 将光标所在行复制到剪贴板,在“yy”前加上数字,可以复制多行 p(小写) 将剪贴板内容复制到光标后 P(大写) 将剪贴板内容复制到光标前 yw 将光标所在的单词复制到剪贴板 4.搜索和替换类命令(待练习) 5.屏幕翻滚类命令(待练习) 来源: https://www.cnblogs.com/tamkery

vi命令大全 linux下vi命令大全

核能气质少年 提交于 2019-12-01 10:16:27
进入vi的命令   vi filename :打开或新建文件,并将光标置于第一行首   vi +n filename :打开文件,并将光标置于第n行首   vi + filename :打开文件,并将光标置于最后一行首   vi +/pattern filename:打开文件,并将光标置于第一个与pattern匹配的串处   vi -r filename :在上次正用vi编辑时发生系统崩溃,恢复filename   vi filename....filename :打开多个文件,依次进行编辑    移动光标类命令   h :光标左移一个字符   l :光标右移一个字符   space:光标右移一个字符   Backspace:光标左移一个字符   k或Ctrl+p:光标上移一行   j或Ctrl+n :光标下移一行   Enter :光标下移一行   w或W :光标右移一个字至字首   b或B :光标左移一个字至字首   e或E :光标右移一个字至字尾   ) :光标移至句尾   ( :光标移至句首   }:光标移至段落开头   {:光标移至段落结尾   nG:光标移至第n行首   n+:光标下移n行   n-:光标上移n行   n$:光标移至第n行尾   H :光标移至屏幕顶行   M :光标移至屏幕中间行   L :光标移至屏幕最后行   0:(注意是数字零)光标移至当前行首