1
0
Fork 0
mirror of synced 2024-12-25 16:23:21 -05:00

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.
This commit is contained in:
Martin Hans 2024-05-13 11:15:53 +02:00
parent ee7e062909
commit 5444b76f9d
No known key found for this signature in database
4 changed files with 38 additions and 10 deletions

1
.gitignore vendored
View file

@ -5,6 +5,7 @@ sources_forked/yankring/doc/tags
sources_non_forked/tlib/doc/tags
sources_non_forked/ctrlp.vim/doc/tags*
my_plugins/
my_configs/
my_configs.vim
tags
.DS_Store

View file

@ -148,7 +148,10 @@ For instance, my `my_configs.vim` looks like this:
~/.vim_runtime > cat my_configs.vim
map <leader>ct :cd ~/Desktop/Todoist/todoist<cr>
map <leader>cw :cd ~/Desktop/Wedoist/wedoist<cr>
map <leader>cw :cd ~/Desktop/Wedoist/wedoist<cr>
To further structurize your own stuff or to enable integration in *dotfile* managers like [chezmoi](https://chezmoi.io)
place `.vim` files with `vimrc` matching syntax in the `~/.vim_runtime/my_configs/` directory.
You can also install your plugins, for instance, via pathogen you can install [vim-rails](https://github.com/tpope/vim-rails):
@ -201,6 +204,7 @@ map <leader>bd :Bclose<cr>
" Close all buffers
map <leader>ba :1,1000 bd!<cr>
```
Useful mappings for managing tabs:
```vim
map <leader>tn :tabnew<cr>

View file

@ -6,6 +6,7 @@ cd $1
VIMRC="\" DO NOT EDIT THIS FILE
\" Add your own customizations in $1/my_configs.vim
\" See ~/.vim_runtime/README.md \"How to include your own stuff\" for further options.
set runtimepath+=$1
@ -14,10 +15,20 @@ source $1/vimrcs/filetypes.vim
source $1/vimrcs/plugins_config.vim
source $1/vimrcs/extended.vim
try
source $1/my_configs.vim
catch
endtry"
let files = glob(\"$1/my_configs/*.vim\", 1, 1)
if empty(files)
try
source $1/my_configs.vim
catch
endtry
else
for file in files
try
execute 'source' fnameescape(file)
catch
endtry
endfor
endif"
if [ "$2" = "--all" ]; then
USERS=$(ls -l /home | awk '{if(NR>1)print $9}')

View file

@ -4,7 +4,8 @@ set -e
cd ~/.vim_runtime
echo '" DO NOT EDIT THIS FILE
" Add your own customizations in ~/.vim_runtime/my_configs.vim
" Add your own customizations in $1/my_configs.vim
" See ~/.vim_runtime/README.md "How to include your own stuff" for further options.
set runtimepath+=~/.vim_runtime
@ -12,9 +13,20 @@ source ~/.vim_runtime/vimrcs/basic.vim
source ~/.vim_runtime/vimrcs/filetypes.vim
source ~/.vim_runtime/vimrcs/plugins_config.vim
source ~/.vim_runtime/vimrcs/extended.vim
try
source ~/.vim_runtime/my_configs.vim
catch
endtry' > ~/.vimrc
let files=glob("~/.vim_runtime/my_configs/*.vim", 1, 1)
if empty(files)
try
source ~/.vim_runtime/my_configs.vim
catch
endtry
else
for file in files
try
execute 'source' fnameescape(file)
catch
endtry
endfor
endif' > ~/.vimrc
echo "Installed the Ultimate Vim configuration successfully! Enjoy :-)"