2009-07-04 10 views
0

이 질문은 this thread을 기반으로합니다.MySQL 용 화면에서 Vim과 같은 K를 사용하려면

문제 : 커서가있을 때이 m에 대한 M ysql을 생각 나게

Ctrl-A Esc Ctrl-m 

에 의해 단어의 시작 부분에 MySQL의 설명서에 액세스 할 수 있습니다.

MySQL의 매뉴얼을 위해 Vim-like K를 어떻게 만들 수 있습니까?

+0

http://stackoverflow.com/questions/1104536/unable-to-install-mysql-manuals-to-mac에 MySQL 매뉴얼 설치에 관한 스레드를 열었습니다. –

답변

3

당신은 MySQL's documentation site에서 man 페이지를 설치 한 가정하면

/path/to/mysql-help.screen에 다음을 넣어 :

# mysql-help.screen 

# prevent messages from slowing this down 
msgminwait 0 
# copy term starting at cursor 
copy 
stuff " e " 
# write term to a file 
writebuf /tmp/screen-copied-term 
# open that file in man in a new screen window 
# (use `read` to pause on error, so user can see error message) 
screen /bin/sh -c 'man `cat /tmp/screen-copied-term` || read' 
# turn message waiting back on 
msgminwait 1 

# vi: ft=screen 

그런 다음 ~/.screenrc

# Have CTRL-A ESC put you in a mode to accept commands in the 'escaped' class 
bind \033 command -c escaped 
# add CTRL-M as an 'escaped' class command to run the given screen script 
bind -c escaped ^M source /path/to/mysql-help.screen 

이 그런 다음 키 바인딩이 작동합니다 당신이 추가 . 다른 프로그램을 사용하여 man 이외의 설명서 을 표시하는 경우 그에 따라 스크립트를 변경해야합니다.

mysqlbugmysqlhotcopyperrormysqldumpresolveipmysqltest_embeddedmysql_setpermissionmysql_client_testmysql_find_rowsmysql_fix_privilege_tablesmysql_waitpidmysql_configmysql_client_test_embeddedmyisampackreplacemsql2mysqlmake_win_bin_distmy_print_defaults:

난 단지 위의 링크에서 확인할 MySQL을위한 man 페이지는 다음 명령에 대한 문서 포함- stress - test. plmysqlaccessmysql_secure_installationmysql. servermysql_convert_table_formatmysql_zapmysql_fix_extensionsmyisamlogmyisam_ftdumpmysqlbinlogmysql_install_dbresolve_stack_dumpmysqlslapmysql - test-run.plmysqld_safemysqladminmysqlshowmysql_tzinfo_to_sqlmysqltestmysqlbackupmysqld_multimysqlmysqldumpslowmysqlcheckmysql_upgrademysqlimport

comp_errmysqldmyisamchkinnochecksum

당신은 또한 당신의 .screenrc

zombie kr 

을 추가하는 것을 고려 할 수 있습니다 그래서 당신은 설명서를 실행하는 경우 인식하지 못하는 용어로 화면은 자동으로 창을 닫지 않고 오류 메시지를 숨기지 않습니다.

+0

@rampion : 바인딩 커넬'bind -c ... -c escpaped '에 버그가있는 것 같습니다. 'bindkey -m^m source/Users/masi/bin/screen/mysql-help.screen'에 의해 실패했다. –

+0

@ rampion : 어떤 화면을 사용하나요? 나는 4.00.03 (OS X)을 사용하며 defzombie 명령을 갖고 있지는 않습니다. –

+0

글쎄, 철자가 잘못되었습니다. 그리고 그것은 두 가지 명령입니다. 이것이 두 줄에있는 이유입니다. – rampion

0

vim이 원하는 것을 정확히 수행 할 수있는 래퍼를 만드는 방법을 모르겠지만 vim에 내장 된 함수로 비슷한 효과를 얻을 수있는 방법에 대해 제안 할 수 있습니다.

:! <command>을 사용하면 vim의 K 명령과 비슷한 인터페이스로 쉘 명령을 실행할 수 있습니다. 가장 간단한 방법은 아니지만 :!을 사용하면 vim을 완전히 떠나지 않고도 특정 용어에 대한 MySQL 매뉴얼을 신속하게 호출 할 수 있습니다.

vim 용 플러그인을 직접 작성해야하는 경우 this article에서 포인터를 제공하고 시작 위치를 알려줄 수 있습니다.

도움이 되었기를 바랍니다.

+0

문제는 다음과 같은 그러한 구성 요소를 빌드하는 것입니다. 당신은 터미널에서 MySQL 에러 메시지가있는 곳에 모든 매뉴얼을 사용할 수 있습니다. --- Vim에 그러한 구성 요소를 만들면 우리를 편집자에 의존하게 만들 수 있습니다. –

+0

아, 당신은 vim을위한 플러그인을 만들려하지 않는다. 당신은 스크린 용 플러그인을 만들고 싶다. 죄송합니다, 그건 분명하지 않았습니다. –

+0

Vim을위한 맵핑을 작성하기 전에 Screen이 필요하다는 것을 깨달았습니다. –

0

매뉴얼을 쉽게 읽을 수 있도록 맨 페이지를 재활용하는 것이 좋습니다. 나는 Rampion의 명령에 다음과 같은 개선점을 제안합니다.

Rampion

screen /bin/sh -c 'man `cat /tmp/screen-copied-term` || read' 

screen /bin/sh -c 'man `cat /tmp/screen-copied-term` > /tmp/manual | less /tmp/manual' 

My code gives you the percent sign to the bottom of a manual.

+2

요즘 실제로 사용하는 것들이 있습니다 : http://gist.github.com/139318 – rampion

+0

@ rampion : 제발, 귀하의 명령에 대한이 스레드를 참조하십시오 http://stackoverflow.com/questions/1120756/unable-to-understand-a-code-in-screenrc –

관련 문제