Fix treesitter config. Reformat

This commit is contained in:
Jan Eitzinger 2023-02-27 07:44:10 +01:00
parent b03926963f
commit 81af8acda9
2 changed files with 97 additions and 86 deletions

View File

@ -15,7 +15,6 @@ treesitter.setup {
node_decremental = "grm" -- decrement to the previous node node_decremental = "grm" -- decrement to the previous node
} }
}, },
textobjects = { textobjects = {
-- syntax-aware textobjects -- syntax-aware textobjects
enable = true, enable = true,
@ -51,35 +50,38 @@ treesitter.setup {
enable = true, enable = true,
set_jumps = true, -- whether to set jumps in the jumplist set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = { goto_next_start = {
["]]"] = "@function.outer" ["]]"] = "@function.outer",
["]c"] = { query = "@class.outer", desc = "Next class start" },
--
-- You can use regex matching and/or pass a list in a "query" key to group multiple queires.
["]o"] = "@loop.*",
-- ["]o"] = { query = { "@loop.inner", "@loop.outer" } }
--
-- You can pass a query group to use query from `queries/<lang>/<query_group>.scm file in your runtime path.
-- Below example nvim-treesitter's `locals.scm` and `folds.scm`. They also provide highlights.scm and indent.scm.
["]s"] = { query = "@scope", query_group = "locals", desc = "Next scope" },
["]z"] = { query = "@fold", query_group = "folds", desc = "Next fold" },
}, },
goto_next_end = { goto_next_end = {
["]["] = "@function.outer" ["]["] = "@function.outer",
["]C"] = "@class.outer",
}, },
goto_previous_start = { goto_previous_start = {
["[["] = "@function.outer" ["[["] = "@function.outer",
["[c"] = "@class.outer",
}, },
goto_previous_end = { goto_previous_end = {
["[]"] = "@function.outer" ["[]"] = "@function.outer",
} ["[C"] = "@class.outer",
}, },
select = { -- Below will go to either the start or the end, whichever is closer.
enable = true, -- Use if you want more granular movements
lookahead = true, -- Make it even more gradual by adding multiple queries and regex.
keymaps = { goto_next = {
-- You can use the capture groups defined in textobjects.scm ["]d"] = "@conditional.outer",
["af"] = "@function.outer", },
["if"] = "@function.inner", goto_previous = {
["ac"] = "@class.outer", ["[d"] = "@conditional.outer",
["ic"] = "@class.inner",
-- Or you can define your own textobjects like this
["iF"] = {
python = "(function_definition) @function",
cpp = "(function_definition) @function",
c = "(function_definition) @function",
java = "(method_declaration) @function",
go = "(method_declaration) @function"
}
} }
}, },
swap = { swap = {

View File

@ -6,61 +6,62 @@ vim.g.maplocalleader = '\\'
-- Plugins -- Plugins
require "paq" { require "paq" {
"savq/paq-nvim"; "savq/paq-nvim",
"nvim-treesitter/nvim-treesitter"; "nvim-treesitter/nvim-treesitter",
"nvim-treesitter/nvim-treesitter-textobjects"; "nvim-treesitter/nvim-treesitter-textobjects",
-- Theming -- Theming
"ellisonleao/gruvbox.nvim"; "ellisonleao/gruvbox.nvim",
"nvim-lualine/lualine.nvim"; "nvim-lualine/lualine.nvim",
"nvim-tree/nvim-web-devicons"; "nvim-tree/nvim-web-devicons",
"lukas-reineke/indent-blankline.nvim"; "lukas-reineke/indent-blankline.nvim",
-- LSP support -- LSP support
"onsails/lspkind.nvim"; "onsails/lspkind.nvim",
"lukas-reineke/lsp-format.nvim"; "lukas-reineke/lsp-format.nvim",
"neovim/nvim-lspconfig"; "neovim/nvim-lspconfig",
{{- if ne .chezmoi.os "openbsd" }} {{- if ne .chezmoi.os "openbsd" }}
"williamboman/mason.nvim"; "williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim"; "williamboman/mason-lspconfig.nvim",
{{- end }} {{- end }}
-- Autocomplete -- Autocomplete
"hrsh7th/nvim-cmp"; "hrsh7th/nvim-cmp",
"hrsh7th/cmp-buffer"; "hrsh7th/cmp-buffer",
"hrsh7th/cmp-path"; "hrsh7th/cmp-path",
"saadparwaiz1/cmp_luasnip"; "saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lsp"; "hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lua"; "hrsh7th/cmp-nvim-lua",
-- Snippets -- Snippets
"L3MON4D3/LuaSnip"; "L3MON4D3/LuaSnip",
"rafamadriz/friendly-snippets"; "rafamadriz/friendly-snippets",
-- Programming support -- Programming support
"kylechui/nvim-surround"; "kylechui/nvim-surround",
"windwp/nvim-autopairs"; "windwp/nvim-autopairs",
"numToStr/Comment.nvim"; "numToStr/Comment.nvim",
"ggandor/leap.nvim"; "ggandor/leap.nvim",
-- Fuzzy search -- Fuzzy search
{ "nvim-telescope/telescope-fzf-native.nvim", run = "gmake" }; { "nvim-telescope/telescope-fzf-native.nvim", run = "gmake" },
"nvim-telescope/telescope-file-browser.nvim"; "nvim-telescope/telescope-file-browser.nvim",
"nvim-telescope/telescope.nvim"; "nvim-telescope/telescope.nvim",
"folke/trouble.nvim"; "folke/trouble.nvim",
"mfussenegger/nvim-dap"; "mfussenegger/nvim-dap",
"theHamsta/nvim-dap-virtual-text"; "theHamsta/nvim-dap-virtual-text",
"rcarriga/nvim-dap-ui"; "rcarriga/nvim-dap-ui",
"norcalli/nvim-colorizer.lua"; "norcalli/nvim-colorizer.lua",
"lewis6991/gitsigns.nvim"; "lewis6991/gitsigns.nvim",
"tpope/vim-fugitive"; "tpope/vim-fugitive",
"renerocksai/telekasten.nvim"; "renerocksai/telekasten.nvim",
"renerocksai/calendar-vim"; "renerocksai/calendar-vim",
"nvim-lua/plenary.nvim"; "nvim-lua/plenary.nvim",
"akinsho/toggleterm.nvim"; "akinsho/toggleterm.nvim",
} }
@ -80,8 +81,8 @@ require 'colorizer'.setup {
filetypes = { filetypes = {
'css', 'css',
'javascript', 'javascript',
scss = { rgb_fn = true; }; scss = { rgb_fn = true, },
html = { mode = 'foreground'; } html = { mode = 'foreground', }
}, },
} }
@ -114,28 +115,28 @@ require("gruvbox").setup {
} }
-- Options -- Options
local o = vim.opt local o = vim.opt
-- basic settings -- basic settings
o.encoding = "utf-8" o.encoding = "utf-8"
o.backspace = "indent,eol,start" -- backspace works on every char in insert mode o.backspace = "indent,eol,start" -- backspace works on every char in insert mode
o.completeopt = { 'menu', 'menuone', 'noselect' } o.completeopt = { 'menu', 'menuone', 'noselect' }
o.history = 1000 o.history = 1000
-- o.dictionary = '/home/jan/.vim/dict/words' -- o.dictionary = '/home/jan/.vim/dict/words'
-- o.dictionary = '/usr/share/dict/words' -- o.dictionary = '/usr/share/dict/words'
o.startofline = true o.startofline = true
o.title = true o.title = true
o.clipboard = 'unnamedplus' o.clipboard = 'unnamedplus'
-- Mapping waiting time -- Mapping waiting time
o.timeoutlen = 200 o.timeoutlen = 200
o.ttimeoutlen = 0 o.ttimeoutlen = 0
-- Spellchecker -- Spellchecker
o.spell = false o.spell = false
o.spelllang = { 'en_us' } o.spelllang = { 'en_us' }
o.spellfile = HOME .. '/.vim/spell/en.utf8.add' o.spellfile = HOME .. '/.vim/spell/en.utf8.add'
o.thesaurus = HOME .. '/.vim/thesaurus/english.txt' o.thesaurus = HOME .. '/.vim/thesaurus/english.txt'
-- Display -- Display
o.showmatch = true -- show matching brackets o.showmatch = true -- show matching brackets
@ -150,15 +151,22 @@ o.laststatus = 2 -- always show status line
o.list = false -- do not display white characters o.list = false -- do not display white characters
o.termguicolors = true o.termguicolors = true
o.background = "dark" o.background = "dark"
-- o.updatetime = 100 o.wrap = false --do not wrap lines even if very long
o.eol = false -- show if there's no eol char
o.showbreak = '↪' -- character to show when line is broken
-- Folding -- Folding
o.foldenable = false o.foldenable = true
o.foldlevel = 4 -- limit folding to 4 levels o.foldnestmax = 2
o.foldmethod = 'syntax' -- use language syntax to generate folds o.foldminlines = 10
o.wrap = false --do not wrap lines even if very long o.foldmethod = "expr"
o.eol = false -- show if there's no eol char o.foldexpr = "nvim_treesitter#foldexpr()"
o.showbreak = '↪' -- character to show when line is broken
-- workaround for Telescope bug
vim.api.nvim_create_autocmd({ "BufEnter" }, {
pattern = { "*" },
command = "normal zx",
})
-- Sidebar -- Sidebar
o.number = true -- line number on the left o.number = true -- line number on the left
@ -222,7 +230,8 @@ o.backupdir = HOME .. '/.local/share/nvim/dirs/backup//' -- backups
-- Commands mode -- Commands mode
o.wildmenu = true -- on TAB, complete options for system command o.wildmenu = true -- on TAB, complete options for system command
o.wildignore = 'deps,.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,.DS_Store,*.aux,*.out,*.toc' o.wildignore =
'deps,.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,.DS_Store,*.aux,*.out,*.toc'
vim.cmd([[ vim.cmd([[
au BufRead,BufNewFile *.md set ft=mkd tw=80 syntax=markdown au BufRead,BufNewFile *.md set ft=mkd tw=80 syntax=markdown