Migrated to ansible
This commit is contained in:
20
roles/yazi/files/keymap.toml
Normal file
20
roles/yazi/files/keymap.toml
Normal file
@@ -0,0 +1,20 @@
|
||||
# Bookmarks
|
||||
[[manager.prepend_keymap]]
|
||||
on = [ "b", "g" ]
|
||||
run = "cd ~/git/"
|
||||
desc = "GIT"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
on = [ "b", "d" ]
|
||||
run = "cd ~/Data/"
|
||||
desc = "DATA"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
on = [ "b", "s" ]
|
||||
run = "plugin bookmark --args=save"
|
||||
desc = "Save Bookmark"
|
||||
|
||||
[[manager.prepend_keymap]]
|
||||
on = [ "b", "j" ]
|
||||
run = "plugin bookmark --args=jump"
|
||||
desc = "Jump Bookmark"
|
||||
39
roles/yazi/files/plugins/bookmark.yazi/init.lua
Normal file
39
roles/yazi/files/plugins/bookmark.yazi/init.lua
Normal file
@@ -0,0 +1,39 @@
|
||||
local temp_dir = os.getenv("TEMP") or os.getenv("TMP") or "/tmp"
|
||||
local file_name = temp_dir .. "/bookmark.yazi"
|
||||
|
||||
local save_bookmark = ya.sync(function(state, idx)
|
||||
local folder = Folder:by_kind(Folder.CURRENT)
|
||||
local file = io.open(file_name, "w")
|
||||
|
||||
if file then
|
||||
file:write(tostring(folder.cwd))
|
||||
file:close()
|
||||
end
|
||||
end)
|
||||
|
||||
local jump_bookmark = ya.sync(function(state, idx)
|
||||
local io = require("io")
|
||||
local file = io.open(file_name, "r")
|
||||
|
||||
if file then
|
||||
local line = file:read("*line")
|
||||
file:close()
|
||||
ya.manager_emit("cd", { line })
|
||||
ya.manager_emit("arrow", { -99999999 })
|
||||
end
|
||||
end)
|
||||
|
||||
return {
|
||||
entry = function(_, args)
|
||||
local action = args[1]
|
||||
if not action then
|
||||
return
|
||||
end
|
||||
|
||||
if action == "save" then
|
||||
save_bookmark()
|
||||
elseif action == "jump" then
|
||||
jump_bookmark()
|
||||
end
|
||||
end
|
||||
}
|
||||
4
roles/yazi/files/yazi.toml
Normal file
4
roles/yazi/files/yazi.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[manager]
|
||||
sort_dir_first = true
|
||||
show_hidden = true
|
||||
show_symlink = true
|
||||
18
roles/yazi/tasks/main.yml
Normal file
18
roles/yazi/tasks/main.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
- name: "[Yazi] Install"
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- yazi
|
||||
state: latest
|
||||
become: true
|
||||
|
||||
- name: "[Yazi] Create config folder"
|
||||
ansible.builtin.file:
|
||||
mode: "0755"
|
||||
path: "{{ ansible_user_dir }}/.config/yazi"
|
||||
state: directory
|
||||
|
||||
- name: "[Yazi] Configure"
|
||||
ansible.builtin.copy:
|
||||
src: "./"
|
||||
dest: "{{ ansible_user_dir }}/.config/yazi"
|
||||
Reference in New Issue
Block a user