-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve vim syntax files. #226
Conversation
This adds autoindent, based on the Python indentation files from neovim. The directory layout is modified so that the repo can be checked out unchanged in your .vim/pack directory for Vim 8 compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
start/vim/indent/toit.vim
Outdated
" | ||
" Vim indent file | ||
" Language: Toit | ||
" Maintainer: Bram Moolenaar <Bram@vim.org> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update this.
start/vim/indent/toit.vim
Outdated
" Language: Toit | ||
" Maintainer: Bram Moolenaar <Bram@vim.org> | ||
" Original Author: David Bustos <bustos@caltech.edu> | ||
" Last Change: 2021 Sep 26 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This too?
start/vim/indent/toit.vim
Outdated
setlocal autoindent " indentexpr isn't much help otherwise | ||
|
||
setlocal indentexpr=ToitGetIndent(v:lnum) | ||
setlocal indentkeys+=<:>,=elif,=except |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elif and except don't make sense.
start/vim/indent/toit.vim
Outdated
|
||
let b:undo_indent = "setl ai< inde< indk< lisp<" | ||
|
||
" Support for Python indenting, see runtime/indent/python.vim |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/python/toit
start/vim/indent/toit.vim
Outdated
return indent(a:lnum) <= a:expected - s:normal_indent | ||
endfunction | ||
|
||
" Some other filetypes which embed Python have slightly different indent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment doesn't really apply.
start/vim/indent/toit.vim
Outdated
endif | ||
|
||
" If the current line begins with a keyword that lines up with "try" | ||
if getline(a:lnum) =~ '^\s*\(except\|finally\)\>' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have 'except'.
Is this trying to unindent?
start/vim/indent/toit.vim
Outdated
if getline(a:lnum) =~ '^\s*\(except\|finally\)\>' | ||
let lnum = a:lnum - 1 | ||
while lnum >= 1 | ||
if getline(lnum) =~ '^\s*\(try\|except\)\>' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto: we don't have 'except'.
start/vim/indent/toit.vim
Outdated
endif | ||
|
||
" If the current line begins with a header keyword, dedent | ||
if getline(a:lnum) =~ '^\s*\(elif\|else\)\>' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Toit doesn't have 'elif'
start/vim/indent/toit.vim
Outdated
if getline(a:lnum) =~ '^\s*\(elif\|else\)\>' | ||
|
||
" Unless the previous line was a one-liner | ||
if getline(plnumstart) =~ '^\s*\(for\|if\|elif\|try\)\>' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto: we don't have elif.
and the try probably doesn't behave the same.
return plindent - s:normal_indent | ||
endif | ||
|
||
" When after a () construct we probably want to go back to the start line. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure that's really true for Toit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still LGTM.
This adds autoindent, based on the Python indentation files from neovim.
The directory layout is modified so that the repo can be checked out unchanged in your .vim/pack directory for Vim 8 compatibility.