Compare commits
No commits in common. "b8c520d600488add405c4c6cbf42f8d149c91a16" and "ef8459d27879f33a46e645c4e63140f89f33116b" have entirely different histories.
b8c520d600
...
ef8459d278
@ -46,84 +46,6 @@ function! OpenPuppetProfileOrRole(layout)
|
|||||||
" Initialize an empty variable for the directory
|
" Initialize an empty variable for the directory
|
||||||
let dirpath = ""
|
let dirpath = ""
|
||||||
|
|
||||||
" List modules in puppet-control here
|
|
||||||
let module_list = []
|
|
||||||
call add(module_list, 'certbot')
|
|
||||||
call add(module_list, 'glauth')
|
|
||||||
call add(module_list, 'jellyfin')
|
|
||||||
call add(module_list, 'lidarr')
|
|
||||||
call add(module_list, 'networking')
|
|
||||||
call add(module_list, 'nzbget')
|
|
||||||
call add(module_list, 'prowlarr')
|
|
||||||
call add(module_list, 'radarr')
|
|
||||||
call add(module_list, 'readarr')
|
|
||||||
call add(module_list, 'redisha')
|
|
||||||
call add(module_list, 'sonarr')
|
|
||||||
|
|
||||||
" Check if the class name starts with 'profiles::' or 'roles::'
|
|
||||||
if classname =~ '^profiles::'
|
|
||||||
let dirpath = "site/profiles/manifests/"
|
|
||||||
let classname = substitute(classname, 'profiles::', '', '')
|
|
||||||
elseif classname =~ '^roles::'
|
|
||||||
let dirpath = "site/roles/manifests/"
|
|
||||||
let classname = substitute(classname, 'roles::', '', '')
|
|
||||||
else
|
|
||||||
let matched = 0
|
|
||||||
for module in module_list
|
|
||||||
if classname =~ '^' . module . '::'
|
|
||||||
let dirpath = "modules/" . module . "/manifests/"
|
|
||||||
let parts = split(classname, '::')
|
|
||||||
if len(parts) > 1
|
|
||||||
let classname = join(parts[1:], '::')
|
|
||||||
else
|
|
||||||
let classname = 'init'
|
|
||||||
endif
|
|
||||||
let matched = 1
|
|
||||||
break
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
if matched == 0
|
|
||||||
if classname =~ '::'
|
|
||||||
echo "Unknown module"
|
|
||||||
return
|
|
||||||
else
|
|
||||||
echo "Unknown class prefix, should be profiles:: or roles::, or be a listed module."
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Replace :: with / to convert class name to file path
|
|
||||||
let filepath = substitute(classname, '::', '/', 'g')
|
|
||||||
|
|
||||||
" Create the full file path
|
|
||||||
let fullpath = dirpath . filepath . ".pp"
|
|
||||||
|
|
||||||
" Open the file in a new tab
|
|
||||||
if a:layout == 'horizontal'
|
|
||||||
execute 'split ' . fullpath
|
|
||||||
elseif a:layout == 'vertical'
|
|
||||||
execute 'vsplit ' . fullpath
|
|
||||||
elseif a:layout == 'tab'
|
|
||||||
execute 'tabedit ' . fullpath
|
|
||||||
else
|
|
||||||
echo "Invalid layout specified."
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
]])
|
|
||||||
|
|
||||||
vim.cmd([[
|
|
||||||
function! OpenPuppetProfileOrRoleOriginal(layout)
|
|
||||||
|
|
||||||
" Get the line under the cursor
|
|
||||||
let line = getline(".")
|
|
||||||
|
|
||||||
" Use a regex to find the full class name
|
|
||||||
let classname = tolower(matchstr(line, '\v\w+(\:\:\w+)+'))
|
|
||||||
|
|
||||||
" Initialize an empty variable for the directory
|
|
||||||
let dirpath = ""
|
|
||||||
|
|
||||||
" Check if the class name starts with 'profiles::' or 'roles::'
|
" Check if the class name starts with 'profiles::' or 'roles::'
|
||||||
if classname =~ '^profiles::'
|
if classname =~ '^profiles::'
|
||||||
let dirpath = "site/profiles/manifests/"
|
let dirpath = "site/profiles/manifests/"
|
||||||
@ -205,7 +127,7 @@ function! OpenPuppetClassOrTemplate(layout)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Check if it's an included class (profiles:: or roles::)
|
" Check if it's an included class (profiles:: or roles::)
|
||||||
if line =~ '::'
|
if line =~ '\(profiles\|roles\)::'
|
||||||
call OpenPuppetProfileOrRole(a:layout)
|
call OpenPuppetProfileOrRole(a:layout)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit 906960d513741ffcb782d42e229bd1153382885a
|
Subproject commit 3546217b65c837617d7bdb467054bbb4b6122a98
|
||||||
@ -5,7 +5,7 @@ sudo dnf install -y dnf-plugins-core
|
|||||||
|
|
||||||
# enable copr
|
# enable copr
|
||||||
sudo dnf copr enable ganto/lxc4 -y
|
sudo dnf copr enable ganto/lxc4 -y
|
||||||
#sudo dnf copr enable livegrenier/i3-desktop -y
|
sudo dnf copr enable livegrenier/i3-desktop -y
|
||||||
sido dnf copr enable tokariew/i3lock-color -y
|
sido dnf copr enable tokariew/i3lock-color -y
|
||||||
|
|
||||||
# install rpmfusion
|
# install rpmfusion
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user