Vim相关优化和配置

升级python
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
tar -xvf Python-3.6.5.tgz
cd Python-3.6.5
./configure --enable-shared \
--prefix=/usr/local/python3.6.5
make
make install
修改系统的默认python版本
ln -fs /usr/local/python3.6.5/bin/python3 /usr/bin/python
ln -fs /usr/local/python3.6.5/lib/libpython3.6m.so.1.0 /usr/lib64/libpython3.6m.so.1.0
修改yum配置文件(否则yum无法正常运行)/usr/bin/yum,改为原来系统默认的版本
将第一行的#!/usr/bin/python修改为系统原有的python版本地址#!/usr/bin/python2.6

 

升级vim
yum -y remove vim
yum install ncurses-devel
git clone https://github.com/vim/vim.git
cd vim
./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp \
--enable-pythoninterp \
--with-python-config-dir=/usr/local/python3.6.5/lib/python3.6/config-3.6m-x86_64-linux-gnu \
--enable-python3interp=yes \
--enable-perlinterp \
--enable-luainterp \
--enable-gui=gtk2 --enable-cscope --prefix=/usr
make
make install


安装vim插件:

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

编辑配置文件 ~/.vimrc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
set nocompatible "Use Vim settings, rather than Vi settings
"Be IMproved
 
filetype off "required!
 
" I use Vundle https://github.com/gmarik/Vundle.vim as my
" preferred plugin manager.... never got the hang of
" vim-pathogen (no offence to the pathogen community)
 
 
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
 
" Let vundle manage itself
Plugin 'gmarik/Vundle.vim'
 
" Plugins
Plugin 'Valloric/YouCompleteMe'
Plugin 'nvie/vim-flake8'
Plugin 'itchyny/lightline.vim'
Plugin 'altercation/vim-colors-solarized'
 
call vundle#end() " required
filetype plugin indent on "required!
 
set backspace=indent,eol,start "allow backspacing over everything in insert mode
 
set history=50 "keep 50 lines of command line history
 
set ruler "show the cursor position all the time
 
set showcmd "display incomplete commands
 
set incsearch "do incremental searching
 
set nu "show line numbers
 
set expandtab "use spaces instead of tabs
 
set tabstop=4 "insert 4 spaces whenever the tab key is pressed
 
set shiftwidth=4 "set indentation to 4 spaces
 
set hlsearch "highlight search terms
 
set ic "Ignore Case during searches
 
set autoindent "start new line at the same indentation level
 
syntax enable "syntax highlighting
 
set cmdheight=1 "The commandbar height
 
set showmatch "Show matching bracets when text indicator is over them
 
set nobackup " do not keep backup files, it's 70's style cluttering
 
set noswapfile " do not write annoying intermediate swap files,
" who did ever restore from swap files
" anyway?
" https://github.com/nvie/vimrc/blob/master/vimrc#L141
 
 
set ttimeoutlen=50 "Solves: there is a pause when leaving insert mode
 
set splitbelow " Horizontal splits open below current file
 
set splitright " Vertical splits open to the right of the current file
 
set wildmode=longest,list " Pressing <Tab> shows command suggestions similar to pressing <Tab>
" in bash
 
set laststatus=2 " Solves lightline not showing
 
" Mappings to traverse buffer list
nnoremap <silent> [b :bprevious<CR>
nnoremap <silent> ]b :bnext<CR>
nnoremap <silent> [B :bfirst<CR>
nnoremap <silent> ]B :blast<CR>
 
"Easy expansion of the active file directory
cnoremap <expr> %% getcmdtype() == ':' ? expand('%:h').'/' : '%%'
 
"Shortcut to Mute Highlighting
nnoremap <silent> <C-l> :<C-u>nohlsearch<CR><C-l>
 
"Root permission on a file inside VIM
cmap w!! w !sudo tee >/dev/null %
 
"To use the Solarized Dark Theme
syntax enable
set background=dark
let g:solarized_termcolors=256
colorscheme darkblue

打开vim安装插件: :PluginInstall

 

posted @   头痛不头痛  阅读(618)  评论(0编辑  收藏  举报
编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
点击右上角即可分享
微信分享提示
主题色彩