" Vim plugin for accessing cheat sheets from cheat.sh.
" Maintainer: David Beniamine
"
" Copyright (C) 2018 David Beniamine. All rights reserved.
"
" This program is free software: you can redistribute it and/or modify
" it under the terms of the GNU General Public License as published by
" the Free Software Foundation, either version 3 of the License, or
" (at your option) any later version.
"
" This program is distributed in the hope that it will be useful,
" but WITHOUT ANY WARRANTY; without even the implied warranty of
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" GNU General Public License for more details.
"
" You should have received a copy of the GNU General Public License
" along with this program. If not, see .
if exists("g:loaded_cheat_sh")
finish
endif
let save_cpo = &cpo
set cpo&vim
let g:loaded_cheat_sh = "v0.2"
" Default query mode
if(!exists("g:CheatSheetDefaultMode"))
let g:CheatSheetDefaultMode=0
endif
" cheat sheet base url
if(!exists("g:CheatSheetBaseUrl"))
let g:CheatSheetBaseUrl='https://cht.sh'
endif
" command definition
command! -nargs=? -bang -count -complete=custom,cheat#completeargs Cheat
\ call cheat#cheat(, , , , 0, "")
command! -nargs=? -count CheatError
\ call cheat#cheat('', -1, -1, -1, 4, '!')
command! -nargs=? -bang -count -complete=custom,cheat#completeargs CheatReplace
\ call cheat#cheat(, , , , 1, "")
command! -nargs=? -bang -count -complete=custom,cheat#completeargs CheatPager
\ call cheat#cheat(, , , , 2, "")
command! -nargs=? -bang -count -complete=custom,cheat#completeargs CheatPaste
\ call cheat#cheat(, , , , 3, "")
command! -nargs=1 CheatNavigateQuestions call cheat#navigate(, 'Q')
command! -nargs=1 CheatNavigateAnswers call cheat#navigate(, 'A')
command! -nargs=1 CheatSeeAlso call cheat#navigate(, 'S')
command! -nargs=1 CheatHistory call cheat#navigate(, 'H')
command! -nargs=? -bang CheatId call cheat#session#id(, "")
command! -nargs=1 -bang -count -complete=custom,cheat#completeargs HowIn
\ call cheat#howin(, , , )
if((!exists("g:CheatDoNotReplaceKeywordPrg") ||
\ g:CheatDoNotReplaceKeywordPrg ==0))
if(has("patch-7.4.1833"))
set keywordprg=:CheatPager!
else
exe 'set keywordprg='.expand(':p:h').'/../scripts/chtpager.sh'
endif
endif
if(!exists("g:CheatSheetDoNotMap") || g:CheatSheetDoNotMap ==0)
nnoremap