vi

Why do gedit and vim hide the final newline from the user?

痞子三分冷 提交于 2019-11-30 17:32:43
Let's assume we have two text documents: Our first file contains " hi " as text. Our second file contains " hi " as text. When we open these two files in gedit, vi, or vim, the two files are visually identical in every way. However, when we run xxd on the files, we get the following: Hex content of our first file reads: 6869 Hex content of our second file reads: 6869 0a Aha! There's an invisible newline. In vim, if we were paying close enough attention to the status bar and happen to understand what [noeol] means, then we might pick up on this, but in gedit, the two files open exactly the same

centos7.0查看IP

南笙酒味 提交于 2019-11-30 16:59:56
输入ip查询命名 ip addr 也可以输入 ifconfig(centOs7没有ifconfig命令)查看ip,但此命令会出现3个条目,centos的ip地址是ens33条目中的inet值。 发现 ens33 没有 inet 这个属性,那么就没法通过IP地址连接虚拟机。 接着来查看ens33网卡的配置: vi /etc/sysconfig/network-scripts/ifcfg-ens33 注意vi后面加空格 vi是Linux内置的文本编辑器命令 打开文件的意思 从配置清单中可以发现 CentOS 7 默认是不启动网卡的(ONBOOT=no)。 把这一项改为YES(ONBOOT=yes), 然后按 Esc 退出 再出入命令 :wq 再按Enter即可 (备注 :wq 是保存然后退出的意思 后面会专门讲下vi) 然后重启网络服务: sudo service network restart 然后我们再输入 ip addr 命令 来源: https://www.cnblogs.com/jiangxiaobo/p/11605451.html

Running vi in adb under Windows

不问归期 提交于 2019-11-30 13:28:37
Very occasionally, I will want to edit a file, say /system/build.prop or /etc/hosts on my Android device. I find that the easiest way to do it is: c:\> adb shell $ su # vi /etc/hosts This works fine if I'm using Linux. However, attempting to run vi on my phone when using Windows results in a borked vi screen with strange characters. I'm assuming this is because cmd doesn't support ANSI control characters. Is there any way to fix this (e.g., a cmd alternative that does the job)? You can do it with PuTTYTray . It's an improved version of PuTTY which features a number of additional features. One

2019-2020-1 20199322 头脑风暴(环境:实验楼)

非 Y 不嫁゛ 提交于 2019-11-30 12:33:49
测试1 要求 每个 .c 一个文件,每个.h一个文件,文件名中最好有自己的学号 在vi中使用K查找printf的帮助文档 提交vi编辑过程截图,要全屏,包含自己的学号信息 操作过程 测试2 要求 用gcc进行预处理,编译,汇编,链接vi输入的代码 生成的可执行文件中要有自己的学号 提交预处理,编译汇编,链接,运行过程截图,要全屏,包含自己的学号信息 操作过程 测试3 要求 用gcc-g 编译vi输入的代码 在main函数中设置一个行断点 在main函数中增加一个空循环,循环次数为自己学号的后4位,设置一个约为学号一半的条件断点 提交调试过程截图(一定包含条件断点的),要全屏,包含自己的学号信息 注意 实验楼环境本身没有gdb调试command,必须自己装一下: sudo apt-get install gdb 操作过程 测试4 要求 除了main.c,其他四个模块(add.c sub.c mul.c div.c)的源代码不想给别人,如何制作一个mymath.a静态库?main.c如何使用mymath.a? 提交静态库生成和调试过程截图(一定包含条件断点的),要全屏,包含自己的学号信息 操作过程 测试5 要求 除了main.c,其他四个模块(add.c sub.c mul.c div.c)的源代码不想给别人,如何制作一个mymath.so共享库?main.c如何使用mymath.so

linux---------vi编译器

孤街醉人 提交于 2019-11-30 12:11:20
vi编译器 1.保存退出 :wq esc ZZ 2 插入命令 :vi模式变化到输入模式 A I O a i o 3 光标移动命令:仅仅移动光标,不会改变模式 ^:移动到行首 第一个非空字符 0:移动到行首第一个字符 $:移动到行位 nG :n :n行 n| :n 列 :set nu 设置行号 :set nonu取消行号 gg 到第一行 G 最后一行 H M L 分别到屏幕的顶端,,中间,和底端 删除命令 x 删除一个 nx删除n个 D 从坐标所在处删到行位 dd 删除坐标所在行 ndd 删除n行 :n1,n2d 删除从n1到n2 dG 从坐标所在行到文件尾 替换命令 R 不停替换 r 替换光标所在位置 u 撤销 . 重复 复制粘贴剪切命令 yy nyy 复制一行或n行 dd ndd 剪切一行或n行 p P 分别在光标所在行的下方和上方粘贴 搜索全文替换 /string 搜素字符串 n 下一个 :%s/old/new/g 全文替换 :n1,n2s/old/new/g 在指定行范围内替换 其他命令 :r !命令 命令导入 if判断 vi if.sh 按A,a,i,I,o,O进入输入命令 然后进行修改 #!/bin/bash if [ -e $1 ] then if [ -f $1 ] then echo "this is an ordinary file." elif [ -d $1

17.vim介绍、颜色显示和移动光标、一般模式下复制、剪切和粘贴

ⅰ亾dé卋堺 提交于 2019-11-30 12:01:57
1.vim 是 vi 的升级版 vim 是带有颜色显示的 mini安装的系统,一般都不带有vim [root@aminglinux-128 ~]# yum install -y vim-enhanced 已加载插件:fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.cn99.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com base | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 软件包 2:vim-enhanced-7.4.160-4.el7.x86_64 已安装并且是最新版本 无须任何处理 vim的使用 基本上vi可以分为三种状态,分别是一般模式、编辑模式和命令行模式,各模式的功能区分如下: 一般模式: 以vi打开一个文件就直接进入一般模式了(这是默认的模式)。在这个模式中, 你可以使用上下左右按键来移动光标,你可以使用删除字符或删除整行来处理文件内容, 也可以使用复制、粘贴来处理你的文件数据。 编辑模式: 在一般模式中可以进行删除、复制、粘贴等的操作,但是却无法编辑文件的内容,只有当到你按下【i,

Copy from Putty/Vim visual mode to windows clipboard [duplicate]

假装没事ソ 提交于 2019-11-30 11:47:55
问题 This question already has answers here : Copying stuff from vim running in putty (4 answers) Closed 2 years ago . I currently have a vim session open in Putty, and I've selected everything in the file via visual mode. Normally to copy this onto clipboard I would use either "+y or "*y , but neither of those commands are working. Here's my vimrc: call pathogen#infect() set noswapfile set mouse=" set ts=4 set wildmenu set wildmode=list:longest,full colorscheme evening set expandtab set smarttab

Returning to previous line with Vim

北城以北 提交于 2019-11-30 10:26:54
问题 I was wondering if there's a way to return to the previous line you were on in Vim. Say, for example, I'm writing C code and I just wanted to add an #include at the top of the page: I press gg and go to the top, add the #include , and then I want to return to the line I left off of. Is this possible in Vim? 回答1: Yes. You can use `` in order to jump between the last two positions. Otherwise, Ctrl + O and Ctrl + I can help you. See :help CTRL-I . 回答2: Use a mark: ma marks the spot (before the

Delete newline in Vim

喜欢而已 提交于 2019-11-30 10:03:06
问题 Is there a way to delete the newline at the end of a line in Vim, so that the next line is appended to the current line? For example: Evaluator<T>(): _bestPos(){ } I'd like to put this all on one line without copying lines and pasting them into the previous one. It seems like I should be able to put my cursor to the end of each line, press a key, and have the next line jump onto the same one the cursor is on. End result: Evaluator<T>(): _bestPos(){ } Is this possible in Vim? 回答1: If you are

Map Esc key in Vim

怎甘沉沦 提交于 2019-11-30 09:26:18
I'm a beginning Vim user. I hate pressing the Esc key, which is a little far on my T61. In order to return to command mode. How do I map it to F4 ? For a single session, you could just enter the following keystrokes exactly: esc : i m a p space < f 4 > space < e s c > enter The esc key ensures that you're in command mode, colon starts a line command, and the imap maps the F4 key to ESCAPE. However, if you want this retained for every session, you'll need to put in in your Vim start-up file. The location of this varies depending on your environment (for my Linux box, it's at $HOME/.gvimrc for