vim\neovim美化 + 终端美化配置

VIM

为了方便大家在不同的平台都能成功配置,考虑到不同的包管理下载的vim都是不同版本的,这里直接采用源码编译版本进行使用

效果图:
在这里插入图片描述

用了一段时间的spacevim 因为不太喜欢它的底部弹窗,索性该用vim

脚本:

#安装代码提示插件  
#依赖
sudo apt install g++-8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8
sudo update-alternatives --config gcc #切换为gcc-8

wget https://github.com/Kitware/CMake/releases/download/v3.17.1/cmake-3.17.1-linux-x86_64.tar.gz
tar -zxvf cmake-3.17.1-linux-x86_64.tar.gz
cd cmake-3.17.1-linux-x86_64
sudp cp /bin/cmake /usr/bin/
sudo cp -r share/cmake-3.17 /usr/share

git clone https://github.com/vim/vim.git
sudo apt-get install libncurses5-dev python-dev python3-dev libgtk3.0-cil-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev
cd vim
sudo ./configure --with-features=huge --enable-multibyte --enable-rubyinterp --enable-pythoninterp --enable-python3interp --enable-luainterp --enable-cscope --enable-gui=gtk3 --enable-perlinterp --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu/ --with-python3-config-dir=/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/ --prefix=/usr/local/vim
sudo make  #gcc version 8.4.0
sudo make install
sudo cp ./src/vim /usr/bin/

#taglist插件依赖
sudo apt-get install ctags

#安装插件
file = '~/.vim/bundle/YouCompleteMe'
if [ ! -d "$file"]; then
    cd ~/.vim/bundle
    git clone https://github.com/ycm-core/YouCompleteMe.git
    git submodule update --init --recursive
    cd ~/.vim/bundle/YouCompleteMe
    python3 install.py --clang-completer
fi

vim ~/.vimrc

set nocompatible
filetype on

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

"YouCompleteMe:语句补全插件
set runtimepath+=~/.vim/bundle/YouCompleteMe
autocmd InsertLeave * if pumvisible() == 0|pclose|endif "离开插入模式后自动关闭预览窗口"
let g:ycm_collect_identifiers_from_tags_files = 1           " 开启 YCM基于标签引擎
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释与字符串中的内容也用于补全
let g:syntastic_ignore_files=[".*\.py$"]
let g:ycm_seed_identifiers_with_syntax = 1                  " 语法关键字补全
let g:ycm_complete_in_comments = 1
let g:ycm_confirm_extra_conf = 0                            " 关闭加载.ycm_extra_conf.py提示
let g:ycm_key_list_select_completion = ['<c-n>', '<Down>']  " 映射按键,没有这个会拦截掉tab, 导致其他插件的tab不能用.
let g:ycm_key_list_previous_completion = ['<c-p>', '<Up>']
let g:ycm_complete_in_comments = 1                          " 在注释输入中也能补全
let g:ycm_complete_in_strings = 1                           " 在字符串输入中也能补全
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释和字符串中的文字也会被收入补全
let g:ycm_show_diagnostics_ui = 0                           " 禁用语法检查
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>"             " 回车即选中当前项
nnoremap <c-j> :YcmCompleter GoToDefinitionElseDeclaration<CR>     " 跳转到定义处
let g:ycm_min_num_of_chars_for_completion=2                 " 从第2个键入字符就开始罗列匹配项
"
" github 仓库中的插件 "
Plugin 'VundleVim/Vundle.vim'
let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py'

"主题"
""colorscheme yowish
colorscheme seoul256


"自动加执行权限"
au BufWritePost * if getline(1) =~ "^#!" | if getline(1) =~ "/bin/" | silent !chmod +x <afile> | endif | endif

"状态栏设置"
""Plugin 'vim-airline/vim-airline'
"vim-airline配置:优化vim界面"
" 显示颜色
""set t_Co=256
""set laststatus=2
" 使用powerline打过补丁的字体
""let g:airline_powerline_fonts = 1
" tabline中当前buffer两端的分隔字符
""let g:airline#extensions#tabline#left_sep = ' '
" tabline中未激活buffer两端的分隔字符
""let g:airline#extensions#tabline#left_alt_sep = ' '
" tabline中buffer显示编号
""let g:airline#extensions#tabline#buffer_nr_show = 1


" 映射切换buffer的键位
nnoremap [b :bp<CR>
nnoremap ]b :bn<CR>
" 映射<leader>num到num buffer
map <leader>1 :b 1<CR>
map <leader>2 :b 2<CR>
map <leader>3 :b 3<CR>
map <leader>4 :b 4<CR>
map <leader>5 :b 5<CR>
map <leader>6 :b 6<CR>
map <leader>7 :b 7<CR>
map <leader>8 :b 8<CR>
map <leader>9 :b 9<CR>

" vim-scripts 中的插件 "
Plugin 'taglist.vim'
"ctags 配置:F3快捷键显示程序中的各种tags,包括变量和函数等。
map <F3> :TlistToggle<CR>
let Tlist_Use_Right_Window=1
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1
let Tlist_WinWidt=25

Plugin 'The-NERD-tree'
"NERDTree 配置:F2快捷键显示当前目录树
map <F2> :NERDTreeToggle<CR>
let NERDTreeWinSize=25


Plugin 'indentLine.vim'
Plugin 'delimitMate.vim'

" 非 github 仓库的插件"
" Plugin 'git://git.wincent.com/command-t.git'
" 本地仓库的插件 "

call vundle#end()
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""新文件标题
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"新建.c,.h,.sh,.java文件,自动插入文件头
autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java,*.py exec ":call SetTitle()"
""定义函数SetTitle,自动插入文件头
func SetTitle()
    "如果文件类型为.sh文件
    if &filetype == 'sh'
        call setline(1, "#!/bin/zsh")
    endif
    if &filetype == 'cpp'
        call setline(1, "#include<iostream>")
        call append(line("."), "")
        call append(line(".")+1, "int main(){")
        call append(line(".")+2, "")
        call append(line(".")+3, "  printf();")
        call append(line(".")+4, "  return 0;")
        call append(line(".")+5, "}")
    endif
    if &filetype == 'c'
        call setline(1, "#include<stdio.h>")
        call append(line("."), "")
        call append(line(".")+1, "int main(){")
        call append(line(".")+2, "")
        call append(line(".")+3, "  printf();")
        call append(line(".")+4, "  return 0;")
        call append(line(".")+5, "}")
    endif
    if &filetype == 'python'
        call setline(1, "#!/usr/bin/python3")
        call append(line("."), "# -*- coding: UTF-8 -*-")
    endif
    if &filetype == 'java'
        call setline(1,"public class ".expand("%"))
        call append(line("."),"")
    endif
    "新建文件后,自动定位到文件末尾
    autocmd BufNewFile * normal G
endfunc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"键盘命令
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map <F5> :call CompileRunGcc()<CR>

func! CompileRunGcc()
    exec "w"
    if &filetype == 'c'
        exec '!gcc % -o %< -g -w  '
        exec '!time ./%<'
    elseif &filetype == 'cpp'
        exec '!g++ % -o %< -g -w'
        exec '!time ./%<'
    elseif &filetype == 'python'
        exec '!time python3 %'
    elseif &filetype == 'sh'
        :!time bash %
    endif
endfunc

nmap <leader>w :w!<cr>
nmap <leader>f :find<cr>

" 映射全选+复制 ctrl+a
map <C-A> ggVGY
map! <C-A> <Esc>ggVGY
map <F12> gg=G
" 选中状态下 Ctrl+c 复制
vmap <C-c> "+y
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""实用设置
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 设置当文件被改动时自动载入
set autoread
" quickfix模式
autocmd FileType c,cpp map <buffer> <leader><space> :w<cr>:make<cr>
"代码补全
set completeopt=preview,menu
"允许插件
filetype plugin on
"共享剪贴板
set clipboard=unnamed
"从不备份
set nobackup
"make 运行
:set makeprg=g++\ -Wall\ \ %
"自动保存
set autowrite
set ruler                   " 打开状态栏标尺
" 设置在状态行显示的信息
set foldcolumn=0
set foldmethod=indent
set foldlevel=3
set foldenable              " 开始折叠
" 不要使用vi的键盘模式,而是vim自己的
set nocompatible
" 语法高亮
syntax on
" 去掉输入错误的提示声音
set noeb
" 在处理未保存或只读文件的时候,弹出确认
set confirm
" 自动缩进
set autoindent
set cindent
" Tab键的宽度
set tabstop=4
" 统一缩进为4
set softtabstop=4
set shiftwidth=4
" 不要用空格代替制表符
set noexpandtab
" 在行和段开始处使用制表符
set smarttab
" 显示行号
set number
" 历史记录数
set history=1000
"禁止生成临时文件
set nobackup
set noswapfile
"搜索忽略大小写
set ignorecase
"搜索逐字符高亮
set hlsearch
set incsearch
"行内替换
set gdefault
"编码设置
set enc=utf-8
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
"语言设置
set langmenu=zh_CN.UTF-8
set helplang=cn
" 我的状态行显示的内容(包括文件类型和解码)
" 命令行(在状态行下)的高度,默认为1,这里是2
set cmdheight=1
" 侦测文件类型
filetype on
" 载入文件类型插件
filetype plugin on
" 为特定文件类型载入相关缩进文件
filetype indent on
" 保存全局变量
set viminfo+=!
" 带有如下符号的单词不要被换行分割
set iskeyword+=_,$,@,%,#,-
" 字符间插入的像素行数目
set linespace=0
" 增强模式中的命令行自动完成操作
set wildmenu
" 使回格键(backspace)正常处理indent, eol, start等
set backspace=2
" 允许backspace和光标键跨越行边界
set whichwrap+=<,>,h,l
" 可以在buffer的任何地方使用鼠标(类似office中在工作区双击鼠标定位)
""set mouse=a  这里不需要可视模式 ,可自行打开
set selection=exclusive
set selectmode=mouse,key
" 通过使用: commands命令,告诉我们文件的哪一行被改变过
set report=0
" 在被分割的窗口间显示空白,便于阅读
set fillchars=vert:\ ,stl:\ ,stlnc:\
" 高亮显示匹配的括号
set showmatch
" 匹配括号高亮的时间(单位是十分之一秒)
set matchtime=1
" 光标移动到buffer的顶部和底部时保持3行距离
set scrolloff=3
" 为C程序提供自动缩进
set smartindent
" 高亮显示普通txt文件(需要txt.vim脚本)
 au BufRead,BufNewFile *  setfiletype txt
"自动补全
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
":inoremap { {<CR>}<ESC>O
":inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap " ""<ESC>i
:inoremap ' ''<ESC>i
function! ClosePair(char)
    if getline('.')[col('.') - 1] == a:char
        return "\<Right>"
    else
        return a:char
    endif
endfunction
filetype plugin indent on
"打开文件类型检测, 加了这句才可以用智能补全
set completeopt=longest,menu
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

终端

在这里插入图片描述

脚本

chsh -s /usr/bin/zsh

path=${HOME}

file=$path'/.oh-my-zsh'
if [ ! -d "$file" ]; then
 git clone https://github.com/ohmyzsh/ohmyzsh.git $file
 cp ${file}/templates/zshrc.zsh-template ~/.zshrc
fi

file=$path'/autojump'
if [ ! -d "$file" ]; then
  git clone https://github.com/wting/autojump.git $file
  cd $file
  ./install.py
fi

file=$path'/.oh-my-zsh/custom/plugins/zsh-autosuggestions'
if [ ! -d "$file" ]; then
git clone https://github.com/zsh-users/zsh-autosuggestions $file
fi

file=$path'/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting'
if [ ! -d "$file" ]; then
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $file
fi

vim ~/.zshrc

export ZSH=$HOME/.oh-my-zsh

export https_proxy=http://10.21.159.116:8234;export http_proxy=http://10.21.159.116:8234;export all_proxy=socks5://10.21.159.116:8235
plugins=(git zsh-autosuggestions zsh-syntax-highlighting autojump )  #插件


[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh


ZSH_THEME="kennethreitz"  #Mac
#ZSH_THEME="arrow"  #箭头
#ZSH_THEME="awesomepanda"  #也可以
#ZSH_THEME="robbyrussell"  #最好看的主题
#ZSH_THEME="candy"   #带时间
#ZSH_THEME="steeef"   #命令在下面

alias cl='clear'
alias python='python3'
alias cat='bat -p'
source $ZSH/oh-my-zsh.sh

为方便使用Leax+vim ,这里我将项目转移到了neovim(现代化vim插件丰富,且容易集成,相当于vim的升级版)

我的neovim使用所需环境:

#!/bin/bash
set -v
brew install neovim yarn
python -m pip install --user --upgrade pynvim

#vim迁移到neovim
mkdir -p ~/.config/nvim/
cd ~/.config/nvim
cp ~/.vimrc ./init.vim
alias vim=nvim


#更新vim插件
nvim init.vim

#vim中 -> :PlugInstall 等待插件更新完毕

cd ~/.config/nvim/plugins/markdown-preview.nvim
yarn install && yarn upgrade

这里写入脚本一键运行就好,然后在你的主目录新建.config/nvim 目录在nvim新建配置文件init.vim 配置如下:

  au BufWritePost * if getline(1) =~ "^#!" | if getline(1) =~ "/bin/" | silent execute "!chmod +x <afile>" | endif | endif
  autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java,*.py exec ":call SetTitle()"
  func SetTitle()
    if &filetype == 'sh'
        call setline(1, "#!/bin/zsh")
    endif
    if &filetype == 'cpp'
        call setline(1, "#include<iostream>")
        call append(line("."), "")
        call append(line(".")+1, "int main(){")
        call append(line(".")+2, "")
        call append(line(".")+3, "  printf();")
        call append(line(".")+4, "  return 0;")
        call append(line(".")+5, "}")
    endif
    if &filetype == 'c'
        call setline(1, "#include<stdio.h>")
        call append(line("."), "")
        call append(line(".")+1, "int main(){")
        call append(line(".")+2, "")
        call append(line(".")+3, "  printf();")
        call append(line(".")+4, "  return 0;")
        call append(line(".")+5, "}")
    endif
    if &filetype == 'python'
        call setline(1, "#!/usr/bin/python3")
        call append(line("."), "# -*- coding: UTF-8 -*-")
      endif
    if &filetype == 'java'
        call setline(1,"public class ".expand("%"))
        call append(line("."),"")
    endif
    autocmd BufNewFile * normal G
  endfunc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    map <F5> :call CompileRunGcc()<CR>
    map <F6> :call CompileRunGccs()<CR>

    func! CompileRunGccs()
        exec "w"
        if &filetype == 'c'
            exec '!gcc % -o %< -g -w  '
        elseif &filetype == 'JavaScript'
            exec '!time python3 ./douyin.sh'
        endif
    endfunc

    func! CompileRunGcc()
        exec "w"
        if &filetype == 'c'
            exec '!gcc % -o %< -g -w  '
            exec '!time ./%<'
        elseif &filetype == 'cpp'
            exec '!g++ % -o %< -g -w'
            exec '!time ./%<'
        elseif &filetype == 'JavaScript'
            exec '!time python3 ./exp.py'
        elseif &filetype == 'python'
            exec '!time python3 %'
        elseif &filetype == 'sh'
            :!time bash %
        endif
      endfunc

    "共享剪贴板
    set clipboard=unnamed
    "自动缩进
    set autoindent
    set cindent
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

  " Search {
    set hlsearch
    set incsearch
    set ignorecase
    set smartcase
  " }

  " Others {
    set fileformats=unix,dos,mac
    set showcmd
    set hidden
    set backspace=indent,eol,start    " Fix backspace indent
    set mousemodel=popup
  " }

"" Visual {
  let $NVIM_TUI_ENABLE_TRUE_COLOR=1

  " Basic {
    set nolinebreak               " don't wrap at words, messes up copying
    set visualbell
    set wildmode=longest,list,full
    set wildmenu
    set numberwidth=3        " minimun width to use for the number column.
  " }

  " Syntax {
    syntax on
    syntax enable
  " }

  " Cursor {
    set guicursor=a:ver25-blinkon10
    "set ruler
    set nonumber
    "set cursorline
    set scrolloff=3
  "}

  " Tab {
    set list                      " Show tabs differently
    set listchars=tab:>-          " Use >--- for tabs
  " }

  " Status {
    set title
    set titleold="Terminal"
    set titlestring=%F
    set noshowmode
    set noruler
    set laststatus=0
    set noshowcmd
  " }
""}

"" Key-mapping {
  " Abbreviations {
    cnoreabbrev W! w!
    cnoreabbrev Q! q!
    cnoreabbrev Qall! qall!
    cnoreabbrev Wq wq
    cnoreabbrev Wa wa
    cnoreabbrev wQ wq
    cnoreabbrev WQ wq
    cnoreabbrev W w
    cnoreabbrev Q q
    cnoreabbrev Qall qall
  "}

  " Mapping {
    " Map Leader to ,
    let mapleader=','

    " Window navigation {
      " Allow Alt + {h, j, k, l} to navigate between windows
      " In all mode including Terminal
      if has("mac")
        " Alt+h,j,k,l ==> ˙,∆,˚,¬
        :tnoremap ˙ <C-\><C-n><C-w>h
        :tnoremap ∆ <C-\><C-n><C-w>j
        :tnoremap ˚ <C-\><C-n><C-w>k
        :tnoremap ¬ <C-\><C-n><C-w>l
        :nnoremap ˙ <C-w>h
        :nnoremap ∆ <C-w>j
        :nnoremap ˚ <C-w>k
        :nnoremap ¬ <C-w>l
      else
        :tnoremap <A-h> <C-\><C-n><C-w>h
        :tnoremap <A-j> <C-\><C-n><C-w>j
        :tnoremap <A-k> <C-\><C-n><C-w>k
        :tnoremap <A-l> <C-\><C-n><C-w>l
        :nnoremap <A-h> <C-w>h
        :nnoremap <A-j> <C-w>j
        :nnoremap <A-k> <C-w>k
        :nnoremap <A-l> <C-w>l
      endif
    " }

    " Split
    noremap <Leader>h :<C-u>split<CR>
    noremap <Leader>v :<C-u>vsplit<CR>

    " Tabs
    nnoremap <Tab> gt
    nnoremap <S-Tab> gT
    nnoremap <silent> <S-t> :tabnew<CR>

    " Terminal {
      nnoremap <silent> <Leader>t :terminal<CR>
      " exit 'terminal' mode
      :tnoremap <Esc> <C-\><C-n>
    "}

    " Set working directory
    nnoremap <Leader>. :lcd %:p:h<CR>

    " Buffer nav
    noremap <Leader>q :bp<CR>
    noremap <Leader>w :bn<CR>

    " Close buffer
    noremap <Leader>c :bd<CR>

    " Clean search (highlight)
    nnoremap <silent> <leader><space> :noh<cr>
  " }
"" }

"" Plugins {

  let s:vim_plug_dir=expand('~/.config/nvim/autoload')

  " Vim-Plug {
    if !filereadable(s:vim_plug_dir.'/plug.vim')
      execute '!wget https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -P '.s:vim_plug_dir
      let s:install_plug=1
    endif

    call plug#begin('~/.config/nvim/plugged')

      Plug 'Shougo/unite.vim'
      Plug 'Shougo/neomru.vim'
      Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
      Plug 'zchee/deoplete-jedi'
      Plug 'mbbill/undotree'
      Plug 'scrooloose/nerdtree'
      Plug 'tpope/vim-commentary'
      Plug 'airblade/vim-gitgutter'
      Plug 'tpope/vim-fugitive'

      Plug 'sheerun/vim-polyglot' " Language packs
      Plug 'scrooloose/syntastic'
      Plug 'majutsushi/tagbar'
      Plug 'bronson/vim-trailing-whitespace'
      Plug 'editorconfig/editorconfig-vim'
      Plug 'Yggdroot/indentLine'

"============================================================================
      " Color thems
      Plug 'junegunn/seoul256.vim'
      Plug 'dylanaraps/wal'
"============================================================================
      "Plug 'plasticboy/vim-markdown'
      "let g:vim_markdown_math = 1
"============================================================================
      "Plug 'iamcco/mathjax-support-for-mkdp'
"============================================================================
      Plug 'SirVer/ultisnips'
      Plug 'keelii/vim-snippets'
      let g:UltiSnipsExpandTrigger = '<tab>'
      let g:UltiSnipsJumpForwardTrigger = '<tab>'
      let g:UltiSnipsJumpBackwardTrigger = '<S-tab>'

      Plug 'lervag/vimtex'
      let g:tex_flavor='latex'
      let g:vimtex_view_method='zathura'
      let g:vimtex_quickfix_mode=0

      Plug 'KeitaNakamura/tex-conceal.vim'
      set conceallevel=1
      let g:tex_conceal='abdmg'
      hi Conceal ctermbg=none

      setlocal spell
      set spelllang=en_us
      inoremap <C-l> <c-g>u<Esc>[s1z=`]a<c-g>u
"============================================================================
      Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && yarn install' }
"      let g:mkdp_them ='dark'
      let g:mkdp_page_title ='Latex'
"============================================================================

    call plug#end()

    if exists('s:install_plug')
      augroup PlugInstall
        au!
        au VimEnter * PlugInstall
      augroup END
    endif
  " }

  " NERDTree {
      set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.db,*.sqlite
      let g:NERDTreeChDirMode=2
      let NERDTreeShowHidden=1
      let g:NERDTreeIgnore=['\.rbc$', '\~$', '\.pyc$', '\.db$', '\.sqlite$', '__pycache__']
      "let g:NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\.bak$', '\~$']
      let g:NERDTreeShowBookmarks=1
      let g:nerdtree_tabs_focus_on_files=1
      let g:NERDTreeMapOpenInTabSilent = '<RightMouse>'
      let g:NERDTreeWinSize=30

      " NERDTree KeyMapping
      " Locate current file in file systems
      nnoremap <silent> <Leader>l :NERDTreeFind<CR>
      noremap <F2> :NERDTreeToggle<CR>
      " Close NERDTree if no other window open
      autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
  " }

  " vim-commentray {
      " to support other file type
      " autocmd FileType apache setlocal commentstring=#\ %s
  " }

  " fugitive-git {
    " noremap <Leader>ga :Gwrite<CR>
    " noremap <Leader>gc :Gcommit<CR>
    " noremap <Leader>gsh :Gpush<CR>
    " noremap <Leader>gll :Gpull<CR>
    noremap <Leader>gs :Gstatus<CR>
    noremap <Leader>gb :Gblame<CR>
    noremap <Leader>gd :Gvdiff<CR>
    " noremap <Leader>gr :Gremove<CR>
  " }

  " Color-thems {
      colorscheme seoul256
      "colorscheme wal
  " }

  " Unite {
    call unite#filters#matcher_default#use(['matcher_fuzzy'])
    nnoremap <Leader>f :<C-u>Unite file_rec/neovim<CR>
    nnoremap <Leader>e :<C-u>Unite -no-split -buffer-name=mru file_mru<cr>
    nnoremap <Leader>b :<C-u>Unite -quick-match buffer<cr>
    nnoremap <Leader>r :<C-u>Unite -no-split -buffer-name=register register<CR>

    " Start insert.
    call unite#custom#profile('default', 'context', {
    \   'start_insert': 1
    \ })

    autocmd FileType unite call s:unite_my_settings()
    function! s:unite_my_settings()"{{{
      " Overwrite settings.

      imap <buffer> jj      <Plug>(unite_insert_leave)
      "imap <buffer> <C-w>     <Plug>(unite_delete_backward_path)

      imap <buffer><expr> j unite#smart_map('j', '')
      imap <buffer> <TAB>   <Plug>(unite_select_next_line)
      imap <buffer> <C-w>     <Plug>(unite_delete_backward_path)
      imap <buffer> '     <Plug>(unite_quick_match_default_action)
      nmap <buffer> '     <Plug>(unite_quick_match_default_action)
      imap <buffer><expr> x
            \ unite#smart_map('x', "\<Plug>(unite_quick_match_jump)")
      nmap <buffer> x     <Plug>(unite_quick_match_jump)
      nmap <buffer> <C-z>     <Plug>(unite_toggle_transpose_window)
      imap <buffer> <C-z>     <Plug>(unite_toggle_transpose_window)
      nmap <buffer> <C-j>     <Plug>(unite_toggle_auto_preview)
      nmap <buffer> <C-r>     <Plug>(unite_narrowing_input_history)
      imap <buffer> <C-r>     <Plug>(unite_narrowing_input_history)
      nnoremap <silent><buffer><expr> l
            \ unite#smart_map('l', unite#do_action('default'))

      let unite = unite#get_current_unite()
      if unite.profile_name ==# 'search'
        nnoremap <silent><buffer><expr> r     unite#do_action('replace')
      else
        nnoremap <silent><buffer><expr> r     unite#do_action('rename')
      endif

      nnoremap <silent><buffer><expr> cd     unite#do_action('lcd')
      nnoremap <buffer><expr> S      unite#mappings#set_current_sorters(
            \ empty(unite#mappings#get_current_sorters()) ?

      " Runs "split" action by <C-s>.
      imap <silent><buffer><expr> <C-s>     unite#do_action('split')
    endfunction"}}}
  " }

  " deoplete {
    let g:deoplete#enable_at_startup = 1
    "let g:deoplete#enable_smart_case = 1

    "deoplete tab-complete
    inoremap <expr><tab> pumvisible() ? "\<c-n>" :"\<tab>"
  " }

"" }
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值