[m-rev.] for review: rewrite of vim syntax file
Peter Wang
novalazy at gmail.com
Thu Apr 16 16:29:16 AEST 2015
On Wed, 15 Apr 2015 12:40:36 +0800, Sebastan Godelet <sebastian.godelet at outlook.com> wrote:
> >
> > >
> > > In your diff, you marked these <Fx> keyboard commands as
> > > conflicting: " <F6> attempts to wrap a call up with { } braces for
> > > DCG escapes. "
> > > -nnoremap <F6> I{ <ESC>%a }<ESC>j
> > > +" pw - conflicts
> > > +" nnoremap <F6> I{ <ESC>%a }<ESC>j
> >
> > Sorry, it only conflicts with my own <F6> binding.
> Do you think that many users are using this?
I doubt it, after DCGs were largely displaced by state variables.
> I find your keybindings far more useful.
> >
> > > " <F7> and <F8> comment and uncomment lines out respectively.
> > > "
> > > -nnoremap <F7> 0i% <ESC>j
> > > -nnoremap <F8> :s/% //e<CR>j
> > > +" pw - should only be applicable to mercury
> > > +" nnoremap <F7> 0i% <ESC>j
> > > +" nnoremap <F8> :s/% //e<CR>j
> > >
> > > These I didn't touch (at least I can't recall that), as far as I
> > > remember there were like this in the original version.
> >
> > Never mind, I just use something else for toggling comments which
> > works for multiple languages.
> Would you mind to share?
Hacked copy of this: http://www.vim.org/scripts/script.php?script_id=2844
> @@ -71,9 +76,35 @@ following directive after the |encoding| setting from 4. >
> =============================================================================
> 3. Filetype plugin *mercury-ftplugin*
>
> +If the mercury_highlight_extra option from |mercury-syntax| is enabled,
> +One can use the following function to visually select the current
one
> +code block (e.g. predicate definition, declaration, pragma, etc.), which
> +might be helpful for refactoring. You can put this into ftplugin (or
> +|after-directory|) file: >
> +
> + inoremap <KEY> <ESC>:call <SID>MarkCurrentPred()<CR>
> + nnoremap <KEY> :call <SID>MarkCurrentPred()<CR>
> +>
> +
> +In a previous version of the ftplugin, there where these keybindings
> +defined which are presumably not used that often. If you want them back,
> +please put them into the same file as above, preferably into an
> +|after-directory| file: >
> +
> + " <F6> attempts to wrap a call up with { } braces for DCG escapes.
> + "
> + nnoremap <F6> I{ <ESC>%a }<ESC>j
> +
> + " <F7> and <F8> comment and uncomment lines out respectively.
> + "
> + nnoremap <F7> 0i% <ESC>j
> + nnoremap <F8> :s/% //e<CR>j
> +<
Or just comment them out in mercury.vim?
> diff --git a/vim/ftplugin/mercury.vim b/vim/ftplugin/mercury.vim
> index d1bef44..1087274 100644
> --- a/vim/ftplugin/mercury.vim
> +++ b/vim/ftplugin/mercury.vim
...
> @@ -92,11 +82,26 @@ endif
> nnoremap ,m <C-W>b:!make<UP><CR>
> autocmd! FileChangedShell *.err vi!
>
> - " Match all the occurances of the variable under the cursor
> - "
> -augroup mercuryMatchVar
> - autocmd! CursorMoved,CursorMovedI,WinEnter <buffer> call s:HighlightMatchingVariables()
> -augroup END
> +nnoremap ,p <ESC>O:- pred
> +nnoremap ,f <ESC>O:- func
> +nnoremap ,t <ESC>O:- type
> +nnoremap ,i <ESC>O:- import_module
> +nnoremap ,P <ESC>O:- pragma foreign_proc("C",<CR><TAB>(_IO0::di, _IO::uo),<CR>[will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],<CR><BS>"<CR><CR><BS>").<ESC>kkkei
> +nnoremap ,M <ESC>O:- mutable(VAR, TYPE, VALUE, ground, [untrailed, attach_to_io_state]).<ESC>2FVcw
> +nnoremap ,T <ESC>Otrace [io(!IO)] (<CR>),<ESC>^O<TAB>
> +
> + " sg - this is now the default
> +" nnoremap ,m :set makeprg=mmc\ --make\
Ok. BTW I found you need to escape the space with backslash:
setlocal makeprg=mmc\ --make
> +nnoremap gi m':1/^:- interface<CR>jj
> +nnoremap gI m':1/^:- implementation<CR>jj
> +nnoremap gE m':/^:- end_module<CR>
gi and gI are standard vim commands so perhaps we should pick something
else, say, <C-X>i and <C-X>I? I don't remember ever using the gE binding
after adding it.
> +
> +inoremap <F3> ::in,
> +inoremap <F4> ::out,
> +inoremap <F5> io::di, io::uo)
> +inoremap <F6> is det.
> +
> + " functions
> diff --git a/vim/syntax/mercury.vim b/vim/syntax/mercury.vim
> index 463f876..a9cc6c8 100644
> --- a/vim/syntax/mercury.vim
> +++ b/vim/syntax/mercury.vim
...
> @@ -279,7 +279,7 @@ syn region mercuryForeignModList matchgroup=mercuryBracket start='\[' end=']'
> \ mercuryDelimiter, at mercuryComments, at mercuryFormatting,
> \ mercuryString,mercuryOperator,mercuryBlock
>
> -syn match mercuryClauseHead /\v^[a-z][a-zA-Z0-9_]*[(]@=/
> +syn match mercuryClauseHead /\v^[a-zA-Z][a-zA-Z0-9_.]*[( =]@=/
The first letter can be restricted to lowercase letters as well.
Well, I'll like the changes, don't know about anybody else :)
Peter
More information about the reviews
mailing list