Skip to content

Instantly share code, notes, and snippets.

@mjhong0708
Last active June 26, 2021 14:35
Show Gist options
  • Save mjhong0708/36c5977b1c8e5027f528f5ee6d62ad57 to your computer and use it in GitHub Desktop.
Save mjhong0708/36c5977b1c8e5027f528f5ee6d62ad57 to your computer and use it in GitHub Desktop.
My init.vim for python development
filetype plugin indent on
autocmd FileType py setlocal tabstop=4 shiftwidth=4 expandtab
set number
call plug#begin('~/.local/share/nvim/site/plugged')
" nvim-yarp
Plug 'roxma/nvim-yarp'
" NCM2
Plug 'ncm2/ncm2'
Plug 'roxma/nvim-yarp'
" enable ncm2 for all buffers
autocmd BufEnter * call ncm2#enable_for_buffer()
" IMPORTANT: :help Ncm2PopupOpen for more information
set completeopt=noinsert,menuone,noselect
" NOTE: you need to install completion sources to get completions. Check
" our wiki page for a list of sources: https://github.com/ncm2/ncm2/wiki
Plug 'ncm2/ncm2-bufword'
Plug 'ncm2/ncm2-path'
Plug 'ncm2/ncm2-jedi'
Plug 'ncm2/ncm2-github'
" UI
Plug 'chriskempson/base16-vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" Better Visual Guide
Plug 'Yggdroot/indentLine'
" syntax
Plug 'w0rp/ale'
Plug 'preservim/tagbar'
" tree
Plug 'preservim/nerdtree'
call plug#end()
let g:python3_host_prog = '$HOME/.local/share/nvim/venv/bin/python'
" vimplug
" Configurations Part
" UI configuration
syntax on
syntax enable
" colorscheme
let base16colorspace=256
colorscheme base16-material-darker
set background=dark
" True Color Support if it's avaiable in terminal
if has("termguicolors")
set termguicolors
endif
if has("gui_running")
set guicursor=n-v-c-sm:block,i-ci-ve:block,r-cr-o:blocks
endif
set number
set hidden
" Tab and Indent configuration
set expandtab
set tabstop=4
set shiftwidth=4
" NCM2
augroup NCM2
autocmd!
" enable ncm2 for all buffers
autocmd BufEnter * call ncm2#enable_for_buffer()
" :help Ncm2PopupOpen for more information
set completeopt=noinsert,menuone,noselect
" When the <Enter> key is pressed while the popup menu is visible, it only
" hides the menu. Use this mapping to close the menu and also start a new line.
" inoremap <expr> <CR> (pumvisible() ? "\<c-y>\<cr>" : "\<CR>")
inoremap <expr> <tab> pumvisible() ? "\<c-n>" : "\<tab>"
inoremap <expr> <s-tab> pumvisible() ? "\<c-p>" : "\<tab>"
" uncomment this block if you use vimtex for LaTex
" autocmd Filetype tex call ncm2#register_source({
" \ 'name': 'vimtex',
" \ 'priority': 8,
" \ 'scope': ['tex'],
" \ 'mark': 'tex',
" \ 'word_pattern': '\w+',
" \ 'complete_pattern': g:vimtex#re#ncm2,
" \ 'on_complete': ['ncm2#on_complete#omni', 'vimtex#complete#omnifunc'],
" \ })
augroup END
" Ale
let g:ale_lint_on_enter = 0
let g:ale_lint_on_text_changed = 'never'
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
let g:ale_linters = {'python': ['flake8']}
" Airline
let g:airline_left_sep = ''
let g:airline_right_sep = ''
let g:airline#extensions#ale#enabled = 1
let airline#extensions#ale#error_symbol = 'E:'
let airline#extensions#ale#warning_symbol = 'W:'
" Toggles
nmap <F9> :NERDTreeToggle<CR>
nmap <F8> :TagbarToggle<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment