vim: pimp keybind usability (remove some, adjust fzf)

This commit is contained in:
Marco Thomas
2023-08-29 12:17:02 +02:00
parent c8d3d8bc0e
commit f99d0e47ef
2 changed files with 33 additions and 33 deletions

View File

@@ -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
}

View File

@@ -128,23 +128,28 @@ let &t_EI = "\<Esc>[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 <C-p> :GFiles<CR>
" search files via fzf
map <C-p> :Files!<CR>
" search in git tracked files with git-grep(1)
command! -bang -nargs=* GGrep
\ call fzf#vim#grep(
\ 'git grep --line-number -- '.shellescape(<q-args>), 0,
\ fzf#vim#with_preview(), <bang>0)
map <C-f> :GGrep
if has("linux")
map <C-f> :GGrep!<CR>
else
" for some reason, openbsd doesnt like fzf live commands
map <C-f> :GGrep
endif
" kill whitespaces fast and efficient
fun! TrimWhitespace()
@@ -154,19 +159,12 @@ fun! TrimWhitespace()
endfun
noremap <leader>ws :call TrimWhitespace()<CR>
" sometimes lsp discards message too quickly
map <C-M> :messages<CR>
" comment DWIM
map <C-_> :Commentary<CR>
" clear search highlighting faster
map <Esc><Esc> :noh <CR>
" Codi
cabbrev py CodiNew python
map <C-i> :Codi!!<CR>
" ============================== LSP
set hidden
let g:LanguageClient_serverCommands = {