vim

How to add space between parenthesis and quotes on save

纵饮孤独 提交于 2020-01-06 03:07:30
问题 I would like to add have VIM automatically add space between parenthesis and " / ' to match jquery style guidelines: http://contribute.jquery.org/style-guide/js/. This could be on save or by triggering a custom command. Ideally it would also add spaces before variable names but not functions or objects literal. What would be the best way to go about this? 回答1: To insert spaces on saves, use an autocommand : au BufWrite *.js silent! %s/\m(\@<=["']/ \0/g | silent! %s/\m["'])\@=/\0 /g au

What is the difference compiling gcc .c file in comparison to making a .c file into an .o file and linking and assembling?

半腔热情 提交于 2020-01-06 01:25:28
问题 I have just started getting involved with GCC. Lets say we have a text file written by vim labaled helloworld.c Why would SWIM (someone who isn't me) compile it with gcc helloworld.c in comparison to gcc -c helloworld.c and then gcc -o helloWorld helloworld.o ? 回答1: For one single file, there is no use. But if you compile a larger project, you may not want to recompile all files, if you only changed one for instance. And thus, gain compile time. Using intermediate .o files lets you only

5.Linux系统的vim与软件包管理

爷,独闯天下 提交于 2020-01-06 01:15:37
5.1 Linux系统的vim编辑器   5.1.1 vim编辑器的概述 vim编辑器的简介        1.vim是什么? vim是一个类似vi的文本编辑器,它在vi的基础上增加了很多新特性 vim是vi发展出来的一个文本编辑器,编译及错误跳转等方便编译的功能丰富,在实际应用中较为广泛       2.为什么要学vim? 所有的Linux系统都会内建vi文本编辑器,其他的文本编辑器不一定存在 很多软件的编辑接口都会主动调用vi vim具有程序编辑的能力,可以主动的以字体颜色辨别语法的正确性,方便程序开发   5.1.2 vim的三种模式详解 vim有哪三种模式       1.一般模式       2.编辑模式       3.命令模式 vim的一般模式       1.一般模式的作用 以vim打开一个文件就直接进入一般模式(默认模式) 一般模式可以使用上下左右键来移动光标的位置 一般模式可以使用删除字符或者删除整行来处理文件内容 一般模式可以使用复制、粘贴来处理文件数据 一般模式无法任意编译文件内容 vim的编辑模式       1.编辑模式的作用 编辑模式可以输入文本内容 按下<Esc>从编辑模式返回一般模式       2.如何从一般模式进入编辑模式 在一般模式下按下以下按键即可进入编辑模式          vim的命令模式        1.命令模式的作用

vim编辑器的使用

老子叫甜甜 提交于 2020-01-06 01:11:28
一,当没安装vim 的时候,提示安装 root@root-virtual-machine:~/test$ vim abc 程序 'vim' 已包含在下列软件包中: * vim * vim-gnome * vim-tiny * vim-athena * vim-athena-py2 * vim-gnome-py2 * vim-gtk * vim-gtk-py2 * vim-gtk3 * vim-gtk3-py2 * vim-nox * vim-nox-py2 请尝试:sudo apt install <选定的软件包> 二,vim常用指令 cat abc // 打开 abc 文件 vim 编辑器有三个模式,命令模式,输入模式,低行模式 刚打开文件是命令模式, 按下 “i” 进入输入模式 按下 “esc” 进入低行模式(也是命令模式) vim + abc //打开abc文件光标直接到最后一行 vim +3 abc vim +10000 abc vim +/search abc //打开abc文件,光标直接定位到首先出现‘search’打位置,按‘n’ 来回切换 光标位置 vim aa bb cc // 一起打开 aa bb cc 文件 ,如果没有则 创建 该文件 在低行模式下输入 :next/:n , :prev/:N 低行模式常用指令: :w :q :wq :! //强制 :6 /

linux 下 vim 的使用 (ubuntu 12.04)

巧了我就是萌 提交于 2020-01-06 01:10:56
  1. 在安装jdk配置环境变量的时候使用如下指令:   vim ~/.bashrc   结果因为没有安装出现了下面到提示   程序“vim”已包含在下列软件包中:   * vim   * vim-gnome   * vim-tiny   * vim-gtk   * vim-nox   请尝试:apt-get install <选定的软件包>   按照提示输入apt-get install vim安装就OK的。      重新输入命令:vim ~/.bashrc   这时候是不可有进行编辑的,可以按下键盘上到"i"或者"o"键就可以进行编辑了。   编辑完成后就保存并退出。   编辑完成后,就按下Esc键。   :wq就是保存并退出了, 从网上找了vim命令到资料,如下 :w 保存编辑后的文件内容,但不退出 vim 编辑器。这个命令的作用是把内存缓冲区中的数据写到启动 vim 时指定的文件中。 :w! 强制写文件,即强制覆盖原有文件。如果原有文件的访问权限不允许写入文件,例如,原有的文件为只读文件,则可使用这个命令强制写入。但是,这种命令用法仅当用户是文件的属主时才适用,而超级用户则不受此限制。 :wq 保存文件内容后退出 vim 编辑器。这个命令的作用是把内存缓冲区中的数据写到启动 vim 时指定的文件中,然后退出 vim 编辑器。另外一种替代的方法是用 ZZ 命令。 :wq!

vim版本更新

谁说我不能喝 提交于 2020-01-06 01:09:30
版本问题 ubuntu 14.05 安装完YouCompleteMe后不生效,提示:YouCompleteMe unavailable : requires Vim 7.4.143 经过检索与查询,ubuntu自带的vim为7.4.50,需要安装最新的vim。 在stackoverflow上查到更新方案如下: sudo add-apt-repository ppa:jonathonf/vim sudo apt update sudo apt install vim sudo add-apt-repository ppa:jonathonf/vim sudo apt-get update && sudo apt-get upgrade 结果,还是不行,ubuntu提示:”The following packages have been kept back”,其中列出了vim的相关组件,但没有进行安装。 经检索找到问题的解释是:因为有部份packages的安装版比release版新。 进行如下操作:apt-get -u dist-upgrade(强制更新软件包到最新版本,并自动解决缺少的依赖包) ,问题解决。 python问题 还会遇到提示缺少python支持,但发现系统中已经安装了其所要求的python版本。经搜索,原因应该是所安装的vim版本不支持python,但我并不想用源码安装

常用linux命令(+vim编辑器的常用命令与设置)

六眼飞鱼酱① 提交于 2020-01-05 22:19:00
前言: 本篇博客主要以一个linux新手的视角,分享linux系统中的一些常用shell命令。帮助大家快速上手,以最实用的命令为主。 如果大家对linux内核与shell与bash之间的关系不太清楚,详见另外一篇博客。 再此,有一个概念,即所有的命令都相当于某个软件,它帮助你完成某个任务。无论是cd,ls,mv还是vim,less,update,这些都会在bash中被解释最终对linux内核进行操作。 博主用的系统为RedHat8.0 1、实验环境控制 作为一个linux系统的学习者,很有可能因为一些不当操作造成系统不可逆的损坏。所以在此希望大家可以先在虚拟机中进行操作练习。以下命令为使用者在命令行中开启一个虚拟机并显示,必要时进行重置的命令。 rht-vmctl start workstation #开启一个工作站 rth(redhat)-vm(virtual mahine)ctl(control)顾名思义为红帽系统的虚拟机控制命令 start开始 workstation工作站 rht-vmview view workstation #将工作站显示出来 view视图 rht-vmctl stop workstation #关停虚拟机 rht-vmctl poweroff workstation #即刻断电 与stop不同的是poweroff不会正常关闭正在运行的程序之后再关机

autocommand for filetypes working for setting options but not for mappings

回眸只為那壹抹淺笑 提交于 2020-01-05 19:29:08
问题 I have the following lines in my vimrc: set shiftwidth=4 autocmd FileType tex setlocal shiftwidth=2 autocmd FileType tex map xyz doSomething If I open a, say, text file (filetype is set correctly), and do set sw , I get 4. If I open a tex file (filetype is set correctly), I get 2 for set sw . That part works! Now for the mapping I type map xyz , and I see that the mapping is done for both filetypes. What am I doing wrong? At first I thought something with the mapping is wrong, so I tried: set

Permamently amend Vim font size

拈花ヽ惹草 提交于 2020-01-05 10:29:08
问题 Warning: first-time Vim "user" I'd like to make the GUI font much bigger. It is installed on a modern windows 32-bit machine. I've used the Edit menu and found a good font using Select Font... Then I entered the command: set gfn? To return ... guifont=Consolas:h16:cANSI Now apparently I need to add something to my vimrc file. I think I have found the file here?: So why am I now struggling to make the changes? Whichever way I try (notepad or via Vim>Open) to open this file it seems to be read

Vim: bold highlighting only after reload solarized color scheme

有些话、适合烂在心里 提交于 2020-01-05 07:33:43
问题 I have the following minimal .vimrc file under $HOME directory (I'm on Ubuntu 14.04 LTS, using vim-gnome ): syntax on set background=dark colorscheme solarized And everything was highlighted as expected except for those supposed to be bold. By default, solarized color scheme should bold error s and todo s. However it doesn't work right away. For example, opening a file and invoking :he group-name , I get the following: You can see error and todo are not bold. If I now reload solarized by