add treesitter-based context and checkbox support

This commit is contained in:
Michael Peters 2022-10-02 16:12:53 -05:00
parent 0eaefff993
commit 4c036cb741
4 changed files with 30 additions and 15 deletions

View File

@ -85,10 +85,10 @@ function M.config()
lsp_highlight_document(client)
end
local sumneko_root_path = '/home/peters/builds/lua-language-server'
local sumneko_binary = sumneko_root_path.."/bin/lua-language-server"
-- local sumneko_root_path = '/home/peters/builds/lua-language-server'
-- local sumneko_binary = sumneko_root_path.."/bin/lua-language-server"
lspconfig.sumneko_lua.setup {
cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" },
-- cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" },
on_attach = on_attach,
settings = {
Lua = {

View File

@ -0,0 +1,16 @@
local M = {}
function M.config()
local present, treesitter_context = pcall(require, 'treesitter-context')
if not present then
return
end
treesitter_context.setup {
mode = 'topline',
}
end
return M

View File

@ -65,15 +65,8 @@ map("n", "<C-d>", "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<
map("n", "<leader>b", "<cmd>GitBlameToggle<CR>", opts)
-- LSP (See configs/lsp-installer.lua)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gl", "<cmd>lua vim.diagnostic.open_float({ source = true, prefix = function(d, i, ttl) return string.rep(' ', #tostring(ttl) - #tostring(i)) .. tostring(i) .. ': ', nil end })<CR>")
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "go", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", '<cmd>lua vim.diagnostic.goto_prev({ border = "rounded" })<CR>', opts)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>ll", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>lf", "<cmd>lua vim.lsp.buf.formatting_sync()<CR>", opts)
-- LSP (see configs/lsp-installer.lua)
-- Checkboxes (see gerardbm/vim-md-checkbox)
-- nnoremap <silent> <leader>we :call <sid>changecheckbox()<cr>
-- nnoremap <silent> <leader>wx :call <sid>deletecheckbox()<cr>

View File

@ -87,6 +87,9 @@ packer.startup {
-- Context-based auto commenting
use { 'JoosepAlviste/nvim-ts-context-commentstring', after = 'nvim-treesitter' }
-- Show context
use { 'nvim-treesitter/nvim-treesitter-context', config = function() require'configs.treesitter-context'.config() end }
--
-- LSP
--
@ -131,7 +134,7 @@ packer.startup {
}
-- Snippet Engine (for nvim-cmp)
-- TODO: Add snippets. rafamadriz/friendly-snippets is too cow for me and has too many snippets.
-- TODO: Add snippets? rafamadriz/friendly-snippets is too cow for me and has too many snippets.
-- I'd like to use my own collection exclusively (unless there is a better, less extensive collection)
use { 'L3MON4D3/LuaSnip' }
@ -162,6 +165,9 @@ packer.startup {
-- Formatting for python (:call Black())
use { 'averms/black-nvim', run = ':UpdateRemotePlugins' }
-- Toggle checkboxes w/ <leader>we, delete w/ <leader>wx
use { 'gerardbm/vim-md-checkbox' }
end,
config = {
display = {