平时除了vscode
, 轻量文本都是用sublime
最近想把sublime
换成neovim
, 找了下, 要么是gui
, 要么是右键菜单运行shell
但收费.
刚好找到 v 友 开发的 OpenInTerminal, 写脚本用Automator
转成 app
#!/bin/bash
config_file="$HOME/.config/alacritty/alacritty_nvim.yml"
nvim_command="/usr/local/bin/nvim"
if [ -n "$1" ]; then
target="$1"
if [ -d "$1" ]; then
working_directory="$1"
else
working_directory=$(dirname "$1")
fi
else
target=""
fi
open -na "Alacritty" --args --config-file="$config_file" --working-directory="$working_directory" -e "$nvim_command" "$target"
替换图标 ontents/Resources/ApplicationStub.icns
如果有更优雅的实现请告诉我(省下买 iRightMenu Pro 的小钱钱)
1
jqtmviyu OP 似乎要改成这样
```sh #!/bin/bash config_file="$HOME/.config/alacritty/alacritty_nvim.yml" nvim_command="/usr/local/bin/nvim" if [ -n "$1" ]; then target="$1" if [ -d "$1" ]; then working_directory="$1" else working_directory=$(dirname "$1") fi else target="" working_directory="$HOME" fi open -na "Alacritty" --args --config-file="$config_file" --working-directory="$working_directory" -e "$nvim_command" ${target:+$target} ``` |
2
akring 2023-09-06 09:15:12 +08:00
看你需求,直接用 neovim 的 gui 好像更直接方便一点?
|
3
jqtmviyu OP |
4
tanranran 2023-09-06 10:29:29 +08:00
|