Skip to content

Commit

Permalink
++ 新增 createPlugin 插件,用于自动生成插件模板。
Browse files Browse the repository at this point in the history
  • Loading branch information
linxinhong committed Dec 5, 2019
1 parent 3954f69 commit 133c1b7
Show file tree
Hide file tree
Showing 10 changed files with 192 additions and 22 deletions.
2 changes: 1 addition & 1 deletion lib/class_quickz.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,6 @@
Comment(actionName, tipString) {
quickz.self.Actions[actionName] := tipString
vimd.Comment(actionName, tipString)
menuz.SetExec(tipString, actionName)
menuz.SetExec(actionName, actionName)
}
}
6 changes: 3 additions & 3 deletions lib/class_vimd.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,9 @@
this.onAfterAction := config.onAfterAction
this.onShowTip := config.onShowTip
this.onHideTip := config.onHideTip
if (IsFunc(config.onInit)) {
Func(config.onInit).call(this)
}
; if (IsFunc(config.onInit)) {
; Func(config.onInit).call(this)
; }
}

HasMode(modeName) {
Expand Down
8 changes: 7 additions & 1 deletion quickz.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ menuz.config({cliptimeout: 400
,onGetClip: "myGetClip"})
menuz.SetFilter("tt", "texttype")
menuz.setexec("sendtext", "sendtext")
menuz.setexec("sendenter", "sendenter")
menuz.setexec("copynamenoext", "copynamenoext")
menuz.settag("test", "tagtest")
menuz.settag("box", "tagbox")
Expand All @@ -39,6 +40,11 @@ sendtext(env, item) {
SendRaw % menuz.ReplaceTag(item.param)
}

sendenter(env, item) {
WinActivate, % "ahk_id " env.winHwnd
Send {enter}
}

copynamenoext(env, item) {
clipboard := env.file.namenoext
}
Expand Down Expand Up @@ -97,7 +103,7 @@ return
return

!x::reload
!q::menuz.Active()
CapsLock::menuz.Active()

#include lib\class_vimd.ahk
#include lib\class_menuz.ahk
Expand Down
6 changes: 6 additions & 0 deletions user/conemu/conemu.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
conemuinit() {

}
conemu() {

}
33 changes: 33 additions & 0 deletions user/conemu/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
plugin:
author: ''
include: conemu.ahk
info: ''
init: conemu_init
name: ''
version: ''
command: ''
config: ''
menu:
var:
conemu: ''
vimd:
name: conemu
winclass: Chrome_WidgetWin_1
winexe: Code.exe
maxCount: 999
timeOut: 500
onMap: ''
onBeforeKey: ''
onAfterKey: ''
onBeforAction: ''
onAfterAction: ''
onChangeMode: ''
onShowTip: ''
onHideTip: ''
mode:
insert:
map: ''
normal:
default: true
mapnum: false
map: ''
14 changes: 10 additions & 4 deletions user/config.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
{
"vimd": {
"winList":{}
},
"var": {
"exec": {},
"filter": {}
},
"tag": {

},
"setting": {

},
"menuz": {
"var": {},
"filter": {},
"color": {},
"menu": {}
}
}
83 changes: 83 additions & 0 deletions user/createplugin/createplugin.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
createPlugin_init() {
menuz.SetExec("createplugin", "createplugin")
}

CreatePlugin(env, item) {
InputBox, pluginName, 新建插件, 指定插件名称
if (not StrLen(pluginName)) {
return
}
pluginDir := A_ScriptDir "\User\" pluginName
ahkFilePath := PluginDir "\" pluginName ".ahk"
ymlFilePath := PluginDir "\plugin.yml"
ahk := pluginName "init() {`n`n}`n" pluginName "() {`n`n}"
yml =
(
plugin:
author: ''
include: %pluginName%.ahk
info: ''
init: %pluginName%_init
name: ''
version: ''
command: ''
config: ''
menu:
var:
%pluginName%: ''
vimd:
name: %PluginName%
winclass: Chrome_WidgetWin_1
winexe: Code.exe
maxCount: 999
timeOut: 500
onMap: ''
onBeforeKey: ''
onAfterKey: ''
onBeforAction: ''
onAfterAction: ''
onChangeMode: ''
onShowTip: ''
onHideTip: ''
mode:
insert:
map: ''
normal:
default: true
mapnum: false
map: ''
)
; yml := yaml_dump({plugin: {name: ""
; , author: ""
; , version: ""
; , info: ""
; , include: pluginName ".ahk"
; , init: pluginName "_init"}
; ,config: ""
; ,command: ""
; ,var: {pluginName: ""}
; ,menu: {}
; ,vimd: {name: pluginName
; ,winclass: env.winclass
; ,winexe: env.winexe
; ,onMap: ""
; ,onChangeMode: ""
; ,onBeforeKey: ""
; ,onAfterKey: ""
; ,onBeforAction: ""
; ,onAfterAction: ""
; ,onShowTip: ""
; ,onHideTip: ""
; ,mode: {normal: {mapnum: true
; ,default: true
; ,map: ""}
; ,insert: {map: ""}}}})
if (not FileExist(PluginDir)) {
FileCreateDir, %PluginDir%
FileAppend, %ahk%, %ahkFilePath%
FileAppend, %yml%, %ymlFilePath%
}
else {
msgbox % "插件:" pluginName "已经存在"
}
}
7 changes: 7 additions & 0 deletions user/createplugin/plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugin:
name: "createplugin"
author: Array
version: 1.0
info: "创建新插件"
include: "createplugin.ahk"
init: "createplugin_init"
3 changes: 2 additions & 1 deletion user/include.ahk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#Include *i D:\Git\ahk\quickz-design\User\everything\everything.ahk
#Include *i D:\Git\ahk\quickz-design\User\createplugin\createplugin.ahk
#Include *i D:\Git\ahk\quickz-design\User\everything\everything.ahk
#Include *i D:\Git\ahk\quickz-design\User\general\general.ahk
#Include *i D:\Git\ahk\quickz-design\User\totalcmd\totalcmd.ahk
#Include *i D:\Git\ahk\quickz-design\User\yml2menu\loadmenu.ahk
52 changes: 40 additions & 12 deletions user/yml2menu/menu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
everything: C:\Program Files\Everything\Everything.exe
explorer: C:\windows\system32\explorer.exe
conemu: D:\Program Files\cmder\vendor\conemu-maximus5\ConEmu.exe
docker: C:\Program Files\Docker\Docker\resources\bin\docker.exe

filter:
textfile: ahk, js, py, yml, yaml, txt, dockerfile, vim
Expand All @@ -23,7 +24,7 @@ color:
icon: %conemu%:0
exec: %conemu%
param: -dir "{file:dir}"
filter: "{only:file}"
filter: "{only:=file}"

- name: ""
filter: "{tt:=url}"
Expand Down Expand Up @@ -53,17 +54,17 @@ color:
exec: %gvim%
param: ""{file:path}""
workdir: "{file:dir}"
filter: "{ext:=%textfile%}, {only:file}"
filter: "{ext:=%textfile%}, {only:=file}"

- name: "VSCode打开"
icon: %VSCode%:0
exec: %vscode%
param: ""{file:path}""
filter: "{only:file}"
filter: "{only:=file}"

- name: "复制文件名"
exec: <copynamenoext>
filter: "{only:file}"
filter: "{only:=file}"

- name: "quickz-ui"
icon: %vscode%:0
Expand All @@ -83,15 +84,37 @@ color:
param: D:\git\ahk\quickz-design
filter: "{pos:x>800 y>600}"

- name: "切换到quickz-design"
exec: <sendtext>
param: cd /d D:\git\ahk\quickz-design
filter: {winexe:=cmd.exe}
- name: "CMD命令工具集"
filter: {winexe:=cmd.exe, conemu.exe}
peer:

- name: "选择文件夹后切换"
exec: <sendtext>
param: cd /d {box:folder}
filter: {winexe:=cmd.exe}
- name: "切换到quickz-design"
exec: <sendtext><sendenter>
param: cd /d D:\git\ahk\quickz-design

- name: "选择文件夹后切换"
exec: <sendtext><sendenter>
param: cd /d {box:folder}

- name: "Docker-选择ID并进入命令行"
icon: %docker%:0
exec: <sendtext><sendenter>
param: docker exec -ti {text} /bin/bash

- name: "Docker-选择ID并重启"
icon: %docker%:0
exec: <sendtext><sendenter>
param: docker stop {text} & docker start {text}

- name: "Docker-compose up"
icon: %docker%:0
exec: <sendtext><sendenter>
param: docker-compose up -d

- name: "Docker-compose down"
icon: %docker%:0
exec: <sendtext><sendenter>
param: docker-compose down

- ""

Expand All @@ -110,3 +133,8 @@ color:
- name: "编辑QuickZ.ahk"
exec: %gvim%
param: D:\git\ahk\quickz-design\quickz.ahk

- name: "创建新插件"
exec: <CreatePlugin>


0 comments on commit 133c1b7

Please sign in to comment.