70 lines
2.5 KiB
VimL
70 lines
2.5 KiB
VimL
" use Vim mode instead of pure Vi, must be the first instruction
|
|
" wrapped in conditional to avoid side effects when already set
|
|
if &compatible
|
|
set nocompatible
|
|
endif
|
|
|
|
" configure plugins using vim-plug
|
|
" https://github.com/junegunn/vim-plug
|
|
call plug#begin('~/.cache/nvim/plugged')
|
|
Plug 'https://github.com/blankname/vim-fish' " fish scripting
|
|
Plug 'https://github.com/farmergreg/vim-lastplace' " intelligently reopen files at last edit position
|
|
Plug 'https://github.com/junegunn/fzf' " fuzzy finder
|
|
Plug 'https://github.com/junegunn/fzf.vim' " fuzzy finder for vim
|
|
Plug 'https://github.com/ntpeters/vim-better-whitespace' " highlights trailing whitespace, :StripWhitespace to remove
|
|
Plug 'https://github.com/PeterRincker/vim-searchlight' " highlight current search match differently
|
|
Plug 'https://github.com/rust-lang/rust.vim' " syntax highlighting, formatting for rust
|
|
Plug 'https://github.com/tpope/vim-sensible' " defaults everyone can agree on
|
|
Plug 'https://github.com/tpope/vim-sleuth' " heuristically set buffer options
|
|
Plug 'https://github.com/vim-airline/vim-airline' " fancy statusline
|
|
call plug#end()
|
|
|
|
" Quickly edit/reload this configuration file
|
|
" To return to previous file, type ':edit #'
|
|
nnoremap gev :edit $MYVIMRC<Return>
|
|
nnoremap gsv :source $MYVIMRC<Return>
|
|
|
|
" hide line numbers at startup, toggle with F2
|
|
set nonumber norelativenumber
|
|
nnoremap <silent> <F2> :set number! relativenumber!<Return>
|
|
|
|
" highlight the cursor line, toggle with F3
|
|
nnoremap <silent> <F3> :set cursorline!<Return>
|
|
|
|
" show the effects of a command incrementally, as you type
|
|
set inccommand=nosplit
|
|
|
|
" clear highlighting with escape key
|
|
nnoremap <silent> <Esc> :noh<Return><Esc>
|
|
|
|
" fzf settings
|
|
let g:fzf_command_prefix = 'Fzf'
|
|
let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }
|
|
nmap <Leader><Tab> <Plug>(fzf-maps-n)
|
|
xmap <Leader><Tab> <Plug>(fzf-maps-x)
|
|
omap <Leader><Tab> <Plug>(fzf-maps-o)
|
|
nnoremap <C-P> :FzfFiles<Return>
|
|
nnoremap fc :FzfCommits<Return>
|
|
nnoremap ff :FzfFiles<Return>
|
|
nnoremap fh :FzfHistory<Return>
|
|
nnoremap fr :FzfRg<Return>
|
|
|
|
" disable match highlighting
|
|
let g:loaded_matchparen=1
|
|
|
|
" write settings
|
|
set confirm " confirm :q in case of unsaved changes
|
|
|
|
" clipboard settings
|
|
set clipboard=unnamedplus " enable copy/paste/yank to and from Vim/Neovim
|
|
|
|
" disable cursor-styling
|
|
" https://github.com/neovim/neovim/wiki/FAQ#how-to-change-cursor-shape-in-the-terminal
|
|
set guicursor=
|
|
autocmd OptionSet guicursor noautocmd set guicursor=
|
|
|
|
" paste settings (in Neovim, use plain insert mode)
|
|
if !has('nvim')
|
|
set pastetoggle=<F3>
|
|
endif
|