diff --git a/go/.vim/ftplugin/go.vim b/go/.vim/ftplugin/go.vim index 644b3b6..0f42406 100644 --- a/go/.vim/ftplugin/go.vim +++ b/go/.vim/ftplugin/go.vim @@ -1,6 +1,6 @@ -set noexpandtab " noexpandtab keeps tabs -set shiftwidth=4 " unify -set softtabstop=4 " Pressing backspace works like tabs +set noexpandtab +set shiftwidth=4 +set softtabstop=4 set tabstop=4 " use goimports for formatting @@ -15,6 +15,12 @@ let g:go_highlight_build_constraints = 1 let g:syntastic_go_checkers = ['go', 'golint', 'errcheck'] +let g:ale_linters['go'] = ['golint', 'gopls'] + +"let g:go_metalinter_autosave=1 +"let g:go_metalinter_autosave_enabled=['golint', 'govet', 'typecheck'] + + " Open go doc in vertical window, horizontal, or tab nnoremap d :GoDef nnoremap t :GoDefType diff --git a/vim/.vim/ftplugin/javascript.vim b/vim/.vim/ftplugin/javascript.vim index eeb3f93..cc19f4f 100644 --- a/vim/.vim/ftplugin/javascript.vim +++ b/vim/.vim/ftplugin/javascript.vim @@ -2,3 +2,5 @@ set expandtab " expandtab converts tabs to spaces set shiftwidth=2 " unify set softtabstop=2 " Pressing backspace works like tabs set tabstop=2 + +let g:ale_linters['javascript'] = ['eslint'] diff --git a/vim/.vim/ftplugin/rust.vim b/vim/.vim/ftplugin/rust.vim new file mode 100644 index 0000000..4ef03d1 --- /dev/null +++ b/vim/.vim/ftplugin/rust.vim @@ -0,0 +1 @@ +let g:rustfmt_autosave = 1 diff --git a/vim/.vim/plugin/autogroup.vim b/vim/.vim/plugin/autogroup.vim new file mode 100644 index 0000000..03cc283 --- /dev/null +++ b/vim/.vim/plugin/autogroup.vim @@ -0,0 +1,3 @@ +augroup COMMIT_EDITMSG + autocmd! BufRead,BufNewFile COMMIT_EDITMSG set filetype=gitcommit +augroup END diff --git a/vim/.vim/plugin/commands.vim b/vim/.vim/plugin/commands.vim new file mode 100644 index 0000000..1533cd8 --- /dev/null +++ b/vim/.vim/plugin/commands.vim @@ -0,0 +1,3 @@ +command! W write +command! Q qall +command! MakeTags !ctags -R . diff --git a/vim/.vim/plugin/mappings.vim b/vim/.vim/plugin/mappings.vim new file mode 100644 index 0000000..77ea8d4 --- /dev/null +++ b/vim/.vim/plugin/mappings.vim @@ -0,0 +1,23 @@ +" Mappings +let mapleader="," +let g:mapleader="," +map rl :source $MYVIMRC +map ss :setlocal spell! +map ct :TlistToggle " taglist shortcut +map ts :%s/\s\s*$//g " trim trailing whitespace +nnoremap rc :split $MYVIMRC +nnoremap p :set paste +nnoremap np :set nopaste +nnoremap nn :set nonumber norelativenumber +nnoremap rn :set number relativenumber + +" Vim Tabs +map tt :tabnew +map te :tabedit +map tc :tabclose +map to :tabonly +map tn :tabNext +map tp :tabprevious +map tf :tabfirst +map tl :tablast +map tm :tabmove diff --git a/vim/.vim/plugin/nerdtree.vim b/vim/.vim/plugin/nerdtree.vim new file mode 100644 index 0000000..1bc783e --- /dev/null +++ b/vim/.vim/plugin/nerdtree.vim @@ -0,0 +1,18 @@ +" Nerdtree settings +" +" Close all open buffers on entering a window if the only +" buffer that's left is the NERDTree buffer +function! s:CloseIfOnlyNerdTreeLeft() + if exists("t:NERDTreeBufName") + if bufwinnr(t:NERDTreeBufName) != -1 + if winnr("$") == 1 + q + endif + endif + endif +endfunction + +let NERDTreeDirArrows=1 +let NERDTreeIgnore = ['\.pyc$', '\.swp$'] +map nt :NERDTreeToggle +autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft() diff --git a/vim/.vim/plugin/settings.vim b/vim/.vim/plugin/settings.vim new file mode 100644 index 0000000..d3f33f6 --- /dev/null +++ b/vim/.vim/plugin/settings.vim @@ -0,0 +1,82 @@ +" Basics +set t_Co=256 " Use 256 colors +set encoding=utf8 " Use utf-8 encoding +set nocompatible " Get out of vi-compatible mode +set background=dark " I am using a dark background +" set background=light " I am using a dark background +syntax on " Syntax highlighting on + +" General +"colorscheme solarized +colorscheme wombat +"colorscheme PaperColor +" setlocal spell spelllang=en_us +set fileformats=unix,dos,mac " support all three, in this order +set nostartofline " leave my cursor where it was +set history=10000 +set autoread " Set to auto read when a file is changed from the outside +set autochdir " Change current directory to be directory of current file +set colorcolumn=81 +"set foldmethod=syntax + +" Have tab complete work more like bash +set wildmenu +set wildmode=list:longest +set backspace=start,eol,indent +set whichwrap+=<,>,[,] +set magic "Set magic on, for regular expressions + +" 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 + +" Tabs +set expandtab " expandtab converts tabs to spaces. For tabs, set noexpandtab +set shiftwidth=4 " unify +set softtabstop=4 " Pressing backspace works like tabs +set tabstop=4 " real tabs should be 4, but they will show with set list on + +" Indent +set autoindent "Auto indent +set smartindent "Smart indent +set copyindent " above all -- follow the conventions laid before us +set preserveindent " above all -- follow the conventions laid before us +set shiftround " when at 3 spaces, and I hit '>', go to 4, not 5 +filetype plugin on " load filetype plug-ins and indent settings +filetype indent on " load filetype plug-ins and indent settings + +" UI +set showcmd " show the command being typed +set ruler " Always show current positions along the bottom +set number relativenumber " Use relative line numbers +set numberwidth=4 " If we have over 9999 lines +set hidden " you can change buffer without saving +"set mouse=a " use mouse everywhere + +" No sound on errors +set noerrorbells +set novisualbell +"visual bell +set t_vb= +set tm=500 + +" Visual Cues +set showmatch " show matching brackets +set matchtime=2 " how many tenths of a second to blink matching brackets for +set hlsearch " highlight searched for phrases +set incsearch " BUT do highlight as you type you search phrase +set scrolloff=5 " Keep 5 lines (top/bottom) for scope +set sidescrolloff=5 " Keep 5 lines at the size +set list " we do what to show tabs, to ensure we get them out of my files +set listchars=tab:\ \ ,trail:… " show tabs and trailing whitespace + +" Status +" ~\file[+] [type] [line,column] [number of lines] +set statusline=%F%m%r%h%w\ [%Y]\ [%03l,%03v]\ [%L] +set laststatus=2 " always show the status line + +" Text Formatting/Layout +set nowrap " do not wrap line +set ignorecase " case insensitive by default +set smartcase " if there are caps, go case-sensitive +set completeopt=menu,longest,preview " improve the way autocomplete works diff --git a/vim/.vim/plugin/sql.vim b/vim/.vim/plugin/sql.vim new file mode 100644 index 0000000..0a9f572 --- /dev/null +++ b/vim/.vim/plugin/sql.vim @@ -0,0 +1 @@ +let g:sql_type_default = 'pgsql' diff --git a/vim/.vimrc b/vim/.vimrc index 06847e1..2b848ce 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -1,15 +1,3 @@ -" Basics -set t_Co=256 " Use 256 colors -set encoding=utf8 " Use utf-8 encoding -set nocompatible " Get out of vi-compatible mode -set background=dark " I am using a dark background -" set background=light " I am using a dark background -syntax on " Syntax highlighting on - -command! W write -command! Q qall -command! MakeTags !ctags -R . - call plug#begin('~/.vim/plugged') Plug 'NLKNguyen/papercolor-theme' @@ -20,7 +8,7 @@ Plug 'editorconfig/editorconfig-vim', { 'tag': 'v1.1.1' } Plug 'fatih/vim-go', { 'tag': 'v1.22' } Plug 'hashivim/vim-hashicorp-tools' Plug 'lifepillar/pgsql.vim' -Plug 'neoclide/coc.nvim', {'branch': 'release'} +Plug 'neoclide/coc.nvim', { 'branch': 'release' } Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle', 'tag': '6.9.8' } Plug 'prettier/vim-prettier', { \ 'branch': 'release/1.x', @@ -54,193 +42,3 @@ Plug 'tpope/vim-surround' Plug 'vim-scripts/CSApprox' call plug#end() - -let g:sql_type_default = 'pgsql' - -"let g:go_metalinter_autosave=1 -"let g:go_metalinter_autosave_enabled=['golint', 'govet', 'typecheck'] - -" General -"colorscheme solarized -colorscheme wombat -"colorscheme PaperColor -" setlocal spell spelllang=en_us -set fileformats=unix,dos,mac " support all three, in this order -set nostartofline " leave my cursor where it was -set history=10000 -set autoread " Set to auto read when a file is changed from the outside -set autochdir " Change current directory to be directory of current file -set colorcolumn=81 -"set foldmethod=syntax - -" fuzzy finding -"set path+=** - -" Have tab complete work more like bash -set wildmenu -set wildmode=list:longest - -set backspace=start,eol,indent -set whichwrap+=<,>,[,] - -set magic "Set magic on, for regular expressions - -" Turn on omni completion. Must have `filetype plugin on` to use. -" To use, in insert mode press ctrl+x ctrl+o -set ofu=syntaxcomplete#Complete - -" Mappings -let mapleader="," -let g:mapleader="," -map rl :source $MYVIMRC -map nt :NERDTreeToggle -map ss :setlocal spell! -map ct :TlistToggle " taglist shortcut -map ts :%s/\s\s*$//g " trim trailing whitespace -nnoremap rc :split $MYVIMRC -nnoremap d :GoDef -nnoremap t :GoDefType -nnoremap p :set paste -nnoremap np :set nopaste -nnoremap nn :set nonumber norelativenumber -nnoremap rn :set number relativenumber - -if bufwinnr(1) - map + < - map - > -endif - -" Nerdtree settings -let NERDTreeDirArrows=1 -let NERDTreeIgnore = ['\.pyc$', '\.swp$'] - -let g:ale_linters = { -\ 'javascript': ['eslint'], -\ 'go': ['golint', 'gopls'], -\} - -let g:rustfmt_autosave = 1 - -" Close all open buffers on entering a window if the only -" buffer that's left is the NERDTree buffer -function! s:CloseIfOnlyNerdTreeLeft() - if exists("t:NERDTreeBufName") - if bufwinnr(t:NERDTreeBufName) != -1 - if winnr("$") == 1 - q - endif - endif - endif -endfunction - -" Vim Tabs -map tt :tabnew -map te :tabedit -map tc :tabclose -map to :tabonly -map tn :tabNext -map tp :tabprevious -map tf :tabfirst -map tl :tablast -map tm :tabmove - -" Tabs -set expandtab " expandtab converts tabs to spaces. For tabs, set noexpandtab -set shiftwidth=4 " unify -set softtabstop=4 " Pressing backspace works like tabs -set tabstop=4 " real tabs should be 4, but they will show with set list on - -" Indent -set autoindent "Auto indent -set smartindent "Smart indent -set copyindent " above all -- follow the conventions laid before us -set preserveindent " above all -- follow the conventions laid before us -set shiftround " when at 3 spaces, and I hit '>', go to 4, not 5 -filetype plugin on " load filetype plug-ins and indent settings -filetype indent on " load filetype plug-ins and indent settings - -" UI -set showcmd " show the command being typed -set ruler " Always show current positions along the bottom -set number relativenumber " Use relative line numbers -set numberwidth=4 " If we have over 9999 lines -set hidden " you can change buffer without saving -"set mouse=a " use mouse everywhere - -" No sound on errors -set noerrorbells " don't make noise -set novisualbell " don't blink -set t_vb= -set tm=500 - -" Visual Cues -set showmatch " show matching brackets -set matchtime=2 " how many tenths of a second to blink matching brackets for -set hlsearch " highlight searched for phrases -set incsearch " BUT do highlight as you type you search phrase -set scrolloff=5 " Keep 5 lines (top/bottom) for scope -set sidescrolloff=5 " Keep 5 lines at the size -set list " we do what to show tabs, to ensure we get them out of my files -set listchars=tab:\ \ ,trail:… " show tabs and trailing whitespace - -" ~\file[+] [type] [line,column] [number of lines] -set statusline=%F%m%r%h%w\ [%Y]\ [%03l,%03v]\ [%L] -"set statusline+=%#warningmsg# -"set statusline+=%{SyntasticStatuslineFlag()} -"set statusline+=%* - -set laststatus=2 " always show the status line - -" Text Formatting/Layout -set nowrap " do not wrap line -set ignorecase " case insensitive by default -set smartcase " if there are caps, go case-sensitive -set completeopt=menu,longest,preview " improve the way autocomplete works - -autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft() - -augroup jade - au! BufRead,BufNewFile *.jade set syntax=jade -augroup END - -augroup javascript - au! BufRead,BufNewFile *.js.flow set filetype=javascript -augroup END - -augroup ruby - au! BufRead,BufNewFile *.cap set syntax=ruby -augroup END - -augroup styl - au! BufRead,BufNewFile *.styl set syntax=stylus -augroup END - -augroup conkyrc - au! BufRead,BufNewFile *.conkyrc set syntax=conkyrc -augroup END - -augroup vcl - au! BufRead,BufNewFile *.vcl set filetype=vcl -augroup END - -augroup mustache - au! BufRead,BufNewFile *.mustache set filetype=mustache - au! BufRead,BufNewFile *.mu set filetype=mustache - au! BufRead,BufNewFile *.hjs set filetype=mustache -augroup END - -augroup coffee - au! BufRead,BufNewFile *.coffee set filetype=coffee -augroup END - -augroup markdown - au! BufRead,BufNewFile *.md set filetype=markdown -augroup END - -augroup COMMIT_EDITMSG - au! BufRead,BufNewFile COMMIT_EDITMSG set filetype=gitcommit -augroup END - -augroup typescript - au! BufRead,BufNewFile *.ts set filetype=typescript -augroup END