Skip to content

Commit 1cae6ca

Browse files
committed
Conditionally set XDG_CONFIG_HOME
1 parent 908f67e commit 1cae6ca

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ You will need to exit Neovim manually with `:qa` after each step.
133133
```vim
134134
" makenew/nvimrc
135135
136+
if empty($XDG_CONFIG_HOME)
137+
let $XDG_CONFIG_HOME = $HOME . '/.config'
138+
endif
139+
136140
call plug#begin($XDG_CONFIG_HOME . '/nvim/plugged')
137141
138142
if filereadable($XDG_CONFIG_HOME . '/nvim/plugged/nvimrc/plugins.vim')
@@ -152,6 +156,10 @@ You will need to exit Neovim manually with `:qa` after each step.
152156
```vim
153157
" makenew/nvimrc
154158
159+
if empty($XDG_CONFIG_HOME)
160+
let $XDG_CONFIG_HOME = $HOME . '/.config'
161+
endif
162+
155163
source $XDG_CONFIG_HOME/nvim/plugged/nvimrc/gui.vim
156164
```
157165

install.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ main () {
66

77
repo='makenew/nvimrc'
88

9-
config_home=$XDG_CONFIG_HOME
9+
config_home=${XDG_CONFIG_HOME:-$HOME/.config}
1010
nvim_root="${config_home}/nvim"
1111

1212
if [ "${1:-}" == 'dev' ]; then
@@ -76,6 +76,10 @@ install_nvimrc () {
7676
tee $nvim_root/init.vim >/dev/null <<EOF
7777
" $repo
7878
79+
if empty(\$XDG_CONFIG_HOME)
80+
let \$XDG_CONFIG_HOME = \$HOME . '/.config'
81+
endif
82+
7983
call plug#begin(\$XDG_CONFIG_HOME . '/nvim/plugged')
8084
8185
if filereadable(\$XDG_CONFIG_HOME . '/nvim/plugged/nvimrc/plugins.vim')
@@ -111,6 +115,10 @@ EOF
111115
tee $nvim_root/ginit.vim >/dev/null <<EOF
112116
" $repo
113117
118+
if empty(\$XDG_CONFIG_HOME)
119+
let \$XDG_CONFIG_HOME = \$HOME . '/.config'
120+
endif
121+
114122
source \$XDG_CONFIG_HOME/nvim/plugged/nvimrc/gui.vim
115123
EOF
116124

makenew.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ makenew () {
3737
read -p '> GitHub user or organization name: ' mk_user
3838
read -p '> GitHub repository name: ' mk_repo
3939

40-
sed -i -e '3d;23,108d;237,240d' README.md
40+
sed -i -e '3d;23,108d;245,248d' README.md
4141

4242
find_replace "s/0\.0\.0/${mk_version}/g"
4343
find_replace "s/2016 Evan Sosenko/${mk_year} ${mk_owner}/g"

0 commit comments

Comments
 (0)