diff --git a/files/vim/.vim/autocmds.vim b/files/vim/.vim/autocmds.vim index 8e8e66e..8ca55c1 100644 --- a/files/vim/.vim/autocmds.vim +++ b/files/vim/.vim/autocmds.vim @@ -1,13 +1,6 @@ if has("autocmd") "filetype functions "------------------ - function FT_halftab() - setlocal expandtab - setlocal tabstop=2 - setlocal softtabstop=2 - setlocal shiftwidth=2 - endfunction - function FT_python() setlocal autoindent setlocal formatprg=yapf @@ -17,6 +10,10 @@ if has("autocmd") xnoremap r :'<,'>:w !python3 endfunction + function FT_ruby() + setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab + endfunction + function FT_go() set noexpandtab let g:go_auto_type_info = 1 @@ -31,6 +28,10 @@ if has("autocmd") setlocal spell endfunction + function FT_halftab() + setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab + endfunction + "global autocmds "----------------- augroup global @@ -71,6 +72,7 @@ if has("autocmd") "-------------------------- augroup language_group autocmd FileType python call FT_python() + autocmd FileType ruby,eruby call FT_ruby() autocmd FileType go call FT_go() autocmd FileType html call FT_html() autocmd FileType markdown call FT_markdown() diff --git a/files/vim/.vim/commands.vim b/files/vim/.vim/commands.vim index dc85a80..14364bf 100644 --- a/files/vim/.vim/commands.vim +++ b/files/vim/.vim/commands.vim @@ -1,10 +1,10 @@ "custom commands -"---------------{{{ +"--------------- "common typos and abbreviations cnoremap w!! w !sudo tee % > /dev/null command! W w !sudo tee % > /dev/null -command! Trim %s/\s\+$// command! Q q command! WQ wq command! Q1 q! -"}}} + +command! Trim %s/\s\+$// diff --git a/files/vim/.vim/functions.vim b/files/vim/.vim/functions.vim index 459836f..adeb171 100644 --- a/files/vim/.vim/functions.vim +++ b/files/vim/.vim/functions.vim @@ -1,5 +1,5 @@ "toggle functions -"----------------{{{ +"---------------- function! ToggleColorColumn() if &cc == '' set cc=80 @@ -43,4 +43,3 @@ function! ToggleNetrw() "make netrw toggleable :noh :let @/ = "" nnoremap i :set invpaste @@ -35,14 +35,13 @@ nnoremap cl :close nnoremap =j :%!python -m json.tool "}}} -"insert mode -"-----------{{{ +"insert mode keybinds +"-------------------- "abbrevations inoreabbrev #!! "#!/usr/bin/env" -"}}} "plugin keybinds -"{{{ +"--------------- "netrw nnoremap e :call ToggleNetrw() @@ -87,5 +86,3 @@ nnoremap b :Buffers nnoremap h :Helptags nnoremap m :Maps nnoremap rg :Rg - -"}}} diff --git a/files/vim/.vim/plugins.vim b/files/vim/.vim/plugins.vim index c3e4e01..778765e 100644 --- a/files/vim/.vim/plugins.vim +++ b/files/vim/.vim/plugins.vim @@ -12,7 +12,10 @@ if empty(glob(plugDir)) endif "pre plugin settings +"------------------- +"load plugins +"------------ call plug#begin(pluginDir) Plug 'junegunn/vim-plug' @@ -25,6 +28,8 @@ call plug#begin(pluginDir) Plug 'tpope/vim-rsi' Plug 'tpope/vim-eunuch' Plug 'tpope/vim-repeat' + + " == external tools == "git Plug 'tpope/vim-fugitive' Plug 'tpope/vim-rhubarb' @@ -37,6 +42,8 @@ call plug#begin(pluginDir) " == language support == "go Plug 'fatih/vim-go' + "ruby + Plug 'vim-ruby/vim-ruby' "html Plug 'mattn/emmet-vim' "markdown @@ -47,14 +54,14 @@ call plug#begin(pluginDir) "linting and lsp Plug 'w0rp/ale' - " == extra == + " == misc == Plug 'flazz/vim-colorschemes' Plug 'editorconfig/editorconfig-vim' Plug 'tyru/open-browser.vim' call plug#end() "post plugin settings -"---------------{{{ +"-------------------- "netrw let g:netrw_banner = 0 let g:netrw_winsize = 24 @@ -70,6 +77,7 @@ let g:netrw_nogx = 1 let g:ale_linters = { \ 'python': ['flake8', 'pylint'], \ 'javascript': ['eslint'], +\ 'ruby': ['rubocop'], \ 'markdown': ['mdl', 'write-good'] \} @@ -77,6 +85,7 @@ let g:ale_fixers = { \ '*': ['remove_trailing_lines', 'trim_whitespace'], \ 'python': ['yapf', 'black'], \ 'javascript': ['prettier', 'eslint'], +\ 'ruby': ['rubocop'], \ 'css': ['prettier'], \ 'scss': ['prettier'], \ 'html': ['prettier'], @@ -97,5 +106,3 @@ let g:vim_markdown_frontmatter = 1 "vim-emmet let g:user_emmet_install_global = 0 - -"}}} diff --git a/files/vim/.vim/settings.vim b/files/vim/.vim/settings.vim index bac5174..f0bf09e 100644 --- a/files/vim/.vim/settings.vim +++ b/files/vim/.vim/settings.vim @@ -1,13 +1,12 @@ "source system defaults -"----------------------{{{ +"---------------------- if filereadable(expand('$VIMRUNTIME/defaults.vim')) unlet! g:skip_defaults_vim source $VIMRUNTIME/defaults.vim endif -"}}} "general settings -"----------------{{{ +"---------------- "encoding/format set encoding=utf-8 set fileformats=unix,dos,mac @@ -63,10 +62,9 @@ set ttimeoutlen=20 "for keycodes "window behaviour (ltr) set splitbelow set splitright -"}}} "os/gui settings -"---------------{{{ +"--------------- if has('win32') let &runtimepath.=",$HOME/.vim" endif @@ -88,17 +86,15 @@ if has("gui_running") augroup END endif endif -"}}} "syntax/filetype/matchit -"-----------------------{{{ +"----------------------- syntax on filetype plugin indent on runtime macros/matchit.vim -"}}} "file cleanup -"------------{{{ +"------------ "swap let mySwapDir = expand("$HOME/.vim/.swap") if !isdirectory(mySwapDir) @@ -125,5 +121,4 @@ if has('writebackup') let &backupdir=myBackupDir set backup endif -"}}}