-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnvimInstall
executable file
·141 lines (125 loc) · 3.34 KB
/
nvimInstall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/sh
#
# nvimInstall: Installs Neovim configuration files.
#
# shellcheck shell=dash
#
scriptName=nvInstall
envName=nvim-env
gitRepo="${DOTFILES_GIT_REPO:=$HOME/devel/dotfiles}"
envPath="$gitRepo/$envName"
cd "$envPath" 2>/dev/null || {
printf '\n%s: Error - failed to cd into "%s"\n\n' "$scriptName" "$gitRepo"
return 1
}
# Parse cmdline arguments and source functions, if not done already
. ../bin/source_setup.sh
dot_config_files='
after/ftplugin/c.lua
after/ftplugin/cpp.lua
after/ftplugin/csv.lua
after/ftplugin/fish.lua
after/ftplugin/haskell.lua
after/ftplugin/help.lua
after/ftplugin/html.lua
after/ftplugin/lua.lua
after/ftplugin/markdown.lua
after/ftplugin/ocaml.lua
after/ftplugin/rust.lua
after/ftplugin/sbt.lua
after/ftplugin/scala.lua
after/ftplugin/sh.lua
after/ftplugin/text.lua
after/ftplugin/tsv.lua
lua/grs/config/autocmds.lua
lua/grs/config/ensure_install.lua
lua/grs/config/keymaps_early.lua
lua/grs/config/keymaps.lua
lua/grs/config/globals.lua
lua/grs/config/options.lua
lua/grs/lib/functional.lua
lua/grs/lib/scroll.lua
lua/grs/lib/text.lua
lua/grs/plugins/coding/init.lua
lua/grs/plugins/coding/gitsigns.lua
lua/grs/plugins/coding/indent_line.lua
lua/grs/plugins/coding/textedit.lua
lua/grs/plugins/core/init.lua
lua/grs/plugins/core/appearance.lua
lua/grs/plugins/core/common.lua
lua/grs/plugins/core/early.lua
lua/grs/plugins/core/telescope.lua
lua/grs/plugins/core/treesitter.lua
lua/grs/plugins/core/whichkey.lua
lua/grs/plugins/ide/init.lua
lua/grs/plugins/ide/cmp.lua
lua/grs/plugins/ide/dap.lua
lua/grs/plugins/ide/lsp.lua
lua/grs/plugins/ide/rust.lua
lua/grs/plugins/ide/scala.lua
spell/en.utf-8.add
init.lua
'
toml_files='
stylua.toml
'
remove_items="
$XDG_CONFIG_HOME/nvim/lua/grs/plugins/coding/refactoring.lua
"
dirs_to_create=""
## Preinstall checks
# See if nvim spellfile will need to be recompiled
SpellFile="$XDG_CONFIG_HOME/nvim/spell/en.utf-8.add"
if which nvim >/dev/null 2>&1
then
if ! test -e "$SpellFile" || {
! diff -q "$SpellFile" spell/en.utf-8.add >/dev/null 2>&1
}
then
compileSpellFile=yes
fi
if ! test -e "${SpellFile}.spl"
then
compileSpellFile=yes
fi
else
compileSpellFile=no
fi
## Install/Check
# Install Neovim files & NVIM related TOML files
process_files "$XDG_CONFIG_HOME/nvim" "
$dot_config_files
$toml_files
" . 0644 "$envPath"
chmod 0755 "$XDG_CONFIG_HOME/nvim"
# Remove/report no longer needed files and directories thru
remove_items "$remove_items"
# Create/report missing directories
ensure_dirs "$dirs_to_create"
## Post install/check tweaks
case "$OPTION_GIVEN" in
install)
# Recompiled spell file if necessary
if test "$compileSpellFile" = yes
then
sf="${SpellFile##*/}"
sf_dir="${SpellFile%/*}"
( if cd "$sf_dir"
then
nvim --headless -c ":mkspell!$sf" -c 'q'
fi )
fi
;;
check)
# Indicate whether the spellfile will be recompiled on next install
if test "$compileSpellFile" = yes
then
printf 'nvimInstall: Spellfile "%s" will be\n' "$SpellFile"
printf ' recompiled on the next install.\n\n'
fi
;;
remove)
remove_items "$XDG_CONFIG_HOME/nvim/lua/grs"
:
;;
esac