let mapleader = "," " Check if vim-plug is installed, otherwise download and install if empty(glob('~/.local/share/nvim/site/autoload/plug.vim')) silent !curl -fLo ~/.local/share/nvim/site/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('~/.local/share/nvim/site/plugged') Plug 'junegunn/goyo.vim' Plug 'PotatoesMaster/i3-vim-syntax' Plug 'tpope/vim-commentary' Plug 'junegunn/fzf' Plug 'junegunn/fzf.vim' Plug 'preservim/nerdtree' Plug 'ervandew/supertab' Plug 'jamessan/vim-gnupg' Plug 'majutsushi/tagbar' Plug 'rust-lang/rust.vim' Plug 'cespare/vim-toml' Plug 'pangloss/vim-javascript' Plug 'ap/vim-css-color' Plug 'https://gitlab.com/HiPhish/info.vim' Plug 'rhysd/git-messenger.vim' if has('nvim-0.6') Plug 'neovim/nvim-lspconfig' Plug 'ojroques/nvim-lspfuzzy' endif call plug#end() " Some basics: set nocompatible filetype plugin on syntax on set foldmethod=syntax set omnifunc=syntaxcomplete#Complete set completeopt=menuone,noinsert set guicursor=n-v-sm:block,i-ci-c-ve:ver25,r-cr-o:block set cursorline set redrawtime=1000 set relativenumber set scrolloff=5 set colorcolumn=+1 set textwidth=80 set mouse=a set number " Colors let g:ultramar_italic=1 let g:ultramar_opaque_bg=0 colorscheme ultramar if $COLORSCHEME == "light" set background=light endif set termguicolors function! ChangeBG() if &background == "light" set background=dark return endif set background=light endfunction map :call ChangeBG() let g:markdown_fenced_languages = ['c', 'go', 'sh', 'bash=sh', 'python', 'html', 'css', 'javascript'] " Set screen title set title " let &titlestring = "NVIM - " . expand("%:t") " if &term == "screen" " set t_ts=^[k " set t_fs=^[\ " endif " au BufEnter * let &titlestring = "NVIM - " . expand("%t") " Functions for git branch name on statusline function! GitBranch() return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'") endfunction function! StatuslineGit() let l:branchname = GitBranch() return strlen(l:branchname) > 0?'  '.l:branchname.' ':'' endfunction " Statusline let laststatus=2 set statusline= set statusline+=%#CursorLineNR# set statusline+=%{StatuslineGit()} set statusline+=%#StatusLine# set statusline+=%< set statusline+=\ %f%r%m set statusline+=%= set statusline+=\ %l/%L,%c%V set statusline+=\ set statusline+=%#StatusLineNC# set statusline+=\ %Y set statusline+=\ %{&fileencoding?&fileencoding:&encoding} set statusline+=\[%{&fileformat}\] set statusline+=\ " default indentation filetype plugin indent on set noexpandtab set copyindent set preserveindent set softtabstop=0 set tabstop=4 set shiftwidth=4 " Splits open at the bottom and right, which is non-retarded, unlike vim defaults. set splitbelow set splitright " To avoid switching between keyboards set langmap=ФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯХЪБЮ;ABCDEFGHIJKLMNOPQRSTUVWXYZ{}<>,фисвуапршолдьтщзйкыегмцчняхъэ;abcdefghijklmnopqrstuvwxyz[]' " Toggle relative line numbers map e :set invrelativenumber map у :set invrelativenumber " Shortcutting split navigation, saving a keypress: map h map j map k map l " Open the selected text in a split (i.e. should be a file). map o "oyaW:sp o xnoremap o "oy:sp o vnoremap o "oy:sp o " Replace all is aliased to S. nnoremap S :%s//g nnoremap Ы :%s//g " Compile document map c :!doccompiler % map с :!doccompiler % " Spell-check set to F2: map :setlocal spell! spelllang=en_us,es,ru " Save changes noremap s :update noremap ы :update " Copy to clipboard vnoremap y "+y nnoremap Y "+yg_ nnoremap y "+y nnoremap yy "+yy " with russian layout vnoremap н "+y nnoremap Н "+yg_ nnoremap н "+y nnoremap нн "+yy " Paste from clipboard nnoremap p "+p nnoremap P "+P vnoremap p "+p vnoremap P "+P " with russian layout nnoremap з "+p nnoremap З "+P vnoremap з "+p vnoremap З "+P " Enable autocompletion: set wildmode=list:longest,full set wildmenu " Automatically deletes all tralling whitespace on save. "autocmd BufWritePre * %s/\s\+$//e " Runs a script that cleans out tex build files whenever I close out of a .tex file. autocmd VimLeave *.tex !texclear % " Disables automatic commenting on newline: autocmd FileType * setlocal formatoptions-=o " C-T for new tab nnoremap :tabe " Navigating with guides inoremap /<++>"_c4l vnoremap /<++>"_c4l map /<++>"_c4l inoremap ;gui <++> inoremap жпгш <++> inoremap ñgui <++> " Replace ex mode with gq map Q gq " with russian layout map Й gq " For normal mode when can't remap caps to escape inoremap jw inoremap wj " SuperTab let g:SuperTabDefaultCompletionType = "context" let g:SuperTabContextDefaultCompletionType = "" " NERDTree map r :NERDTreeToggle map к :NERDTreeToggle " FZF let g:fzf_preview_window = ['hidden,right,50%,<70(hidden,up,40%)', 'ctrl-\'] map f :Files map а :Files map F :Rg map А :Rg " Open new terminal in current directory map t :!setsid $TERMINAL & map е :!setsid $TERMINAL & " Tagbar map :TagbarToggle " Goyo let g:goyo_width = 100 let g:goyo_linenr = 1 map gg :Goyo " Insert datetime map d :r!date +"\%Y-\%m-\%dT\%H:\%M:\%S"kJ map в :r!date +"\%Y-\%m-\%dT\%H:\%M:\%S"kJ " LSP if has('nvim-0.6') set omnifunc=v:lua.vim.lsp.omnifunc lua require('lspconfig').clangd.setup{filetypes = { "c", "cpp", "objc", "objcpp", "ch" }} lua require('lspconfig').gopls.setup{} lua require('lspconfig').pylsp.setup{} lua require('lspconfig').rls.setup{} lua require('lspconfig').quick_lint_js.setup{} lua require('lspfuzzy').setup{} endif " LSP keybinds nmap gd lua vim.lsp.buf.definition() nmap gD lua vim.lsp.buf.declaration() nmap gK lua vim.lsp.buf.hover() nmap gz lua vim.lsp.buf.references() nmap n lua vim.lsp.buf.rename() nmap b lua vim.lsp.buf.formatting() nmap a lua vim.lsp.buf.code_action() nmap w lua vim.lsp.buf.workspace_symbol() nmap l lua vim.diagnostic.setloclist() nmap ]g lua vim.diagnostic.goto_next() nmap [g lua vim.diagnostic.goto_prev() " Termdebugger keybinds nmap gn :Over nmap gs :Step nmap gc :Continue nmap gu :Until nmap gb :Break nmap gC :Clear " File format preferences " MFing neovim overrding my omnifunc with whatever ccomplete is autocmd FileType c,ch,header,cpp setlocal omnifunc=v:lua.vim.lsp.omnifunc " No, Rust, spaces is not superior to tabs, 100 lines is too much autocmd FileType rust setlocal noet ci pi sts=0 ts=4 sw=4 tw=80 autocmd FileType meson setlocal noet ci pi sts=0 ts=4 sw=4 tw=80 autocmd FileType tex setlocal spell spelllang=en_us,es,ru tw=80 | \ let b:SuperTabContextDefaultCompletionType = "" autocmd FileType text setlocal spell spelllang=en_us,es,ru tw=80 | \ let b:SuperTabContextDefaultCompletionType = "" autocmd FileType mail setlocal spell spelllang=en_us,es,ru tw=72 | \ let b:SuperTabContextDefaultCompletionType = "" autocmd FileType markdown setlocal spell spelllang=en_us,es,ru tw=80 | \ let b:SuperTabContextDefaultCompletionType = "" " C indentation rules set cino=:0l1 " For project-specific configuration set exrc set secure