.vimrc的配置---轉

原文鏈接:https://www.cnblogs.com/ldh1112/p/11001780.html

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 KaTeX parse error: Double superscript at position 50: …hljs-string">' '̲</span> <sp…VIMRUNTIME . ‘\diff"’
else
let cmd = substitute(KaTeX parse error: Double superscript at position 48: …hljs-string">' '̲</span>, <span …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 autoindent
set smartindent
set tabstop=4
set softtabstop=4
set shiftwidth=4
set smarttab
set textwidth=80

"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 ‘vim-syntastic/syntastic’
Plugin ‘nvie/vim-flake8’
Plugin ‘Lokaltog/vim-powerline’
Plugin ‘Yggdroot/indentLine’
Plugin ‘godlygeek/tabular’
Plugin ‘plasticboy/vim-markdown’
Plugin ‘lervag/vimtex’
Plugin ‘tpope/vim-fugitive’
Plugin ‘EditPlus’
Plugin ‘cst’
Plugin ‘Xdebug’
Plugin ‘PyChimp’
Plugin ‘taglist.vim’
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

寫完配置文件後,就要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(哎,人生苦短,直接截圖):

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章