V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  cy18  ›  全部回复第 18 页 / 共 26 页
回复总数  515
1 ... 10  11  12  13  14  15  16  17  18  19 ... 26  
2018-02-12 22:04:47 +08:00
回复了 fyxtc 创建的主题 程序员 急求一个 zsh 超好用的历史记录命令提示插件,求大佬们看看
fish 是好用,但是太激进了,很多语法跟 bash 不兼容,最后还是用了 zsh
现在的脚本在新版的 AHK 会有点问题,下面是改进过的版本:

;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: cy18 <[email protected]>
;
; An improved script to use space as modifier
; In normal cases, if space is pressed for more than 0.1 second, it becomes a modifier, this time could be modified in the script
; If no other keys are pressed during space is pressed, a space is output when space is released
; Severial tunes are made so that the script works well when typing in fast speed
; Note that repeating space no longer works

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
StringCaseSense, On

AnyKeyPressedOtherThanSpace(mode = "P") {
keys = 1234567890-=qwertyuiop[]\asdfghjkl;'zxcvbnm,./
Loop, Parse, keys
{
isDown := GetKeyState(A_LoopField, mode)
if(isDown)
return True
}

return False
}


supressed := False
RestoreInput(){
BlockInput, Off
Global supressed
supressed := False
}

SupressInput(){
Global supressed
supressed := True
BlockInput, On
SetTimer, RestoreInput, -180
}

ModifierStates := ""
UpdateModifierStates(){
Global ModifierStates
if (supressed){
return
}
ModifierStates := ""

if GetKeyState("LWin", "P") || GetKeyState("RWin", "P") {
ModifierStates .= "#"
}

if GetKeyState("Ctrl", "P"){
ModifierStates .= "^"
}

if GetKeyState("Alt", "P"){
ModifierStates .= "!"
}

if GetKeyState("Shift", "P"){
ModifierStates .= "+"
}
}

SendKey(Key, num=1){
Global ModifierStates
Loop, %num%{
Send, %ModifierStates%%Key%
}
}

ReleaseModifier(){
global space_up
if (not space_up){
space_up := true
}
Send, {RShift}
}

Space Up::
Send {Blind}{Space up}
space_up := true
SendEvent, {RShift}
return
Space::
if AnyKeyPressedOtherThanSpace(){
SendInput, {Blind}{Space}
Return
}
if (GetKeyState(LShift, mode)){
SendInput ^{Space}
Return
}
inputed := False
space_up := False
input, UserInput, L1 T0.05, {RShift}
if (space_up) {
Send, {Blind}{Space}
return
}else if (StrLen(UserInput) == 1){
Send, {Space}%UserInput%
return
}
SetTimer, ReleaseModifier, -18000
while true{
input, UserInput, L1, {RShift}
if (space_up) {
if (!inputed){
Send, {Blind}{Space}
}
break
}else{
inputed := True
StringLower, UserInput, UserInput
UpdateModifierStates()
SupressInput()
if (UserInput == "e")
SendKey("{Up}")
else if (UserInput == "d")
SendKey("{Down}")
else if (UserInput == "s")
SendKey("{Left}")
else if (UserInput == "a")
SendKey("{Left}", 8)
else if (UserInput == "f")
SendKey("{Right}")
else if (UserInput == "g")
SendKey("{Right}", 8)
else if (UserInput == "w")
SendKey("{Home}")
else if (UserInput == "r")
SendKey("{End}")
else if (UserInput == "c")
SendKey("{BS}")
else if (UserInput == "x")
SendKey("{BS}", 6)
else if (UserInput == "v")
SendKey("{DEL}")
else if (UserInput == "b")
SendKey("{DEL}", 6)
else if (UserInput == "5")
SendKey("{F5}")
else if (UserInput == "8"){
RestoreInput()
break
}else if (UserInput == "`t")
SendKey(" ")
else
Send, {Blind}%UserInput%
}
}
RestoreInput()
return
@moonhuahua 我试了一下不行- -不知道是不是版本问题,不过改成
else if (UserInput == "`t")
SendKey(" ")就可以用空格+tab 输入空格了
2018-01-31 23:52:36 +08:00
回复了 Cryse 创建的主题 程序员 准备家里整个廉价服务器,两个选择无法决断
性能要求很高?旧笔记本没法满足?
LZ 是不是买了有合约期的合约机?
2017-12-13 09:52:13 +08:00
回复了 swordspoet 创建的主题 Linux 求推荐一款编程开发用 Linux 笔记本
买乞丐版自己加内存,ssd 吧
2017-12-10 09:56:18 +08:00
回复了 gdzzzyyy 创建的主题 Python Python 有个语法一直没理解
书推荐 learning python
2017-12-02 13:18:45 +08:00
回复了 imherer 创建的主题 程序员 Linux crontab 权限问题
我比较好奇 crontab 里面怎么 sudo ?不需要输密码?
2017-12-02 10:19:02 +08:00
回复了 drzhaug 创建的主题 程序员 有关 tcp 和 http 的问题
@zhujinliang 现在 sni 代理好像被认证了,没法用。能不能用这个思路在适当的地方把 TCP 包截断从而避开 sni 被认证的问题?感觉大墙可能还没有做到跟踪每一个 TCP 链接。
2017-11-30 16:47:49 +08:00
回复了 wvc 创建的主题 程序员 哎,好压也开始弹东西了。
给我一个不用 7zip 的理由
2017-11-15 22:01:11 +08:00
回复了 workwonder 创建的主题 Python Python 's builtin min/max is evil
同意 @n2ex2 #11 的观点,不符合 min/max 逻辑的使用方式就应该报错而不应该过度包装。
如果自带的 min,max 默认处理 None,这才是 evil 的。可以参考 JS 各种神奇的==结果。
2017-10-31 09:20:35 +08:00
回复了 creayningy 创建的主题 问与答 招商银行经典白金信用卡,有没有必要激活?已申领。
@yhxx 大神
建议 LZ 去小米之家上手体验一下。流畅度应该问题不大,拿在手里手感,拍照之类的会有点差距。
2017-10-21 08:39:30 +08:00
回复了 xiaoyanbot 创建的主题 问与答 编程(动词)的英文是什么? code 吗?
build a program
2017-10-14 01:20:32 +08:00
回复了 loy6491 创建的主题 问与答 比特币似乎又要开始一轮暴涨?
@won 现在国内网站充不进 rbm 但是能充比特币跟提现
2017-10-13 11:45:47 +08:00
回复了 RqPS6rhmP3Nyn3Tm 创建的主题 Bitcoin 在当下,有哪些用人民币购买比特币的途径?
@pimin #6 这种手续费高么?
2017-10-12 13:31:54 +08:00
回复了 justtery 创建的主题 问与答 大家如何看待不给权限无法运行应用的行为
@lingo #42 可以的,我用的就是小鹤
2017-10-12 09:21:59 +08:00
回复了 justtery 创建的主题 问与答 大家如何看待不给权限无法运行应用的行为
Google 双拼飘过
2017-10-11 06:12:16 +08:00
回复了 cy18 创建的主题 问与答 求推荐个实用的大点、背负好点的双肩包
@joey0904 额- -性价比高?就是在背负比较好的包里面属于不贵的,不是说在所有双肩包里面属于不贵的。背负好的包也有贵有便宜撒- -
1 ... 10  11  12  13  14  15  16  17  18  19 ... 26  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1065 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 34ms · UTC 19:18 · PVG 03:18 · LAX 12:18 · JFK 15:18
Developed with CodeLauncher
♥ Do have faith in what you're doing.