Skip to content

Instantly share code, notes, and snippets.

@jamm1985
Last active Nov 29, 2020
Embed
What would you like to do?
Vim configuration as Python IDE (and also C, tex/latex and Julia)
"colors
syntax enable
colorscheme vimbrains
"modern vim
set nocompatible
set backspace=indent,eol,start
" folding for python style
au BufNewFile,BufRead *.py set foldmethod=indent
set modelines=0
set nu
"spell
set spell
set spelllang=en,ru
"tabs
set expandtab
set tabstop=2
set shiftwidth=2
"searching
set ignorecase
set smartcase
set gdefault
set incsearch
set showmatch
set hlsearch
"Automatically change the current directory
set autochdir
"look for a tags file in the directory of the current file, then upward until / and in the working directory, then upward until /
set tags=./tags;,tags;
"plugins
call plug#begin('~/.vim/plugged')
Plug 'JuliaEditorSupport/julia-vim'
Plug 'jpalardy/vim-slime'
Plug 'scrooloose/nerdtree'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'godlygeek/tabular'
Plug 'plasticboy/vim-markdown'
Plug 'rhysd/vim-clang-format'
Plug 'justmao945/vim-clang'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'lervag/vimtex'
Plug 'dense-analysis/ale'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()
"plugins configs
"slime
let g:slime_target = "vimterminal"
let g:slime_python_ipython = 1
"nerd
map <C-n> :NERDTreeToggle<CR>
let g:NERDTreeWinSize=80
"airline
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_idx_mode = 1
nmap <leader>1 <Plug>AirlineSelectTab1
nmap <leader>2 <Plug>AirlineSelectTab2
nmap <leader>3 <Plug>AirlineSelectTab3
nmap <leader>4 <Plug>AirlineSelectTab4
nmap <leader>5 <Plug>AirlineSelectTab5
nmap <leader>6 <Plug>AirlineSelectTab6
nmap <leader>7 <Plug>AirlineSelectTab7
nmap <leader>8 <Plug>AirlineSelectTab8
nmap <leader>9 <Plug>AirlineSelectTab9
nmap <F5> <Plug>AirlineSelectPrevTab
nmap <F6> <Plug>AirlineSelectNextTab
"let g:airline_section_b = '%{strftime("%d/%m/%Y %H:%M")}'
let g:airline#extensions#whitespace#enabled = 0
"markdown
let g:vim_markdown_folding_disabled = 1
let g:vim_markdown_toc_autofit = 1
"ALE
"python linter works over coc plugin
let g:ale_linters = {'c': ['clang'], 'tex': ['chktex']}
"let g:ale_julia_executable = '/Applications/Julia-1.1.app/Contents/Resources/julia/bin/julia'
"coc config
" python plugin https://github.com/neoclide/coc-python
" snippets plugin https://github.com/neoclide/coc-snippets
" vimtex plugin https://github.com/neoclide/coc-vimtex
" to update plugins use CocUpdate
" see .vim/coc-settings.json !!
" Formatting selected code.
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
" Use K to show documentation in preview window.
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
elseif (coc#rpc#ready())
call CocActionAsync('doHover')
else
execute '!' . &keywordprg . " " . expand('<cword>')
endif
endfunction
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
let g:tex_flavor = "latex"
"vimtex
let g:tex_flavor='latex'
let g:vimtex_view_method='mupdf'
let g:vimtex_quickfix_open_on_warning=0
"status line
set laststatus=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment