From 4e2fdd73e7f3fad6bede5f015a990e5bd8bd9f59 Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Fri, 31 Jul 2020 15:12:20 +0200 Subject: [PATCH] Added vim state --- .alias | 1 + README.md | 6 +++--- salt/README.md | 2 +- salt/pillars/packages.sls | 5 ++--- salt/pillars/top.sls | 1 + salt/pillars/vim.sls | 15 +++++++++++++++ salt/states/vim.sls | 9 +++++++++ 7 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 salt/pillars/vim.sls create mode 100644 salt/states/vim.sls diff --git a/.alias b/.alias index c5440ad..d117b57 100644 --- a/.alias +++ b/.alias @@ -6,3 +6,4 @@ alias dotf='/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME' alias ls_dotfiels='/usr/bin/git --git-dir=$HOME/.dotfiles ls-tree --full-tree -r --name-only HEAD' alias t="todo.sh" alias gl='git log --graph --pretty=format:'\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\'' --abbrev-commit --date=relative' +alias salt='sudo salt-call --local "$@"' diff --git a/README.md b/README.md index dd8b5fc..8659da6 100644 --- a/README.md +++ b/README.md @@ -11,13 +11,13 @@ tags: I use a very simple way to manage my dotfiles with git and some bash aliases. All you have to create a folder for your git repository in your home folder and initiate a bare git repository ```bash -mkdir "$HOME/.dotf" -git init --bare "$HOME/.dotf" +mkdir "$HOME/.dotfiles" +git init --bare "$HOME/.dotfiles" ``` Then create an alias so you don't have to write a long command each time you want to add a file or configure your git repository, don't forget to add that alias to $HOME/.alias ```bash -alias dotf='/usr/bin/git --git-dir=$HOME/.dotf --work-tree=$HOME' +alias dotf='/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME' ``` so, that alias is calling git and sets the repository as well as working directory and it can be called from what ever path you currently be in. diff --git a/salt/README.md b/salt/README.md index c9888f3..6c1394d 100644 --- a/salt/README.md +++ b/salt/README.md @@ -1,3 +1,3 @@ ``` -sudo salt-call --local "$@" +alias salt='sudo salt-call --local "$@"' ``` diff --git a/salt/pillars/packages.sls b/salt/pillars/packages.sls index 3298f73..3f0df6d 100644 --- a/salt/pillars/packages.sls +++ b/salt/pillars/packages.sls @@ -1,5 +1,4 @@ packages: - vim: { status: installed } git: { status: installed } curl: { status: installed } tmux: { status: installed } @@ -7,9 +6,9 @@ packages: terminator: { status: installed } borgbackup: { status: installed } go: { status: installed } - nextcloud-client: { status: installed } + nextcloud-desktop: { status: installed } keepassxc: { status: installed } vim-plugin-gnupg: { status: installed } # vim-instant-markdown xdg-utils: { status: installed } - nodejs10 { status: installed } + nodejs10: { status: installed } diff --git a/salt/pillars/top.sls b/salt/pillars/top.sls index 9db098a..068cc47 100644 --- a/salt/pillars/top.sls +++ b/salt/pillars/top.sls @@ -3,6 +3,7 @@ base: - user - packages - repositories + - vim {% if salt['file.file_exists']('hosts/{0}.sls'.format(grains.id)) %} '{{ grains.id }}': diff --git a/salt/pillars/vim.sls b/salt/pillars/vim.sls new file mode 100644 index 0000000..d335497 --- /dev/null +++ b/salt/pillars/vim.sls @@ -0,0 +1,15 @@ +packages: + vim: { status: installed } + +vim: + plugins: + jonas: + calendar-vim: + name: https://github.com/mattn/calendar-vim.git + vim-commentary: + name: https://github.com/tpope/vim-commentary.git + vim-instant-markdown: + name: https://github.com/suan/vim-instant-markdown.git + vim-surround: + name: https://github.com/tpope/vim-surround.git + diff --git a/salt/states/vim.sls b/salt/states/vim.sls new file mode 100644 index 0000000..d624369 --- /dev/null +++ b/salt/states/vim.sls @@ -0,0 +1,9 @@ +{% for user, plugins in pillar['vim']['plugins'].items() %} +{% for plugin, args in plugins.items() %} +{{ plugin }}: + git.latest: + - name: {{ args['name'] }} + - target: {{ salt['user.info']( user ).home }}/.vim/bundle/{{ plugin }} + - user: {{ user }} +{% endfor %} +{% endfor %}