diff --git a/vim/.vimrc b/vim/.vimrc new file mode 100644 index 0000000000000000000000000000000000000000..c8fdda224ce1501727d8a181e55546a2a6acfdfd --- /dev/null +++ b/vim/.vimrc @@ -0,0 +1,183 @@ +" .vimrc +" from +" https://github.com/erkrnt/awesome-streamerrc/blob/master/ThePrimeagen/.vimrc +" http://vim.fisadev.com + +" ============================================================================ +" Vim-plug initialization +" Avoid modifying this section, unless you are very sure of what you are doing + +let vim_plug_just_installed = 0 +let vim_plug_path = expand('~/.vim/autoload/plug.vim') +if !filereadable(vim_plug_path) + echo "Installing Vim-plug..." + echo "" + silent !mkdir -p ~/.vim/autoload + silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + let vim_plug_just_installed = 1 +endif + +" manually load vim-plug the first time +if vim_plug_just_installed + :execute 'source '.fnameescape(vim_plug_path) +endif +" ============================================================================ + +" ---- PLUGINS ---------------------------------------------------------------- +" +" https://github.com/junegunn/vim-plug +" install plugins with :PlugInstall +" clean unused plugins :PlugClean +" +call plug#begin('~/.vim/plugged') + +Plug 'morhetz/gruvbox' " color scheme +"Plug 'tpope/vim-fugitive' " git integration +"Plug 'lyuts/vim-rtags' " C++ +"Plug 'ycm-core/YouCompleteMe' +"Plug 'mbbill/undotree' + + +" Airline (status bar on the bottom) +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' + +call plug#end() +" ----------------------------------------------------------------------------- + + +" ============================================================================ +" Install plugins the first time vim runs +if vim_plug_just_installed + echo "Installing Bundles, please ignore key map error messages" + :PlugInstall +endif +" ============================================================================ + + +" mouse +set mouse-=a " disable custom mouse in vim (so that we can select +"if has("mouse") +" set mouse=a " control cursor with the mouse +"endif + +syntax on " syntax highlighting + + +" hides buffers instead of closing them. This means that you can have unwritten +" changes to a file and open a new file using :e, without being forced to write +" or undo your changes first +"set hidden + +"set nocompatible " useless + +set visualbell +set noerrorbells " no sounds + +set tabstop=4 " size of tabs (set ts=4 also works) +set shiftwidth=4 " indent using '>' uses 4 spaces +set softtabstop=4 +set expandtab " tabs => spaces +set smartindent +set number " line numbers (set nu) +set nowrap " no wrapping of long lines + +set noswapfile +set nobackup " because undodir/undofile +set undodir=~/.vim/undodir +set undofile +if !isdirectory(&undodir) + call mkdir(&undodir, "p") +endif + +set hlsearch " highlight search terms +set incsearch " incremental search +set ignorecase +set smartcase " ignore case if search pattern is all lowercase, + " case-sensitive otherwise + +set cmdheight=2 " more space for displaying msgs + +" when scrolling, keep cursor 3 lines away from screen border +set scrolloff=3 + + + +" colours/theme +set background=dark + +" use 256 colors when possible +if has('gui_running') || (&term =~? 'mlterm\|xterm\|xterm-256\|screen-256') + if !has('gui_running') + let &t_Co = 256 + endif + colorscheme gruvbox + "colorscheme desert "moche +else + colorscheme delek "tres moche +endif + + + +set cursorline " highlight the line of the cursor +set colorcolumn=80 " highlight column #80 +highlight CorlorColumn ctermbg=0 guibg=lightgrey +" highlight text beyond column 80 +highlight OverLength ctermbg=71 ctermfg=white guibg=#592929 +match OverLength /\%81v.\+/ + + +" the default file browser in vim is netrw (cmd :Explore) +" https://shapeshed.com/vim-netrw/ +let g:netrw_banner = 0 " remove banner (key `I`) +let g:netrw_browse_split = 2 " open files in a new vertical split +let g:netrw_winsize = 25 " sets the width to 25% of the page +let g:netrw_liststyle = 3 " default list style (key `i`) + + + +" defines a `leader key` for custom shortcuts +let mapleader=" " + +" REMAPs + +" move cursor to other splits +nnoremap <leader>h :wincmd h<CR> +nnoremap <leader>j :wincmd j<CR> +nnoremap <leader>k :wincmd k<CR> +nnoremap <leader>l :wincmd l<CR> +" open explorer +nnoremap <leader>pv :wincmd v<bar> :Ex <bar> :vertical resize 30<CR> +" resize splits +nnoremap <silent> <Leader>+ :vertical resize +5<CR> +nnoremap <silent> <Leader>- :vertical resize -5<CR> + + + + + + + +" Remove newbie crutches in Command Mode +"cnoremap <Down> <Nop> +"cnoremap <Left> <Nop> +"cnoremap <Right> <Nop> +"cnoremap <Up> <Nop> + +" Remove newbie crutches in Insert Mode +"inoremap <Down> <Nop> +"inoremap <Left> <Nop> +"inoremap <Right> <Nop> +"inoremap <Up> <Nop> + +" Remove newbie crutches in Normal Mode +"nnoremap <Down> <Nop> +"nnoremap <Left> <Nop> +"nnoremap <Right> <Nop> +"nnoremap <Up> <Nop> + +" Remove newbie crutches in Visual Mode +"vnoremap <Down> <Nop> +"vnoremap <Left> <Nop> +"vnoremap <Right> <Nop> +"vnoremap <Up> <Nop>