From f7493d2db2dee0cc227217675d35b06e21fd8dcc Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Tue, 21 Feb 2023 18:28:55 +0200 Subject: [PATCH] Neovim - treesitter only on workstation. --- files/dotfiles/nvim/lua/user/packer.lua | 12 ++++++++---- playbooks/workstation.yml | 2 ++ roles/vim_user/defaults/main.yml | 2 ++ roles/vim_user/tasks/main.yml | 9 +++++++++ 4 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 roles/vim_user/defaults/main.yml diff --git a/files/dotfiles/nvim/lua/user/packer.lua b/files/dotfiles/nvim/lua/user/packer.lua index fc55375..fe55854 100644 --- a/files/dotfiles/nvim/lua/user/packer.lua +++ b/files/dotfiles/nvim/lua/user/packer.lua @@ -1,3 +1,5 @@ +local treesitter_extention_exists, _ = pcall(require, 'user.packer_extention_treesitter') + return require("packer").startup(function(use) -- Packer can manage itself use 'wbthomason/packer.nvim' @@ -60,10 +62,12 @@ return require("packer").startup(function(use) requires = { { 'nvim-lua/plenary.nvim' } } } - use { - 'nvim-treesitter/nvim-treesitter', - run = ':TSUpdate' - } + if treesitter_extention_exists then + use { + 'nvim-treesitter/nvim-treesitter', + run = ':TSUpdate' + } + end -- Beacon use 'danilamihailov/beacon.nvim' diff --git a/playbooks/workstation.yml b/playbooks/workstation.yml index 926375e..fde5e2a 100644 --- a/playbooks/workstation.yml +++ b/playbooks/workstation.yml @@ -5,6 +5,8 @@ theme: gruvbox # The running user running_user: "{{ ansible_user_id }}" + # for nvim - workstation should install extentions + nvim_extention_treesitter: true roles: - base - fonts diff --git a/roles/vim_user/defaults/main.yml b/roles/vim_user/defaults/main.yml new file mode 100644 index 0000000..73f4dad --- /dev/null +++ b/roles/vim_user/defaults/main.yml @@ -0,0 +1,2 @@ +--- +nvim_extention_treesitter: false diff --git a/roles/vim_user/tasks/main.yml b/roles/vim_user/tasks/main.yml index b0ca40c..939cabe 100644 --- a/roles/vim_user/tasks/main.yml +++ b/roles/vim_user/tasks/main.yml @@ -22,3 +22,12 @@ copy: src: dotfiles/nvim/ dest: ~/.config/nvim/ + +- name: Debug extentions + debug: + msg: "TreeSitter: {{ nvim_extention_treesitter }}" + +- name: nvim extention treesitter + shell: | + echo "return {}" > ~/.config/nvim/lua/user/packer_extention_treesitter.lua + when: nvim_extention_treesitter