If you want to use IDE tools, all you need to do is install vim-nox.
However, such errors may be reported during installation.
The following packages have unmet dependencies:
vim-nox : Depends: vim-common (= 2:7.3.547-7) but 2:7.4.488-7 is to be installed
Depends: libperl5.14 (>= 5.14.2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
How to solve it?
sudo apt-get remove vim-common
After uninstalling this, another error will be reported later. At this time, we need to uninstall it again.
The following packages have unmet dependencies:
vim-nox : Depends: vim-common (= 2:7.4.1689-3ubuntu1) but 2:7.4.1689-3ubuntu1.2 is to be installed
Depends: vim-runtime (= 2:7.4.1689-3ubuntu1) but 2:7.4.1689-3ubuntu1.2 is to be installed
At this time, there should be only the following mistake. At this point, it only needs to be executed again.
sudo apt-get remove vim-runtime
sudo apt-get install vim-nox
Install Vundle
Vundle yes vim One of the many plug-in managers is also one of the most widely used. install Vundle:
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
touch ~/.vimrc
Add configuration files
"vundle
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
"git interface
Plugin 'tpope/vim-fugitive'
"filesystem
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'kien/ctrlp.vim'
"html
" isnowfy only compatible with python not python3
Plugin 'isnowfy/python-vim-instant-markdown'
Plugin 'jtratner/vim-flavored-markdown'
Plugin 'suan/vim-instant-markdown'
Plugin 'nelstrom/vim-markdown-preview'
"python sytax checker
Plugin 'nvie/vim-flake8'
Plugin 'vim-scripts/Pydiction'
Plugin 'vim-scripts/indentpython.vim'
Plugin 'scrooloose/syntastic'
"auto-completion stuff
"Plugin 'klen/python-mode'
Plugin 'Valloric/YouCompleteMe'
Plugin 'klen/rope-vim'
"Plugin 'davidhalter/jedi-vim'
Plugin 'ervandew/supertab'
""code folding
Plugin 'tmhedberg/SimpylFold'
"Colors!!!
Plugin 'altercation/vim-colors-solarized'
Plugin 'jnurmine/Zenburn'
call vundle#end()
filetype plugin indent on " enables filetype detection
let g:SimpylFold_docstring_preview = 1
"autocomplete
let g:ycm_autoclose_preview_window_after_completion=1
"custom keys
let mapleader=" "
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
"
call togglebg#map("<F5>")
"colorscheme zenburn
"set guifont=Monaco:h14
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
"I don't like swap files
set noswapfile
"turn on numbering
set nu
"python with virtualenv support
py << EOF
import os.path
import sys
import vim
if 'VIRTUA_ENV' in os.environ:
project_base_dir = os.environ['VIRTUAL_ENV']
sys.path.insert(0, project_base_dir)
activate_this = os.path.join(project_base_dir,'bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
EOF
"it would be nice to set tag files by the active virtualenv here
":set tags=~/mytags "tags for ctags and taglist
"omnicomplete
autocmd FileType python set omnifunc=pythoncomplete#Complete
"------------Start Python PEP 8 stuff----------------
" Number of spaces that a pre-existing tab is equal to.
au BufRead,BufNewFile *py,*pyw,*.c,*.h set tabstop=4
"spaces for indents
au BufRead,BufNewFile *.py,*pyw set shiftwidth=4
au BufRead,BufNewFile *.py,*.pyw set expandtab
au BufRead,BufNewFile *.py set softtabstop=4
" Use the below highlight group when displaying bad whitespace is desired.
highlight BadWhitespace ctermbg=red guibg=red
" Display tabs at the beginning of a line in Python mode as bad.
au BufRead,BufNewFile *.py,*.pyw match BadWhitespace /^\t\+/
" Make trailing whitespace be flagged as bad.
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
" Wrap text after a certain number of characters
au BufRead,BufNewFile *.py,*.pyw, set textwidth=100
" Use UNIX (\n) line endings.
au BufNewFile *.py,*.pyw,*.c,*.h set fileformat=unix
" Set the default file encoding to UTF-8:
set encoding=utf-8
" For full syntax highlighting:
let python_highlight_all=1
syntax on
" Keep indentation level from previous line:
autocmd FileType python set autoindent
" make backspaces more powerfull
set backspace=indent,eol,start
"Folding based on indentation:
autocmd FileType python set foldmethod=indent
"use space to open folds
nnoremap <space> za
"----------Stop python PEP 8 stuff--------------
"js stuff"
autocmd FileType javascript setlocal shiftwidth=2 tabstop=2
© 2017 GitHub, Inc.
Paste it over, one at a time. Then execute in last line mode
PluginInstall
YouCompleteMe
Killer plug-in. The auto-filling artifact on vim can provide the auto-filling experience similar to IDE, and can cooperate with Syntastic to provide real-time grammar checking. YouCompleteMe differs from other plug-ins in that it requires not only installation, but also manual compilation, but also configuration in. vimrc.
The languages supported by YouCompleteMe are:
C,Objectiv-c,C#,C++,Objectiv-C++,Php,Javascript,Typescript,python,Go,Rust
Installation requires only one command:
Plugin 'Valloric/YouCompleteMe'
Compiled commands:
cd ~/.vim/bundle/YouCompleteMe
./install.py –clang-completer
The parameter clang-completer is to add the automatic completion of C series languages. If not, it also supports the completion of other languages. See the official documentation for details.
There are many configuration options involved in YouCompleteMe, which I don't fully understand. In addition, I personally feel that Syntactic's tips are a bit ugly, so there is no installation. Here is a list of what I'm using. Please check the official documents for details:
"Default profile path"
let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
"open vim No more queries about loading ycm_extra_conf.py To configure"
let g:ycm_confirm_extra_conf=0
set completeopt=longest,menu
"python Interpreter Path"
let g:ycm_path_to_python_interpreter='/usr/local/bin/python'
"Whether to Turn on Semantic Completion"
let g:ycm_seed_identifiers_with_syntax=1
"Is Completion Opened in Notes"
let g:ycm_complete_in_comments=1
let g:ycm_collect_identifiers_from_comments_and_strings = 0
"Number of Characters Starting Completion"
let g:ycm_min_num_of_chars_for_completion=2
"Automatic shutdown preview window after completion"
let g:ycm_autoclose_preview_window_after_completion=1
" Disallow caching matches,Reproduce the matches every time"
let g:ycm_cache_omnifunc=0
"Completion is also turned on in strings"
let g:ycm_complete_in_strings = 1
"Automatically close the preview window after leaving insert mode"
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
"Check the current item when returning"
inoremap <expr> <CR> pumvisible() ? '<C-y>' : '\<CR>'
"Upper and Lower Key Behavior"
inoremap <expr> <Down> pumvisible() ? '\<C-n>' : '\<Down>'
inoremap <expr> <Up> pumvisible() ? '\<C-p>' : '\<Up>'
inoremap <expr> <PageDown> pumvisible() ? '\<PageDown>\<C-p>\<C-n>' : '\<PageDown>'
inoremap <expr> <PageUp> pumvisible() ? '\<PageUp>\<C-p>\<C-n>' : '\<PageUp>'
vim-powerline
Used to beautify the status bar, the original status bar is ugly and shows little information, so this beautiful and practical status bar is useful. Out of the box, convenient and fast.
Some additional suggestions
While configuring YouCompleteMe, some of the errors I still encountered remained unresolved. The above code is best copied bit by bit in batches to execute PluginInstall. This is easy to verify and find the cause of the error.
Reference articles
http://www.jianshu.com/p/f0513d18742a
https://segmentfault.com/a/1190000003962806
http://learnvimscriptthehardway.stevelosh.com/
http://blog.csdn.net/github_33934628/article/details/51854843