Skip to content

Commit 5444b76

Browse files
committed
Add sourcing from my_configs/
To enable structurizing of own stuff or using *dotfile* managers, this PR add the sourcing of `*.vim` files from the `my_config/` directory. If the `glob("~/.vim_runtime/my_configs/*.vim",1,1)` list is empty, the `~/.vim_runtime/my_configs.vim` is sourced as previously.
1 parent ee7e062 commit 5444b76

File tree

4 files changed

+38
-10
lines changed

4 files changed

+38
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ sources_forked/yankring/doc/tags
55
sources_non_forked/tlib/doc/tags
66
sources_non_forked/ctrlp.vim/doc/tags*
77
my_plugins/
8+
my_configs/
89
my_configs.vim
910
tags
1011
.DS_Store

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@ For instance, my `my_configs.vim` looks like this:
148148

149149
~/.vim_runtime > cat my_configs.vim
150150
map <leader>ct :cd ~/Desktop/Todoist/todoist<cr>
151-
map <leader>cw :cd ~/Desktop/Wedoist/wedoist<cr>
151+
map <leader>cw :cd ~/Desktop/Wedoist/wedoist<cr>
152+
153+
To further structurize your own stuff or to enable integration in *dotfile* managers like [chezmoi](https://chezmoi.io)
154+
place `.vim` files with `vimrc` matching syntax in the `~/.vim_runtime/my_configs/` directory.
152155

153156
You can also install your plugins, for instance, via pathogen you can install [vim-rails](https://github.com/tpope/vim-rails):
154157

@@ -201,6 +204,7 @@ map <leader>bd :Bclose<cr>
201204
" Close all buffers
202205
map <leader>ba :1,1000 bd!<cr>
203206
```
207+
204208
Useful mappings for managing tabs:
205209
```vim
206210
map <leader>tn :tabnew<cr>

install_awesome_parameterized.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ cd $1
66

77
VIMRC="\" DO NOT EDIT THIS FILE
88
\" Add your own customizations in $1/my_configs.vim
9+
\" See ~/.vim_runtime/README.md \"How to include your own stuff\" for further options.
910
1011
set runtimepath+=$1
1112
@@ -14,10 +15,20 @@ source $1/vimrcs/filetypes.vim
1415
source $1/vimrcs/plugins_config.vim
1516
source $1/vimrcs/extended.vim
1617
17-
try
18-
source $1/my_configs.vim
19-
catch
20-
endtry"
18+
let files = glob(\"$1/my_configs/*.vim\", 1, 1)
19+
if empty(files)
20+
try
21+
source $1/my_configs.vim
22+
catch
23+
endtry
24+
else
25+
for file in files
26+
try
27+
execute 'source' fnameescape(file)
28+
catch
29+
endtry
30+
endfor
31+
endif"
2132

2233
if [ "$2" = "--all" ]; then
2334
USERS=$(ls -l /home | awk '{if(NR>1)print $9}')

install_awesome_vimrc.sh

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,29 @@ set -e
44
cd ~/.vim_runtime
55

66
echo '" DO NOT EDIT THIS FILE
7-
" Add your own customizations in ~/.vim_runtime/my_configs.vim
7+
" Add your own customizations in $1/my_configs.vim
8+
" See ~/.vim_runtime/README.md "How to include your own stuff" for further options.
89
910
set runtimepath+=~/.vim_runtime
1011
1112
source ~/.vim_runtime/vimrcs/basic.vim
1213
source ~/.vim_runtime/vimrcs/filetypes.vim
1314
source ~/.vim_runtime/vimrcs/plugins_config.vim
1415
source ~/.vim_runtime/vimrcs/extended.vim
15-
try
16-
source ~/.vim_runtime/my_configs.vim
17-
catch
18-
endtry' > ~/.vimrc
16+
17+
let files=glob("~/.vim_runtime/my_configs/*.vim", 1, 1)
18+
if empty(files)
19+
try
20+
source ~/.vim_runtime/my_configs.vim
21+
catch
22+
endtry
23+
else
24+
for file in files
25+
try
26+
execute 'source' fnameescape(file)
27+
catch
28+
endtry
29+
endfor
30+
endif' > ~/.vimrc
1931

2032
echo "Installed the Ultimate Vim configuration successfully! Enjoy :-)"

0 commit comments

Comments
 (0)