Add goto and search functions

This commit is contained in:
Augusto Gunsch 2021-12-14 13:53:50 -03:00
parent 1f2e6d6540
commit 5d737ff9ff
No known key found for this signature in database
GPG Key ID: F7EEFE29825C72DC
2 changed files with 15 additions and 5 deletions

View File

@ -37,7 +37,7 @@ nnoremap _ ddkP
nnoremap <silent> <leader>ev <cmd>tabnew $MYVIMRC<cr>
nnoremap <silent> <leader>sv <cmd>source $MYVIMRC<cr>
nnoremap <C-s> <cmd>%s//gc<left><left><left>
nnoremap <C-s> :%s//gc<left><left><left>
nnoremap <silent> <C-w>t <cmd>tabnew<cr>
nnoremap dL 0D
@ -156,7 +156,7 @@ local pylsp_settings = {
plugins = {
pycodestyle = {
enabled = true,
ignore = {'E501'}
ignore = {'E501', 'E711'}
}
}
}

View File

@ -28,7 +28,7 @@ alias feh="feh -."
alias info="info --vi-keys"
# grepa
alias grepa="grep -n --color=always -r --exclude-dir=venv"
alias grepa="grep -I -n --color=always -r --exclude-dir=venv"
# less
alias less="less -R"
@ -42,6 +42,16 @@ alias sl="ls"
#la
alias la="ls -a"
finder() {
grepa "$1" | less
search() {
grepa "$@" . | sed -nE '/^.{,200}$/p'
}
goto() {
open="$(search "$@" | fzf --ansi)"
if [ ! -z "$open" ]; then
file="$(echo "$open" | cut -d: -f1 -)"
line="$(echo "$open" | cut -d: -f2 -)"
vim "$file" -c "normal! $line"gg
fi
}