Simplify vim config
parent
004de0eb1f
commit
340fe01281
@ -0,0 +1,105 @@
|
||||
" Mappings
|
||||
let mapleader=","
|
||||
let g:mapleader=","
|
||||
|
||||
map <leader>rl :source $MYVIMRC<CR>
|
||||
map <leader>ss :setlocal spell!<CR>
|
||||
map <leader>ts :%s/\s\s*$//g<CR>
|
||||
nnoremap <leader>rc :split $MYVIMRC<cr>
|
||||
nnoremap <leader>p :set paste<cr>
|
||||
nnoremap <leader>np :set nopaste<cr>
|
||||
nnoremap <leader>nn :set nonumber norelativenumber<cr>
|
||||
nnoremap <leader>rn :set number relativenumber<cr>
|
||||
|
||||
" commands
|
||||
command! W write
|
||||
command! Q qall!
|
||||
|
||||
" Vim Tabs
|
||||
map <leader>tt :tabnew<cr>
|
||||
map <leader>te :tabedit
|
||||
map <leader>tc :tabclose<cr>
|
||||
map <leader>to :tabonly<cr>
|
||||
map <leader>tn :tabNext<cr>
|
||||
map <leader>tp :tabprevious<cr>
|
||||
map <leader>tf :tabfirst<cr>
|
||||
map <leader>tl :tablast<cr>
|
||||
map <leader>tm :tabmove
|
||||
|
||||
" Basics
|
||||
set encoding=utf-8
|
||||
|
||||
" General
|
||||
" setlocal spell spelllang=en_us
|
||||
set fileformats=unix,dos,mac
|
||||
set nostartofline
|
||||
set autochdir
|
||||
set colorcolumn=81
|
||||
|
||||
" Have tab complete work more like bash
|
||||
set wildmode=list:longest
|
||||
set whichwrap+=<,>,[,]
|
||||
set magic
|
||||
|
||||
" Turn on omni completion. Must have `filetype plugin on` to use.
|
||||
" To use, in insert mode press ctrl+x ctrl+o
|
||||
set omnifunc=syntaxcomplete#Complete
|
||||
set completeopt=menu,longest,preview
|
||||
|
||||
" Indent
|
||||
set smartindent
|
||||
set copyindent
|
||||
set preserveindent
|
||||
set shiftround
|
||||
|
||||
" Text Formatting/Layout
|
||||
set nowrap
|
||||
set ignorecase
|
||||
set smartcase
|
||||
set list
|
||||
|
||||
" UI
|
||||
set showcmd
|
||||
set number relativenumber
|
||||
set numberwidth=4
|
||||
set hidden
|
||||
|
||||
" Cues
|
||||
set showmatch
|
||||
set matchtime=2
|
||||
set hlsearch
|
||||
set noerrorbells
|
||||
set novisualbell
|
||||
set t_vb=
|
||||
set timeoutlen=500
|
||||
|
||||
" Tabs
|
||||
set complete-=i
|
||||
set autoindent
|
||||
set backspace=indent,eol,start
|
||||
set smarttab
|
||||
set noexpandtab
|
||||
set shiftwidth=4
|
||||
set softtabstop=4
|
||||
set tabstop=4
|
||||
|
||||
set autoread
|
||||
|
||||
" Status
|
||||
" ~/file [type] [line,column] [number of lines]
|
||||
"set statusline=%F%m%r%h%w\ [%Y]\ [%03l,%03v]\ [%L]
|
||||
|
||||
set laststatus=2
|
||||
set ruler
|
||||
set wildmenu
|
||||
|
||||
set nrformats-=octal
|
||||
|
||||
set incsearch
|
||||
set sessionoptions-=options
|
||||
set viewoptions-=options
|
||||
|
||||
augroup COMMIT_EDITMSG
|
||||
autocmd!
|
||||
autocmd BufRead,BufNewFile COMMIT_EDITMSG set filetype=gitcommit
|
||||
augroup END
|
@ -1,23 +0,0 @@
|
||||
" Mappings
|
||||
let mapleader=","
|
||||
let g:mapleader=","
|
||||
|
||||
map <leader>rl :source $MYVIMRC<CR>
|
||||
map <leader>ss :setlocal spell!<CR>
|
||||
map <leader>ts :%s/\s\s*$//g<CR>
|
||||
nnoremap <leader>rc :split $MYVIMRC<cr>
|
||||
nnoremap <leader>p :set paste<cr>
|
||||
nnoremap <leader>np :set nopaste<cr>
|
||||
nnoremap <leader>nn :set nonumber norelativenumber<cr>
|
||||
nnoremap <leader>rn :set number relativenumber<cr>
|
||||
|
||||
" Vim Tabs
|
||||
map <leader>tt :tabnew<cr>
|
||||
map <leader>te :tabedit
|
||||
map <leader>tc :tabclose<cr>
|
||||
map <leader>to :tabonly<cr>
|
||||
map <leader>tn :tabNext<cr>
|
||||
map <leader>tp :tabprevious<cr>
|
||||
map <leader>tf :tabfirst<cr>
|
||||
map <leader>tl :tablast<cr>
|
||||
map <leader>tm :tabmove
|
@ -1,4 +0,0 @@
|
||||
Plug 'bfrg/vim-jq'
|
||||
Plug 'cespare/vim-toml', { 'for': 'toml' }
|
||||
Plug 'editorconfig/editorconfig-vim', { 'tag': 'v1.1.1' }
|
||||
Plug 'tpope/vim-surround', { 'tag': 'v2.2' }
|
@ -1,9 +0,0 @@
|
||||
" chezmoi:template:left-delimiter="{{
|
||||
"{{- /* vim: set filetype=vim: */ -}}
|
||||
"{{- if lookPath "fzf" -}}
|
||||
Plug 'junegunn/fzf', { 'tag': '0.40.0' }
|
||||
Plug 'junegunn/fzf.vim'
|
||||
|
||||
map <leader>fz :GFiles<CR>
|
||||
map <leader>rg :Rg<CR>
|
||||
"{{- end }}
|
@ -1,5 +0,0 @@
|
||||
" chezmoi:template:left-delimiter="{{
|
||||
"{{- /* vim: set filetype=vim: */ -}}
|
||||
"{{- if lookPath "go" -}}
|
||||
Plug 'fatih/vim-go'
|
||||
"{{- end }}
|
@ -1,30 +0,0 @@
|
||||
Plug 'preservim/nerdtree', { 'tag': '6.10.16' }
|
||||
|
||||
let g:NERDTreeDirArrowExpandable = '▸'
|
||||
let g:NERDTreeDirArrowCollapsible = '▾'
|
||||
|
||||
let NERDTreeDirArrows=1
|
||||
|
||||
map <leader>nt :NERDTreeToggle<CR>
|
||||
|
||||
" Close nerdtree if it's the last buffer
|
||||
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree()
|
||||
\ | quit
|
||||
\ | endif
|
||||
|
||||
" Mirror nerdtree in each tab
|
||||
autocmd BufWinEnter * silent NERDTreeMirror
|
||||
|
||||
" check if reading from stdin
|
||||
autocmd StdinReadPre * let s:std_in=1
|
||||
|
||||
" open nerdtree if no args in passed to vim
|
||||
autocmd VimEnter * if argc() == 0 && !exists('s:std_in') | NERDTree | wincmd p | endif
|
||||
|
||||
" open nerdtree if vim opens to a directory
|
||||
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in')
|
||||
\ | execute 'NERDTree' argv()[0]
|
||||
\ | wincmd p
|
||||
\ | enew
|
||||
\ | execute 'cd '.argv()[0]
|
||||
\ | endif
|
@ -1,5 +0,0 @@
|
||||
" chezmoi:template:left-delimiter="{{
|
||||
"{{- /* vim: set filetype=vim: */ -}}
|
||||
"{{- if lookPath "rustc" -}}
|
||||
Plug 'rust-lang/rust.vim', { 'for': 'rust' }
|
||||
"{{- end }}
|
@ -1,14 +0,0 @@
|
||||
Plug 'NLKNguyen/papercolor-theme'
|
||||
Plug 'joshdick/onedark.vim'
|
||||
Plug 'morhetz/gruvbox'
|
||||
Plug 'nanotech/jellybeans.vim', { 'tag': 'v1.7' }
|
||||
Plug 'romainl/Apprentice'
|
||||
Plug 'sheerun/vim-wombat-scheme'
|
||||
Plug 'tomasr/molokai'
|
||||
Plug 'vim-airline/vim-airline'
|
||||
Plug 'vim-airline/vim-airline-themes'
|
||||
|
||||
let g:airline_powerline_fonts = 0
|
||||
let g:molokai_original = 1
|
||||
let g:onedark_hide_endofbuffer = 1
|
||||
let g:onedark_terminal_italics = 1
|
@ -1,4 +0,0 @@
|
||||
augroup COMMIT_EDITMSG
|
||||
autocmd!
|
||||
autocmd BufRead,BufNewFile COMMIT_EDITMSG set filetype=gitcommit
|
||||
augroup END
|
@ -1,2 +0,0 @@
|
||||
command! W write
|
||||
command! Q qall!
|
@ -1,10 +0,0 @@
|
||||
let g:ale_sign_error = '→'
|
||||
let g:ale_sign_warning = '‽'
|
||||
let g:ale_echo_msg_format = '%s [%severity%] [%linter%]'
|
||||
let g:ale_set_loclist = 0
|
||||
let g:ale_set_quickfix = 1
|
||||
|
||||
augroup linters
|
||||
autocmd!
|
||||
autocmd FileType javascript let g:ale_linters['javascript'] = ['eslint']
|
||||
augroup END
|
@ -1,19 +0,0 @@
|
||||
" Allow color schemes to do bright colors without forcing bold.
|
||||
if &t_Co == 8 && $TERM !~# '^Eterm'
|
||||
set t_Co=16
|
||||
else
|
||||
set t_Co=256
|
||||
endif
|
||||
|
||||
if (has("nvim"))
|
||||
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
|
||||
endif
|
||||
|
||||
if (has("termguicolors"))
|
||||
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
|
||||
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
|
||||
set termguicolors
|
||||
endif
|
||||
|
||||
colorscheme gruvbox
|
||||
set background=dark
|
@ -0,0 +1,69 @@
|
||||
" chezmoi:template:left-delimiter="{{
|
||||
"{{- /* vim: set filetype=vim: */ -}}
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" fzf
|
||||
"{{ if lookPath "fzf" }}
|
||||
Plug 'junegunn/fzf', { 'tag': '0.40.0' }
|
||||
Plug 'junegunn/fzf.vim'
|
||||
|
||||
map <leader>fz :GFiles<CR>
|
||||
map <leader>rg :Rg<CR>
|
||||
"{{ end }}
|
||||
|
||||
colorscheme gruvbox
|
||||
set background=dark
|
||||
|
||||
let g:airline_powerline_fonts = 0
|
||||
let g:molokai_original = 1
|
||||
let g:onedark_hide_endofbuffer = 1
|
||||
let g:onedark_terminal_italics = 1
|
||||
|
||||
let g:UltiSnipsSnippetDirectories = [ 'UltiSnips', 'snips' ]
|
||||
|
||||
"{{ if .development }}
|
||||
let g:sql_type_default = 'pgsql'
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" ALE
|
||||
let g:ale_sign_error = '→'
|
||||
let g:ale_sign_warning = '‽'
|
||||
let g:ale_echo_msg_format = '%s [%severity%] [%linter%]'
|
||||
let g:ale_set_loclist = 0
|
||||
let g:ale_set_quickfix = 1
|
||||
|
||||
augroup linters
|
||||
autocmd!
|
||||
autocmd FileType javascript let g:ale_linters['javascript'] = ['eslint']
|
||||
augroup END
|
||||
"{{ end }}
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" NERDTree
|
||||
let g:NERDTreeDirArrowExpandable = '▸'
|
||||
let g:NERDTreeDirArrowCollapsible = '▾'
|
||||
|
||||
let NERDTreeDirArrows=1
|
||||
|
||||
map <leader>nt :NERDTreeToggle<CR>
|
||||
|
||||
" Close nerdtree if it's the last buffer
|
||||
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree()
|
||||
\ | quit
|
||||
\ | endif
|
||||
|
||||
" Mirror nerdtree in each tab
|
||||
autocmd BufWinEnter * silent NERDTreeMirror
|
||||
|
||||
" check if reading from stdin
|
||||
autocmd StdinReadPre * let s:std_in=1
|
||||
|
||||
" open nerdtree if no args in passed to vim
|
||||
autocmd VimEnter * if argc() == 0 && !exists('s:std_in') | NERDTree | wincmd p | endif
|
||||
|
||||
" open nerdtree if vim opens to a directory
|
||||
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in')
|
||||
\ | execute 'NERDTree' argv()[0]
|
||||
\ | wincmd p
|
||||
\ | enew
|
||||
\ | execute 'cd '.argv()[0]
|
||||
\ | endif
|
@ -1,3 +1,4 @@
|
||||
" use XDG
|
||||
if empty($MYVIMRC) | let $MYVIMRC = expand('%:p') | endif
|
||||
|
||||
if empty($XDG_CACHE_HOME) | let $XDG_CACHE_HOME = $HOME.'/.cache' | endif
|
Loading…
Reference in New Issue