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

Review vim config #5

Open
AltGr opened this issue Jan 26, 2015 · 0 comments
Open

Review vim config #5

AltGr opened this issue Jan 26, 2015 · 0 comments

Comments

@AltGr
Copy link
Contributor

AltGr commented Jan 26, 2015

I wrote the vim config, but without experience in the matter, I'd welcome reviews from Vim gurus around here. In particular, it doesn't seem to work well when running from another switch without ocp-indent installed.

Here is the generated config:

" ## added by OPAM user-setup for vim / base ## 8a3125e39f347f6b9a1b167d8e564281 ## you can edit, but keep this line
let s:opam_share_dir = system("opam config var share")
let s:opam_share_dir = substitute(s:opam_share_dir, '[\r\n]*$', '', '')

let s:opam_configuration = {}

function! OpamConfOcpIndent()
  let l:file = s:opam_share_dir . "/vim/syntax/ocp-indent.vim"
  execute "source " . l:file
endfunction
let s:opam_configuration['ocp-indent'] = function('OpamConfOcpIndent')

function! OpamConfOcpIndex()
  let l:file = s:opam_share_dir . "/vim/syntax/ocpindex.vim"
  execute "source " . l:file
endfunction
let s:opam_configuration['ocp-index'] = function('OpamConfOcpIndex')

function! OpamConfMerlin()
  let l:dir = s:opam_share_dir . "/merlin/vim"
  execute "set rtp+=" . l:dir
endfunction
let s:opam_configuration['merlin'] = function('OpamConfMerlin')

let s:opam_packages = ["ocp-indent", "ocp-index", "merlin"]
let s:opam_check_cmdline = ["opam list --installed --short --safe --color=never"] + s:opam_packages
let s:opam_available_tools = split(system(join(s:opam_check_cmdline, ' ')))
for tool in s:opam_available_tools
  call s:opam_configuration[tool]()
endfor
" ## end of OPAM user-setup addition for vim / base ## keep this line
" ## added by OPAM user-setup for vim / ocp-indent ## 5d6d99a031a6705f9cc2e11f1f82dfc1 ## you can edit, but keep this line
if count(s:opam_available_tools,"ocp-indent") == 0
  source "/home/lg/.opam/4.02.1/share/vim/syntax/ocp-indent.vim"
endif
" ## end of OPAM user-setup addition for vim / ocp-indent ## keep this line
" ## added by OPAM user-setup for vim / ocp-index ## 59d5c954776e5ce4ab11f142f76e9cf1 ## you can edit, but keep this line
if count(s:opam_available_tools,"ocp-index") == 0
  source "/home/lg/.opam/4.02.1/share/vim/syntax/ocpindex.vim"
endif
" ## end of OPAM user-setup addition for vim / ocp-index ## keep this line

The first chunk is static, the two last, obviously, dynamic, they serve as fallback when you run vim from a switch that doesn't have ocp-indent while your original switch had it.

Besides, does merlin/vim rely on python ? If yes, no reason not to do so for ocp-indent so I'd rather use the better version of the ocp-indent/vim plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant