vi

How to change the default text editor in R when in Linux?

只谈情不闲聊 提交于 2019-12-01 06:34:10
I am programming using R in Linux and each time I want to edit a function by typing fix(FunctioName) The VI editor is used and for me, it is not that handy, I want to change it and make it an other one for example nano. I am connecting to our school server so I have only shell, no graphical interface. Thank you in advance. As always, export the desired editor in $EDITOR or $VISUAL before starting. Or in R, to override the environment variable: options(editor = "nano") 来源: https://stackoverflow.com/questions/4221310/how-to-change-the-default-text-editor-in-r-when-in-linux

Ubuntu vi命令

不羁岁月 提交于 2019-12-01 05:22:03
最近在使用ubuntu,在linux下,要编辑文件或者其他的文本文件,哪那么一个ubuntu linux下的强大的文本编辑工具就不得不提了,那就是VI编辑器。下面把VI常用到的命令行贴出来。 进入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 : 光 标 移 至 屏

How can I swap or replace multiple strings in code at the same time?

坚强是说给别人听的谎言 提交于 2019-12-01 04:10:54
Given the following code sample: uint8_t i, in, ni; i = in = 2; ni = 1; while (2 == i > ni) in++; How can I replace i, in, and ni , respectively with either in, ni, and i or inni, inin, and nini using emacs, vi, *nix commands, or anything else? If I'm not mistaken, the solutions provided so far (using Perl and Vim) do not work correctly when any of the replacements is among the latter words to be replaced. In particular, none of the solutions works for the first example: "i" would be replaced with "in", which would then be incorrectly replaced with "ni" and then back to "i" by the subsequent

Vim 全选命令

点点圈 提交于 2019-12-01 02:17:19
ggVG 稍微解释一下上面的命令 gg 让光标移到首行,在vim才有效,vi中无效 V 是进入Visual(可视)模式 G 光标移到最后一行 选中内容以后就可以其他的操作了,比如: d 删除选中内容 y 复制选中内容到0号寄存器 "+y 复制选中内容到+寄存器,也就是系统的剪贴板,供其他程序用 右键粘贴 :wq 保存退出 来源: https://www.cnblogs.com/tangcn/p/11647556.html

vi编辑器简介

醉酒当歌 提交于 2019-12-01 02:15:56
vi编辑器是Linux和Unix上最基本的文本编辑器,工作在字符模式下。由于不需要图形界面,vi是效率很高的文本编辑器。尽管在Linux上也有很多图形界面的编辑器可用,但vi在系统和服务器管理中的功能是那些图形编辑器所无法比拟的。 vi 编辑器并不是一个排版程序,它不像Word或WPS那样可以对字体、格式、段落等其他属性进行编排,它只是一个文本编辑程序。没有菜单,只有命令,且命令繁多。vi有3种基本工作模式:命令行模式、文本输入模式和末行模式。 Vim是vi的加强版,比vi更容易使用。vi的命令几乎全部都可以在vim上使用。 文本编辑器的作用 创建或修改文本文件 维护Linux系统中的各种配置文件 Linux中最常用的文本编辑器 vi:类UNIX操作系统的默认文本编辑器 vim: vim是vi文本编辑器(一般简称为vi编辑器)的增强版本 vi编辑器的工作模式 三种工作模式 模式 作用 命令模式 在该模式下,用户可以输入各种合法的Vi命令,用于管理自己的文档。 输入模式 在该模式下,用户输入的任何字符都被vi当做文件内容保存起来,并将其显示在屏幕上。 末行模式 多数文件管理命令都是在此模式下执行,末行命令执行完后,Vi自动回到命令模式。 不同模式之间的切换 快捷键 作用 快捷键 作用 a 在光标之前插入 i 在光标之后插入 o 光标所在的下一行插入 O 光标所在上一行插入 :

Within vim's regex engine, why are some metacharacters escaped and some are not?

て烟熏妆下的殇ゞ 提交于 2019-12-01 02:12:44
问题 Why do you have to escape some metacharacters in their regex engine, but not others? For example: /foo[1-9]* works as expected, but the regular expression foo[1-9]+ must be expressed as /foo[1-9]\+ in vim. Anybody know? 回答1: This is because vim (actually vi ) created their own regex flavor long before perl did. Even POSIX BRE and ERE came after vim wikipedia . They are still maintaining their own flavor so it's quite different. To make the answer more resourceful here is a quote from ed's

How can I swap or replace multiple strings in code at the same time?

ⅰ亾dé卋堺 提交于 2019-12-01 01:43:08
问题 Given the following code sample: uint8_t i, in, ni; i = in = 2; ni = 1; while (2 == i > ni) in++; How can I replace i, in, and ni , respectively with either in, ni, and i or inni, inin, and nini using emacs, vi, *nix commands, or anything else? 回答1: If I'm not mistaken, the solutions provided so far (using Perl and Vim) do not work correctly when any of the replacements is among the latter words to be replaced. In particular, none of the solutions works for the first example: "i" would be

vi字符替换&Ubuntu卸载旧内核

北慕城南 提交于 2019-11-30 22:18:32
一、vi编辑器操作实现字符串替换: vi 中如何使用 :s 命令实现字串的替换. :s/str1/str2/ 用字串 str2 替换行中首次出现的字串 str1 :s/str1/str2/g 用字串 str2 替换行中所有出现的字串 str1 :.,$ s/str1/str2/g 用字串str2替换正文当前行到末尾所有出现的字符串str1 :1,$ s/str1/str2/g 用字串str2替换正文中所有出现的字串str1 :g/str1/s//str2/g 用字串str2替换正文中所有出现的字串str1 :%s/str1/str2/g 用字串str2替换正文中所有出现的字串str1 可见,g放在命令末尾,表示对搜索字串的每次出现进行替换;不加g,表示只对搜索字串的首次出现进行替换,g放在命令开头,表示对正文中所有包含搜索字串的行进行替换. 这是最近配置文件使用vi编辑器时遇到学习,所以在此备忘记录分享下 二、删除ubuntu旧内核操作: #dpkg -get selections|grep linux //查询确认ubuntu现已有的不同版本内核 #apt-get remove linux-images-2.26.27-7-generic //带有images的为内核版本号 #uname -a // 确认现在系统所使用的是哪个版本 #reboot //重启下电脑系统搞定

paste data at the start of line in visual mode

家住魔仙堡 提交于 2019-11-30 21:14:12
I can select lines using SHIFT + V , then selecting lines using up down left right keys, then copy them using y (yank them) and paste them using p (put). I can similarly select data block using CTRL + V , then selecting lines using up down left right keys, then then copy them using y (yank them) and paste them using p (put). But when I am pasting data blocks using p , it always pastes data after the current cursor location. Which means, if I want to paste to the beginning of lines, it won't work - it copies the data after the first character. So how can I paste data block at the beginning of a

LINUX 中vi/vim用法(转)

我怕爱的太早我们不能终老 提交于 2019-11-30 19:17:55
Linux vi/vim 所有的 Unix Like 系统都会内建 vi 文书编辑器,其他的文书编辑器则不一定会存在。 但是目前我们使用比较多的是 vim 编辑器。 vim 具有程序编辑的能力,可以主动的以字体颜色辨别语法的正确性,方便程序设计。 相关文章: 史上最全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