Overall View:
1. Move the cursor:
1) j --> move down
2) k --> move up
3) h --> move forward
4) l --> move afterward
5) 0 --> move to the start of current line
6) $ --> move to the end of current line
7) w --> move to the start of next word
8) e --> move to the end of next word
9) 3w --> move 3 words afterward
10) 3e --> move 3 words afterward
2. Deletion
1) x --> delete single character at the cursor
2)dw --> delete whole word at the cursor including all the spaces after the word.
3)d$ --> delete all characters including and after the current cursor.
4) d3w --> delete 3 words afterward
5) d3e --> delete 3 words afterward
6) dd --> delete current line
7) d2d --> delete 2 lines afterward including current line
8) 2dd --> delete 2 lines afterward including current line. same with d2d
9) ce --> delete the left character in the word after & including the current cursor
10) c$
3. Insertion
1) i --> insert before current cursor
2) I --> insert before the first character of current line.
3) a --> insert after current cursor
4) A --> insert after the last character of current line.
w - until the start of the next word, EXCLUDING its first character. e - to the end of the current word, INCLUDING the last character. $ - to the end of the line, INCLUDING the last character.
5) o --> open a line BELOW the cursor and start Insert mode
6) O --> open a line ABOVE the cursor and start Insert mode
4) Exit
1) :q! --> quit without saving changes
2) :wq --> quit and saving all changes
5) Undo
1) u --> undo single operation
2) U --> undo all the operations on a line.
1. To delete from the cursor up to the next word type: dw 2. To delete from the cursor to the end of a line type: d$ 3. To delete a whole line type: dd 4. To repeat a motion prepend it with a number: 2w 5. The format for a change command is: operator [number] motion where: operator - is what to do, such as d for delete [number] - is an optional count to repeat the motion motion - moves over the text to operate on, such as w (word), $ (to the end of line), etc. 6. To move to the start of the line use a zero: 0 7. To undo previous actions, type: u (lowercase u) To undo all the changes on a line, type: U (capital U) To undo the undo's, type: CTRL-R
6) Paste
1) p --> paste after current line
2) P --> paste before current line
7) Replace
1) r --> replace single character on the cursor
2) R --> replace more than one character on the cursor.
3) :s/thee/the --> replace the word 'thee' with 'the' in current line. only replace once.
4) :s/thee/the/g --> replace the word 'thee' with 'the' in current line. replace all occurence in current line.
5) :%s/thee/the/g --> replace the word 'thee' with 'the' replace all occurence in current file.
type :#,#s/old/new/g where #,# are the line numbers of the range of lines where the substitution is to be done. Type :%s/old/new/g to change every occurrence in the whole file. Type :%s/old/new/gc to find every occurrence in the whole file, with a prompt whether to substitute or not.
8) Position
1) G --> Go to the last line of the file
2) gg --> Go to the first line of the file
3) ctrl + g --> Also called CTRL-G, show the detail position information for current line.
4) 123G --> Move cursor to line 123.
5) Ctrl + b --> Move backward one screen
6) Ctrl + f --> Move forward one screen
9) Search
1) /errroor<ENTER> --> find the word "errroor" in file search FORWARD for the phrase.
2) ?errroor<ENTER> --> find the word "errroor" in file search BACKWARD for the phrase.
3) n --> go to next match
4) N --> go to prev match
5) % --> go to the corresponding character. {}, [], ()
This is very useful in debugging a program with unmatched parentheses!
6) ctrl+o --> go to older position
7) ctrl+i --> go to newer position
10) Select
1) v --> start visual selection
11) Copy
1) y --> yank (copy)
2) yw --> copy word
3) ye --> copy word
4) y$ --> copy till the end of line
5) yy --> copy whole line
12) Set command
Typing ":set xxx" sets the option "xxx". Some options are: 'ic' 'ignorecase' ignore upper/lower case when searching 'is' 'incsearch' show partial matches for a search phrase 'hls' 'hlsearch' highlight all matching phrases You can either use the long or the short option name.
相关推荐
**vim基础操作** vim(Vi IMproved)是一款强大的文本编辑器,被广泛应用于Linux和Unix-like操作系统中。它以其高效、灵活和可扩展性而受到程序员和系统管理员的喜爱。了解并掌握vim的基本操作是每个IT从业者必备的...
### Vim高级实例技巧详解 #### 一、文本操作(Text Manipulation) **1.1 搜索(Searching)** ##### 1.1.1 搜索当前光标下的子程序或函数声明 在 Vim 中,可以通过以下命令搜索当前光标所在位置的子程序或函数声明...
Vim(Vi IMproved)是Linux、Unix、Mac OS X及Windows等操作系统中的一款强大的文本编辑器,由 Bram Moolenaar 开发,基于原始的Vi编辑器。它以其高效、可高度定制化和功能丰富而闻名,是程序员和系统管理员的首选...
标题“msys运行vim依赖”涉及的是在MSYS(Minimal SYStem)环境下成功运行Vim编辑器所需的一些关键依赖。MSYS是一个轻量级的Unix-like环境,它为Windows提供了一个模拟POSIX接口,使得用户可以在Windows上编译和运行...
因此,为了同时满足学习和操作的需求,项目中的文件都采用了Markdown格式,既可以按照说明文档来阅读,也可以用Vim:文件进行实际操作(建议采用一部分)。 如何使用 进入控制台 clone项目到本地 git clone git@...
对于vim: ln -s ~/.oob-vim ~/.vim 用于NeoVim ln -s ~/.oob-vim ~/.config/nvim 安装插件 对于vim: vim +PlugInstall +qa 对于NeoVim: nvim +PlugInstall +qa 自动安装 为vim和NeoVim安装oob-vim: curl -...
杀虫剂利用coc插件打造开发环境以下参考Java IDEC / C ++ #termux apt安装clang #vim :CocInstall coc-clangdPython #termux apt安装python 点安装绝地#阿里巴巴代理商pip配置设置global.index-url #vim :...
编辑~/.vimrc文件,里面加一行: so ~/.vim/vim/init.vimso ~/.vim/vim/skywind.vim视窗:新建D:\github目录,把项目克隆到D:\github\vim下面: d:cd \githubgit clone https://github.com/skywind3000/vim.git...
掌握Vim 这是Packt发行的的代码存储库。 使用Vim和Neovim构建软件开发环境 这本书是关于什么的? Vim是一个无处不在的文本编辑器,可用于所有编程语言。 它具有广泛的插件系统,并与许多工具集成。 Vim为程序员...
#termux apt安装clang #vim :CocInstall coc-clangd Python #termux apt安装python 点安装绝地#vim :CocInstall安装coc-python 高朗 #termux apt安装golang #vim :cocInstall安装coc-go 网路 #termux ...
**Packman.vim:探索Vim的简单插件包管理器** 在Vim的世界里,高效管理和组织插件是提升编辑器体验的关键。这就是Packman.vim的角色所在,它作为一个轻量级的插件包管理器,使得安装、更新和卸载Vim插件变得极其...
YAJS:另一个JavaScript语法Vim的另一个JavaScript语法文件。 主要区别: 使用“ javascript”作为组名的前缀,而不是“ javaScript”或“ JavaScript”。 与一起。 识别Web API和DOM关键字。 基于与完美搭配删除旧...
Salt-VIM 这是一个用于在服务器上安装的 salt state 模块。... salt '*' state.sls vim样本Struts数据: 我希望在... vim: {% if grains['os_family'] == 'Debian' %} config_base_dir: /etc/vim {% endif %} autocmds:
.vim:Vim配置
使用带有 light主题和neoline.vim: 安装 :mage: 在Vim / NeoVim配置文件上添加以下行: Plug ' https://github.com/adelarsq/neoline.vim ' 然后打开编辑器并使用PlugInstall安装。 在Vim / NeoVim配置文件上...
本篇文章将重点讨论如何通过SUID的`vim.basic`文件来实现提权。 首先,我们要确保有一个SUID权限的`vim.basic`文件。在Kali Linux系统中,我们可以使用`chmod`命令来添加这个权限: ```bash chmod u+s /usr/bin/...
lucariox.vim 定制vim和neovim从激发颜色方案Lucario与混合Darkblue元件和一些额外的比特。 原始Lucario配色方案: Darkblue配色方案是默认的一部分vim分布。 此外,它还定义了嵌入式终端的颜色,变量类型,... ...
alpine-vim:“ dockerized”的Vim