dotfiles/nvim/init.vim
2024-02-04 16:51:31 +01:00

219 lines
4.5 KiB
VimL

if has('win32') || has ('win64')
let $VIMHOME = $HOME."/vimfiles"
set backupdir=$TEMP//
set directory=$TEMP//
else
let $VIMHOME = $HOME."/.vim"
endif
let g:vimtex_compiler_progname = "nvr"
let g:vimtex_view_method = 'zathura'
" let g:vimtex_latexmk_options = '-pdf -bibtex -pdflatex="xelatex -synctex=1 \%S \%O" -verbose -file-line-error -interaction=nonstopmode'
let g:deoplete#enable_at_startup = 1
set mouse=a
let g:tmpl_search_paths = [ $VIMHOME.'/templates' ]
call plug#begin($VIMHOME.'/plugged')
" Plug 'terryma/vim-multiple-cursors'
Plug 'thinca/vim-localrc'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'rafi/awesome-vim-colorschemes'
Plug 'lervag/vimtex'
Plug 'tpope/vim-surround'
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-repeat'
Plug 'tibabit/vim-templates'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'gootorov/q-sharp.vim'
Plug 'tpope/vim-fugitive'
Plug 'junegunn/fzf.vim'
Plug 'simnalamburt/vim-mundo'
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
" load local plugins
if filereadable("~/.local-plugins.vimrc")
source "~/.local-plugins.vimrc"
endif
call plug#end()
let g:deoplete#enable_at_startup = 1
let g:deoplete#disable_auto_complete = 1
let g:LanguageClient_serverCommands = {
\ 'python': ['/home/kadet/.config/nvim/venv/env/bin/pyls'],
\ 'c': ['clangd'],
\ }
call deoplete#custom#var('omni', 'input_patterns', {
\ 'tex': g:vimtex#re#deoplete
\})
set colorcolumn=80,120
set t_Co=256
set diffopt+=vertical
"
" My own config
"
" one time settings
if !exists("g:running")
" " Conemu specific settings
" if !has('gui_running') && !has('nvim')
" set term=xterm
" inoremap <Char-0x07F> <BS>
" nnoremap <Char-0x07F> <BS>
" let &t_AB="\e[48;5;%dm"
" let &t_AF="\e[38;5;%dm"
" inoremap <Esc>[62~ <C-X><C-E>
" inoremap <Esc>[63~ <C-X><C-Y>
" nnoremap <Esc>[62~ <C-E>
" nnoremap <Esc>[63~ <C-Y>
" endif
if has('gui_running')
set guifont=Fira_Code_Medium:h9:cANSI:qDRAFT
set guioptions=
set columns=200
set lines=58
endif
endif
let g:running = 1
" UTF-8 support
if has("multi_byte")
if &termencoding == ""
let &termencoding = &encoding
endif
set enc=utf-8
set encoding=utf-8
setglobal fileencoding=utf-8
" setglobal bomb
" set fileencodings=ucs-bom,utf-8,latin1
endif
" undo
set undofile
set undodir=$VIMHOME/undo
set undolevels=1000
" i like to have ctrl-x menu
set shortmess-=c
" Required for operations modifying multiple buffers like rename.
set hidden
set splitbelow
set shellslash
" set backspace=2
set autoindent
" tabs
set expandtab
set tabstop=4
set shiftwidth=4
" syntax
syntax on
set number
" colors
set termguicolors
colorscheme molokai
" disable bells
set noeb vb t_vb=
let &t_SI = "\<Esc>[6 q"
let &t_SR = "\<Esc>[6 q"
let &t_EI = "\<Esc>[2 q"
" filetypes
" autocmd FileType c,cpp :compiler cl
au FileType asm :set ft=masm
au FileType tex :set tw=120 spell spelllang=pl ft=tex
" airline
let g:airline_powerline_fonts = 0
let g:airline_theme = "powerlineish"
let g:airline#extensions#tabline#enabled = 1
" ctrlp
let g:ctrlp_switch_buffer = 'Et'
" ycm config
let g:ycm_confirm_extra_conf = 0
" vim surround
let g:surround_{char2nr('c')} = "\\\1command\1{\r}"
" no arrows
nnoremap <Left> <Nop>
nnoremap <Right> <Nop>
nnoremap <Up> <Nop>
nnoremap <Down> <Nop>
set completeopt=longest,menuone
" remapings
nnoremap YY :%y+<CR>
nnoremap <leader><cr> :nohlsearch<cr>
noremap <leader>y "*y
noremap <leader>Y "*Y
noremap <leader>p "*p
noremap <leader>P "*P
noremap <leader>q gq<cr>
nnoremap <c-s-tab> gT
nnoremap <c-tab> gt
nnoremap <space>a ggVG
vnoremap > >gv
vnoremap < <gv
nnoremap gd< :diffget //2 | diffupdate
nnoremap gd> :diffget //3 | diffupdate
command! SetCwd :cd %:p:h
nnoremap <F4> :call LanguageClient_contextMenu()<CR>
nnoremap <F6> :SetCwd<CR>
map <F5> :set rnu!<CR>
map <C-F5> :source ~/.vimrc<CR>
vnoremap gO "py<Esc>:e <C-R>p<CR>
vnoremap gT "py<Esc>:tabe <C-R>p<CR>
inoremap <silent><expr> <C-Space>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ deoplete#manual_complete()
function! s:check_back_space() abort "{{{
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction"}}}
nmap \\ :Files<CR>
" local settings
if filereadable("~/.local.vimrc")
source "~/.local.vimrc"
endif