Skip to content

Commit

Permalink
Use .vim/vimrc if present
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbou committed May 17, 2018
1 parent 7acab6d commit c77b287
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions vim/vim.ml
Expand Up @@ -9,12 +9,22 @@ let check () =
List.exists Re.(execp @@ compile @@ str "+syntax")
(lines_of_command "vim --version")

let dotvimrc =
let ( / ) = Filename.concat in
let vimrc = "vimrc" in
let dotvimrc = "." ^ vimrc in
let dotvim = ".vim" in
if not (Sys.file_exists (home/dotvimrc)) &&
Sys.file_exists (home/dotvim/vimrc) then
dotvim/vimrc
else dotvimrc

(*
* Base template
*)

(* vim-sensible @ b30dcf387af977acfa21732592bfca05598b2188 *)
let base_template = [ ".vimrc", lines_of_string
let base_template = [ dotvimrc, lines_of_string
{vim|
" sensible.vim - Defaults everyone can agree on
" Maintainer: Tim Pope <http://tpo.pe/>
Expand Down Expand Up @@ -115,7 +125,7 @@ inoremap <C-U> <C-G>u<C-U>
* Generic OPAM config
*)

let base_setup = [ ".vimrc", Text (lines_of_string
let base_setup = [ dotvimrc, Text (lines_of_string
{vim|
let s:opam_share_dir = system("opam config var share")
let s:opam_share_dir = substitute(s:opam_share_dir, '[\r\n]*$', '', '')
Expand Down Expand Up @@ -167,7 +177,7 @@ endif
|vim}
(share_dir/"ocp-indent"/"vim"/"indent"/"ocaml.vim")
in
[".vimrc", Text (lines_of_string contents)]
[dotvimrc, Text (lines_of_string contents)]
let files = []
let post_install = []
let pre_remove = []
Expand Down

0 comments on commit c77b287

Please sign in to comment.