Skip to content

Commit 6d645a1

Browse files
fix(nix): add filewritable check to syn_rootpath
1 parent fd42b20 commit 6d645a1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

autoload/sonokai.vim

+3-2
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,10 @@ function! sonokai#syn_write(rootpath, syn, content) "{{{
267267
call writefile(['" vim: set sw=2 ts=2 sts=2 et tw=80 ft=vim fdm=marker fmr={{{,}}}:'], syn_path, 'a')
268268
endfunction "}}}
269269
function! sonokai#syn_rootpath(path) "{{{
270+
let plugin_path = fnamemodify(a:path, ':p:h:h')
270271
" Get the directory where `after/syntax` is generated.
271-
if (matchstr(a:path, '^/usr/share') ==# '') " Return the plugin directory. The `after/syntax` directory should never be generated in `/usr/share`, even if you are a root user.
272-
return fnamemodify(a:path, ':p:h:h')
272+
if (matchstr(a:path, '^/usr/share') ==# '' && filewritable(plugin_path) == 2) " Return the plugin directory. The `after/syntax` directory should never be generated in `/usr/share`, even if you are a root user.
273+
return plugin_path
273274
else " Use vim home directory.
274275
if has('nvim')
275276
return stdpath('config')

colors/sonokai.vim

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
let s:configuration = sonokai#get_configuration()
1111
let s:palette = sonokai#get_palette(s:configuration.style, s:configuration.colors_override)
1212
let s:path = expand('<sfile>:p') " the path of this script
13-
let s:last_modified = 'Mon Sep 30 10:09:56 UTC 2024'
13+
let s:last_modified = 'Wed Dec 25 11:24:30 PM UTC 2024'
1414
let g:sonokai_loaded_file_types = []
1515

1616
if !(exists('g:colors_name') && g:colors_name ==# 'sonokai' && s:configuration.better_performance)

0 commit comments

Comments
 (0)