Skip to content

Instantly share code, notes, and snippets.

@ichizok
ichizok / anyenv.zsh
Last active February 22, 2018 02:03
anyenv
# anyenv initialization
function() {
local anyenv_root=/usr/local/share/anyenv
if [[ -d "${anyenv_root}" ]]; then
export ANYENV_ROOT=${anyenv_root}
path=(${anyenv_root}/bin $path)
local anyenv_init=${TMPDIR:-/tmp}/anyenv-init.zsh
if [[ -e "${anyenv_init}" ]]; then
source "${anyenv_init}"
@ichizok
ichizok / prof.vim
Created November 28, 2017 20:21
profile
scriptencoding utf-8
func! Foo()
return [
\ "一丁丂七丄丅丆万丈三上下丌不与丏丐丑丒专且丕世丗丘丙业丛东丝丞丟丠両丢丣两严並丧丨丩个丫丬中丮丯丰丱串丳临丵丶丷丸丹为主丼丽举丿乀乁乂乃乄久乆乇么义乊之乌乍乎乏乐乑乒乓乔乕乖乗乘乙乚乛乜九乞也习乡乢乣乤乥书乧乨乩乪乫乬乭乮乯买乱乲乳乴乵乶乷乸乹乺乻乼乽乾乿亀亁亂亃亄亅了亇予争亊事二亍于亏亐云互亓五井亖亗亘亙亚些亜亝亞亟亠亡亢亣交亥>亦产亨亩亪享京亭亮亯亰亱亲亳亴亵亶亷亸亹人亻亼亽亾亿什仁仂仃仄仅仆仇仈仉今介仌仍从仏仐仑仒仓仔仕他仗付仙仚仛仜仝仞仟仠仡仢代令以仦仧仨仩仪仫们仭仮仯仰仱仲仳仴仵件价仸仹>仺任仼份仾仿伀企伂伃伄伅伆伇伈伉伊伋伌伍伎伏伐休伒伓伔伕伖众优伙会伛伜伝伞伟传伡伢伣伤伥伦伧伨伩伪伫伬伭伮伯估伱伲伳伴伵伶伷伸伹伺伻似伽伾伿佀佁佂佃佄佅但佇佈佉佊佋佌位>低住佐佑佒体佔",
\ "伀企伂伃伄伅伆伇伈伉伊伋伌伍伎伏伐休伒伓伔伕伖众优伙会伛伜伝伞伟传伡伢伣伤伥伦伧伨伩伪伫伬伭伮伯估伱伲伳伴伵伶伷伸伹伺伻似伽伾伿佀佁佂佃佄佅但佇佈佉佊佋佌位低住佐佑佒体佔何佖佗佘余佚佛作佝佞佟你佡佢佣佤佥佦佧佨佩佪佫佬佭佮佯佰佱佲佳佴併佶佷佸佹佺佻佼佽佾使侀侁侂侃侄侅來侇侈侉侊例侌侍侎侏侐侑侒侓侔侕侖侗侘侙侚供侜依侞侟侠価侢侣侤侥>侦侧侨侩侪侫侬侭侮侯侰侱侲侳侴侵侶侷侸侹侺侻侼侽侾便俀俁係促俄俅俆俇俈俉俊俋俌俍俎俏俐俑俒俓俔俕俖俗俘俙俚俛俜保俞俟俠信俢俣俤俥俦俧俨俩俪俫俬俭修俯俰俱俲俳俴俵俶俷俸俹>俺俻俼俽俾俿倀倁倂倃倄倅倆倇倈倉倊個倌倍倎倏倐們倒倓倔倕倖倗倘候倚倛倜倝倞借倠倡倢倣値倥倦倧倨倩倪倫倬倭倮倯倰倱倲倳倴倵倶倷倸倹债倻值倽倾倿偀偁偂偃偄偅偆假偈偉偊偋偌偍>偎偏偐偑偒偓偔",
\ ]
endfunc
call Foo()
diff --git a/src/syntax.c b/src/syntax.c
index e0736cb63..87d374955 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -7354,6 +7354,19 @@ lookup_color(int idx, int foreground, int *boldp)
return color;
}
+ static void
+update_str_arg(char_u **str, char_u *arg)
@ichizok
ichizok / term_getruncmd.patch
Last active August 1, 2017 08:42
rough implementation for demonstration
diff --git a/src/evalfunc.c b/src/evalfunc.c
index fc0e05dad..9ef54bba8 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -835,6 +835,7 @@ static struct fst
{"term_getcursor", 1, 1, f_term_getcursor},
{"term_getjob", 1, 1, f_term_getjob},
{"term_getline", 1, 2, f_term_getline},
+ {"term_getruncmd", 1, 1, f_term_getruncmd},
{"term_getsize", 1, 1, f_term_getsize},
diff --git a/src/eval.c b/src/eval.c
index 401171c9b..4cb32893f 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -5329,6 +5329,10 @@ garbage_collect(int testing)
abort = abort || set_ref_in_quickfix(copyID);
#endif
+#ifdef FEAT_TERMINAL
+ abort = abort || set_ref_in_term(copyID);
@ichizok
ichizok / term-cursor.patch
Last active July 26, 2017 16:41
fix cursor visibility
diff --git a/src/terminal.c b/src/terminal.c
index 9833a43b7..ea60f0783 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -322,11 +322,13 @@ update_cursor(term_T *term, int redraw)
{
/* TODO: this should not always be needed */
setcursor();
- if (redraw && term->tl_buffer == curbuf && term->tl_cursor_visible)
diff --git a/src/testdir/shared.vim b/src/testdir/shared.vim
index e28d162b8..790b07b56 100644
--- a/src/testdir/shared.vim
+++ b/src/testdir/shared.vim
@@ -111,14 +111,15 @@ endfunc
" Wait for up to a second for "expr" to become true.
" Return time slept in milliseconds. With the +reltime feature this can be
" more than the actual waiting time. Without +reltime it can also be less.
-func WaitFor(expr)
+func WaitFor(expr, ...)
@ichizok
ichizok / peco.bash
Last active March 9, 2017 10:33
peco.bash
if type peco &>/dev/null; then
# pd (peco-change-directory)
function pd() {
local dir_tmp=
local dir_path=${1:-.}
local dot_line_show="[show dot]"
local dot_line_hide="[hide dot]"
local dot_line=${dot_line_show}
while true; do
dir_path=$(cd "${dir_path/\/\///}"; pwd)
@ichizok
ichizok / ssh.zsh
Last active March 1, 2017 17:17
restore window name
# restore window name
[[ "$@" =~ BatchMode=yes ]] || echo -ne '\e[22;0t'
command ssh "$@"
[[ "$@" =~ BatchMode=yes ]] || echo -ne '\e[23;0t'
@ichizok
ichizok / peco_hist.zsh
Last active February 15, 2017 05:59
zsh select history by peco
## select-history by peco
if type peco &>/dev/null; then
if type tac &>/dev/null; then
function _reverse_lines() { tac }
else
function _reverse_lines() { tail -r }
fi
function peco-select-history() {
BUFFER=$(history -n 1 | _reverse_lines | peco --query "${LBUFFER}")
CURSOR=${#BUFFER}