From 08fdc7093ab46d1dc9b4a7e36e95749d3338a40a Mon Sep 17 00:00:00 2001 From: Aleh Atsman Date: Sun, 13 Jan 2019 14:42:06 +0100 Subject: [PATCH] Update vim and add tmux --- init.sh | 0 playbook.yml | 1 + roles/brew/vars/main.yml | 3 ++- roles/docker/tasks/main.yml | 5 ----- roles/python/tasks/main.yml | 7 +++++-- roles/tmux/tasks/main.yml | 19 +++++++++++++++++++ roles/tmux/templates/.tmux.conf.j2 | 8 ++++++++ roles/tmux/vars/main.yml | 2 ++ roles/vim/tasks/main.yml | 14 +++++++++++++- roles/vim/templates/plugins.vim | 4 +++- roles/vim/vars/main.yml | 8 ++++++++ 11 files changed, 61 insertions(+), 10 deletions(-) mode change 100644 => 100755 init.sh create mode 100644 roles/tmux/tasks/main.yml create mode 100644 roles/tmux/templates/.tmux.conf.j2 create mode 100644 roles/tmux/vars/main.yml diff --git a/init.sh b/init.sh old mode 100644 new mode 100755 diff --git a/playbook.yml b/playbook.yml index 8b2b9d3..b46a523 100644 --- a/playbook.yml +++ b/playbook.yml @@ -10,6 +10,7 @@ - {role: 'ssh', tags: 'ssh'} - {role: 'zsh', tags: 'zsh'} - {role: 'iterm2', tags: 'iterm2'} + - {role: 'tmux', tags: 'tmux'} - {role: 'vim', tags: 'vim'} - {role: 'golang', tags: 'golang'} - {role: 'jvm', tags: 'jvm'} diff --git a/roles/brew/vars/main.yml b/roles/brew/vars/main.yml index 13cd34c..ba8ae21 100644 --- a/roles/brew/vars/main.yml +++ b/roles/brew/vars/main.yml @@ -5,6 +5,7 @@ taps: - homebrew/cask - jesseduffield/lazygit - wata727/tflint + - wagoodman/dive apps: - ansible @@ -43,7 +44,7 @@ cask_apps: - vagrant - veracrypt - visual-studio-code - - virtualbox +# - virtualbox - vlc - wireshark - flux diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 612d844..7047fb0 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -8,8 +8,3 @@ homebrew: name: kubernetes-cli state: present - -- name: Make sure minikube is installed - homebrew_cask: - name: minikube - state: present diff --git a/roles/python/tasks/main.yml b/roles/python/tasks/main.yml index 67885b0..660c439 100644 --- a/roles/python/tasks/main.yml +++ b/roles/python/tasks/main.yml @@ -1,8 +1,11 @@ --- -- name: Install python 3 +- name: Install python homebrew: - name: python + name: '{{ item }}' state: latest + with_items: + - python@2 + - python - name: Install pipenv pip: diff --git a/roles/tmux/tasks/main.yml b/roles/tmux/tasks/main.yml new file mode 100644 index 0000000..bb328c1 --- /dev/null +++ b/roles/tmux/tasks/main.yml @@ -0,0 +1,19 @@ +--- +- name: Make sure folders are present + file: + path: '{{ item }}' + state: directory + with_items: + - '{{ tmux_path }}' + - '{{ tmux_path }}/plugins' + +- name: Make sure config is generated + template: + src: 'templates/.tmux.conf.j2' + dest: '~/.tmux.conf' + +- name: Make sure tmp is installed + git: + repo: 'https://github.com/tmux-plugins/tpm' + dest: '{{ tmux_path }}/plugins/tpm' + depth: 1 diff --git a/roles/tmux/templates/.tmux.conf.j2 b/roles/tmux/templates/.tmux.conf.j2 new file mode 100644 index 0000000..808108b --- /dev/null +++ b/roles/tmux/templates/.tmux.conf.j2 @@ -0,0 +1,8 @@ +# List of plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'christoomey/vim-tmux-navigator' + +set-environment -g PATH "/usr/local/bin:/bin:/usr/bin" + +run '{{ tmux_path }}/plugins/tpm/tpm' diff --git a/roles/tmux/vars/main.yml b/roles/tmux/vars/main.yml new file mode 100644 index 0000000..258b7f3 --- /dev/null +++ b/roles/tmux/vars/main.yml @@ -0,0 +1,2 @@ +--- +tmux_path: '~/.tmux' diff --git a/roles/vim/tasks/main.yml b/roles/vim/tasks/main.yml index 7b67bdf..ac12940 100644 --- a/roles/vim/tasks/main.yml +++ b/roles/vim/tasks/main.yml @@ -14,10 +14,21 @@ url: https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim dest: "{{ autoload_path }}/plug.vim" +- name: Check that the python_venv exists + stat: + path: '{{ python_venv_path }}' + register: python_venv_present + +- name: Check that the python3_venv exists + stat: + path: '{{ python3_venv_path }}' + register: python3_venv_present + - name: Make sure venvs are created for python2 and python3 shell: | virtualenv -p python {{ python_venv_path }} virtualenv -p python3 {{ python3_venv_path }} + when: not (python_venv_present and python3_venv_path) - name: Make sure neovim libs are intalled to python venv pip: @@ -28,7 +39,8 @@ - name: Make sure neovim libs are intalled to python3 venv pip: virtualenv: "{{ python3_venv_path }}" - name: "{{ python_libs }}" + virtualenv_python: python3 + name: "{{ python3_libs }}" state: latest - name: Create directories diff --git a/roles/vim/templates/plugins.vim b/roles/vim/templates/plugins.vim index 62fbb12..d3eccbc 100644 --- a/roles/vim/templates/plugins.vim +++ b/roles/vim/templates/plugins.vim @@ -3,6 +3,8 @@ call plug#begin('{{ plug_path }}') Plug 'editorconfig/editorconfig-vim' Plug 'dracula/vim' +Plug 'christoomey/vim-tmux-navigator' + " File explorer and tabs Plug 'scrooloose/nerdtree' @@ -21,7 +23,7 @@ Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' " Autocomplete -Plug 'Shougo/deoplete.nvim' +Plug 'Shougo/deoplete.nvim' { 'do': ':UpdateRemovePlugins' } " Quoting/Parenthesizing Plug 'tpope/vim-surround' diff --git a/roles/vim/vars/main.yml b/roles/vim/vars/main.yml index 1d0d105..ebf0356 100644 --- a/roles/vim/vars/main.yml +++ b/roles/vim/vars/main.yml @@ -9,8 +9,16 @@ autoload_path: "{{ config_path }}/autoload" python_venv_path: "{{ config_path }}/python_venv" python3_venv_path: "{{ config_path }}/python3_venv" + python_libs: - neovim - flake8 - websocket-client - sexpdata + +python3_libs: + - pynvim + - neovim + - flake8 + - websocket-client + - sexpdata