dotfiles/neovim/.config/nvim/init.vim

78 lines
1.9 KiB
VimL

set showmatch " show matching () {}
set ignorecase " case insensitive
set mouse=v " middle-click paste
set tabstop=4
set softtabstop=4
set expandtab
set shiftwidth=4
set autoindent
set number " current line number
set relativenumber " relative numbering
set wildmode=longest,list
set cc=80
set mouse=a " enable mouse click
set clipboard=unnamedplus " using system clipboard
filetype plugin on
set cursorline " highlight current cursorline
set ttyfast " speed up scrolling
set backupdir=~/.cache/nvim
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin(stdpath('data') . '/plugged')
Plug 'dracula/vim', { 'as': 'dracula' }
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'editorconfig/editorconfig-vim'
Plug 'wakatime/vim-wakatime'
call plug#end()
colorscheme dracula
" https://github.com/henrik/vim-reveal-in-finder/blob/master/plugin/reveal_in_finder.vim
function! s:RevealInFinder()
if filereadable(expand("%"))
let l:command = "open -R " . shellescape("%")
elseif getftype(expand("%:p:h")) == "dir"
let l:command = "open " . shellescape("%") . ":p:h"
else
let l:command = "open ."
endif
execute ":silent! !" . l:command
" For terminal Vim not to look messed up.
redraw!
endfunction
command! Reveal call <SID>RevealInFinder()
" Auto close, Ctrl-v to not do
ino " ""<left>
ino ' ''<left>
ino ( ()<left>
ino [ []<left>
ino { {}<left>
ino {<CR> {<CR>}<ESC>O
" no ex mode
nnoremap Q <Nop>