Merge remote-tracking branch 'casimir/modeline-compat'
This commit is contained in:
commit
94748713f2
|
@ -20,26 +20,19 @@ def -hidden _modeline-parse %{
|
||||||
local tr=""
|
local tr=""
|
||||||
|
|
||||||
case "${key}" in
|
case "${key}" in
|
||||||
so) ;&
|
so|scrolloff) tr="scrolloff ${value},${kak_opt_scrolloff##*,}";;
|
||||||
scrolloff) tr="scrolloff ${value},${kak_opt_scrolloff##*,}";;
|
siso|sidescrolloff) tr="scrolloff ${kak_opt_scrolloff%%,*},${value}";;
|
||||||
siso) ;&
|
ts|tabstop) tr="tabstop ${value}";;
|
||||||
sidescrolloff) tr="scrolloff ${kak_opt_scrolloff%%,*},${value}";;
|
sw|shiftwidth) tr="indentwidth ${value}";;
|
||||||
ts) ;&
|
tw|textwidth) tr="autowrap_column ${value}";;
|
||||||
tabstop) tr="tabstop ${value}";;
|
ff|fileformat)
|
||||||
sw) ;&
|
|
||||||
shiftwidth) tr="indentwidth ${value}";;
|
|
||||||
tw) ;&
|
|
||||||
textwidth) tr="autowrap_column ${value}";;
|
|
||||||
ff) ;&
|
|
||||||
fileformat)
|
|
||||||
case "${value}" in
|
case "${value}" in
|
||||||
unix) tr="eolformat lf";;
|
unix) tr="eolformat lf";;
|
||||||
dos) tr="eolformat crlf";;
|
dos) tr="eolformat crlf";;
|
||||||
*) printf %s\\n "echo -debug 'Unsupported file format: ${value}'";;
|
*) printf %s\\n "echo -debug 'Unsupported file format: ${value}'";;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
ft) ;&
|
ft|filetype) tr="filetype ${value}";;
|
||||||
filetype) tr="filetype ${value}";;
|
|
||||||
bomb) tr="BOM utf8";;
|
bomb) tr="BOM utf8";;
|
||||||
nobomb) tr="BOM none";;
|
nobomb) tr="BOM none";;
|
||||||
*) printf %s\\n "echo -debug 'Unsupported vim variable: ${key}'";;
|
*) printf %s\\n "echo -debug 'Unsupported vim variable: ${key}'";;
|
||||||
|
@ -77,17 +70,16 @@ def -hidden _modeline-parse %{
|
||||||
# It will also convert the ':' seperators beween the option=value pairs
|
# It will also convert the ':' seperators beween the option=value pairs
|
||||||
# More info: http://vimdoc.sourceforge.net/htmldoc/options.html#modeline
|
# More info: http://vimdoc.sourceforge.net/htmldoc/options.html#modeline
|
||||||
options=(
|
options=(
|
||||||
$(printf %s\\n "${kak_selection}" | sed -r \
|
$(printf %s\\n "${kak_selection}" | sed \
|
||||||
-e 's/^(.+\s\w+:\s?(set?)?\s)//' \
|
-e 's/^[^:]\{1,\}://' \
|
||||||
-e 's/:?\s[^a-zA-Z0-9_=-]+$//' \
|
-e 's/[ \t]*set\{0,1\}[ \t]//' \
|
||||||
-e 's/:/ /g')
|
-e 's/:[^a-zA-Z0-9_=-]*$//' \
|
||||||
|
-e 's/:/ /g')
|
||||||
)
|
)
|
||||||
|
|
||||||
case "${kak_selection}" in
|
case "${kak_selection}" in
|
||||||
*vi:*) ;&
|
*vi:*|*vim:*) type_selection="vim";;
|
||||||
*vim:*) type_selection="vim";;
|
*kak:*|*kakoune:*) type_selection="kakoune";;
|
||||||
*kak:*) ;&
|
|
||||||
*kakoune:*) type_selection="kakoune";;
|
|
||||||
*) echo "echo -debug Unsupported modeline format";;
|
*) echo "echo -debug Unsupported modeline format";;
|
||||||
esac
|
esac
|
||||||
[ -n "${type_selection}" ] || exit 1
|
[ -n "${type_selection}" ] || exit 1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user