Created
November 15, 2022 14:13
-
-
Save pbabics/433dfbe73b96a841b491e1bf471032ab to your computer and use it in GitHub Desktop.
nvim config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
silent !stty -ixon > /dev/null 2>/dev/null | |
let g:python_host_prog = '/home/peter/.pyenv/versions/neovim2/bin/python' | |
let g:python3_host_prog = '/home/peter/.pyenv/versions/neovim3/bin/python' | |
set t_Co=256 | |
set laststatus=2 | |
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.config/nvim/bundle/Vundle.vim | |
call vundle#begin() | |
" let Vundle manage Vundle, required | |
Plugin 'VundleVim/Vundle.vim' | |
Plugin 'tpope/vim-markdown' | |
Plugin 'tpope/tpope-vim-abolish' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'tpope/vim-commentary' | |
Plugin 'tpope/vim-sensible' | |
Plugin 'vim-airline/vim-airline' | |
Plugin 'vim-airline/vim-airline-themes' | |
Plugin 'ctrlpvim/ctrlp.vim' | |
Plugin 'itkq/fluentd-vim' | |
Plugin 'leafgarland/typescript-vim' | |
Plugin 'dense-analysis/ale' | |
Plugin 'mhinz/vim-sayonara' | |
Plugin 'Janiczek/vim-latte' | |
let g:airline_theme='luna' | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline_powerline_fonts = 1 | |
let g:ale_linters = {'python':['cq','mypy']} | |
" All of your Plugins must be added before the following line | |
call vundle#end() " required | |
filetype plugin indent on " required | |
" Modules | |
set number | |
set modeline | |
set autoindent | |
set smartindent | |
set hidden | |
nnoremap <C-e> <C-w> | |
inoremap <C-e> <C-w> | |
" Tab navigation like Firefox. | |
nnoremap <C-A-PageUp> :bprevious<CR> | |
nnoremap <C-A-PageDown> :bnext<CR> | |
inoremap <C-A-PageUp> :bprevious<CR> | |
inoremap <C-A-PageDown> :bnext<CR> | |
" Misc Commands | |
nnoremap <C-s> :w<CR> | |
inoremap <C-s> :w<CR> | |
nnoremap <C-q> :Sayonara<CR> | |
inoremap <C-q> :Sayonara<CR> | |
" Hackfix for autocompletion | |
inoremap <C-Space> <C-x><C-o> | |
imap <buffer> <Nul> <C-Space> | |
smap <buffer> <Nul> <C-Space> | |
" Highlight whitespace at the end of line | |
highlight EOLWhitespace ctermbg=21 ctermfg=white guifg=#0000ff "rgb=0,0,255 | |
let w:hi_eol_whitespace = matchadd('EOLWhitespace', '\s\+$') | |
augroup python | |
au! | |
autocmd BufNewFile,BufRead *.py,*.pyx,*.pxd setlocal sts=4 ts=4 sw=4 expandtab | |
autocmd BufNewFile,BufRead */quantlane/**/*.py,*/quantlane/**/*.pyx,*/quantlane/**/*.pxd setlocal sts=2 ts=2 sw=2 noexpandtab | |
autocmd BufWinEnter *.py,*.pyx call s:pythonHighlighting() | |
function s:pythonHighlighting() | |
" Highlights characters that are over length of line (121 characters) | |
highlight OverLength ctermbg=13 ctermfg=white guibg=#592929 | |
let w:hi_over_length = matchadd('OverLength', '\%121v.\+') | |
highlight InTextIndent ctermbg=7 ctermfg=white guifg=#5f5f00 "rgb=95,95,0 | |
" Highlights tabs in between text (after indentation) | |
let w:hi_mixed_ident = matchadd('InTextIndent', '[^\t]\@<=\t\+') | |
" Highlights multiple indentation between text | |
let w:hi_multiple_ident = matchadd('InTextIndent', '[^ \t]\@<=\s\{2,}[^ \t]\@=') | |
" Highlights spaces after tabs in initial indent | |
highlight SpacesIndentation ctermbg=3 ctermfg=white guifg=#5f5f00 "rgb=95,95,0 | |
let w:hi_mixed_initial_ident = matchadd('SpacesIndentation', '\(\_^\t\+\)\@<= \+') | |
highlight GuidelineConflict ctermbg=22 ctermfg=white guifg=#939300 | |
" Highlights class name which is not in cammel case | |
let w:hi_invalid_class_name = matchadd('GuidelineConflict', '^\s\+class\s\+\zs\([^:(]*[^a-zA-Z_:(][^:(]*\|[a-z][a-zA-Z]*\)\ze[:(]') | |
" Highlights def name which is not in snakecase | |
let w:hi_invalid_def_name = matchadd('GuidelineConflict', '^\s\+\(async\s\+\)\?def\s\+\zs[^(]*[^a-z0-9_][^(]*\ze(') | |
" Highlights invalid dict(), list() use | |
let w:hi_invalid_dict_list_use = matchadd('GuidelineConflict', '\v[^a-zA-Z_](dict|list)\(\s*[^ \t]\+\s*\)') | |
" Highlights pylint use of code disable | |
let w:hi_pylint_disable = matchadd('GuidelineConflict', 'pylint:\s\+disable\s*=\s*[DIWE][0-9]\+') | |
" Highlights blanket import, allow only typing | |
let w:hi_blanked_import = matchadd('GuidelineConflict', '\v^from\s+(ql_types[ \t.]|typing[ \t.]|\.[ \t]|\.\.[ \t])@!&.*') | |
endfunction | |
augroup END | |
augroup shell_files | |
au! | |
autocmd BufNewFile,BufRead *.yml.template,*.yml,*.yaml.template,*.yaml,*.yml.jinja2,*.yml.j2,*.sh,.bashrc,.profile,.bash_profile setlocal sts=2 ts=2 sw=2 expandtab | |
autocmd BufNewFile,BufRead *.yml.template,*.yml,*.yaml.template,*.yaml,*.yml.jinja2,*.yml.j2 setf yaml | |
augroup END | |
augroup c_files | |
au! | |
autocmd BufNewFile,BufRead *.c,*.cpp,*.h,*.hpp setlocal sts=2 ts=2 sw=2 noexpandtab | |
augroup END | |
augroup web_scripts | |
au! | |
autocmd BufNewFile,BufRead *.js,*.tsx,*.ts setlocal sts=2 ts=2 sw=2 noexpandtab | |
autocmd BufNewFile,BufRead *.tsx,*.ts setf typescript | |
augroup END | |
augroup rst | |
au! | |
autocmd BufNewFile,BufRead *.rst setlocal sts=4 ts=4 sw=4 expandtab | |
augroup END | |
set iskeyword-=_ | |
" 1. base64-encode(visual-selection) -> F2 -> encoded base64-string | |
vnoremap <F2> c<c-r>=system("base64 -w 0", @")<cr><esc> | |
" 2. base64-decode(visual-selection) -> F3 -> decoded string | |
vnoremap <F3> c<c-r>=system("base64 -d", @")<cr> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment