Skip to content
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

Some opam updates #73

Merged
merged 5 commits into from
Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/opam.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*opam.txt* Switch OCaml versions from inside Vim using OPAM
*opam.txt* Switch OCaml versions from inside Vim using opam

Author: Rudi Grinberg <http://rgrinberg.com>
License: Same terms as Vim itself (see |license|)
Expand Down
2 changes: 1 addition & 1 deletion ftdetect/opam.vim
Original file line number Diff line number Diff line change
@@ -1 +1 @@
au BufNewFile,BufRead opam,*.opam,*.opam.template setf opam
au BufNewFile,BufRead opam,*.opam,*.opam.template,opam.locked,*.opam.locked setf opam
8 changes: 4 additions & 4 deletions plugin/opam.vim
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let g:loaded_opam = 1
" Utility {{{1

function! opam#eval_env()
let opam_eval = system("opam config env")
let opam_eval = system("opam env --read-only")
let cmds = split(opam_eval, "\n")
for cmd in cmds
let var = split(split(cmd, ";")[0], "=")
Expand Down Expand Up @@ -69,9 +69,9 @@ function! s:Opam(bang,...) abort
endfunction

function! s:Complete(A,L,P)
let installed = split((system("opam switch -s -i 2> /dev/null")), "\n")
call map(installed, 'opam#chomp(v:val)')
return join(installed, "\n")
let switches = split((system("opam switch --short 2> /dev/null")), "\n")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-i i no more available, is it required to have only installed ones?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think so

call map(switches, 'opam#chomp(v:val)')
return join(switches, "\n")
endfunction

command! -bar -nargs=* -complete=custom,s:Complete Opam :execute s:Opam(<bang>0,<f-args>)
Expand Down
34 changes: 31 additions & 3 deletions syntax/opam.vim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
" Vim syntax file
" Language: OPAM - OCaml package manager
" Language: opam - OCaml package manager
" Maintainer: Markus Mottl <[email protected]>
" URL: https://github.com/ocaml/vim-ocaml
" Last Change:
Expand All @@ -11,8 +11,36 @@ endif

" need %{vars}%
" env: [[CAML_LD_LIBRARY_PATH = "%{lib}%/stublibs"]]
syn keyword opamKeyword1 remove depends pin-depends depopts conflicts env packages patches version maintainer tags license homepage authors doc install author available name depexts substs synopsis description
syn match opamKeyword2 "\v(bug-reports|post-messages|ocaml-version|opam-version|dev-repo|build-test|build-doc|build)"
syn keyword opamKeyword1 author
syn keyword opamKeyword1 authors
syn keyword opamKeyword1 available
syn keyword opamKeyword1 conflicts
syn keyword opamKeyword1 depends
syn keyword opamKeyword1 depexts
syn keyword opamKeyword1 depopts
syn keyword opamKeyword1 description
syn keyword opamKeyword1 doc
syn keyword opamKeyword1 extra-files
syn keyword opamKeyword1 features
syn keyword opamKeyword1 flags
syn keyword opamKeyword1 homepage
syn keyword opamKeyword1 install
syn keyword opamKeyword1 libraries
syn keyword opamKeyword1 license
syn keyword opamKeyword1 maintainer
syn keyword opamKeyword1 messages
syn keyword opamKeyword1 name
syn keyword opamKeyword1 patches
syn keyword opamKeyword1 pin-depends
syn keyword opamKeyword1 remove
syn keyword opamKeyword1 run-test
syn keyword opamKeyword1 setenv
syn keyword opamKeyword1 substs
syn keyword opamKeyword1 synopsis
syn keyword opamKeyword1 syntax
syn keyword opamKeyword1 tags
syn keyword opamKeyword1 version
syn match opamKeyword2 "\v(bug-reports|post-messages|opam-version|dev-repo|build)"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason to have both opamKeyword1 and opamKeyword2 ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea. You can try including it in opamKeyword1 and see if it works.


syn keyword opamTodo FIXME NOTE NOTES TODO XXX contained
syn match opamComment "#.*$" contains=opamTodo,@Spell
Expand Down