GitHub - jarolrod/vim-python-ide: .vimrc geared towards python development
source link: https://github.com/jarolrod/vim-python-ide
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Table of contents
Getting Started
A script shell will get a copy of the vimrc up and running on your local machine for testing purposes. The script will install the vimrc and compile the YouCompleteMe plugin:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/jarolrod/vim-python-ide/master/setup.sh)"
curl -fsSL https://raw.githubusercontent.com/jarolrod/vim-python-ide/master/setup.sh | sh
YouCompleteMe
YouCompleteMe must be compiled for it to work. The install script handles the compiling, but if something goes wrong then do the following:
- Make sure the following is included in your vimrc where all the vundle plugins are placed:
Plugin 'Valloric/YouCompleteMe'
MacOS
- Assuming you already have MacVim installed, install Cmake through brew
brew install cmake
- Navigate to YouCompleteMe bundle folder and run the compile script
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer
- Reference the YouCompleteMe README.md for any other configuration
Linux
Make sure you have Cmake and Python 3 Headers, they can be downloaded through your distributions package manager. Then run:
cd ~/.vim/bundle/YouCompleteMe
python3 ./install.py --clang-completer
DevIcons (Optional)
This plugin is used to show file icons in NerdTree and requires additional steps to install:
- Must install a patched font that contains required glyphs:
- Arch Linux
- Everyone Else
- Set vim encoding to UTF-8
set encoding=utf8
- Set vim font to NerdFont
set guifont=<FONT_NAME> <FONT_SIZE>
- Add glyphs to Airline
let g:airline_powerline_fonts = 1
- If you dont want this feature simply remove this plugin from your vimrc and execute :PluginUpdate in vim, for proper removal delete the devicons plugin folder
Alternatively:
- Cherry pick the parts you like from my vimrc and add it to yours
Plugins
- PEP 8 Indentation - Python Indentation
- Jinja - Syntax and Indentation
- Python Combined - Extra handling
Code and Project Navigation
- NerdTree - Project and File navigation
- Tagbar - Class outline
- CtrlSpace - Bookmarks/Workspaces/Fuzzy Search/ File management
- Ack - Search tool
- Airline - Tabline
- Powerline - Used for fonts
- Fixed Task List - Pending tasks
- Comfortable Motion - Physics based scrolling
- Bookmarks - Bookmark code
- Indent Guides - Visual repesentation of indents
Snippets
- Snippets - Snippets
- Snip-Mate - Snippet Manager
- NerdCommenter - Easy code documentation
- Utility Functions - Add-on
- Add-on - interpret file by function
Extra
- Sparkup - Condensed HTML parser
- Riv - Take notes in RST
- Surround - Add parentheses + etc. in pairs
- Colorscheme - Change vim colorscheme
- Rainbow-Parantheses - Rianbow Parentheses
- Vim-Wiki - Personal Vim wiki
- Vimagit - Git operations from buffer
- Dev Icons - File icons in NerdTree
Key-Bindings
Python
let g:pymode_run_bind='<F5>'
imap <F5> <Esc>:w<CR>:!clear;python %<CR>
Switching Between Buffers
nmap <F9> :bprev<CR>
nmap <F10> :bnext<CR>
Toggle Relative Numbering
nnoremap <F4> :set relativenumber!<CR>
Comfortable Motion Scrolling
let g:comfortable_motion_scroll_down_key = "j"
let g:comfortable_motion_scroll_up_key = "k"
nnoremap <silent> <C-d> :call comfortable_motion#flick(g:comfortable_motion_imp ulse_multiplier * winheight(0) * 2)<CR>
nnoremap <silent> <C-u> :call comfortable_motion#flick(g:comfortable_motion_imp ulse_multiplier * winheight(0) * -2)<CR>
nnoremap <silent> <C-f> :call comfortable_motion#flick(g:comfortable_motion_imp ulse_multiplier * winheight(0) * 4)<CR>
nnoremap <silent> <C-b> :call comfortable_motion#flick(g:comfortable_motion_imp ulse_multiplier * winheight(0) * -4)<CR>
NerdTree Toggle
- NerdTree wil automatically open when vim is launched in terminal without a file
nmap " :NERDTreeToggle<CR>
Disable Arrow Keys
no <down> <Nop>
no <left> <Nop>
no <right> <Nop>
no <up> <Nop>
ino <down> <Nop>
ino <left> <Nop>
ino <right> <Nop>
ino <up> <Nop>
vno <down> <Nop>
vno <left> <Nop>
vno <right> <Nop>
vno <up> <Nop>
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK