资讯专栏INFORMATION COLUMN

我的vim配置文件,再度升级

Simon_Zhou / 1487人阅读

摘要:不过近日来随着最后几个补全插件的加入和配置调整,这个配置文件已经比较完整,因此可以好好坐下来,对使用方法和注意点作一介绍。更建议你打开里面的各个文件查看,学习。

中文介绍

原来的repo放在 spf13-vim-leoatchina,因为原来一时脑抽,把中文字体放进去后导致体积较大,影响速度,所以重开一个repo并把windows下的工具分开,以增加clone速度。

现在的配置是在 leoatchina-vim,把原来的windows下面的工具扔到另一个repo下以减少体积

这里是我本人的vim配置,从spf13-vim:steve francia"s vim distribution fork而来。作为几年前的作品,原配置已经不大适合这个vim8/neovim当道的时代。因此在近两年的使用时间里, 我不断调整,从其他人的配置中吸取经验,对参数进行微调,以适应在不同的系统环境条件下达到较好的使用体验。

长期以来,这个repo的README一直处于远远落后于配置改变的进度,细碎调整特别是快捷键的改动,实在是提不劲来进行说明。不过近日来随着最后几个补全插件的加入和配置调整,这个配置文件已经比较完整,因此可以好好坐下来,对使用方法和注意点作一介绍。(其实,在这写这个文档的时候还在不停地改快捷键)

主要特点:

根据系统情况,自动选择安装用的插件,并可在~/.vimrc.local里半定制化

漂亮,选择了兼容256色终端的多个主题

功能丰富:自动补全、语法高亮、语法检查、运行、格式化都有相应插件

这里我把README里的前面部分贴出来,后面的各个插件的介绍,和快捷键,请去原repo查看。更建议你打开里面的各个文件查看,学习。

Requirements

Git 1.7 and Vim7.0 with any of +job,+python,+python3,+lua is at least required, Vim8 or neovim and Git 2.0+ is prefered for advanced fearutures

And I wish you have a basic understanding for vim, know how to read the config files to find what I not mention here.

Install Linux, *nix, Mac OSX
  git clone https://github.com/leoatchina/leoatchina-vim.git
  cd leoatchina-vim
  ./install.sh
windows
  git clone https://github.com/leoatchina/tools-leoatchina-vim.git
  cd leoatchina-vim
  click setup.cmd with administrator rights
  open vim, do :PlugInstall
Update Linux, *nix, Mac OSX
  ./install.sh ,chosse y|Y, the scipt will do git pull and do reinstall plugins
windows
  cd leoatchina-vi#m
  git pull
  open vim, do :PlugReinstall
Upgrade plugins Linux, *nix, Mac OSX
  cd leoatchina-vim
  ./updata.sh

OR

  ~/.vimrc.update

OR

  open vim; do :PlugNew
windows
  open vim; do :PlugNew
Delete Linux, *nix, Mac OSX
  cd leoatchina-vim
  ./uninstall.sh
Windows
  click delete.cmd with administrator rights
How it works

After the installation, a .vimrcsymbol link in the ~ folder (for neovim, to its config file ~/.config/nvim/init.vim in Linux ) which links to the .vimrc file in the leoatchina-vim folder.

The .vimrc or init.vim sources ~/.vimrc.plug for plugins definition, and ~/.vimrc.plug sources ~/.vimrc.local when the file exists, the local file contains an import variable called g:plug_groups for the supporting features for vim, and you do :PlugClean, :PlugInstall, the plugsin will change. The default contents of .vimrc.local is

let g:plug_groups=["smartcomplete", "php", "javascript", "html", "snippet"]

And you can also create ~/.gvimrc.local for gvim, ~/.nvimrc.local for nvim to intall diffent plugins for gvim and nvim. If these two local file not exist, .vimrc.local works.

The typical variables that could be add to g:plug_groups are pymode,go,airline, youcompleteme, etc.

Here is a trick that I set diffent PLUG_PATH for vim/gvim/neovim , ~/.vim/plug for vim , ~/.gvim/plug for gvim, ~/.nvim/plug for neovim.

.vimrc.clean it is an bash file which is set to delete ~/.vimswap & ~/.vimviews folders. Also be linked as ~/.vimrc.clean

Main changes from spf13

use vim-plug instead of vundle, more quick and more smart

totally simplify, delete fork,before files , which are redundent for most users

delete lots of variables for feature settings

just have mentioned before, the link is from the cloned folder

not support XP

Some features

no backup file

no backup

no sound

no scroll bars

no menu, no tools when gui-running

line number

highlight search results

smart indent

In Visual, keep selection after indention change with >,<

Main shortcuts

to , so the biggest key on keyboard is more usefull

to

. for number + 1, , for number -1

: source ~/.vimrc. It is for config develop & debug myself

for bracket jump

c-a to the head of a line, c-e to end in normal/visual/inesert mode, compatible with linux

c-f, c-b, c-k, c-l, g work like Leader key in normal mode

c-f to right c-b to left in insert mode

c-x instead of "c-e" for fullscreen jump, pairs with c-y

c-p invoke browser tools fzf or LeaderF or denite or Ctrlp

gc for gcommit, + for :Git

~ instead of Q, and Q for quit current buffer at once

. for exit visual mode

! for :!

F1: tab help

F2: toggle search results highlight

F3: show register strings

F4: toggle quickrun windows

F5: run script (with plugin vim-quickrun)

F11: full screen toggle, but sometimes not work

F12: paste toggle

tab/buffer control

set tabpagemax=10

cmap Tabe tabe

nnoremap - :tabprevious

nnoremap :tabnext

nnoremap tp :tabprevious

nnoremap tn :tabnext

nnoremap - :tabm -1

nnoremap :tabm +1

nnoremap - :tabfirst

nnoremap :tablast

nnoremap te :tabe

nnoremap ts :tab split

nnoremap tw :tabs

nnoremap tm :tabm

nnoremap :buffers

nnoremap ] :bn

nnoremap [ :bp

copy & paste

vnoremap y "+y

nnoremap y "+y

nnoremap yy "+yy

nnoremap Y "*y

vnoremap Y "*y

nnoremap Y y$

vnoremap Y *y$

nnoremap p "+p

nnoremap P "*P

vnoremap p "+p

vnoremap P "*P

Some other shortcuts

nmap w [I:let nr = input("Which one: ")exe "normal " . nr ."[t"

nnoremap fd :set nofoldenable! nofoldenable?

nnoremap fw :set nowrap! nowrap?

nmap w :w

nmap W :wq!

nmap WQ :wa:q

nmap q :q!

nmap Q :qa!

nmap :vsplit

nmap :split

nmap = =

nmap :resize -3

nmap :resize +3

nmap :vertical resize -3

nmap :vertical resize +3

vnoremap <

vnoremap > >gv

nnoremap < <<

nnoremap > >>

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/25016.html

相关文章

  • 晒下我的vim+tmux

    摘要:效果最开始的想法是最简配置实现最高效的使用。几个有用的配置显示空格和。打开时,用的语法进行高亮显示。使用后,不显示工作目录问题。 效果 showImg(https://segmentfault.com/img/bVkBdC); showImg(https://segmentfault.com/img/bVkBdx); showImg(https://segmentfault.co...

    妤锋シ 评论0 收藏0
  • 征服恐惧!用 Vim 写 iOS App

    摘要:我们都知道和都是文本编辑器中的上古神器,你也许用,配合完成过大型或者的开发,你也许配合过其他插件,完成过,代码的开发,但是很少有人试过的开发吧,毕竟的框架包含了很多东西,以及天生很长的名字,让我们没办法把此神器用起来,今天我就来给大家讲下 我们都知道 Vim 和 Emacs 都是文本编辑器中的上古神器,你也许用 ctags,cscopes 配合 Vim 完成过大型 C 或者 C++ 的...

    endless_road 评论0 收藏0
  • 华为云全新计算实例C6、S6商用,智能加速“引擎”再度开启

    摘要:华为云全新计算实例商用,智能加速引擎再度开启近年来,人工智能的快速发展给云计算能力带来新的挑战,数据与训练的指数级增长激发了对算力巨大的需求。 华为云全新计算实例C6、S6商用,智能加速引擎再度开启 近年来,人工智能的快速发展给云计算能力带来新的挑战,数据与训练的指数级增长激发了对算力巨大的需求。同时,随着数字世界向智能世界的转变,行业+智能开始成为各行各业构建竞争力的关键所在。 4月...

    vvpvvp 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<