" Sane vim defaults for ArchLabs scriptencoding utf8 " Arch defaults runtime! archlinux.vim " create the backup and undo directories silent! call mkdir($HOME.'/.config/nvim/undo', 'p') silent! call mkdir($HOME.'/.config/nvim/backup', 'p') " leader key let g:mapleader = "\" syntax enable set clipboard^=unnamed,unnamedplus " system clipboard (requires +clipboard) set number " enable line numbers set backup " create backup files in runtimepath/backup/ set undofile " persistent undo files in runtimepath/undo/ set modeline " enable vim modelines set hlsearch " highlight search items set incsearch " searches are performed as you type set confirm " ask confirmation like save before quit. set tabstop=4 " tab is equivalent to how many spaces set softtabstop=4 " tab is equivalent to how many spaces set shiftwidth=4 " amount of spaces for indentation set shortmess+=aAcws " hide or shorten certain messages set wildmenu " tab completion menu in command mode set linebreak breakindent set list listchars=tab:>>,trail:~ set wildignore+=*~,*.pyc,*/.git/*,*.so,*.swp,*.o,*.zip,*.zwc,*.png,*.jpg set mouse=niv " use the terminal mouse in command mode (:) if has('mouse_sgr') " sgr mouse is better but not every term supports it set ttymouse=sgr endif let g:netrw_altv = 1 let g:netrw_liststyle = 3 let g:netrw_browse_split = 3 if $TERM !=? 'linux' set termguicolors if has('multi_byte') && $TERM !=? 'linux' set list listchars=tab:▏\ ,extends:❯,precedes:❮ set fillchars=vert:┃ showbreak=↪ endif endif " set the colorscheme variant.. midnight, night, or day let g:jinx_theme = 'midnight' try colorscheme jinx catch colorscheme evening endtry " change cursor shape for different editing modes, neovim does this by default if !has('nvim') if exists('$TMUX') let &t_SI = "\Ptmux;\\e[5 q\\\" let &t_SR = "\Ptmux;\\e[4 q\\\" let &t_EI = "\Ptmux;\\e[2 q\\\" elseif $TERM ==# 'linux' let &t_SI = "\e[?0c" let &t_EI = "\e[?8c" else let &t_SI = "\e[6 q" let &t_SR = "\e[4 q" let &t_EI = "\e[2 q" endif endif " ------ commands ------ command! D Explore command! W exec 'silent w !sudo tee % >/dev/null'|edit! " ------ basic maps ------ " alt defaults nnoremap 0 ^ nnoremap Y y$ nnoremap n nzzzv nnoremap N Nzzzv nnoremap ==1j vnoremap == " gj/k but preserve numbered jumps ie: 12j or 45k nmap j v:count ? 'j' : 'gj' nmap k v:count ? 'k' : 'gk' " toggle folding nnoremap za :set foldenable! " fix syntax highlighting issues nnoremap U :syntax sync fromstart:redraw! " ------ autocmd ------ " when quitting a file save the cursor position and reload if file changed augroup load_changed_file autocmd! autocmd BufReadPost * call setpos(".", getpos("'\"")) autocmd FocusGained,BufEnter * if mode() !=? 'c' | checktime | endif autocmd FileChangedShellPost * echo "Changes loaded from source file" augroup END " make the built-in terminal behave a bit better if has('nvim') augroup open_terminal autocmd! autocmd TermOpen * setlocal nonumber norelativenumber modifiable | startinsert autocmd TermClose * buffer # augroup END elseif has('terminal') augroup open_terminal autocmd! autocmd TerminalOpen * setlocal nonumber norelativenumber augroup END endif " when not running in a linux console toggle some things when in insert mode if $TERM !=# 'linux' augroup active_cursorline autocmd! autocmd InsertEnter * setlocal cursorline listchars-=trail:• autocmd InsertLeave * setlocal nocursorline listchars+=trail:• augroup END else " otherwise disable cursorline set nocursorline endif