Fix treesitter config. Reformat
This commit is contained in:
parent
b03926963f
commit
81af8acda9
@ -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 = {
|
||||||
|
@ -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', }
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,16 +151,23 @@ 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
|
|
||||||
|
|
||||||
-- 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.wrap = false --do not wrap lines even if very long
|
||||||
o.eol = false -- show if there's no eol char
|
o.eol = false -- show if there's no eol char
|
||||||
o.showbreak = '↪' -- character to show when line is broken
|
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
|
-- Sidebar
|
||||||
o.number = true -- line number on the left
|
o.number = true -- line number on the left
|
||||||
o.relativenumber = true
|
o.relativenumber = true
|
||||||
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user