nvim: treesitter goodness

This commit is contained in:
Daniel Lundin 2021-04-19 20:22:00 +02:00
parent d3c122a310
commit df0a108c8b
5 changed files with 38 additions and 14 deletions

View file

@ -7,7 +7,7 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] =
vim.lsp.diagnostic.on_publish_diagnostics,
{
update_in_insert = false,
virtual_text = {prefix = "‹❮❰ 🔥" }
virtual_text = {prefix = "‹❮❰ " }
}
)
vim.fn.sign_define(
@ -29,14 +29,14 @@ vim.fn.sign_define(
"LspDiagnosticsSignInformation",
{
text = "💡",
texthl = "LspDiagnosticsSignInformation"
texthl = "LspDiagnosticsSignInformation",
}
)
vim.fn.sign_define(
"LspDiagnosticsSignHint",
{
text = "💡",
texthl = "LspDiagnosticsSignHint"
texthl = "LspDiagnosticsSignHint",
}
)

View file

@ -23,8 +23,6 @@ telescope.setup {
}
}
-- TODO: Reduce preview ratio
-- Override flex layout
local layout_strategies = require("telescope.pickers.layout_strategies")
local config = require("telescope.config")

View file

@ -1,24 +1,41 @@
require("nvim-treesitter.configs").setup {
ensure_installed = "maintained",
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 = {
move = {
enable = true,
goto_next_start = {
["]m"] = "@function.outer",
["]]"] = "@class.outer"
["]]"] = "@function.outer",
["]m"] = "@class.outer"
},
goto_next_end = {
["]M"] = "@function.outer",
["]["] = "@class.outer"
["]["] = "@function.outer",
["]M"] = "@class.outer"
},
goto_previous_start = {
["[m"] = "@function.outer",
["[["] = "@class.outer"
["[["] = "@function.outer",
["[m"] = "@class.outer"
},
goto_previous_end = {
["[M"] = "@function.outer",
["[]"] = "@class.outer"
["[]"] = "@function.outer",
["[M"] = "@class.outer"
}
},
select = {

View file

@ -48,6 +48,7 @@ vim.o.sidescrolloff = 5
vim.o.termguicolors = true
vim.wo.cursorline = true
vim.wo.number = true
vim.o.laststatus = 0
--- Key mappings
local map = require("dln.utils").map

View file

@ -77,6 +77,12 @@ return require('packer').startup(function()
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', '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
}
@ -91,10 +97,11 @@ return require('packer').startup(function()
config = function()
require('dln.telescope')
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>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>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>t', '<cmd>lua require("telescope.builtin").treesitter()<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",
run = ":TSUpdate",
requires = {
"nvim-treesitter/playground",
"nvim-treesitter/nvim-treesitter-textobjects",
"windwp/nvim-ts-autotag"
},