.dotfiles/vimrc

89 lines
2 KiB
VimL

filetype plugin on
filetype indent on
set encoding=utf-8
" Save file as sudo even if not initially opened as sudo
command! W execute 'w !sudo tee % > /dev/null' <bar> edit!
" Custom keybinds FOR ME
nnoremap <buffer> <Leader>mm <cmd>make<CR>
nnoremap <buffer> <Leader>md :Termdebug<CR>
nnoremap <buffer> <Leader>/ :let @/ = ""<CR>
" folds
set foldmethod=syntax
set foldlevelstart=0
" make autocomplete a little more bash like
set wildmode=longest,list
set showcmd
color unokai
" searching shit
set ignorecase
set smartcase
set hlsearch
set incsearch
set relativenumber
" line number
set number
" syntax highlighting
syntax enable
" set tab width
set tabstop=4
set shiftwidth=4
set autoindent
set smartindent
set tags=./tags,tags;$HOME
" make gutentags automatically make a tags file if directory
" has a makefile
let g:gutentags_project_root = ['Makefile']
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" coc black magic
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
inoremap <silent><expr> <c-@> coc#refresh()
nmap <silent><nowait> [g <Plug>(coc-diagnostic-prev)
nmap <silent><nowait> ]g <Plug>(coc-diagnostic-next)
packadd! termdebug
highlight ColorColumn ctermbg=magenta
call matchadd('ColorColumn', '\%81v', 100)
" auto install vimplug if it is not installed
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin()
Plug 'stevearc/vim-arduino'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'ludovicchabant/vim-gutentags'
call plug#end()
" color again? but if i put it next to colorscheme it no work
highlight Normal ctermbg=16