vi

No syntax highlighting after session restore in terminal

余生颓废 提交于 2019-12-06 09:48:44
I'm using Mac Lion 10.7.1, MacVim Snapshot 61, Vim version 7.3 I want to save the session on quit and restore the last session on Vim start without any arguments. So I added this code in my .vimrc file: autocmd VimEnter * call LoadSession() autocmd VimLeave * call SaveSession() function! SaveSession() execute 'mksession! $HOME/.vim/sessions/session.vim' endfunction function! LoadSession() if argc() == 0 execute 'source $HOME/.vim/sessions/session.vim' endif endfunction this works great with MacVim, but when I open Vim in terminal syntax highlighting is not working. How do I get this to work?

PolygonCollider2D.OverlapPoint()在小scale下失效的一种解决办法

醉酒当歌 提交于 2019-12-06 08:27:25
偶然发现PolygonCollider2D的方法OverlapPoint()有时会失效(一直返回false),测试后发现在scale很小的情况下(通常在UI Canvas设置RenderMode为ScreenSpace-Camera时),OverlapPoint()会失效,有时PolygonCollider2D的Editor Collider编辑模式也不能编辑 可以通过手动计算来进行判断(算法来自网络,在边缘时好像有点问题) 因用途不在于点击响应判断,使用localPosition进行计算 public static bool IsLocalPositionInPolygon2D(float x, float y, PolygonCollider2D collider) { if (collider == null) return false; Vector2[] ps = collider.points; int i = 0; int j = ps.Length - 1; int c = 0; for (; i < ps.Length; j = i++) { Vector2 vi = ps[i]; Vector2 vj = ps[j]; if (((vi.y > y) != (vj.y > y)) && (x < vj.x - vi.x) * (y - vi.y) / (vj.v

vi和vim编辑器的使用

别来无恙 提交于 2019-12-06 06:53:24
简介 vi所有的Linux的系统都会内建vi文本编译器,vim是具有程序编辑的能力可以看成是vi的增强版本 模式 1、正常模式,插入模式/编辑模式 ,命令行模式 2、正常模式:以vim打开一个档案就相当于进入这个模式了 3、插入模式/删除模式: 在该模式下,程序员可以输入内容,按下i,I,O,a,A,r,R中任何一个字母均可,即可输入内容 4、命令模式:这个模式可以让我们完成读取,存盘,替换,离开,显示行号等 关系 编写程序子vim 下 vim hello.java :wq 保存并退出 5、快捷键 a、拷贝当前行 yy 拷贝当前行向下的5行 5yy 并黏贴(p),光标所在的地方,进行复制接着下一行 b、删除当前行dd,删除当下的5行5dd c、在文件中查找某个单词 在命令模式下 /关键字 ,输入n就是查找下一个 d、设置文件的行号,取消文件的行号 命令如下 set nu 和set nonu e、使用快捷键到达文档的最末行G和首行gg f、在一个文件中输入hello想撤销 u g、编译文件,并将光标移动到第20行 shirt+g 第一步: 显示行号 :set nu 第二步: 输入20这个数 第三步:输入shirt+g 来源: https://www.cnblogs.com/bianfuxia/p/11966941.html

visual selection in bash / cli

ⅰ亾dé卋堺 提交于 2019-12-06 03:23:29
问题 Is there a way to make bash use visual selections for text replacement ? Standard text input conventions don't work: If you press Shift+Left Arrow, the character to the left should be visually selected If you press Ctrl+Left Arrow, the cursor should move to the beginning of the previous word If you press Shift+Ctrl+Left Arrow, the word to the left should be visually selected If you visually select some text then press any key, the text should be replaced with the text of the key you press Vi

Repeating a navigation command in vi

这一生的挚爱 提交于 2019-12-06 00:44:45
问题 How do I repeat a navigation command in vi? For example, I execute the command 20j which moves the cursor down 20 lines, and I tried hitting . to repeat that command, but it says "No command to repeat". P.S. Also, what command goes to the next page in a document? 回答1: There isn't a shortcut to repeat the last navigation command - you have to retype it, or set up some sort of shortcut of your own ( :map or similar). Page up (back) is Control-B ; page down (forward) is Control-F . Half-pages

force vim to overwrite external changes

心不动则不痛 提交于 2019-12-05 21:04:03
I use Vim 7.4 (Mac OS) to edit and run Lua scripts. I've mapped a key in my .vimrc to save the current buffer and run an external script. The key map in .vimrc: map V :w!<CR> :!python "$HOME/tools/client/concli.py" --lua %<CR> It works fine but every once in a while the files are 'touched' by Xcode (touch shell command). Then when I hit the mapped key vim warns me that the file has been changed externally and I have to confirm to write to it. This is quite annoying since the files are often touched. How could I force vim to overwrite external changes without prompting? I tried 'w!' without

linux的编辑器VI中不能按Ctrl s

[亡魂溺海] 提交于 2019-12-05 19:28:00
很多刚从windows转移到linux上来工作的同事,在用vim编辑程序时,常常会习惯性的按下Ctrl s保存文件内容。殊不知,这一按不紧,整个终端再也不响应了。 事实上Ctrl s在终端下是有特殊用途的,那就是暂停该终端,这个功能是否有什么实际用途,目前没有用到过,还不清楚。要退出这种状态,让终端继续运行,很简单,按下Ctrl q就行了。 想当年,刚开始用linux时,不小心按下Ctrl s,不知道怎么处理,只好重起电脑。 下面随便提一下其它几个特殊按键: Ctrl c中止当前正在执行的程序。 Ctrl d相当于exit命令,退出当前会话。 Ctrl z将当前运行的程序放到后台运行。与运行时加&类似。 Tab键自动补全命令。 在bash脚本里,可以通过trap命令来禁止响应一些信号以达到屏蔽上面一些按键功能。 来源: oschina 链接: https://my.oschina.net/u/87799/blog/6610

7 打开文件

空扰寡人 提交于 2019-12-05 19:18:55
/*--> */ /*--> */ /*--> */ /*--> */ /*--> */ /*--> */ /*--> */ /*--> */ 7. vi--终端中的编辑器 ¶ 目标 ¶ vi 简介 打开和新建文件 三种工作模式 常用命令 分屏命令 常用命令速查图 7.1 vi简介 ¶ 7.1.1 学习vi目的 ¶ 在工作中,要对 服务器 上的文件进行简单的修改,可以使用 ssh 远程登录到服务器上,并且使用 vi 进行快递的编辑即可 常见需要修改的文件包括: 源程序 配置文件 ,例如 ssh 的配置文件 ~/.ssh/config 在没有图形界面的环境下,要编辑文件, vi 是最佳选择! 每一个要是用Linux的程序员,都应该或多或少学习一些 vi 的常用命令 7.1.2 vi 和vim ¶ vi vi 是 Visual interface 的简称,是 Linux 中 最经典 的文本编辑器 vi 的核心设计思想-- 让程序员的手指始终保持在键盘的核心区域,就能完成所有的编辑操作 vi 的特点: 没有图形界面 的 功能强大 的编辑器 只能是编辑 文本内容 ,不能对字体、段落进行排版 不支持鼠标操作 没有菜单 只有命令 vi 编辑器在 系统管理、服务器管理 编辑文件时, 其功能永远不是图形界面的编辑器能比拟的 vim vim=vi improved vim 是从 vi

Opening a file stored in HDFS to edit in VI

本秂侑毒 提交于 2019-12-05 18:02:38
问题 I would like to edit a text file directly in HDFS using VI without having to copy it to local, edit it and then copy it back from local. Is this possible? Edit: This used to be possible in Cloudera's Hue UI but is no longer the case. 回答1: There are couple of options that you could try, which allows you to mount HDFS to your local machine and then you could use your local system commands like cp, rm, cat, mv, mkdir, rmdir, more, etc. But neither of them supports random write operations but

第二周 测试

﹥>﹥吖頭↗ 提交于 2019-12-05 17:28:28
测试 实验 vi 每个 .c一个文件,每个 .h一个文件,文件名中最好有自己的学号; 用Vi输入图中代码,并用gcc编译通过; 在Vi中使用K查找printf的帮助文档,提交vi编辑过程截图。 gcc 用gcc 进行预处理,编译,汇编,链接vi输入的代码; 生成的可执行文件中要有自己的学号; 提交预处理,编译,汇编,链接,运行过程截图。 gdb 用gcc -g编译vi输入的代码; 在main函数中设置一个行断点; 在main函数增加一个空循环,循环次数为自己学号后4位,设置一个约为学号一半的条件断点。 静态库 除了main.c外,其他4个模块(add.c sub.c mul.c div.c)的源代码不想给别人,如何制作一个mymath.a静态库?main.c如何使用mymath.a? 共享库 除了main.c外,其他4个模块(add.c sub.c mul.c div.c)的源代码不想给别人,如何制作一个mymath.so共享库?main.c如何使用mymath.so? Makefile 写出编译上面vi编辑代码的makefile,编译出来的目标文件为testmymath, 只用显式规则就可以。 代码 head.h #ifndef HEAD_H #define HEAD_H int add(int ,int); int sub(int ,int); int mul(int ,int