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
}
},
textobjects = {
-- syntax-aware textobjects
enable = true,
@ -51,35 +50,38 @@ treesitter.setup {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
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 = {
["]["] = "@function.outer"
["]["] = "@function.outer",
["]C"] = "@class.outer",
},
goto_previous_start = {
["[["] = "@function.outer"
["[["] = "@function.outer",
["[c"] = "@class.outer",
},
goto_previous_end = {
["[]"] = "@function.outer"
}
["[]"] = "@function.outer",
["[C"] = "@class.outer",
},
select = {
enable = true,
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.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"
}
-- Below will go to either the start or the end, whichever is closer.
-- Use if you want more granular movements
-- Make it even more gradual by adding multiple queries and regex.
goto_next = {
["]d"] = "@conditional.outer",
},
goto_previous = {
["[d"] = "@conditional.outer",
}
},
swap = {

View File

@ -6,61 +6,62 @@ vim.g.maplocalleader = '\\'
-- Plugins
require "paq" {
"savq/paq-nvim";
"savq/paq-nvim",
"nvim-treesitter/nvim-treesitter";
"nvim-treesitter/nvim-treesitter-textobjects";
"nvim-treesitter/nvim-treesitter",
"nvim-treesitter/nvim-treesitter-textobjects",
-- Theming
"ellisonleao/gruvbox.nvim";
"nvim-lualine/lualine.nvim";
"nvim-tree/nvim-web-devicons";
"lukas-reineke/indent-blankline.nvim";
"ellisonleao/gruvbox.nvim",
"nvim-lualine/lualine.nvim",
"nvim-tree/nvim-web-devicons",
"lukas-reineke/indent-blankline.nvim",
-- LSP support
"onsails/lspkind.nvim";
"lukas-reineke/lsp-format.nvim";
"neovim/nvim-lspconfig";
"onsails/lspkind.nvim",
"lukas-reineke/lsp-format.nvim",
"neovim/nvim-lspconfig",
{{- if ne .chezmoi.os "openbsd" }}
"williamboman/mason.nvim";
"williamboman/mason-lspconfig.nvim";
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
{{- end }}
-- Autocomplete
"hrsh7th/nvim-cmp";
"hrsh7th/cmp-buffer";
"hrsh7th/cmp-path";
"saadparwaiz1/cmp_luasnip";
"hrsh7th/cmp-nvim-lsp";
"hrsh7th/cmp-nvim-lua";
"hrsh7th/nvim-cmp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lua",
-- Snippets
"L3MON4D3/LuaSnip";
"rafamadriz/friendly-snippets";
"L3MON4D3/LuaSnip",
"rafamadriz/friendly-snippets",
-- Programming support
"kylechui/nvim-surround";
"windwp/nvim-autopairs";
"numToStr/Comment.nvim";
"ggandor/leap.nvim";
"kylechui/nvim-surround",
"windwp/nvim-autopairs",
"numToStr/Comment.nvim",
"ggandor/leap.nvim",
-- Fuzzy search
{ "nvim-telescope/telescope-fzf-native.nvim", run = "gmake" };
"nvim-telescope/telescope-file-browser.nvim";
"nvim-telescope/telescope.nvim";
"folke/trouble.nvim";
{ "nvim-telescope/telescope-fzf-native.nvim", run = "gmake" },
"nvim-telescope/telescope-file-browser.nvim",
"nvim-telescope/telescope.nvim",
"folke/trouble.nvim",
"mfussenegger/nvim-dap";
"theHamsta/nvim-dap-virtual-text";
"rcarriga/nvim-dap-ui";
"mfussenegger/nvim-dap",
"theHamsta/nvim-dap-virtual-text",
"rcarriga/nvim-dap-ui",
"norcalli/nvim-colorizer.lua";
"lewis6991/gitsigns.nvim";
"tpope/vim-fugitive";
"renerocksai/telekasten.nvim";
"renerocksai/calendar-vim";
"nvim-lua/plenary.nvim";
"akinsho/toggleterm.nvim";
"norcalli/nvim-colorizer.lua",
"lewis6991/gitsigns.nvim",
"tpope/vim-fugitive",
"renerocksai/telekasten.nvim",
"renerocksai/calendar-vim",
"nvim-lua/plenary.nvim",
"akinsho/toggleterm.nvim",
}
@ -80,8 +81,8 @@ require 'colorizer'.setup {
filetypes = {
'css',
'javascript',
scss = { rgb_fn = true; };
html = { mode = 'foreground'; }
scss = { rgb_fn = true, },
html = { mode = 'foreground', }
},
}
@ -150,16 +151,23 @@ o.laststatus = 2 -- always show status line
o.list = false -- do not display white characters
o.termguicolors = true
o.background = "dark"
-- o.updatetime = 100
-- Folding
o.foldenable = false
o.foldlevel = 4 -- limit folding to 4 levels
o.foldmethod = 'syntax' -- use language syntax to generate folds
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
o.foldenable = true
o.foldnestmax = 2
o.foldminlines = 10
o.foldmethod = "expr"
o.foldexpr = "nvim_treesitter#foldexpr()"
-- workaround for Telescope bug
vim.api.nvim_create_autocmd({ "BufEnter" }, {
pattern = { "*" },
command = "normal zx",
})
-- Sidebar
o.number = true -- line number on the left
o.relativenumber = true
@ -222,7 +230,8 @@ o.backupdir = HOME .. '/.local/share/nvim/dirs/backup//' -- backups
-- Commands mode
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([[
au BufRead,BufNewFile *.md set ft=mkd tw=80 syntax=markdown