From fb401e1fcb73a286d0fc5b4ee6691d1cf3f3341f Mon Sep 17 00:00:00 2001 From: Tovi Jaeschke-Rogers Date: Mon, 27 Jun 2022 13:33:55 +0930 Subject: [PATCH] Update aliasrc and init.vim --- .config/aliasrc | 21 ++++++++++++- .config/nvim/init.vim | 73 ++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 89 insertions(+), 5 deletions(-) diff --git a/.config/aliasrc b/.config/aliasrc index 0b143fe..f696881 100644 --- a/.config/aliasrc +++ b/.config/aliasrc @@ -22,4 +22,23 @@ alias \ sv="sudo nvim" \ c="xclip -selection clipboard" \ v="xclip -selection clipboard -o" \ - lf="lfcd" + lf="lfcd" \ + dcu='docker-compose up' \ + dce='docker-compose exec' \ + dps="docker ps" \ + ds="docker stop" \ + dce-test='docker-compose exec fpm ./artisan test' \ + dc-phpunit='docker-compose exec fpm ./vendor/bin/phpunit' \ + dm='mysql -h localhost -P 33061 --protocol=tcp -u root -psecret' \ + staging-mysql='mysql --host tf-codium-staging.ch66levpagqo.ap-southeast-2.rds.amazonaws.com --user=root --password=r43r34rg' \ + mailhog='docker run -d --restart unless-stopped -p 1025:1025 -p 8025:8025 mailhog/mailhog' \ + t12wl='docker run -it -v $(pwd):/workpace -v /root/.ssh:/root/.ssh:ro -v ~/.aws:/root/.aws -w /workpace hashicorp/terraform:0.12.27 workspace list ' \ + t12ws='docker run -it -v $(pwd):/workpace -v /root/.ssh:/root/.ssh:ro -v ~/.aws:/root/.aws -w /workpace hashicorp/terraform:0.12.27 workspace select ' \ + t12wd='docker run -it -v $(pwd):/workpace -v /root/.ssh:/root/.ssh:ro -v ~/.aws:/root/.aws -w /workpace hashicorp/terraform:0.12.27 workspace delete ' \ + t12='docker run -it -v $(pwd):/workpace -v /root/.ssh:/root/.ssh:ro -v ~/.aws:/root/.aws -w /workpace hashicorp/terraform:0.12.27 ' \ + ducks='du -cks * | sort -rn | head' \ + fn="find . -name" \ + tinker="docker-compose exec fpm php artisan tinker" \ + phpunit="docker-compose exec fpm ./vendor/bin/phpunit" \ + jsonlint="python -m json.tool" \ + migseed="docker-compose exec fpm php artisan migrate --seed" diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index e57e15a..5034dd6 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -24,6 +24,11 @@ if !exists('g:vscode') Plug 'nvim-telescope/telescope.nvim', Cond(!exists('g:vscode')) Plug 'nvim-telescope/telescope-fzy-native.nvim', Cond(!exists('g:vscode')) + Plug 'Rican7/php-doc-modded' + + Plug 'udalov/kotlin-vim' + Plug 'f-person/git-blame.nvim' + Plug 'vimwiki/vimwiki', Cond(!exists('g:vscode')) Plug 'ap/vim-css-color', Cond(!exists('g:vscode')) @@ -41,6 +46,7 @@ set nohlsearch set incsearch set ignorecase +autocmd BufWritePre * :%s/\s\+$//e if !exists('g:vscode') set go=a @@ -60,10 +66,26 @@ if !exists('g:vscode') set encoding=utf-8 set number relativenumber + nnoremap vs :vsplit + nnoremap hs :split + " Tab 2 spaces filetype plugin indent on set tabstop=4 softtabstop=4 expandtab shiftwidth=4 smarttab + let g:tabStop=4 + function! ToggleTabWidth() + if g:tabStop == 2 + set tabstop=4 softtabstop=4 expandtab shiftwidth=4 smarttab + let g:tabStop=4 + else + set tabstop=2 softtabstop=2 expandtab shiftwidth=2 smarttab + let g:tabStop=2 + endif + endfunction + + nnoremap t :call ToggleTabWidth() + " Disables automatic commenting on newline: autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o @@ -77,6 +99,24 @@ if !exists('g:vscode') " Set gohtml template files to html syntax autocmd BufNewFile,BufRead *.gohtml set syntax=html + " Automatically save the current session whenever vim is closed + autocmd VimLeave * mksession! ~/.config/nvim/session/shutdown_session.vim + + " restores that 'shutdown session' + noremap :source ~/.config/nvim/session/shutdown_session.vim + + " If you really want to, this next line should restore the shutdown session + " automatically, whenever you start vim. (Commented out for now, in case + " somebody just copy/pastes this whole block) + " + " autocmd VimEnter source ~/.vim/shutdown_session.vim + + " manually save a session with + noremap :mksession! ~/.config/nvim/session/manual_session.vim + + " recall the manually saved session with + noremap :source ~/.config/nvim/session/manual_session.vim + " NETRW let g:netrw_liststyle = 3 @@ -91,7 +131,7 @@ if !exists('g:vscode') let i = bufnr("$") while (i >= 1) if (getbufvar(i, "&filetype") == "netrw") - silent exe "bwipeout " . i + silent exe "bwipeout " . i endif let i-=1 endwhile @@ -135,12 +175,32 @@ if !exists('g:vscode') " Telescope remaps lua require("telescope") - nnoremap gs :lua require('telescope.builtin').grep_string({ search = vim.fn.input("Grep For > ")}) - nnoremap :lua require('telescope.builtin').git_files() - nnoremap :lua require('telescope.builtin').find_files() + nnoremap :lua require('telescope.builtin').grep_string({ search = vim.fn.input("Grep For > ")}) + nnoremap :lua require('telescope.builtin').git_files() + nnoremap :lua require('telescope.builtin').find_files() nnoremap fb lua require('telescope.builtin').buffers() + + " PHP Doc + + nnoremap h :call UpdatePhpDocIfExists() + function! UpdatePhpDocIfExists() + normal! k + if getline('.') =~ '/' + normal! V%d + else + normal! j + endif + call PhpDocSingle() + normal! k^%k$ + if getline('.') =~ ';' + exe "normal! $svoid" + endif + endfunction + + nnoremap :call UpdatePhpDocIfExists() + " VimWiki let pentest_wiki = {} @@ -172,4 +232,9 @@ if !exists('g:vscode') vnoremap /<++>"_c4l map /<++>"_c4l + augroup twig_ft + au! + autocmd BufNewFile,BufRead *.docker set syntax=dockerfile + augroup END + endif