【NeoVim】macOS Alfred5工作流用iTerm打开neoVim并进入全屏

环境

  • macOS
  • Alfred5
  • neoVim
  • iTerm2

步骤

  1. Alfred5创建新的工作流

  2. 创建输入组件
    inputs --> Keyword 拖进caves,双击编辑
    在这里插入图片描述
    这里的Keyword我设置的是vim,按照自己的喜好修改

  3. 创建脚本组件
    Actions --> Run Script
    这一步和下一步无所谓先后,如果不知道为啥这么写,先看下一步
    在这里插入图片描述

  4. applescript

    • 打开当前工作流所在文件夹:点击上面标注的图标
    • 创建文件:openVim.applescript
    • 用文本编辑器或者脚本编辑器(macOS自带)打开
    • 输入脚本,保存关闭
    on run argv
    	set useFullScreen to true -- 默认全屏
    	
    	if (count of argv) is not 0 then
    		set argValue to item 1 of argv as integer
    		if argValue is 0 then
    			set useFullScreen to false
    		end if
    	end if
    	
    	tell application "iTerm"
    		activate
    		create window with default profile
    		
    		-- set to fullscreen
    		if useFullScreen then
    			tell application "System Events"
    				tell process "iTerm2"
    					click (first menu item whose name is "Toggle Full Screen") of menu "View" of menu bar 1
    				end tell
    			end tell
    		end if
    		delay(0.8)
    		-- open nvim
    		tell current session of current window
    			write text "nvim" --命令,如果打开vim改成相应的命令
    		end tell
    	end tell
    end run
    
    

使用

vim [0/1]

呼出alfred之后输入vim即可打开neoVIm
默认全屏打开,如果Keyword后面加入参数0,就是默认窗口大小打开;如果参数是1,也是全屏打开。

参数

  • 缺省/1: 全屏打开neovim
  • 0: 默认大小窗口打开neovim
    在这里插入图片描述
  • 9
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值