我的.vimrc配置
termux平台下,通过pkg update && pkg upgrade && pkg install vim来获得vim。可是,当我配置.vimrc时发现如果我每在一个平台使用vim都要敲键盘的话,太浪费时间了。毕竟,人生苦短。于是,我将win10、centos平台下编写的配置写下来;以后就复制粘贴就行了。
在Windows平台下,Full安装默认出现:
source $VIMRUNTIME/vimrc_example.vim
set diffexpr=MyDiff()
function MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg1 = substitute(arg1, '!', '\!', 'g')
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg2 = substitute(arg2, '!', '\!', 'g')
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let arg3 = substitute(arg3, '!', '\!', 'g')
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
if empty(&shellxquote)
let l:shxq_sav = ''
set shellxquote&
endif
let cmd = '"' . $VIMRUNTIME . '\diff"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
let cmd = substitute(cmd, '!', '\!', 'g')
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
if exists('l:shxq_sav')
let &shellxquote=l:shxq_sav
endif
endfunction
在linux平台下:
touch ~/.vimrc
”设置文件编码
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936
set fileencoding=gb2312
set termencoding=utf-8
syntax on
"设置颜色
color darkblue
set cursorline cursorcolumn
set incsearch
set ignorecase
set smartcase
"设置保持历史记录10000
set history=10000
set nofoldenable
set confirm
set backspace=indent,eol,start
set t_Co=256
set report=0
set nowrap
set scrolloff=5
set number
set ruler
set showmatch
set showcmd
set title
set laststatus=2
set matchtime=2
set matchpairs+=<:>
" 设置文件不备份,这里被注释掉;
" set nobackup
" set noundofile
" set noswapfile
set backupext=.bak
set backupdir=~/.vim/vim_bak/
set autoindent
set smartindent
set tabstop=4
set softtabstop=4
set shiftwidth=4
set smarttab
set textwidth=120
set colorcolumn=+1
set autoread
set autowrite
"Vundle
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'mattn/calendar-vim'
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
Plugin 'suan/vim-instant-markdown'
Plugin 'lervag/vimtex'
Plugin 'sirver/ultisnips'
Plugin 'pboettch/vim-cmake-syntax'
Plugin 'Valloric/YoucompleteMe'
Plugin 'kien/ctrlp.vim'
Plugin 'jiangmiao/auto-pairs'
Plugin 'EasyGrep'
Plugin 'scrooloose/syntastic'
Plugin 'Valloric/ListToggle'
Plugin 'bling/vim-airline'
Plugin 'maralla/completor.vim'
Plugin 'vim-scripts/indentpython.vim'
Plugin 'nvie/vim-flake8'
Plugin 'Lokaltog/vim-powerline'
Plugin 'Yggdroot/indentLine'
Plugin 'lervag/vimtex'
Plugin 'tpope/vim-fugitive'
Plugin 'EditPlus'
Plugin 'cst'
Plugin 'Xdebug'
Plugin 'PyChimp'
Plugin 'snipMate'
call vundle#end()
filetype plugin indent on
"设置日历方面
let g:calendar_diary="/mnt/c/Users/mydai/diary/"
let g:calendar_focus_today=1
let g:tex_flavor='latex'
let g:vimtex_view_method='zathura'
let g:vimtex_quickfix_mod=0
set conceallevel=1
" YouCompleteme config:fedora 27 and later:
" sudo dnf install cmake gcc g++ make python3-devel
" Compiling YCM with semantic support for C-family languages through libclang;
" cd ~/.vim/bundle/youcompleteme
" python3 install.py --clang-completer
" YCM Configuration notes:
let g:ycm_min_num_of_chars_for_completion=3
let g:ycm_python_binary_path='python'
let g:ycm_seed_identifiers_with_syntax=1
let g:ycm_autoclose_preview_window_after_completion=1
let g:ycm_auto_trigger=1
" pip3 install jedi
" 为了Python3的第三方库安装Jedi插件
" Plugin 'davidhalter/jedi-vim'
"===============================Jedi==================================
if has('python3')
let g:loaded_youcompleteme = 1 " 判断如果是python3的话,就禁用ycmd。
let g:jedi#force_py_version = 3
let g:pymode_python = 'python3'
endif
"===============================Jedi===================================
"Note: This option must be set in .vimrc(_vimrc). NOT IN .gvimrc(_gvimrc)!
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplete.
let g:neocomplete#enable_at_startup = 1
" Use smartcase.
let g:neocomplete#enable_smart_case = 1
" Set minimum syntax keyword length.
let g:neocomplete#sources#syntax#min_keyword_length = 3
" Define dictionary.
let g:neocomplete#sources#dictionary#dictionaries = {
\ 'default' : '',
\ 'vimshell' : $HOME.'/.vimshell_hist',
\ 'scheme' : $HOME.'/.gosh_completions'
\ }
" Define keyword.
if !exists('g:neocomplete#keyword_patterns')
let g:neocomplete#keyword_patterns = {}
endif
let g:neocomplete#keyword_patterns['default'] = '\h\w*'
" Plugin key-mappings.
inoremap <expr><C-g> neocomplete#undo_completion()
inoremap <expr><C-l> neocomplete#complete_common_string()
" Recommended key-mappings.
" <CR>: close popup and save indent.
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
return (pumvisible() ? "\<C-y>" : "" ) . "\<CR>"
" For no inserting <CR> key.
"return pumvisible() ? "\<C-y>" : "\<CR>"
endfunction
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" <C-h>, <BS>: close popup and delete backword char.
inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
" Close popup by <Space>.
"inoremap <expr><Space> pumvisible() ? "\<C-y>" : "\<Space>"
" AutoComplPop like behavior.
"let g:neocomplete#enable_auto_select = 1
" Shell like behavior(not recommended).
"set completeopt+=longest
"let g:neocomplete#enable_auto_select = 1
"let g:neocomplete#disable_auto_complete = 1
"inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<C-x>\<C-u>"
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
" Enable heavy omni completion.
if !exists('g:neocomplete#sources#omni#input_patterns')
let g:neocomplete#sources#omni#input_patterns = {}
endif
"let g:neocomplete#sources#omni#input_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
"let g:neocomplete#sources#omni#input_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)'
"let g:neocomplete#sources#omni#input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
" For perlomni.vim setting.
" https://github.com/c9s/perlomni.vim
let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
"vim打开文件,光标定位到上次退出的位置;
if has("autocmd")
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
endif"`'")"'")
写完配置文件后,就要git了:
mkdir ~/.vim/
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
随后进入 vim:
执行:
PluginInstall
git相关知识,再次写一下:
Powershell平台下posh-git:
Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy RemoteSigned -Force
Install-Module posh-git -Scope CurrentUser -Force
Install-Module posh-git -Scope CurrentUser -AllowPrerelease -Force # Newer beta version with PowerShell Core support(这个没下载,不使用)
Git in Bash(哎,人生苦短,直接截图):

我的.vimrc配置的更多相关文章
- vimrc配置-新建文件时自动生成文件头
vimrc配置-新建文件时自动生成文件头 auto add file header autocmd BufNewFile *.py 0r /home/zxkletters/.vim/vim_te ...
- Linux大棚版vimrc配置
Linux大棚版vimrc配置—V2.0版本,如下: [shell] $cat .vimrc “== “Author :roc “Website:roclinux.cn “Version:2.0 “= ...
- vimrc配置
"=========================================================================" DesCRiption 适合 ...
- 我在linux中使用的vundle 和 vimrc配置
set nocompatible filetype off set rtp+=~/.vim/bundle/vundle/ call vundle#rc() Plugin 'gmarik/vundle' ...
- vim的vimrc配置
windows "# modified by Neoh set helplang=cn "使用中文帮助文档 set encoding=utf-8 "查看utf-8格式的帮 ...
- cygwin下的vim 的vimrc配置
1.一直接照 vim 在linux的配置使用 cygwin下的 vi. vim --version 之后,出现了帮助...
- Vimrc配置以及Vim的常用操作
""""""""""""""""&quo ...
- 我的vimrc配置
fankcoder@fankcoder:~$ cat ~/.vimrclet Tlist_Auto_Highlight_Tag=1 let Tlist_Auto_Open=1 let Tlist_Au ...
- vimrc 配置支持backspace
在vimrc中添加: set nocompatible set backspace=indent,eol,start
随机推荐
- react typescript jest config (一)
1. initialize project create a folder project Now we'll turn this folder into an npm package. npm in ...
- OAuth - 四种方式
OAuth 2.0 的标准是 RFC 6749 文件.该文件先解释了 OAuth 是什么. OAuth 引入了一个授权层,用来分离两种不同的角色:客户端和资源所有者.......资源所有者同意以后,资 ...
- 白话理解https
为什么需要加密? 因为http的内容是明文传输的,传输过程有可能被劫持或被篡改(中间人攻击),如何解决? 当然是加密.最简单的方式就是对称加密(快). 对称机密 就是一个密钥,可以理解为一把钥匙,我们 ...
- Uva 1754 Posterize
#include<bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i=a;i<=b;++i) #defi ...
- Mysql使用规范及建议
MySQL数据库使用规范一.建表规约1.[强制]表达是与否概念的字段,必须使用is_xxx的方式命名,数据类型是unsigned tinyint (1表示是,0表示否) 说明:任何字段如果为非负数,必 ...
- HDU1873 看病要排队【模拟+优先队列】
看病要排队 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Subm ...
- handlebars模板引擎使用初探1
谈到handlebars,我们不禁产生疑问,为什么要使用这样的一个工具呢?它究竟能为我们带来什么样的好处?如何使用它呢? 一.handlebars可以干什么? 首先,我们来看一个案例: 有这样的htm ...
- CF1288C-Two Arrays (DP)
You are given two integers n and m. Calculate the number of pairs of arrays (a,b) such that: the len ...
- Acmer 仅以此纪念最痛苦的一天
今天打比赛,完全不在状态,看到别人又AK了,自己心里真TM不是个滋味,我为什么这么弱,菜鸡,每天都在水题,我的人生也是这么水?伪学习?没有学习能力,这不只是队伍的问题,是自己的问题,别人平均3题我们队 ...
- python(类多态)
一.多态 (以封装和继承为前提)不同的子类调用相同的方法,产生不同的结果 class Dog(): def __init__(self,name): self.name = name def game ...