nvim: treesitter goodness
This commit is contained in:
parent
d3c122a310
commit
df0a108c8b
5 changed files with 38 additions and 14 deletions
|
@ -7,7 +7,7 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] =
|
||||||
vim.lsp.diagnostic.on_publish_diagnostics,
|
vim.lsp.diagnostic.on_publish_diagnostics,
|
||||||
{
|
{
|
||||||
update_in_insert = false,
|
update_in_insert = false,
|
||||||
virtual_text = {prefix = "‹❮❰ 🔥" }
|
virtual_text = {prefix = "‹❮❰ " }
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
vim.fn.sign_define(
|
vim.fn.sign_define(
|
||||||
|
@ -29,14 +29,14 @@ vim.fn.sign_define(
|
||||||
"LspDiagnosticsSignInformation",
|
"LspDiagnosticsSignInformation",
|
||||||
{
|
{
|
||||||
text = "💡",
|
text = "💡",
|
||||||
texthl = "LspDiagnosticsSignInformation"
|
texthl = "LspDiagnosticsSignInformation",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
vim.fn.sign_define(
|
vim.fn.sign_define(
|
||||||
"LspDiagnosticsSignHint",
|
"LspDiagnosticsSignHint",
|
||||||
{
|
{
|
||||||
text = "💡",
|
text = "💡",
|
||||||
texthl = "LspDiagnosticsSignHint"
|
texthl = "LspDiagnosticsSignHint",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,6 @@ telescope.setup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- TODO: Reduce preview ratio
|
|
||||||
-- Override flex layout
|
|
||||||
local layout_strategies = require("telescope.pickers.layout_strategies")
|
local layout_strategies = require("telescope.pickers.layout_strategies")
|
||||||
local config = require("telescope.config")
|
local config = require("telescope.config")
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,41 @@
|
||||||
require("nvim-treesitter.configs").setup {
|
require("nvim-treesitter.configs").setup {
|
||||||
ensure_installed = "maintained",
|
ensure_installed = "maintained",
|
||||||
highlight = {enable = true},
|
highlight = {enable = true},
|
||||||
|
playground = {
|
||||||
|
enable = true,
|
||||||
|
disable = {},
|
||||||
|
updatetime = 25,
|
||||||
|
persist_queries = false
|
||||||
|
},
|
||||||
|
|
||||||
|
incremental_selection = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
init_selection = "ss",
|
||||||
|
node_incremental = "sq",
|
||||||
|
scope_incremental = "sd",
|
||||||
|
node_decremental = "sa",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
textobjects = {
|
textobjects = {
|
||||||
move = {
|
move = {
|
||||||
enable = true,
|
enable = true,
|
||||||
goto_next_start = {
|
goto_next_start = {
|
||||||
["]m"] = "@function.outer",
|
["]]"] = "@function.outer",
|
||||||
["]]"] = "@class.outer"
|
["]m"] = "@class.outer"
|
||||||
},
|
},
|
||||||
goto_next_end = {
|
goto_next_end = {
|
||||||
["]M"] = "@function.outer",
|
["]["] = "@function.outer",
|
||||||
["]["] = "@class.outer"
|
["]M"] = "@class.outer"
|
||||||
},
|
},
|
||||||
goto_previous_start = {
|
goto_previous_start = {
|
||||||
["[m"] = "@function.outer",
|
["[["] = "@function.outer",
|
||||||
["[["] = "@class.outer"
|
["[m"] = "@class.outer"
|
||||||
},
|
},
|
||||||
goto_previous_end = {
|
goto_previous_end = {
|
||||||
["[M"] = "@function.outer",
|
["[]"] = "@function.outer",
|
||||||
["[]"] = "@class.outer"
|
["[M"] = "@class.outer"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
select = {
|
select = {
|
||||||
|
|
|
@ -48,6 +48,7 @@ vim.o.sidescrolloff = 5
|
||||||
vim.o.termguicolors = true
|
vim.o.termguicolors = true
|
||||||
vim.wo.cursorline = true
|
vim.wo.cursorline = true
|
||||||
vim.wo.number = true
|
vim.wo.number = true
|
||||||
|
vim.o.laststatus = 0
|
||||||
|
|
||||||
--- Key mappings
|
--- Key mappings
|
||||||
local map = require("dln.utils").map
|
local map = require("dln.utils").map
|
||||||
|
|
|
@ -77,6 +77,12 @@ return require('packer').startup(function()
|
||||||
map('i', '<C-k>', '<Cmd>lua vim.lsp.buf.signature_help()<CR>')
|
map('i', '<C-k>', '<Cmd>lua vim.lsp.buf.signature_help()<CR>')
|
||||||
map('n', '1gd', '<Cmd>lua vim.lsp.buf.type_definition()<CR>')
|
map('n', '1gd', '<Cmd>lua vim.lsp.buf.type_definition()<CR>')
|
||||||
map('n', 'gf', '<Cmd>lua vim.lsp.buf.formatting()<CR>')
|
map('n', 'gf', '<Cmd>lua vim.lsp.buf.formatting()<CR>')
|
||||||
|
map('n', 'rn', '<Cmd>lua vim.lsp.buf.rename()<CR>')
|
||||||
|
map('n', '[d', '<Cmd>lua vim.lsp.diagnostic.goto_prev()<CR>')
|
||||||
|
map('n', ']d', '<Cmd>lua vim.lsp.diagnostic.goto_next()<CR>')
|
||||||
|
map('n', 'wa', '<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>')
|
||||||
|
map('n', 'wr', '<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>')
|
||||||
|
map('n', 'wl', '<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR>')
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,10 +97,11 @@ return require('packer').startup(function()
|
||||||
config = function()
|
config = function()
|
||||||
require('dln.telescope')
|
require('dln.telescope')
|
||||||
local map = require('dln.utils').map
|
local map = require('dln.utils').map
|
||||||
map('n', '<space>', '<cmd>lua require("telescope.builtin").buffers()<CR>')
|
|
||||||
map('n', '<leader>b', '<cmd>lua require("telescope.builtin").buffers()<CR>')
|
map('n', '<leader>b', '<cmd>lua require("telescope.builtin").buffers()<CR>')
|
||||||
map('n', '<leader>f', '<cmd>lua require("telescope.builtin").oldfiles()<CR>')
|
map('n', '<leader>f', '<cmd>lua require("telescope.builtin").oldfiles()<CR>')
|
||||||
|
map('n', '<space>', '<cmd>lua require("telescope.builtin").oldfiles()<CR>')
|
||||||
map('n', '<leader>e', '<cmd>lua require("telescope.builtin").git_files()<CR>')
|
map('n', '<leader>e', '<cmd>lua require("telescope.builtin").git_files()<CR>')
|
||||||
|
map('n', '<leader>g', '<cmd>lua require("telescope.builtin").git_status()<CR>')
|
||||||
map('n', '<leader>s', '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>')
|
map('n', '<leader>s', '<cmd>lua require("telescope.builtin").lsp_document_symbols()<CR>')
|
||||||
map('n', '<leader>t', '<cmd>lua require("telescope.builtin").treesitter()<CR>')
|
map('n', '<leader>t', '<cmd>lua require("telescope.builtin").treesitter()<CR>')
|
||||||
map('n', '<leader>/', '<cmd>lua require("telescope.builtin").live_grep()<CR>')
|
map('n', '<leader>/', '<cmd>lua require("telescope.builtin").live_grep()<CR>')
|
||||||
|
@ -111,6 +118,7 @@ return require('packer').startup(function()
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
run = ":TSUpdate",
|
run = ":TSUpdate",
|
||||||
requires = {
|
requires = {
|
||||||
|
"nvim-treesitter/playground",
|
||||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||||
"windwp/nvim-ts-autotag"
|
"windwp/nvim-ts-autotag"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue