Merge remote-tracking branch 'lenormf/rc-misc-fixes'
This commit is contained in:
commit
55d1d1020d
|
@ -11,7 +11,7 @@ decl str termcmd %sh{
|
||||||
'gnome-terminal -e ' \
|
'gnome-terminal -e ' \
|
||||||
'xfce4-terminal -e ' ; do
|
'xfce4-terminal -e ' ; do
|
||||||
terminal=${termcmd%% *}
|
terminal=${termcmd%% *}
|
||||||
if which $terminal > /dev/null 2>&1; then
|
if command -v $terminal >/dev/null 2>&1; then
|
||||||
printf %s\\n "'$termcmd'"
|
printf %s\\n "'$termcmd'"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -283,30 +283,35 @@ def -hidden c-family-insert-include-guards %{
|
||||||
|
|
||||||
hook global BufNewFile .*\.(h|hh|hpp|hxx|H) c-family-insert-include-guards
|
hook global BufNewFile .*\.(h|hh|hpp|hxx|H) c-family-insert-include-guards
|
||||||
|
|
||||||
decl str-list alt_dirs ".;.."
|
decl str-list alt_dirs ".:.."
|
||||||
|
|
||||||
def c-family-alternative-file -docstring "Jump to the alternate file (header/implementation)" %{ %sh{
|
def c-family-alternative-file -docstring "Jump to the alternate file (header/implementation)" %{ %sh{
|
||||||
alt_dirs=$(printf %s\\n "${kak_opt_alt_dirs}" | sed -e 's/;/ /g')
|
alt_dirs=$(printf %s\\n "${kak_opt_alt_dirs}" | tr ':' '\n')
|
||||||
file=$(basename "${kak_buffile}")
|
file="${kak_buffile##*/}"
|
||||||
|
file_noext="${file%.*}"
|
||||||
dir=$(dirname "${kak_buffile}")
|
dir=$(dirname "${kak_buffile}")
|
||||||
|
|
||||||
case ${file} in
|
case ${file} in
|
||||||
*.c|*.cc|*.cpp|*.cxx|*.C|*.inl|*.m)
|
*.c|*.cc|*.cpp|*.cxx|*.C|*.inl|*.m)
|
||||||
for alt_dir in ${alt_dirs}; do
|
for alt_dir in ${alt_dirs}; do
|
||||||
for ext in h hh hpp hxx H; do
|
for ext in h hh hpp hxx H; do
|
||||||
altname="${dir}/${alt_dir}/${file%.*}.${ext}"
|
altname="${dir}/${alt_dir}/${file_noext}.${ext}"
|
||||||
[ -f ${altname} ] && break
|
if [ -f ${altname} ]; then
|
||||||
|
printf 'edit %%{%s}\n' "${altname}"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
[ -f ${altname} ] && break
|
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
*.h|*.hh|*.hpp|*.hxx|*.H)
|
*.h|*.hh|*.hpp|*.hxx|*.H)
|
||||||
for alt_dir in ${alt_dirs}; do
|
for alt_dir in ${alt_dirs}; do
|
||||||
for ext in c cc cpp cxx C m; do
|
for ext in c cc cpp cxx C m; do
|
||||||
altname="${dir}/${alt_dir}/${file%.*}.${ext}"
|
altname="${dir}/${alt_dir}/${file_noext}.${ext}"
|
||||||
[ -f ${altname} ] && break
|
if [ -f ${altname} ]; then
|
||||||
|
printf 'edit %%{%s}\n' "${altname}"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
[ -f ${altname} ] && break
|
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -314,9 +319,5 @@ def c-family-alternative-file -docstring "Jump to the alternate file (header/imp
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
if [ -f ${altname} ]; then
|
echo "echo -color Error 'alternative file not found'"
|
||||||
printf %s\\n "edit '${altname}'"
|
|
||||||
else
|
|
||||||
echo "echo -color Error 'alternative file not found'"
|
|
||||||
fi
|
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -24,17 +24,8 @@ def -params 1 -docstring "colorscheme <name>: enable named colorscheme" \
|
||||||
|
|
||||||
%sh{
|
%sh{
|
||||||
autoload_directory() {
|
autoload_directory() {
|
||||||
dir=$1
|
find -L "$1" -type f -name '*\.kak' \
|
||||||
for rcfile in ${dir}/*.kak; do
|
-exec printf 'try %%{ source "%s" } catch %%{ echo -debug Autoload: could not load "%s" }\n' '{}' '{}' \;
|
||||||
if [ -f "$rcfile" ]; then
|
|
||||||
echo "try %{ source '${rcfile}' } catch %{ echo -debug Autoload: could not load '${rcfile}' }";
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
for subdir in ${dir}/*; do
|
|
||||||
if [ -d "$subdir" ]; then
|
|
||||||
autoload_directory $subdir
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
localconfdir=${XDG_CONFIG_HOME:-${HOME}/.config}/kak
|
localconfdir=${XDG_CONFIG_HOME:-${HOME}/.config}/kak
|
||||||
|
|
Loading…
Reference in New Issue
Block a user