From f99d0e47ef1ad12a677afdd7c4ea4de06b98dceb Mon Sep 17 00:00:00 2001 From: Marco Thomas Date: Tue, 29 Aug 2023 12:17:02 +0200 Subject: [PATCH] vim: pimp keybind usability (remove some, adjust fzf) --- files/shell/.shellrc.alias | 46 ++++++++++++++++++++------------------ files/vim/.vimrc | 20 ++++++++--------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/files/shell/.shellrc.alias b/files/shell/.shellrc.alias index 07c0ae3..0675eca 100644 --- a/files/shell/.shellrc.alias +++ b/files/shell/.shellrc.alias @@ -1,4 +1,6 @@ # fzf +export FZF_DEFAULT_COMMAND='find .' + export FZF_DEFAULT_OPTS=' --layout=reverse --color=fg:#5c6a72,bg:#FDF6E3,hl:#8da101 @@ -81,25 +83,25 @@ ocr() { } # deprecated -# conservation() { -# location='/sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode' -# if [ -z $1 ]; then -# cat $location -# elif [ $1 = '0' ] || [ $1 = '1' ]; then -# echo $1 | sudo tee $location -# else -# echo 'Invalid option' -# fi -# } -# -# power() { -# location='/sys/firmware/acpi/platform_profile' -# if [ -z $1 ]; then -# echo "Current:" $(cat $location) -# echo "Can be one of:" $(cat /sys/firmware/acpi/platform_profile_choices) -# elif [ $1 = 'low-power' ] || [ $1 = 'balanced' ] || [ $1 = 'performance' ]; then -# echo $1 | sudo tee $location -# else -# echo 'Invalid option' -# fi -# } +conservation() { + location='/sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode' + if [ -z $1 ]; then + cat $location + elif [ $1 = '0' ] || [ $1 = '1' ]; then + echo $1 | sudo tee $location + else + echo 'Invalid option' + fi +} + +power() { + location='/sys/firmware/acpi/platform_profile' + if [ -z $1 ]; then + echo "Current:" $(cat $location) + echo "Can be one of:" $(cat /sys/firmware/acpi/platform_profile_choices) + elif [ $1 = 'low-power' ] || [ $1 = 'balanced' ] || [ $1 = 'performance' ]; then + echo $1 | sudo tee $location + else + echo 'Invalid option' + fi +} diff --git a/files/vim/.vimrc b/files/vim/.vimrc index 349f5f5..c3a2a9a 100644 --- a/files/vim/.vimrc +++ b/files/vim/.vimrc @@ -128,23 +128,28 @@ let &t_EI = "\[2 q" " ============================== netrw let g:netrw_winsize = 25 " width let g:netrw_liststyle = 3 " Tree-like structure -let g:netrw_banner = 0 " Remove useless banner at the top of netrw " ============================== Macros and Mappings " im a lazy brick cabbrev g Git cabbrev mktex latexmk -xelatex -shell-escape +cabbrev vs vsplit -" search git tracked files via git-ls-files(1) -map :GFiles +" search files via fzf +map :Files! " 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 :GGrep +if has("linux") + map :GGrep! +else + " for some reason, openbsd doesnt like fzf live commands + map :GGrep +endif " kill whitespaces fast and efficient fun! TrimWhitespace() @@ -154,19 +159,12 @@ 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 -" Codi -cabbrev py CodiNew python -map :Codi!! - " ============================== LSP set hidden let g:LanguageClient_serverCommands = {