commit 5130c1b5f838b1855481d0c49f091c749a250272
parent 968c51c061cb2a1e9393ddb5ff04454b26764a8b
Author: oscarbenedito <oscar@oscarbenedito.com>
Date:   Tue, 21 Apr 2020 16:23:42 +0200

Reorganized vimrc and added some lines

Diffstat:
Mdot_config/nvim/init.vim | 129+++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------
1 file changed, 87 insertions(+), 42 deletions(-)

diff --git a/dot_config/nvim/init.vim b/dot_config/nvim/init.vim @@ -1,15 +1,28 @@ +" _ +" __ _(_)_ __ ___ _ __ ___ +" \ \ / / | '_ ` _ \| '__/ __| +" \ V /| | | | | | | | | (__ +" (_)_/ |_|_| |_| |_|_| \___| +" + +" plugins {{{ + call plug#begin() -Plug 'junegunn/goyo.vim' " minimalist design, nice for writing text +Plug 'junegunn/goyo.vim' " minimalist design, nice for writing text Plug 'vim-latex/vim-latex' -Plug 'sheerun/vim-polyglot' " languages syntax -Plug 'tpope/vim-surround' " surrounding objects -Plug 'tpope/vim-commentary' " easily comment objects +Plug 'sheerun/vim-polyglot' " languages syntax +Plug 'tpope/vim-surround' " surrounding objects +Plug 'tpope/vim-commentary' " easily comment objects +Plug 'tpope/vim-fugitive' " git wrapper call plug#end() -" commands for latex-suite -filetype plugin on " invokes latex-suite +" /plugins }}} + +" latex-suite {{{ + +filetype plugin on " invokes latex-suite set grepprg=grep\ -nH\ $* -filetype indent on " automatic indentation +filetype indent on " automatic indentation let g:tex_flavor='latex' let g:Tex_Folding=0 let g:Tex_AutoFolding=0 @@ -18,35 +31,50 @@ autocmd BufRead,BufNewFile *.tex set filetype=tex autocmd BufRead,BufNewFile *.cls set filetype=tex autocmd BufRead,BufNewFile *.sty set filetype=tex -" nerd tree shortcut -" map <C-n> :NERDTreeToggle<CR> +" /latex-suite }}} -" find in subdirectories -set path+=** +" change default behaviours {{{ -" copying to clipboard -set clipboard=unnamedplus +let mapleader="," " set ',' as leader +set hidden " hide buffers instead of closing them +set path+=** " find in subdirectories as well " indentation -set expandtab -set shiftwidth=2 -set tabstop=2 +set expandtab " insert spaces instead of tabs +set tabstop=4 " number of spaces when tab is pressed +set shiftwidth=2 " number of spaces for indentation + " line numbers -set number -set relativenumber +set number " show line numbers +set relativenumber " show numbers relative to current line " line wrapping -set wrap -set linebreak +set wrap " wrap lines +set linebreak " don't cut words when wrapping -" splits configuraction +" new splits position set splitbelow set splitright -" switch C-j to C-o on latex-suite -imap <C-o> <Plug>IMAP_JumpForward -nmap <C-o> <Plug>IMAP_JumpForward +" other useful defaults +syntax on " syntax coloring +set foldmethod=marker " using {{{ and }}} to delimit folding areas +set modeline " enable per-file settings with modeline +set colorcolumn=81 " color column 81 differently +set textwidth=80 " break lines longer than 80 characters +set nojoinspaces " joining lines: no double space after period + +" show blank characters when invisible +set list +set listchars=tab:>-,trail:ยท,extends:#,nbsp:. + +" /change default behaviours }}} + +" shortcuts {{{ + +" change change latex-suite C-j shortcut on normal mode +nmap <Leader>n <Plug>IMAP_JumpForward " set up vim-like commands to switch panels map <C-h> <C-w>h @@ -54,14 +82,30 @@ map <C-j> <C-w>j map <C-k> <C-w>k map <C-l> <C-w>l -" key bindings +" undo nnoremap U <C-r> -" set up colorscheme +" edit/reload config file +nmap <silent> <Leader>ev :e $MYVIMRC<CR> +nmap <silent> <Leader>sv :so $MYVIMRC<CR> + +" save with sudo privileges using w!! +cmap w!! w !sudo tee % >/dev/null + +" clean search highlights +nmap <silent> <Leader>/ :nohlsearch<CR> + +" space to toggle fold +nmap <Space> za + +" /shortcuts }}} + +" colorscheme {{{ + colorscheme onedark -set t_ut="" " deactivates vim BCE option (messes up colors) +set t_ut="" " deactivates vim BCE option (messes up colors) -if (empty($TMUX)) " 24-bit true-color configuration +if (empty($TMUX)) " 24-bit true-color configuration if (has("nvim")) let $NVIM_TUI_ENABLE_TRUE_COLOR=1 endif @@ -70,6 +114,10 @@ if (empty($TMUX)) " 24-bit true-color configuration endif endif +" /colorscheme }}} + +" status line {{{ + " set up status line " function! GitBranch() " let l:branchname = system("cd '".expand('%:p:h')."' && git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'") @@ -93,18 +141,15 @@ set statusline+=\[%{&fileformat}\] set statusline+=\ %p%% set statusline+=\ %l:%c set statusline+=\ -set laststatus=2 " activate status line +set laststatus=2 " activate status line -" other useful defaults -syntax on " syntax coloring -set foldmethod=marker " using {{{ and }}} to delimit folding areas -set modeline -set colorcolumn=81 " color line 81 differently -set textwidth=80 " break lines longer than 80 characters -map <F2> <Esc>:w<CR>:!make<CR> - -" templates -nnoremap ,sh :-1read $XDG_CONFIG_HOME/nvim/templates/shebang.sh<CR>:w<CR>:e<CR>j -nnoremap ,texs :-1read $XDG_CONFIG_HOME/nvim/templates/summary.tex<CR> -nnoremap ,texg :-1read $XDG_CONFIG_HOME/nvim/templates/tex.gitignore<CR> -nnoremap ,texm :-1read $XDG_CONFIG_HOME/nvim/templates/tex.Makefile<CR> +" /status line }}} + +" templates {{{ + +nnoremap <Leader>sh :-1read $XDG_CONFIG_HOME/nvim/templates/shebang.sh<CR>:w<CR>:e<CR>j +nnoremap <Leader>texs :-1read $XDG_CONFIG_HOME/nvim/templates/summary.tex<CR> +nnoremap <Leader>texg :-1read $XDG_CONFIG_HOME/nvim/templates/tex.gitignore<CR> +nnoremap <Leader>texm :-1read $XDG_CONFIG_HOME/nvim/templates/tex.Makefile<CR> + +" /templates }}}