Skip to content

Instantly share code, notes, and snippets.

@atareao
Created July 13, 2021 12:32
Show Gist options
  • Save atareao/b367dc1639eacae3b56a6e3436545780 to your computer and use it in GitHub Desktop.
Save atareao/b367dc1639eacae3b56a6e3436545780 to your computer and use it in GitHub Desktop.
set encoding=utf-8
let g:ale_disable_lsp = 1
" Auto installation of Plug
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Plugins
call plug#begin('~/.local/share/nvim/plugged')
Plug 'davidhalter/jedi-vim'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'zchee/deoplete-jedi'
Plug 'dense-analysis/ale'
" Airline
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'jiangmiao/auto-pairs'
" Rust
Plug 'vim-test/vim-test'
Plug 'rust-lang/rust.vim'
" Git integration
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'
" Code and files fuzzy finder
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
" Change cursor in Insert and Replace
Plug 'wincent/terminus'
" Color scheme
Plug 'ayu-theme/ayu-vim'
call plug#end()
" Deoplete
let g:deoplete#enable_at_startup = 1
" -------------- Airline ---------------
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" -------------- template ---------------
augroup templates
au!
let g:template_name = 'Lorenzo Carbonell <a.k.a. atareao>'
autocmd BufNewFile *.* silent! execute '0r $HOME/.config/nvim/templates/'.expand("<afile>:e").'.tpl'
autocmd BufNewFile * %s/{{YEAR}}/\=strftime('%Y')/ge
autocmd BufNewFile * %s/{{NAME}}/\=template_name/ge
autocmd BufNewFile * %s/{{EVAL\s*\([^}]*\)}}/\=eval(submatch(1))/ge
augroup END
" -------------- personal ---------------
" unicode symbols
let g:airline_left_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
let g:airline_symbols.linenr = '|'
let g:airline_symbols.linenr = '|'
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'
" airline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = '|'
set splitright
set splitbelow
" ---- Color theme -----
" important!!
if has('termguicolors')
set termguicolors
endif
" The configuration options should be placed before `colorscheme sonokai`.
let ayucolor="light"
" let ayucolor="mirage"
" let ayucolor="dark"
colorscheme ayu
" Map leader key to space
let mapleader = " " " map leader to Space
" Relative number
set number relativenumber
" Line wrap
set wrap linebreak nolist
" Highlight search
set incsearch
set hlsearch
set ignorecase
set smartcase
" Show column 80
if exists('+colorcolumn')
set colorcolumn=80
else
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
endif
" Show ruler
set ruler
" Spell
setlocal spell spelllang=es
hi SpellBad ctermfg=015 ctermbg=009 cterm=bold
"Run Python from Vim
autocmd FileType python map <buffer> <F5> :w<CR>:exec '!python3' shellescape(@%, 1)<CR>
autocmd FileType python imap <buffer> <F5> <esc>:w<CR>:exec '!python3' shellescape(@%, 1)<CR>
setlocal ts=4 sts=4 sw=4 expandtab
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" ---- Remap arrow keys ----
cnoremap <Down> <Nop>
cnoremap <Left> <Nop>
cnoremap <Right> <Nop>
cnoremap <Up> <Nop>
cnoremap <C-j> <Down>
cnoremap <C-k> <Up>
cnoremap <C-h> <Left>
cnoremap <C-l> <Right>
inoremap <Down> <Nop>
inoremap <Left> <Nop>
inoremap <Right> <Nop>
inoremap <Up> <Nop>
inoremap <C-j> <Down>
inoremap <C-k> <Up>
inoremap <C-h> <Left>
inoremap <C-l> <Right>
nnoremap <Down> <Nop>
nnoremap <Left> <Nop>
nnoremap <Right> <Nop>
nnoremap <Up> <Nop>
vnoremap <Down> <Nop>
vnoremap <Left> <Nop>
vnoremap <Right> <Nop>
vnoremap <Up> <Nop>
vnoremap <C-j> <Down>
vnoremap <C-k> <Up>
vnoremap <C-h> <Left>
vnoremap <C-l> <Right>
" ---- Backup ----
" Put all temporary files under the same directory.
" https://github.com/mhinz/vim-galore#handling-backup-swap-undo-and-viminfo-files
set backup
set backupdir =$HOME/.config/nvim/backup/
set backupext =-vimbackup
set backupskip =
set directory =$HOME/.config/nvim/swap/
set updatecount =100
set undofile
set undodir =$HOME/.config/nvim/undo/
set viminfo ='100,n$HOME/.config/nvim/info/viminfo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment