vim

Linux Vi/Vim常用命令

随声附和 提交于 2020-01-25 04:44:51
1、跳转到指定行 行数G (命令模式) :行数 (末行模式) 2、跳转到行首 gg(命令模式) 3、跳转到行尾 G(命令模式) 4、自动格式化程序 gg=G (命令模式) 5、大括号对应 %(命令模式) 6、删除单个字符 x(命令模式)执行结束,工作模式不变. 7、删除一个单词 dw (命令模式)光标置于单词首字母进行操作。 8、删除光标至行尾 D 或者 d$ (命令模式) 9、删除光标至行首 d0 (命令模式) 10、替换单个字符 将待替换的字符用光标选中, r (命令模式),再按欲替换的字符 11、删除指定区域 按 V (命令模式)切换为“可视模式”,使用 h、j、k、l 挪移 光标中选中的待删除区域。按 d 删除该区域。 12、删除指定一行:(也可以当作剪切当行) 在光标所在行,按 dd (命令模式) 13、删除指定N行 在光标所待删除首行,按 Ndd (命令模式) 14、复制一行 yy 15、粘贴: p:向后 P:向前 16、查找: (1)、找 设想 内容 命令模式下,按 “/”输入欲搜索关键字,回车。使用 n 检索下一个。 (2)、 找看到内容 命令模式下,将光标置于单词任意一个字符上,按“*”/”#“ 17 单行替换: 将光标置于待换行上,进入末行模式,输入: s /原数据/新数据 18、通篇替换 末行模式: %s /原数据/新数据/g g:不加,只替换每行首个。 19

linux下vim的常用命令

瘦欲@ 提交于 2020-01-25 03:40:22
vim常用命令: i 进入编辑模式 w 保存 q 退出 q!强制退出 wq 保存退出 esc 退出编辑模式,进入命令模式 cc 删除当前行,并进入编辑模式 u 撤销 ctrl+r 反撤销 set nu 显示行号 set nonu 取消行号 /5$ 查找以5结尾的 nohl 关闭高亮提示 w 写入 | w cppname 将当前文本写入cppname中 w>>cppname 将当前文本追加到cppname中 1,6 w>>cppname 将当前文本1到6行写入cppname中 %s/nam/name/g 将当前文本内所有nam改为name 来源: CSDN 作者: kris-蒙 链接: https://blog.csdn.net/qq_44042072/article/details/103957624

linux中安装配置vnc

戏子无情 提交于 2020-01-25 03:35:11
要求在图形化界面的虚拟机 安装实验环境 [ root@localhost ~ ] # yum install -y vnc-server vnc vim 启动VNCSERVER [ root@localhost ~ ] # vncserver :1 You will require a password to access your desktops. Password:自己设置的密码 Verify:和上述一样就行 New 'localhost:1 (zx)' desktop is localhost:1 Creating default startup script /root/.vnc/xstartup Starting applications specified in /root/.vnc/xstartup Log file is /root/.vnc/localhost:1.log 配置VNC [ root@localhost ~ ] # vim /etc/sysconfig/vncservers VNCSERVERS = "2:hubery" VNCSERVERARGS [ 2 ] = "-geometry 800x600 -nolisten tcp -nohttpd -localhost" 在远程Windows机器安装VNC Viewer软件并打开 来源: CSDN

树莓派使用STEP4:安装vim

 ̄綄美尐妖づ 提交于 2020-01-25 03:15:42
系统原装的vi操作对新手和学习者不友好,可以用nano编辑器,因为我比较熟悉vi和vim,这里推荐使用vim。首先需要删除原装的vi,然后重新安装新的vim,过程比较简单。 1、卸载预装的vi sudo apt-get remove vim-common 2、安装新的vim sudo apt-get install vim 来源: CSDN 作者: jianwang16 链接: https://blog.csdn.net/u010058695/article/details/103767794

Kali常用命令(持续更新)

一个人想着一个人 提交于 2020-01-24 14:50:07
ls list cd change directionary cd .. 返回上一层目录 rm -r zlll.deb 删除zlll.deb文件 pwd 查看当前目录位置 tar -zxvf zlll.tar.gz 解压zlll.tar.gz文件 mkdir make directionary 创建新文件夹 mkdir a/b/c/d cd ../../../../ top 类似windows的热键启动Ctrl+Alt+Delete,查看进程等 touch a.txt 创建一个a.txt文件 vim a.txt 进入并编辑以vim方式 mv a.txt ./usr 将a.txt移动到当前目录的usr文件夹下 mv即move cp ./usr/a.txt b.txt 将usr文件夹下的a.txt复制到当前目录并更名为b.txt cp即copy fmt b.txt 读取文本内容 cat b.txt 同上 find / -name b.txt 寻找b.txt文件在哪个目录中 cd /var/log/ 日志存放地 cat message 查看日志里的message文件 head -n 4 ./message 只查看message的前4行 tail -n 4 ./message 只查看message的后4行 tail -f ./message 查看实时更新的message ps -aux

Vim behaving weirdly on Mingw

折月煮酒 提交于 2020-01-24 05:45:07
问题 My Vim on MinGW 4.6.2 is behaving weirdly, for example, pressing Backspace in insert mode deletes characters, but I have to move the cursor with arrow keys before the deleted characters disappear, and it also takes me out of insert mode. Another example, pressing Del to delete characters sometimes generates weird characters like changing lowercase characters to uppercase, or corrupts the next character that I key in, for example pressing 'S' gives me '$' initally. Am I using Vim wrong or

Get length of current line

北慕城南 提交于 2020-01-24 05:25:06
问题 I'm trying to add an indicator in my statusline for the total length of the line (not just the cursor column position, which can be shown with %c ). How do I do this? 回答1: To get the contents of a line as a string, use getline(<line number>) . To get the contents of the current line as a string, you can use getline(".") . To get the length of a string, you can use strlen(<string>) . Putting it all together, we get strlen(getline(".")) . To add it to your statusline, simply: statusline += "%

Is it possible to remap an Ex command in Vim (remap :Ack to :ack)?

爷,独闯天下 提交于 2020-01-24 05:24:26
问题 I use the Vim plugin ack.vim, but I don't understand why the command is :Ack with a capital "A" (a little annoying to hold shift ). Is it possible to remap this to :ack ? 回答1: Built-in commands start with a lowercase character and custom commands start with an uppercase character. Those are the rules. Vim simply won't let you define a custom command starting with a lowercase. If you don't like it, nothing prevents you from creating a normal mode mapping: nnoremap <leader>a :Ack<Space> which

将VIM配置为IDE

别来无恙 提交于 2020-01-24 04:23:55
前言 我们在服务器上做开发时,可以选择使用字符界面或者GUI界面。 由于远程GUI界面比较吃资源,因此其流畅度和本地操作系统的GUI界面相差甚远,使用体验往往不尽人意。 因此,一般首选字符界面做开发,VIM 编辑器是字符界面下的一款神器。 VIM 编辑器在配置好各种插件后,可以媲美 Windows 下功能强大的 IDE 而又不显得臃肿。 本文的配置非常方便快捷,Ubuntu 下只需通过 apt 安装 ctags 和 cscope ,再修改 .vimrc 配置文件即可, 几分钟内 就能将 VIM 配置成 IDE。 本文配置的 VIM 编辑器的 最终效果 如下图,使用了 NerdTree、TagList、MiniBufExplorer、SourceExplorer 这几个插件。 安装 ctags 和 cscope 在命令行输入下面两条命令安装 ctags 和 cscope: $ sudo apt install ctags $ sudo apt install cscope 使用 ctags 和 cscope 在代码目录下生成符号库,可以帮助我们在 VIM 编辑器中查找变量、函数等的定义,进行跳转。 上面两条命令执行完毕后,进入代码项目所在目录,执行下面的命令生成 tags 文件: $ ctags -R . 执行下面的命令生成 cscope 的符号索引数据库: $ cscope

Windows7 PowerShell inserts ^@ between every characters - how to prevent?

↘锁芯ラ 提交于 2020-01-24 04:16:04
问题 Hopefully for you this would be trivial to answer. I have gvim and vim on Win7. Any time I redirect command result to file and open it with Vim (or Gvim, same effect) I have binary 0 (^@ sign) inserted between every characters. So, instead of r96130 I have ^@r^@9^@6^@1^@3^@0^@ Any idea how to (preferred) prevent it or (fine) get rid of it? I tried substitution but obviously this ain't just ^@, it's a binary zero (I think) so it's not picked up on /^@ . Edit(s): 1) Tried setting encoding to