" core.vim — general settings, basic keymaps, performance, indentation " filetype/syntax already enabled by plug#end() in plugins.vim set number set relativenumber if !g:is_tty set cursorline endif set nobackup set scrolloff=10 set nowrap set incsearch set ignorecase set smartcase set showcmd set showmode set hlsearch set history=1000 set wildmenu set wildmode=list:longest set wildignorecase set wildignore=*.docx,*.jpg,*.png,*.gif,*.pdf,*.pyc,*.exe,*.flv,*.img,*.xlsx set wildignore+=*/node_modules/*,*/.git/*,*/__pycache__/*,*/dist/*,*/build/* set mouse=a set encoding=utf-8 set foldmethod=indent set foldlevel=99 set splitbelow set splitright set backspace=indent,eol,start set nrformats-=octal set autoread set cmdheight=1 set hidden set whichwrap+=<,>,h,l set magic set showmatch set mat=2 set noerrorbells set novisualbell set t_vb= set ttimeout set ttimeoutlen=10 if $COLORTERM ==# 'gnome-terminal' set t_Co=256 endif if has("gui_running") set guioptions-=T set guioptions-=e set t_Co=256 set guitablabel=%M\ %t endif set display+=lastline set ffs=unix,dos,mac set nowb set noswapfile if has('persistent_undo') set undofile let &undodir = expand('~/.vim/.undo') silent! call mkdir(&undodir, 'p', 0700) endif " ── Text, Tab and Indent ──────────────────────────────────────────────────── if g:is_tty set listchars=tab:>-,trail:.,extends:>,precedes:<,nbsp:_ else set listchars=tab:→\ ,trail:·,extends:▸,precedes:◂,nbsp:· endif set expandtab set smarttab set shiftwidth=4 set tabstop=4 set lbr set tw=0 set autoindent set smartindent " ── Leader ────────────────────────────────────────────────────────────────── let mapleader = "," " ── Basic Keymaps ─────────────────────────────────────────────────────────── nnoremap w :w! nnoremap q :q nnoremap x :x nnoremap :noh nnoremap bd :Bclose nnoremap ba :bufdo bd nnoremap l :bnext nnoremap h :bprevious nnoremap tn :tabnew nnoremap to :tabonly nnoremap tc :tabclose nnoremap tm :tabmove nnoremap t :tabnext let g:lasttab = 1 nnoremap tl :exe "tabn ".g:lasttab augroup ChopstickTabHistory autocmd! autocmd TabLeave * let g:lasttab = tabpagenr() augroup END nnoremap te :tabedit =expand("%:p:h")/ nnoremap cd :lcd %:p:h:pwd nnoremap 0 ^ nnoremap gV `[v`] cnoremap cnoremap nnoremap :m .+1== nnoremap :m .-2== vnoremap :m '>+1gv=gv vnoremap :m '<-2gv=gv nnoremap ss :setlocal spell! nnoremap sn ]s nnoremap sp [s nnoremap sa zg nnoremap s? z= set pastetoggle= nnoremap :set invnumber nnoremap :set invrelativenumber nnoremap :set list! nnoremap za nnoremap Y y$ nnoremap Q inoremap jk vnoremap < >gv nnoremap n nzzzv nnoremap N Nzzzv vnoremap // y/\V=escape(@",'/\') nnoremap :w inoremap :w nnoremap zz nnoremap zz if has('clipboard') nnoremap y "+y vnoremap y "+y nnoremap Y "+Y nnoremap p "+p nnoremap P "+P endif nnoremap qo :copen nnoremap qc :cclose augroup ChopstickResize autocmd! autocmd VimResized * wincmd = augroup END " ── Performance ───────────────────────────────────────────────────────────── set synmaxcol=200 set ttyfast set lazyredraw set complete-=i set updatetime=300 set shortmess+=cI if g:is_tty set signcolumn=auto set synmaxcol=120 else if has("patch-8.1.1564") set signcolumn=number else set signcolumn=yes endif endif " ── Project-Local Config ──────────────────────────────────────────────────── set exrc set secure set sessionoptions=blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal " ── Format Options ────────────────────────────────────────────────────────── augroup ChopstickFormatOptions autocmd! autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions+=j augroup END augroup ChopstickPaste autocmd! autocmd InsertLeave * set nopaste augroup END set timeoutlen=500