

我的vim/mavim/neovim配置
source link: http://wwj718.github.io/post/%E5%B7%A5%E5%85%B7/vim-setting/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

我的vim/mavim/neovim配置
之前用的配置是wklken的k-vim,wklken的vim插件相关的文章写得很棒
近来觉得vim打开速度慢的让人无法忍受,想来是配置(插件)造成的,于是在目录中频繁打开关闭的文件偏好用sublime来编辑了
可我对sublime的快捷键总也记不住,用了就丢那种,连跳转到行的快捷键都记不得,全局替换也要去按按钮,手指远远跟不上脑袋,有种播放视频卡顿的感觉,很是不爽。想想还是重写把vim配置好划算些。
我发现实际上k-vim的大多配置,对我而言是多余的,而许多配置,又不舍得任,不妨从这里入手,只挑出非用不可的特性,翻wklken的k-vim博客,恰好看到他的这篇文章:一些VIM的个性化配置,里边把定制配置分条整理了,按需索取就行,我尽量少选
先列出我偏好的配置,之后给出配置文件
- 更改leader键
- 移动时, 保留到底部的空间
- 自定义代码折叠toggle
- ctrl-n进行相对行号/绝对行号切换
- 打开vim, 自动定位到上次最后变更位置
- F键区的映射
- 分屏窗口切换时, 直接使用ctrl-h/j/k/l
- leader-/ 关闭掉上次搜索的高亮
- Python 写入注释#号时, 不每次都跳到行首
- 强制保存:w!!, 没权限的时候
- 保存文件时, 自动移除多余空格
- shell和python文件新建时, 自动插入行头
- 启动的时候不显示那个援助索马里儿童的提示
- 退出vim后,内容显示在终端屏幕
####常用插件 首先是插件管理
我们采用Vundle.vim,之前的gmarik/vundle
使用方法很简单,先git clone到本地git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
在配置文件里加上
:::text
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'scrooloose/nerdtree'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
以及我需要使用一些常见插件
:::text
Plugin 'scrooloose/nerdtree'
Plugin 'davidhalter/jedi-vim'
Plugin 'scrooloose/syntastic'
Plugin 'msanders/snipmate.vim'
Plugin 'mattn/emmet-vim'
"Plugin 'Valloric/YouCompleteMe' "YouCompleteMe编译比较麻烦,选用
安装插件只需要":PluginInstall"
youcomplateme
youcomplateme值得学习
ps:在我的环境里,需要进入virtualenv里才正常(这是我的个人笔记)
jedi-vim
jedi-vim 能智能理解python代码
:::text
Completion <C-Space>
Goto assignments <leader>g (typical goto function)
Goto definitions <leader>d (follow identifier as far as possible, includes imports and statements)
Show Documentation/Pydoc K (shows a popup with assignments)
Renaming <leader>r
Usages <leader>n (shows all the usages of a name)
Open module, e.g. :Pyimport os (opens the os module)
jedi-vim 可以在写python时拥有ipython的感觉,K
文档查询
macvim
想用macvim的动机是,鼠标的移动能力是目之所及,即可操作,一些非批量化,零碎的任务是很适合用鼠标的,诸如移动到某个位置,切换版块,跳到tab标签,菜单功能。免去记忆很多实用频率不高,记了又忘的快捷键。同时不丧失vim的编辑优势,我可能没有十分强烈cui的原教旨倾向,在工具这方便大概算是实用主义者吧。我想用macvim这种带有gui功能的编辑器,使用场景主要是在gui文件夹中临时想编辑文件时。
neovim
使用neovim则是,反正都要重新配置,不如换用为新世纪倒灶的neovim,甩下vim的历史包袱,由于neovim和vim配置基本相同,所以neovim的配置和vim重叠,并不带来新的学习成本
配置文件:~/.config/nvim/init.vim
配置文件和文档
具体的配置文档可以参考/wwj718-vim),里边给出了使用的细节
Recommend
-
149
Documentation | Chat | Twitter Neovim is a...
-
12
How Do I Create New Text Objects in Neovim/Vim2020-11-15Nvim1183 words 6 mins read 758 times readShortly after I started using
-
6
Introducing My First Vim/Neovim Plugin2020-12-18Nvim306 words 2 mins read 1 times readAfter using and learning Neovim for over 2 years, I have finally...
-
8
vim-mine-sweeping mine sweeping game in vim and neovim ScreenShot Installation " vim-plug Plug 'iqxd/vim-mine-sweeping' Usage Launch Vim Mine Sweeping with...
-
11
最近...
-
205
Copilot.vim GitHub Copilot is an AI pair programmer which suggests line completions and entire function bodies as you type. GitHub Copilot is powered by the OpenAI Codex AI system, trained on public Internet text and billions of line...
-
6
📅 Dec 26, 2015 · ☕ 4 min read · ✍️ Syed Dawood Unnamed "Vim uses unnamed register as the default register. It is often used for all delete, change, copy or cut operations. It also points to the last used reg...
-
11
📅 Jan 16, 2016 · ☕ 3 min read · ✍️ Syed Dawood The first thing that may come to your mind when I say language of vim is Vim Script.No that's not what I am talking about.I am talking about the patterns of keystrokes t...
-
12
How to start using Neovim instead of Vim 5 minutes readIn this article I want to show you how to start using Neovim instead of Vim with a minimum effort. If...
-
14
Real-time LaTeX Using (Neo)Vim This tutorial series will help you set up the Vim or Neovim text editors for efficiently writing LaTeX documents. Here is an example of what I have in mind:
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK