vi

how to remove a buffer from gvim without closing the window

淺唱寂寞╮ 提交于 2019-12-03 11:04:36
问题 I usually type :bd to remove the buffer, however, it results in undesirable side-effect of the window being closed which I do NOT want. 回答1: I usually use :bn (next buffer) followed by :bd# (delete alternate buffer). You could create a mapping or command for this, of course. 回答2: nmap <leader>d :bprevious<CR>:bdelete #<CR> Works as it should until one buffer is open in several windows. Good enough unless you want to use the bigger scripts out there. 回答3: I'm not sure if icecrime's bufclose

vi — 终端中的编辑器

大憨熊 提交于 2019-12-03 10:52:35
目标 vi 简介 打开和新建文件三种工作模式 常用命令速查图 vi简介 1.1 学习 vi的目的 在工作中,要对 服务器 上的文件进行 简单 的修改,可以使用 ssh 远程登录到服务器上,并且使用 vi 进行快速的编辑即可 常见需要修改的文件包括: 源程序 配置文件,例如 ssh 的配置文件 ~/.ssh/config 在没有图形界面的环境下,要编辑文件, vi 是最佳选择! 每一个要使用 Linux 的程序员,都应该或多或少的学习一些 vi 的常用命令 1.1 vi 和 vim 在很多 Linux 发行版中,直接把 vi 做成 vim 的软连接 vi vi 是 Visual interface 的简称,是 Linux 中 最经典 的文本编辑器 vi 的核心设计思想 —— 让程序员的手指始终保持在键盘的核心区域,就能完成所有的编辑操作 vi 的特点: 没有图形界面 的 功能强大 的编辑器 只能是编辑 文本内容,不能对字体、段落进行排版不支持鼠标操作 没有菜单只有命令 vi 编辑器在 系统管理、服务器管理 编辑文件时,其功能永远不是图形界面的编辑器能比拟的 vim vim = vi improved vim 是从 vi 发展出来的一个文本编辑器,支持 代码补全、编译 及 错误跳转 等方便编程的功能特别丰富,在程序员中被广泛使用,被称为 编辑器之神 查询软连接命令(知道) 在很多

vi bindings in ndk-gdb

匿名 (未验证) 提交于 2019-12-03 09:52:54
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I know C+M+j enters into vi-mode in gdb. Cygwin-gdb seems to obey my shell settings ( set -o vi ) and automatically is in vi-mode. However, I can't seem to get ndk-gdb to get into vi-mode. Does anyone know how? 转载请标明出处: vi bindings in ndk-gdb 文章来源: vi bindings in ndk-gdb

Keyboard-only column block selection in GVim Win32, or why does Ctrl-Q not emulate Ctrl-V when mswin.vim is included?

核能气质少年 提交于 2019-12-03 09:50:21
I want to be able to select columnar blocks using only the keyboard when I use GVim on Windows, but I do not seem to be able to do so when using gvim (7.2) on Windows XP. Edit: For convenience, it is preferable to make the selection with arrow keys as is commonly done in other versions of vi/vim. In a terminal, when using vim, to define a block, one may select columnar blocks by pressing Ctrl-V and by conveniently moving the cursor with the arrow keys . When using GVim on mswin, Ctrl-V is mapped to a paste operation. Every reference found on this topic mentions that on mswin, Ctrl-Q is set to

How to change file permission from within vi

我怕爱的太早我们不能终老 提交于 2019-12-03 09:19:33
问题 I sometimes open a read-only file in vi, forgetting to do chmod +w before opening it. Is there way to change the file from within vi? Something like !r chmod +w [filename] ? Is there a shortcut to refer to the currently open file without spelling it's long name? 回答1: Just use :!chmod +w % in command mode. % will be replaced by the current file name. 回答2: If you have the rights to write to the file, then you can just use exclamation mark to force it: :w! If you don't have the rights and need

xargs with command that open editor leaves shell in weird state

China☆狼群 提交于 2019-12-03 09:02:25
问题 I tried to make an alias for committing several different git projects. I tried something like cat projectPaths | \ xargs -I project git --git-dir=project/.git --work-tree=project commit -a where projectPaths is a file containing the paths to all the projects I want to commit. This seems to work for the most part, firing up vi in sequence for each project so that I can write a commit msg for it. I do, however, get a msg: "Vim: Warning: Input is not from a terminal" and afterward my terminal

VIM - Sourcing tags from multiple locations in project

孤人 提交于 2019-12-03 08:21:11
Good day, I typically work on relatively small (less than 20,000 lines of code) projects that are all self contained within a single directory, have their own Makefile, and are fairly easy to work with. VIM is my preferred editor, and when I open a project, I typically build the ctags list via a mapping to the F10 key: map <F10> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR> This allows me to jump to the definition of a variable/struct/etc via moving the cursor over the text, and hitting CTRL + ] , as well as using code completion with a drop-down list via OmniCppComplete. However, I

Removing contiguous duplicate lines in vi without sorting

心已入冬 提交于 2019-12-03 08:17:15
问题 This question already addresses how to remove duplicate lines, but enforces that the list is sorted first. I would like to perform the remove contiguous duplicate lines step (i.e. uniq ) without first sorting them. Example before: Foo Foo Bar Bar Example after: Foo Bar 回答1: Just found the solution here. The following regex works correctly: g/^\(.*\)$\n\1$/d 回答2: :%!uniq if you're on a unix system, or a system that has the uniq program 回答3: If you want to remove non-contiguous duplicates you

Why are there so few modal-editors that aren't vi*?

杀马特。学长 韩版系。学妹 提交于 2019-12-03 08:17:02
问题 Pretty much every other editor that isn't a vi descendant (vim, cream, vi-emu) seems to use the emacs shortcuts ( ctrl + w to delete back a word and so on) 回答1: Early software was often modal, but usability took a turn at some point, away from this style. VI-based editors are total enigmas -- they're the only real surviving members of that order of software. Modes are a no-no in usability and interaction design because we humans are fickle mammals who cannot be trusted to remember what mode

VI Editor: Move to EOL instead of last character

非 Y 不嫁゛ 提交于 2019-12-03 07:29:37
I'm most often finding myself having to work with plain old vi on minimalistic terminals that tend to act differently than the vim on big distros, and so the behavior trips me up. What I want to know is not how to move to the last character in the line, but one character past that. Because typing $ does NOT move the insertion cursor to the last character in the line, and this is easily proven. I'm using vi on MSYS right now. If I type in the line This is a test and hit esc , $ , i , and <enter> , I will get the following: This is a tes t This shows that the insertion cursor was not put at the