-- Only required if you have packer configured as `opt` local ensure_packer = function() local fn = vim.fn local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' if fn.empty(fn.glob(install_path)) > 0 then fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path }) vim.cmd [[packadd packer.nvim]] return true end return false end local packer_bootstrap = ensure_packer() local packer = require('packer') packer.startup(function(use) -- Packer can manage itself use 'wbthomason/packer.nvim' use 'nvim-lua/plenary.nvim' use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', cond = vim.fn.executable 'make' == 1 } use { 'marko-cerovac/material.nvim', config = function() vim.g.material_style = "palenight" vim.cmd [[colorscheme material]] end } use { 'nvim-treesitter/nvim-treesitter', run = function() local ts_update = require('nvim-treesitter.install').update({ with_sync = true }) ts_update() end } use { -- Additional text objects via treesitter 'nvim-treesitter/nvim-treesitter-textobjects', after = 'nvim-treesitter', } use { 'nvim-telescope/telescope.nvim', tag = '0.1.0', requires = { {'nvim-lua/plenary.nvim'} } } use { 'numToStr/Comment.nvim', config = function() require('Comment').setup() end } use { "kylechui/nvim-surround", tag = "*", -- Use for stability; omit to use `main` branch for the latest features config = function() require("nvim-surround").setup({}) end } -- use { 'TimUntersberger/neogit', requires = 'nvim-lua/plenary.nvim' } end) if packer_bootstrap then require('packer').sync() end local autocmd = vim.api.nvim_create_autocmd local augroup = vim.api.nvim_create_augroup autocmd(('BufWritePost'), { group = augroup('packer_user_config', { clear = true }), pattern = "plugins.lua", once = true, callback = function() vim.cmd('source ~/.config/nvim/lua/plugins.lua') packer.compile() end }) require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter ensure_installed = { 'c', 'cpp', 'go', 'lua', 'bash', 'rust', 'go', 'help', 'haskell', 'ocaml' }, highlight = { enable = true, additional_vim_regex_highlighting = false }, indent = { enable = true }, incremental_selection = { enable = true, keymaps = { init_selection = '', node_incremental = '', scope_incremental = '', node_decremental = '', }, }, textobjects = { select = { enable = true, lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim keymaps = { -- You can use the capture groups defined in textobjects.scm ['aa'] = '@parameter.outer', ['ia'] = '@parameter.inner', ['af'] = '@function.outer', ['if'] = '@function.inner', ['ac'] = '@class.outer', ['ic'] = '@class.inner', }, }, move = { enable = true, set_jumps = true, -- whether to set jumps in the jumplist goto_next_start = { [')'] = '@function.outer', [']]'] = '@class.outer', }, goto_next_end = { [']M'] = '@function.outer', [']['] = '@class.outer', }, goto_previous_start = { ['('] = '@function.outer', ['[['] = '@class.outer', }, goto_previous_end = { ['[M'] = '@function.outer', ['[]'] = '@class.outer', }, }, -- TODO: Fix this swap = { enable = true, swap_next = { ['a'] = '@parameter.inner', }, swap_previous = { ['A'] = '@parameter.inner', }, }, }, }