vim

practical vim tips --- part 1

依然范特西╮ 提交于 2020-01-07 16:19:21
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 记录下自己感觉会用得到的命令。 Vim Tips from Practical Vim Normal Mode 1. >G 从当前 行直到文件结束,增加缩进 2. A 在当前行的末尾添加,如果想要多行行尾添加内容,如添加 ; 可以 A;<Esc> ,然后 j. 对后面的行执行同样的添加操作 3. f{char} 行内寻找 字符, ; 执行上次的 f 命令,找到下一个; , 找到上一个。 4. & 执行上一次的替换操作 5. * 搜索光标所在的词 9. daw 删除单词及与单词前面相邻的空格。 10. C-a 给数字加1, C-x 给数字减1. 也可以在前面加数字,执行这个数次操作。 12. d{motion} 可通过** :h operator **查看完整列表。 Insert Mode 13.在Insert模式下修正, <C-h> == backspace 后退删除一个字符, <C-w> 后退删除一个单词, <C-u> 删除到行首。 14. <C-[> 切换到normal模式。可以将此映射为 <Esc> 。 书上说的<C-o>是进入insert模式,在我的配置下不行。在跳转的时候<C-i>,<C-o>是进入退出。 15.从寄存器粘贴 K 查找光标所在单词的man页, J 连接当前行与下一行。 yt, , t

vim 环境设定与记录: ~/.vimrc, ~/.viminfo

半世苍凉 提交于 2020-01-07 16:19:04
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 有没有发现,如果我们以 vim 软件来搜寻一个档案内部的某个字符串时,这个字符串会被反白,而下次我们再次以 vim 编辑这个档案时,该搜寻的字符串反白情况还是存在呢!甚至于在编辑其他档案时,如果其他档案内也存在这个字符串,哇!竟然还是主动反白耶!真神奇!另外,当我们重复编辑同一个档案时,当第二次进入该档案时,游标竟然就在上次离开的那一行上头呢!真是好方便啊~但是,怎么会这样呢? 这是因为我们的 vim 会主动的将你曾经做过的行为登录下来,好让你下次可以轻松的作业啊!那个记录动作的档案就是: ~/.viminfo !如果你曾经使用过 vim,那你的家目录应该会存在这个档案才对。这个档案是自动产生的,你不必自行建立。而你在 vim 里头所做过的动作,就可以在这个档案内部查询到啰~ ^_^ 此外,每个 distributions 对 vim 的预设环境都不太相同,举例来说,某些版本在搜寻到关键词时并不会高亮度反白,有些版本则会主动的帮你进行缩排的行为。但这些其实都可以自行设定的,那就是 vim 的环境设定啰~vim 的环境设定参数有很多,如果你想要知道目前的设定值,可以在一般模式时输入『 :set all 』来查阅,不过.....设定项目实在太多了~所以,鸟哥在这里仅列出一些平时比较常用的一些简单的设定值

[vim] 使用 fugitive.vim 处理 git merge 文件冲突

断了今生、忘了曾经 提交于 2020-01-07 11:32:16
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> fugitive.vim 是一个处理 git 信息的 vim 插件。 非常好用,这里展示下怎样用它来处理 git merge 操作中常遇到的文件冲突。 在项目目录中打开 vim, command 模式下输入命令 :Gstatus ,出现以下界面 来源: oschina 链接: https://my.oschina.net/u/1024009/blog/413046

Vim73 not picking up any color, including scheme

岁酱吖の 提交于 2020-01-07 08:29:29
问题 I had been using Vim through Putty on a windows machine for the last 6 months and everything was fine. After seeing somebody using a new text editor that had amazing colors, I decided to venture down the colorscheme path. This worked great for about 24 hours and then i decided i wanted to add a bunch of plugins which required me to recompile my VIM. After doing so (using vim73), I NO longer can get any colors in my vim. It is black and white with a foggy background. My .vimrc file has not

如何正确的使用动态VPS(Linux)自动更换IP

夙愿已清 提交于 2020-01-07 06:48:15
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 背景 现在越来越多的人开始玩网赚项目,蚂蚁再小也是肉,薅羊毛的羊毛党越来越多,一些网赚项目也越来越受欢迎,但是一般的网赚项目都是要求真实用户的,所以要想获得大量的真实ip,一种动态VPS就诞生了,动态VPS采用PPTP或者ADSL拨号的方式获取动态IP,不仅可以做到获取区域性IP,还可以混拨,也就是可以获取全国各地的IP地址,这样对于网赚项目来说就非常好了,轻松模拟出来各种地区IP,达到赚钱的目的。 博主最近接到一单,编写自动化拨号脚本,自动切换动态VPS的外网IP实现自动化网赚,今天就记录下动态VPS的配置以及使用的姿势。 机器 先看下机器的配置,客户给过来的机器,配置如下: 系统:Linux 内存:512M CPU:单核(PS:博主好想去采购一批ARM单片机来做动态VPS啊,高收益低成本) 硬盘:10G 带宽:2M 由于客户一次性给过来的机器比较多,100多台VPS,配置大体上都差不多,但是各个机器之间的差距很大,比如有的机器只有一个网卡,有的机器有好几张网卡,有的机器装的是Centos 6有的是Centos7,有的已经配置好拨号程序了,有的啥也没有等等各种情况都存在。 配置 既然是要实现自动化拨号程序,自然是要先判断下拨号程序在不在,Linux的拨号程序使用的是 pppoe-start 命令,注意

gettings spellfiles in vim

眉间皱痕 提交于 2020-01-07 06:46:11
问题 How do I get regional spell-files for vim? I want e.g. de_DE as spell language. The help suggests using http://extensions.services.openoffice.org/dictionary but I don't get how to create a spell file from them. I also found https://github.com/ganwell/vim-hunspell-dicts but the instructions don't help either. 回答1: Vim helpfully includes the spellfile.vim plugin to automatically download missing spellfiles: :set spelllang=de_DE :set spell Cannot find spell file for "de" in utf-8 Do you want me

VIM: How to add custom markers before lines

一曲冷凌霜 提交于 2020-01-07 05:42:17
问题 I want to mark erroneous lines a source code. I detect the incorrect lines using an external program (e.g., flake8). When I save the source, I would like VIM to execute the external program and mark invalid lines. I thought about different possibilities of "marking" the lines, like underlining full line or changing background colour. What I would like to do is to have an additional column on the left hand side of the text, where I could place some markers (e.g., ">") indicating the offending

vim: Find history of recently used shortcuts

我只是一个虾纸丫 提交于 2020-01-07 04:41:31
问题 Problem A plugin that I am using, my mappings, or a combination of those two are causing some issues on vim . In particular, when I press a particular combination of keys the following happens: the 1st number in the current line it decreases it jumps to another line The problem is that I don't know who the combination that I am pressing is. I cannot reproduce it. I am a saving-the-buffers-constantly-freak , so when I am "idling" (don't write anything on vim) my fingers involuntary maybe enter

Can't BundleInstall the vim-css-color plugin using Vundle

折月煮酒 提交于 2020-01-07 04:07:04
问题 I added Bundle 'ap/vim-css-color' to my .vimrc under the " original repos on github section and ran :BundleInstall but I do not see it the list of newly installed bundles that shows up in the new buffer. In fact even if I comment out a Bundle line in my .vimrc and do :BundleClean the plugin remains in that list. How can I get Vundle to work? my .vimrc set nocompatible filetype off " required! set rtp+=~/.vim/bundle/vundle call vundle#rc() " let Vundle manage Vundle " required! Bundle 'gmarik

switch tab with vimscript?

我怕爱的太早我们不能终老 提交于 2020-01-07 03:07:24
问题 I want do something like this: check if a split named __Potion_Bytecode__ exists if exists, switch to the split with name if not, new a split named __Potion_Bytecode__ Here is code I am now doing: function! PotionShowBytecode() " Here I need to check if split exists " open a new split and set it up vsplit __Potion_Bytecode__ normal! ggdG endfunction 回答1: In lh-vim-lib, I have lh#buffer#jump() that does exactly that. It relies on another function to find a window where the buffer could be. "