Vim+python Development Environment built

Source: Internet
Author: User
Tags ack autoload imap set background

1. A ready-made one-click installation script

Curl -O HTTPS://raw. githubusercontent. com/vince67/ v7_config/Master/vim. SH

2.bash vim. SH 3. My. vimrc file, pro-Test available

Let vim_plug_just_installed = 0
Let Vim_plug_path = expand (' ~/.vim/autoload/plug.vim ')
If!filereadable (Vim_plug_path)
echo "Installing Vim-plug ..."
echo ""
Silent!mkdir-p ~/.vim/autoload
Silent!curl-flo ~/.vim/autoload/plug.vim--create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master /plug.vim
Let vim_plug_just_installed = 1
endif

If vim_plug_just_installed
: Execute ' source '. Fnameescape (Vim_plug_path)
endif

Call Plug#begin (' ~/.vim/plugged ')
"Override configs by directory
Plug ' Arielrossanigo/dir-configs-override.vim '
"Better File Browser
Plug ' Scrooloose/nerdtree '
"Code Commenter
Plug ' Scrooloose/nerdcommenter '
"Class/module Browser
Plug ' Majutsushi/tagbar '
The Code and Files Fuzzy finder
Plug ' Ctrlpvim/ctrlp.vim '
"Extension to CTRLP, for fuzzy command finder
Plug ' Fisadev/vim-ctrlp-cmdpalette '
"Zen Coding
Plug ' Mattn/emmet-vim '
"Git Integration
Plug ' Motemen/git-vim '
The TAB list panel
Plug ' Kien/tabman.vim '
"Airline
Plug ' Vim-airline/vim-airline '
Plug ' Vim-airline/vim-airline-themes '
"Terminal Vim with colors ColorScheme
Plug ' Fisadev/fisa-vim-colorscheme '
"Consoles as buffers
Plug ' Rosenfeld/conque-term '
The Pending Tasks list
Plug ' Fisadev/fixedtasklist.vim '
"Surround
Plug ' Tpope/vim-surround '
"Autoclose
Plug ' Townk/vim-autoclose '
"Indent text Object
Plug ' Michaeljsmith/vim-indent-object '
"Indentation based movements
Plug ' Jeetsukumaran/vim-indentwise '
"Python autocompletion, go to definition.
Plug ' Davidhalter/jedi-vim '
"Better autocompletion
Plug ' Shougo/neocomplcache.vim '
"Snippets Manager (Snipmate), dependencies, and Snippets repo
Plug ' Marcweber/vim-addon-mw-utils '
Plug ' Tomtom/tlib_vim '
Plug ' Honza/vim-snippets '
Plug ' Garbas/vim-snipmate '
"Git/mercurial/others diff icons on the side of the file lines
Plug ' Mhinz/vim-signify '
"Automatically sort Python imports
Plug ' Fisadev/vim-isort '
"Drag Visual blocks Arround
Plug ' Fisadev/dragvisuals.vim '
"Window Chooser
Plug ' T9md/vim-choosewin '
"Python and other Languages code checker
Plug ' scrooloose/syntastic '
"Paint CSS colors with the real color
Plug ' Lilydjwg/colorizer '
"ACK Code search (requires ACK installed in the system)
Plug ' Mileszs/ack.vim '
If has (' Python ')
"Yapf Formatter for Python
Plug ' Pignacio/vim-yapf-format '
endif
"Relative numbering of lines (0 is the current line)
"(disabled by default because was very intrusive and can ' t be easily toggled
"On/off. When the plugin is present, 'll always activate the relative
"Numbering every time you go to normal mode. Author refuses to add a setting
To avoid that)
"Plug ' Myusuf3/numbers.vim '

"Plugins from Vim-scripts repos:

"Search Results counter
Plug ' Indexedsearch '
"Xml/html tags Navigation
Plug ' Matchit.zip '
"Gvim ColorScheme
Plug ' Wombat '
"Yank History Navigation
Plug ' Yankring.vim '

"Tell Vim-plug we finished declaring plugins, so it can load them
Call Plug#end ()

" ============================================================================
"Install plugins the first time vim runs

If vim_plug_just_installed
echo "Installing Bundles, please ignore key map error Messages"
:P Luginstall
endif

" ============================================================================
"Vim Settings and mappings
"Can edit them as you wish

"No vi-compatible
Set nocompatible

' Allow plugins by file type ' (Required for plugins!)
FileType plugin on
FileType indent on

"Tabs and spaces handling
Set Expandtab
Set tabstop=4
Set softtabstop=4
Set shiftwidth=4

"Tab length exceptions on some file types
Autocmd FileType HTML setlocal shiftwidth=4 tabstop=4 softtabstop=4
Autocmd FileType Htmldjango setlocal shiftwidth=4 tabstop=4 softtabstop=4
Autocmd FileType javascript setlocal shiftwidth=4 tabstop=4 softtabstop=4

Always Show status bar
Set ls=2

"Incremental Search
Set Incsearch
"Highlighted search results
Set Hlsearch

"Syntax highlight on
Syntax on

"Show line numbers
Set Nu

Set guioptions-=t
Set Guioptions-=m

Set Background=dark
Let g:solarized_termcolors=256
ColorScheme solarized
Set Autoindent
Set Smartindent
Set Cindent
Set Cinoptions=g0,:0,n-s, (0
Set tabstop=4
Set softtabstop=4
Set shiftwidth=4
Set Expandtab
Set Smarttab
Set number
Set Autoread
Set Completeopt=preview,menu
Set Autowrite
Set Magic
Set Noeb
Set confirm
Set Nobackup
Set Noswapfile
Set ignorecase
Set linespace=0
Set Wildmenu
Set backspace=2
Set Whichwrap+=<,>,h,l
Set selection=exclusive
Set Selectmode=mouse,key
Set report=0
Set Fillchars=vert:\, Stl:\, Stlnc:\
Set Showmatch
Set matchtime=1
Set scrolloff=3
Set Completeopt=longest,menu
Set iskeyword+=.
"Tab Navigation mappings
Map tn:tabn<cr>
Map tp:tabp<cr>
Map TM:TABM
Map Tt:tabnew
Map Ts:tab split<cr>
Map <C-S-Right>:tabn<cr>
IMAP <C-S-Right> <ESC>:tabn<CR>
Map <C-S-Left>:tabp<cr>
IMAP <C-S-Left> <ESC>:tabp<CR>

"Navigate windows with Meta+arrows
Map <M-Right> <c-w>l
Map <M-Left> <c-w>h
Map <M-Up> <c-w>k
Map <M-Down> <c-w>j
IMAP <M-Right> <ESC><C-W>L
IMAP <M-Left> <ESC><C-W>H
IMAP <M-Up> <ESC><C-W>K
IMAP <M-Down> <ESC><C-W>J

"Old AutoComplete keyboard shortcut
IMAP <C-J> <C-X><C-O>

"Comment this line to enable Autocompletion Preview window
(Displays documentation related to the selected completion option)
"Disabled by default because preview makes the window flicker
Set Completeopt-=preview

"Save As Sudo
CA w!! W!sudo Tee "%"

"Simple recursive grep
Nmap, R:ack
Nmap, Wr:ack <cword><CR>

"Use of colors when possible
if (&term =~?) ' mlterm\|xterm\|xterm-256\|screen-256 ') | | Has (' Nvim ')
Let &t_co = 256
ColorScheme Darkblue
Else
ColorScheme Delek
endif

"Colors for Gvim
If has (' gui_running ')
ColorScheme Wombat
endif

"When scrolling, keep cursor 3 lines away from screen border
Set scrolloff=3

"Autocompletion of files and commands behaves like shell
(Complete is the common part, list of options that match)
Set Wildmode=list:longest
Set history=1000
"Better backup, swap and undos storage
Set directory=~/.vim/dirs/tmp "directory to place swap files in
Set backup "Make Backup Files"
Set Backupdir=~/.vim/dirs/backups "Where to put backup files
Set Undofile "Persistent Undos-undo after you re-open the file
Set Undodir=~/.vim/dirs/undos
Set Viminfo+=n~/.vim/dirs/viminfo
"Store yankring history file there too
Let G:yankring_history_dir = ' ~/.vim/dirs/'

"Create needed directories if they don ' t exist
If!isdirectory (&backupdir)
Call mkdir (&backupdir, "P")
endif
If!isdirectory (&directory)
Call mkdir (&directory, "P")
endif
If!isdirectory (&undodir)
Call mkdir (&undodir, "P")
endif

" ============================================================================
"Plugins Settings and mappings
"Edit them as you wish."

"Tagbar-----------------------------

"Toggle Tagbar Display
Map <F4>:tagbartoggle<cr>
"Autofocus on Tagbar Open
Let G:tagbar_autofocus = 1

"Nerdtree-----------------------------

"Toggle Nerdtree Display
Map <F3>:nerdtreetoggle<cr>
"Open Nerdtree with the current file selected
Nmap,t:nerdtreefind<cr>
"Don;t Show these file types
Let Nerdtreeignore = [' \.pyc$ ', ' \.pyo$ ']


"Tasklist------------------------------

The Show pending Tasks list
Map <F2>:tasklist<cr>

"CTRLP------------------------------

The File Finder mapping
Let G:ctrlp_map = ', E '
"Tags (symbols) in the current File finder mapping
Nmap,g:ctrlpbuftag<cr>
tags (symbols) in the All Files finder mapping
Nmap,g:ctrlpbuftagall<cr>
"General code Finder in all Files mapping
Nmap,f:ctrlpline<cr>
"Recent Files Finder mapping
Nmap,m:ctrlpmrufiles<cr>
"Commands Finder Mapping
Nmap,c:ctrlpcmdpalette<cr>
"To is able to call CTRLP with default search text
function! Ctrlpwithsearchtext (Search_text, Ctrlp_command_end)
Execute ': CTRLP '. A:ctrlp_command_end
Call Feedkeys (A:search_text)
Endfunction
"Same as previous mappings, but calling with the current word as default text
Nmap, Wg:call ctrlpwithsearchtext (expand (' <cword> '), ' Buftag ') <CR>
Nmap, Wg:call ctrlpwithsearchtext (expand (' <cword> '), ' Buftagall ') <CR>
Nmap, Wf:call ctrlpwithsearchtext (expand (' <cword> '), ' line ') <CR>
Nmap, We:call ctrlpwithsearchtext (expand (' <cword> '), ') <CR>
Nmap, Pe:call ctrlpwithsearchtext (expand (' <cfile> '), ') <CR>
Nmap, Wm:call ctrlpwithsearchtext (expand (' <cword> '), ' mrufiles ') <CR>
Nmap, Wc:call ctrlpwithsearchtext (expand (' <cword> '), ' Cmdpalette ') <CR>
"Don ' t Change working directory
Let G:ctrlp_working_path_mode = 0
"Ignore these files and folders on file finder
Let G:ctrlp_custom_ignore = {
\ ' dir ': ' \v[\/] (\.git|\.hg|\.svn|node_modules) $ ',
\ ' file ': ' \.pyc$\|\.pyo$ ',
\ }

"Syntastic------------------------------

"Show list of errors and warnings on the current file
Nmap <leader>e:Errors<CR>
"Check also when just opened the file
Let G:syntastic_check_on_open = 1
"Don ' t put icons on the sign column (it hides the VCs status icons of signify)
Let g:syntastic_enable_signs = 0
"Custom icons (enable them if you use a patched font, and enable the previous
"setting)
"Let G:syntastic_error_symbol = '? '
"Let G:syntastic_warning_symbol = '? '
"Let G:syntastic_style_error_symbol = '? '
"Let G:syntastic_style_warning_symbol = '? '

"Jedi-vim------------------------------

"All these mappings work only for Python code:
"Go to Definition
Let G:jedi#goto_command = ', d '
"Find ocurrences
Let G:jedi#usages_command = ', O '
"Find Assignments
Let G:jedi#goto_assignments_command = ', a '
"Go to Definition in new tab
Nmap, D:tab split<cr>:call jedi#goto () <CR>

"Neocomplcache------------------------------

"Most of them not documented because I ' m not sure how they work
(Docs aren ' t good, had to does a lot of trial and error to make
"It play Nice)
Let G:neocomplcache_enable_at_startup = 1
Let G:neocomplcache_enable_ignore_case = 1
Let G:neocomplcache_enable_smart_case = 1
Let G:neocomplcache_enable_auto_select = 1
Let g:neocomplcache_enable_fuzzy_completion = 1
Let g:neocomplcache_enable_camel_case_completion = 1
Let g:neocomplcache_enable_underbar_completion = 1
Let G:neocomplcache_fuzzy_completion_start_length = 1
Let G:neocomplcache_auto_completion_start_length = 1
Let G:neocomplcache_manual_completion_start_length = 1
Let G:neocomplcache_min_keyword_length = 1
Let G:neocomplcache_min_syntax_length = 1
"Complete with workds from any opened file
Let g:neocomplcache_same_filetype_lists = {}
Let G:neocomplcache_same_filetype_lists._ = ' _ '

"Tabman------------------------------

"Mappings to toggle display, and to focus on it
Let G:tabman_toggle = ' tl '
Let G:tabman_focus = ' tf '

"Autoclose------------------------------

"Fix to let ESC work as espected with Autoclose plugin
Let g:autoclosepumvisible = {"ENTER": "\<c-y>", "ESC": "\<esc>"}

"Dragvisuals------------------------------

"Mappings to move blocks in 4 directions
Vmap <expr> <S-M-LEFT> Dvb_drag (' left ')
Vmap <expr> <S-M-RIGHT> Dvb_drag (' right ')
Vmap <expr> <S-M-DOWN> Dvb_drag (' Down ')
Vmap <expr> <S-M-UP> Dvb_drag (' Up ')
"Mapping to duplicate block
Vmap <expr> D dvb_duplicate ()

"Signify------------------------------

"This first setting decides in which order try to guess your the current VCs
"UPDATE it to reflect your preferences, it'll speed up opening files
Let g:signify_vcs_list = [' git ', ' HG ']
"Mappings to changed blocks
Nmap <leader>sn <plug> (signify-next-hunk)
Nmap <leader>sp <plug> (signify-prev-hunk)
"Nicer colors
Highlight Diffadd cterm=bold Ctermbg=none ctermfg=119
Highlight Diffdelete cterm=bold Ctermbg=none ctermfg=167
Highlight Diffchange cterm=bold Ctermbg=none ctermfg=227
Highlight Signifysignadd cterm=bold ctermbg=237 ctermfg=119
Highlight Signifysigndelete cterm=bold ctermbg=237 ctermfg=167
Highlight Signifysignchange cterm=bold ctermbg=237 ctermfg=227

"Window Chooser------------------------------

"Mapping
Nmap-<Plug> (Choosewin)
"Show Big Letters
Let g:choosewin_overlay_enable = 1

"Airline------------------------------

Let g:airline_powerline_fonts = 1
Let G:airline_theme = ' Luna '
Let g:airline#extensions#whitespace#enabled = 0
Let g:airline#extensions#tabline#enabled = 1
Let G:airline#extensions#tabline#left_sep = "
Let g:airline#extensions#tabline#left_alt_sep = ' | '
If!exists (' G:airline_symbols ')
Let G:airline_symbols = {}
endif

Vim+python Development Environment built

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.