From d08eade077a269bccceb80fac283f0c2a9918bd5 Mon Sep 17 00:00:00 2001 From: Marco Thomas Date: Fri, 28 Jul 2023 15:10:15 +0200 Subject: [PATCH] gitconf/vim/shell: small tweaks --- files/git/.gitconfig | 7 ++++--- files/shell/.zshrc | 14 -------------- files/vim/.vimrc | 36 ++++++++++++++++++++++++------------ 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/files/git/.gitconfig b/files/git/.gitconfig index 3bd439c..a7c9c28 100644 --- a/files/git/.gitconfig +++ b/files/git/.gitconfig @@ -2,11 +2,11 @@ name = Marco Thomas email = rb.ma.tho@gmail.com [includeIf "gitdir:~/dev/uni/lrz-gitlab/**"] - path = "~/dev/uni/lrz-gitlab/.gitconfig" + path = "~/dev/lrz-gitlab/.gitconfig" [alias] a = add aa = add . - b = blame -L + bl = blame br = branch c = commit -v ca = commit -v --amend @@ -16,11 +16,12 @@ lg = log --oneline --decorate --graph lgp = lg -p pl = pull --rebase + plm = pull + plm = pull ps = push r = rebase sh = show st = status - u = pull --rebase yeet = push yoink = pull [blame] diff --git a/files/shell/.zshrc b/files/shell/.zshrc index 6c00eed..3581f3c 100644 --- a/files/shell/.zshrc +++ b/files/shell/.zshrc @@ -18,20 +18,6 @@ NEWLINE=$'\n' export PROMPT="${HOSTN}${DIR}${GIT}${NEWLINE}${ICON}%{$reset_color%} " zstyle ':vcs_info:git:*' formats ' (%b )' -# show info in title bar -case $TERM in - (*xterm* | rxvt | alacritty) - # This is seen when the shell prompts for input. - function precmd { - print -Pn "\e]0;%m: %~\a" - } - # This is seen while the shell waits for a command to complete. - function preexec { - printf "\033]0;$(hostname): %s\a" "$1" - } - ;; -esac - # ============================== Completion unsetopt menu_complete # do not autoselect the first completion entry unsetopt flowcontrol diff --git a/files/vim/.vimrc b/files/vim/.vimrc index 481924b..c951d03 100644 --- a/files/vim/.vimrc +++ b/files/vim/.vimrc @@ -5,7 +5,7 @@ let mapleader = "\" " ============================== vim-plug -let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' +let data_dir = '~/.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 ~/.vimrc @@ -16,6 +16,7 @@ call plug#begin() Plug 'tpope/vim-sleuth' " heuristic file indendation Plug 'jiangmiao/auto-pairs' " pair completion Plug 'tpope/vim-fugitive' " git wrapper +Plug 'mhinz/vim-signify' " show lines changed Plug 'tpope/vim-commentary' " DWIM comments Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } @@ -33,6 +34,7 @@ if has('linux') endif call plug#end() + " ============================== Colors syntax on set background=light @@ -66,6 +68,7 @@ set wildmenu " autocomplete :e set scrolloff=5 " minimum lines above or below the cursor let g:ctrlp_show_hidden = 1 " show hidden files in ctrlp menus +let g:fzf_preview_window = ['down,50%', 'ctrl-/'] " ============================== Statusline let g:airline_powerline_fonts = 1 @@ -116,18 +119,21 @@ let g:netrw_liststyle = 3 " Tree-like structure let g:netrw_banner = 0 " Remove useless banner at the top of netrw " ============================== Macros and Mappings -" file interaction -let g:fzf_preview_window = ['down,50%', 'ctrl-/'] + +" im a lazy brick +cabbrev g Git + +" search git tracked files via git-ls-files(1) +map :GFiles + +" search in git tracked files with git-grep(1) command! -bang -nargs=* GGrep \ call fzf#vim#grep( \ 'git grep --line-number -- '.shellescape(), 0, \ fzf#vim#with_preview(), 0) - -map :GFiles map :GGrep -cabbrev g Git - +" kill whitespaces fast and efficient fun! TrimWhitespace() let l:save = winsaveview() keeppatterns %s/\s\+$//e @@ -135,18 +141,24 @@ fun! TrimWhitespace() endfun noremap ws :call TrimWhitespace() +" sometimes lsp discards message too quickly map :messages + +" comment DWIM map :Commentary +" clear search highlighting faster +map :noh + " ============================== LSP if has('linux') set hidden let g:LanguageClient_serverCommands = { - \ 'rust': ['~/.cargo/bin/rust-analyzer'], - \ 'python': ['/usr/bin/pylsp'], - \ 'c': ['/usr/bin/clangd'], - \ 'cpp': ['/usr/bin/clangd'], - \ 'yaml': ['~/.local/bin/yaml-lsp'], + \ 'rust': ['rust-analyzer'], + \ 'python': ['pylsp'], + \ 'c': ['clangd'], + \ 'cpp': ['clangd'], + \ 'yaml': ['yaml-lsp'], \ } nnoremap :call LanguageClient_contextMenu()