This commit is contained in:
lelgenio 2020-06-17 05:25:10 -03:00
parent 4178222332
commit 8409bc1e5c
5 changed files with 130 additions and 50 deletions

View File

@ -160,32 +160,39 @@ call plug#end()
" Keys{{{
"
"
" dvorak
" noremap s l
" noremap n k
" noremap t j
" noremap h h "h keeps it's meaning
" Dvorak it!
noremap h h
noremap t j
noremap n k
noremap s l
" Dvorak it!
noremap h h
noremap t j
noremap n k
noremap s l
" no s :
" no S :
noremap j d
noremap l n
noremap L N
" Added benefits
noremap - $
noremap _ ^
noremap N <C-w><C-w>
noremap T <C-w><C-r>
noremap H 8<Down>
noremap T 8<Up>
noremap D <C-w><C-r>
noremap j d
noremap l n
noremap L N
" Added benefits
noremap - $
noremap _ ^
noremap N <C-w><C-w>
noremap T <C-w><C-r>
noremap H 8<Down>
noremap T 8<Up>
noremap D <C-w><C-r>
" Single charater traversal
imap <C-t> <Left>
imap <C-n> <Right>
" Quickly exit insert mode
imap jj <ESC>
"I deserve the death sentence
nmap <C-s> :w<CR>
"open and close folds
nmap <silent> s <right>:silent! foldopen<CR>
nmap <silent> <right> <right>:silent! foldopen<CR>
" Easy comment toggle
nmap <silent> gc :Commentary<CR>
xmap <silent> gc :Commentary<CR>
@ -198,16 +205,26 @@ noremap D <C-w><C-r>
nmap ga <Plug>(EasyAlign)
" Simplify window navigation
nnoremap <silent> <C-h> <C-w><C-h>
nnoremap <silent> <C-j> <C-w><C-j>
nnoremap <silent> <C-k> <C-w><C-k>
nnoremap <silent> <C-l> <C-w><C-l>
" nnoremap <silent> <C-h> <C-w><C-h>
" nnoremap <silent> <C-t> <C-w><C-j>
" nnoremap <silent> <C-n> <C-w><C-k>
" nnoremap <silent> <C-s> <C-w><C-l>
" use <tab> for trigger completion and navigate to the next complete item
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
" Interact with language server
nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
inoremap <silent><expr> <Tab>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<Tab>" :
\ coc#refresh()
" " Interact with language server
" nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
" nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
" nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
"}}}
" Lanugage Server{{{
@ -285,7 +302,7 @@ augroup END
endif
endfunction
nnoremap <S-h> :call ToggleHiddenAll()<CR>
" nnoremap <S-h> :call ToggleHiddenAll()<CR>
call ToggleHiddenAll()
"}}}
" vim:foldmethod=marker

View File

@ -4,6 +4,7 @@ map n scroll up
map s scroll right
map l search forward
map L search backward
map i set recolor

View File

@ -236,6 +236,10 @@ c.hints.border = '2px solid #D9534F'
# Type: UniqueCharString
c.hints.chars = 'aoeuidnths'
# Leave insert mode if a non-editable element is clicked.
# Type: Bool
c.input.insert_mode.auto_leave = False
# Enable smooth scrolling for web pages. Note smooth scrolling does not
# work with the `:scroll-px` command.
# Type: Bool
@ -320,7 +324,7 @@ c.tabs.show_switching_delay = 2000
# `{protocol}`: Protocol (http/https/...) of the current web page. *
# `{audio}`: Indicator for audio/mute status.
# Type: FormatString
c.tabs.title.format = '{current_title}'
c.tabs.title.format = '{audio}{index}: {current_title}'
# Width (in pixels) of the progress indicator (0 to disable).
# Type: Int

62
scripts/.local/bin/dzadd Executable file
View File

@ -0,0 +1,62 @@
#!/bin/sh
set -ex
tmpf=$(mktemp)
choose(){
choice=$(grep "$(cat $tmpf | cut -d\| -f1| wdmenu)" $tmpf)
choiceId="$(echo $choice| cut -d\| -f2)"
choiceUrl=http://deezer.com/$sType/$choiceId
choicePreview=$( curl -s "api.deezer.com/$sType/$choiceId/$preview_suffix" |
jq -r '.preview, .data[0].preview | select(. != null)' )
choice=$( echo -e "Preview\nDownload" | wdmenu )
if [ "$choice" = Preview ]
then
mpv --quiet "$choicePreview" &
mpvPid=$!
choice=$(echo -e "Download\nAnother" | wdmenu -p 'Download?')
kill $mpvPid
if test "$choice" = "Another"
then
choose
return
fi
fi
if [ "$choice" = Download ]
then
deemix "$choiceUrl"
fi
}
clean(){
set +e
kill "$mpvPid"
rm -f $tmpf
}
trap clean EXIT
sType=$(echo -e "Track\nAlbum\nArtist" | wdmenu | tr [:upper:] [:lower:] )
query=$(echo -n | wdmenu | sed 's/[^ a-z]//g;s/ /+/g')
case "$sType" in
track)
jqFilter='.data[]|.title+" - "+.album.title+" - "+.artist.name+"|"+( .id | tostring ) '
;;
album)
jqFilter='.data[]| ( .nb_tracks | tostring ) +" - "+.title+" - "+.artist.name+"|"+ ( .id | tostring ) '
preview_suffix=tracks
;;
artist)
jqFilter='.data[]| ( .nb_fan | tostring ) +" - "+.name+"|"+ ( .id | tostring ) '
preview_suffix=top
;;
esac
curl -s "api.deezer.com/search/$sType?q=${query}" |
jq -r "$jqFilter" > $tmpf
choose

View File

@ -77,7 +77,7 @@ owm_pango(){
owm_json(){
owm
cat > .forecast.json <<EOF
tee > .forecast.json <<EOF
{
"min":"$MIN",
"max":"$MAX",
@ -93,19 +93,15 @@ wttrin(){
curl -sH "Accept-Language: ${LANG%_*}" --compressed "$request"
}
if [ "$1" == "full" ]
then
wttrin
elif [ "$1" == "short" ]
then
owm_short
elif [ "$1" == "pango" ]
then
owm_pango
elif [ "$1" == "json" ]
then
owm_json
elif [ "$1" == "long" ]
then
owm_long
fi
case "$1" in
short)
owm_short;;
pango)
owm_pango;;
json)
owm_json;;
long)
owm_long;;
full|*)
wttrin;;
esac