vim-zsh-tmux环境配置

因为准备把我的电脑的总体环境转到Linux下,因此准备作一个记录来记录在Linux下要配置的一些奇奇怪怪的插件或者环境。考虑到之后工做中可能会没有su权限,因此总体安装尽可能采用源码编译的方式,但会比较吃配置,有些状况下编译仍是比较花时间的,尽可能不要在虚拟机中。html

ZSH

原文地址
有可能会出现的问题:python

You may need to install a package called 'curses-devel' or 'ncurses-devel' on your system.

相关内容
通常状况下都会有这个库,也能够采用源码安装方式:linklinux

在最后的设置成默认的shell中个人作法和原博主有些不同,我修改了~/.bashrc中相关内容,即启动bash后再启动zsh
默认的zsh是不显示绝对路径只显示当前目录的名字,这一点比较难受;
修改方法git


TMUX

原文地址
固然原博主安装的位置有一丢丢的奇怪,因此能够在./configure的时候把安装位置修改到一个合适的位置。
tmux比较简单,安装好了应该没什么须要额外配置的了,固然有兴趣的也能够把按键改到顺手的地方
记得把tmux加到~/.bashrc 或者 ~/.zshrc中,这样子每次启动就是在tmux环境下了
使用教程github


VIM

vim确实能够算整个配置中的大头了,详细弄弄花上一成天的时间也不是没有可能。其中vim里最烦人的就要算youcompleteme的配置了,个人方法可能并不能所有work。shell

首先咱们须要一个支持python/python3的vim,版本要 >= 7.4.1578
打开vim后直接:version查看版本
vim

注意python/python3以前要有一个加号,否则须要重装vim
固然咱们假设之后的工做环境是会主动提供支持python的vim的,否则源码安装比较麻烦,就不在这里展开了bash

apt-get 安装支持python的vim:
先卸载:sudo apt remove vim
再安装:sudo apt install vim-noxapp

配置vim第一步:ide

安装Vundle

github地址
教程仍是比较详细的,简单来讲就是先

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

而后在~/.vimrc最顶上加上这么一段话

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()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

而后保存,而后:PluginInstall
Vundle就安装完成了。

以后就是重头戏:

YouCompleteMe

github地址
首先,在vundle中加入对应的配置

Plugin 'Valloric/YouCompleteMe'

安装分两种,源码编译安装与apt-get安装
比较简单的apt-get安装:

sudo apt install build-essential cmake python3-dev

装就完事了
以后加上c-family的语义支持

cd ~/.vim/bundle/YouCompleteMe
python3 install.py --clang-completer

至于源码安装...
先要安装libclang
相关教程
而后将编译好的相关文件(bin,lib,include之类)放入~/ycm_temp/llvm_root_dir

编译ycm_core:
创建临时文件夹

cd ~
mkdir ycm_build
cd ycm_build

而后编译:

cmake -G "<generator>" -DPATH_TO_LLVM_ROOT=~/ycm_temp/llvm_root_dir . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp

generator即指Makefiles
在vimrc中加入let g:ycm_clangd_binary_path = "/path/to/clangd"

配置ycm相关:
在vimrc中加入相关配置:连接
ycm_extra_conf.py:连接

vim nerdtree相关:连接

配色相关:连接

所有配置:

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()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'git://github.com/scrooloose/nerdtree.git'

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

syntax on
set number
set softtabstop=4
set shiftwidth=4
set ignorecase

color desert

set cursorline 
set cursorcolumn
"highlight CursorLine ctermfg=black ctermbg=red
"highlight CursorColumn ctermbg=darkGrey

" 当光标一段时间保持不动了,就禁用高亮
autocmd cursorhold * set nohlsearch
" 当输入查找命令时,再启用高亮
noremap n :set hlsearch<cr>n
noremap N :set hlsearch<cr>N
noremap / :set hlsearch<cr>/
noremap ? :set hlsearch<cr>?
noremap * *:set hlsearch<cr>

" NERDTree config
map <F3> :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") &&b:NERDTreeType == "primary") | q | endif
"第一条是说使用F3键快速调出和隐藏它;
"第二条是关闭vim时,若是打开的文件除了NERDTree没有其余文件时,它自动关闭,减小屡次按:q!。
"若是想打开vim时自动打开NERDTree,能够以下设定
"autocmd vimenter * NERDTree

" YouCompleteMe
" Python Semantic Completion
let g:ycm_python_binary_path='/usr/bin/python3'
" C family Completion Path
let g:ycm_global_ycm_extra_conf='~/.ycm_extra_conf.py'
" 跳转快捷键
nnoremap <c-k> :YcmCompleter GoToDeclaration<CR>|
nnoremap <c-h> :YcmCompleter GoToDefinition<CR>| 
nnoremap <c-j> :YcmCompleter GoToDefinitionElseDeclaration<CR>|
" 中止提示是否载入本地ycm_extra_conf文件
let g:ycm_confirm_extra_conf=0
" 语法关键字补全
let g:ycm_seed_identifiers_with_syntax=1
" 开启 YCM 基于标签引擎
let g:ycm_collect_identifiers_from_tags_files=1
" 从第2个键入字符就开始罗列匹配项
let g:ycm_min_num_of_chars_for_completion=2
" 在注释输入中也能补全
let g:ycm_complete_in_comments=1
" 在字符串输入中也能补全
let g:ycm_complete_in_strings=1
" 注释和字符串中的文字也会被收入补全
let g:ycm_collect_identifiers_from_comments_and_strings=1
" 弹出列表时选择第1项的快捷键(默认为<TAB>和<Down>)
let g:ycm_key_list_select_completion=['<C-n>', '<Down>']
" 弹出列表时选择前1项的快捷键(默认为<S-TAB>和<UP>)
let g:ycm_key_list_previous_completion=['<C-p>', '<Up>']
" 主动补全, 默认为<C-Space>
"let g:ycm_key_invoke_completion=['<C-Space>']
" 中止显示补全列表(防止列表影响视野), 能够按<C-Space>从新弹出
"let g:ycm_key_list_stop_completion=['<C-y>']

autocmd BufWrite * execute ':s/\s*$//'

set tags=tags;
set autochdir
set fdm=indent