Usersettings: Add variable to disable vim plugings

Some systems just don't need them, but they take quite some time to
install and take up space.
This commit is contained in:
Jannik Beyerstedt 2023-01-07 17:26:51 +01:00
parent bee777ac81
commit d084912154
4 changed files with 53 additions and 45 deletions

View File

@ -29,6 +29,7 @@ The User Setup will change the user shell and global gitconfig. This can be disa
* `gitconfig_name`: User's name in .gitconfig file (default: n.a.)
* `gitconfig_email`: User's email in .gitconfig file (default: n.a.)
- `usersetup_virtualenvwrapper`: Boolean to enable the virtualenvwrapper plugin in oh-my-zsh (default: false)
- `usersetup_vimplugins`: Boolean to enable installing my VIM plugins (default: true)
The development environment for different programming languages can be setup automatically.
To enable, that Visual Studio Code will be installed and configured, set `user_vscode` to true, otherwise only the bare development toolchain will be installed.

View File

@ -15,6 +15,9 @@ usersetup_gitconfig: true
# enable virtualenvwrapper plugin in oh-my-zsh
usersetup_virtualenvwrapper: false
# install VIM plugins
usersetup_vimplugins: true
# install VS Code and selectively activate different programming languages
user_vscode: false
user_lang_cpp: false

View File

@ -2,8 +2,8 @@
# Common/Usersettings: Universial Dotfiles. Update regularly.
- name: usersettings - Install required tools
become: yes
ignore_errors: yes # just fail on systems without sudo access
become: true
ignore_errors: true # just fail on systems without sudo access
ansible.builtin.package:
name: "{{ packages }}"
state: present
@ -33,8 +33,8 @@
when:
(override_os_family is defined) | ternary(override_os_family,ansible_os_family) != "Darwin" and
(override_os_family is defined) | ternary(override_os_family,ansible_os_family) != "FreeBSD"
become: yes
ignore_errors: yes # just fail on systems without sudo access
become: true
ignore_errors: true # just fail on systems without sudo access
ansible.builtin.package:
name: "{{ packages }}"
state: present
@ -43,7 +43,7 @@
- python3-pip
- name: usersettings - Install pip virtualenvwrapper (Debian)
when: (override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Debian"
become: yes
become: true
ansible.builtin.pip:
name: virtualenvwrapper
extra_args: --system
@ -57,7 +57,7 @@
when:
(override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Centos" or
(override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Archlinux"
become: yes
become: true
ansible.builtin.pip:
name: virtualenvwrapper
- name: usersettings - Copy dotfiles
@ -69,10 +69,6 @@
src: "{{ role_path }}/files/_gitignore_global",
dest: "{{ ansible_user_dir }}/.gitignore_global",
}
- {
src: "{{ role_path }}/files/_vimrc",
dest: "{{ ansible_user_dir }}/.vimrc",
}
- {
src: "{{ role_path }}/files/_config/mpv.conf",
dest: "{{ ansible_user_dir }}/.config/mpv/",
@ -104,6 +100,11 @@
dest: "{{ ansible_user_dir }}/.tmux.conf",
force: yes,
}
- {
src: "{{ role_path }}/templates/_vimrc.j2",
dest: "{{ ansible_user_dir }}/.vimrc",
force: yes,
}
- {
src: "{{ role_path }}/templates/htoprc.j2",
dest: "{{ ansible_user_dir }}/.config/htop/htoprc",
@ -115,38 +116,39 @@
src: "{{ role_path }}/templates/_gitconfig.j2"
dest: "{{ ansible_user_dir }}/.gitconfig"
- name: usersettings - Create .vim directory
ansible.builtin.file:
path: "{{ ansible_user_dir }}/.vim/autoload"
state: directory
- name: usersettings - Install vim plugin manager
ansible.builtin.get_url:
url: https://tpo.pe/pathogen.vim
dest: "{{ ansible_user_dir }}/.vim/autoload/pathogen.vim"
- name: usersettings - Install vim plugins
ansible.builtin.git:
repo: "{{ item.repo }}"
dest: "{{ item.dest }}"
with_items:
- {
repo: "https://github.com/itchyny/lightline.vim",
dest: "{{ ansible_user_dir }}/.vim/bundle/lightline",
}
- {
repo: "https://github.com/w0rp/ale",
dest: "{{ ansible_user_dir }}/.vim/bundle/ale",
}
- {
repo: "https://github.com/airblade/vim-gitgutter",
dest: "{{ ansible_user_dir }}/.vim/bundle/vim-gitgutter",
}
- {
repo: "https://github.com/sheerun/vim-polyglot",
dest: "{{ ansible_user_dir }}/.vim/bundle/vim-polyglot",
}
- {
repo: "https://github.com/tpope/vim-commentary",
dest: "{{ ansible_user_dir }}/.vim/bundle/vim-commentary",
}
- name: usersettings - Vim Plugings
when: usersetup_vimplugins == true
block:
- name: usersettings - Create .vim directory
ansible.builtin.file:
path: "{{ ansible_user_dir }}/.vim/autoload"
state: directory
- name: usersettings - Install vim plugin manager
ansible.builtin.get_url:
url: https://tpo.pe/pathogen.vim
dest: "{{ ansible_user_dir }}/.vim/autoload/pathogen.vim"
- name: usersettings - Install vim plugins
ansible.builtin.git:
repo: "{{ item.repo }}"
dest: "{{ item.dest }}"
with_items:
- {
repo: "https://github.com/itchyny/lightline.vim",
dest: "{{ ansible_user_dir }}/.vim/bundle/lightline",
}
- {
repo: "https://github.com/w0rp/ale",
dest: "{{ ansible_user_dir }}/.vim/bundle/ale",
}
- {
repo: "https://github.com/airblade/vim-gitgutter",
dest: "{{ ansible_user_dir }}/.vim/bundle/vim-gitgutter",
}
- {
repo: "https://github.com/sheerun/vim-polyglot",
dest: "{{ ansible_user_dir }}/.vim/bundle/vim-polyglot",
}
- {
repo: "https://github.com/tpope/vim-commentary",
dest: "{{ ansible_user_dir }}/.vim/bundle/vim-commentary",
}

View File

@ -121,6 +121,7 @@ filetype plugin indent on
" PLUGIN SETTINGS
" ----------------------------------------------------------------------------
{% if usersetup_vimplugins|bool %}
" Use Pathogen for plugin management. See update.sh in this directory.
runtime bundle/vim-pathogen/autoload/pathogen.vim
call pathogen#infect()
@ -182,6 +183,7 @@ function! s:MaybeUpdateLightline()
call lightline#update()
end
endfunction
{% endif %}
" ----------------------------------------------------------------------------
" COLORS