treesitter: indent config

This commit is contained in:
Daniel Lundin 2021-04-20 10:15:40 +02:00
parent 0d7e357c3f
commit 301dab336e
5 changed files with 110 additions and 97 deletions

View file

@ -63,36 +63,36 @@ for _, lsp in ipairs(servers) do
end end
local efm_prettier = { local efm_prettier = {
formatCommand = "prettier --stdin-filepath ${INPUT}", formatCommand = "prettier --stdin-filepath ${INPUT}",
formatStdin = true formatStdin = true
} }
lspconfig.sumneko_lua.setup { lspconfig.sumneko_lua.setup {
cmd = {"lua-language-server", "-E", "/usr/share/lua-language-server/main.lua"}, cmd = {"lua-language-server", "-E", "/usr/share/lua-language-server/main.lua"},
settings = { settings = {
Lua = { Lua = {
completion = {kewordSnippet = "Disable"}, completion = {kewordSnippet = "Disable"},
diagnostics = { diagnostics = {
enable = true, enable = true,
globals = {"renoise", "use", "vim"} globals = {"renoise", "use", "vim"}
}, },
runtime = { runtime = {
version = "LuaJIT", version = "LuaJIT",
path = {"?.lua", "?/init.lua", "?/?.lua"} path = {"?.lua", "?/init.lua", "?/?.lua"}
}, },
workspace = { workspace = {
library = { library = {
[vim.fn.expand("$VIMRUNTIME/lua")] = true, [vim.fn.expand("$VIMRUNTIME/lua")] = true,
[vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true, [vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true,
[vim.fn.stdpath("config") .. "/lua"] = true, [vim.fn.stdpath("config") .. "/lua"] = true,
[vim.fn.stdpath("data") .. "/site/pack"] = true [vim.fn.stdpath("data") .. "/site/pack"] = true
}, },
maxPreload = 2000, maxPreload = 2000,
preloadFileSize = 1000 preloadFileSize = 1000
} }
} }
} }
} }
lspconfig.yamlls.setup { lspconfig.yamlls.setup {

View file

@ -1,73 +1,78 @@
require("nvim-treesitter.configs").setup { require("nvim-treesitter.configs").setup {
ensure_installed = "maintained", ensure_installed = "maintained",
highlight = {enable = true}, highlight = {
playground = { enable = true,
enable = true, use_languagetree = true,
disable = {}, },
updatetime = 25,
persist_queries = false
},
incremental_selection = {
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 = {
["]]"] = "@function.outer",
["]m"] = "@class.outer"
},
goto_next_end = {
["]["] = "@function.outer",
["]M"] = "@class.outer"
},
goto_previous_start = {
["[["] = "@function.outer",
["[m"] = "@class.outer"
},
goto_previous_end = {
["[]"] = "@function.outer",
["[M"] = "@class.outer"
}
},
select = {
enable = true, enable = true,
keymaps = { keymaps = {
init_selection = "ss", -- You can use the capture groups defined in textobjects.scm
node_incremental = "sq", ["af"] = "@function.outer",
scope_incremental = "sd", ["if"] = "@function.inner",
node_decremental = "sa", ["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"
}
}
}, },
swap = {
textobjects = { enable = true,
move = { swap_next = {
enable = true, ["<leader>l"] = "@parameter.inner"
goto_next_start = { },
["]]"] = "@function.outer", swap_previous = {
["]m"] = "@class.outer" ["<leader>h"] = "@parameter.inner"
}, }
goto_next_end = { }
["]["] = "@function.outer", },
["]M"] = "@class.outer" --- nvim-ts-autotag ---
}, autotag = {
goto_previous_start = { enable = true,
["[["] = "@function.outer", filetypes = {"html", "javascriptreact", "xml"}
["[m"] = "@class.outer" }
},
goto_previous_end = {
["[]"] = "@function.outer",
["[M"] = "@class.outer"
}
},
select = {
enable = 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"
}
}
},
swap = {
enable = true,
swap_next = {
["<leader>l"] = "@parameter.inner"
},
swap_previous = {
["<leader>h"] = "@parameter.inner"
}
}
},
--- nvim-ts-autotag ---
autotag = {
enable = true,
filetypes = {"html", "javascriptreact", "xml"}
}
} }

View file

@ -21,9 +21,9 @@ vim.o.listchars = 'extends:,precedes:,nbsp:·,tab:→ ,trail:·'
vim.wo.foldlevel = 99 vim.wo.foldlevel = 99
vim.wo.linebreak = true vim.wo.linebreak = true
vim.wo.list = true vim.wo.list = true
vim.o.shiftwidth = 4 vim.o.shiftwidth = 2
vim.o.tabstop = 4 vim.o.tabstop = 2
vim.o.softtabstop = 4 vim.o.softtabstop = 2
--- Search --- Search
vim.cmd('set path+=**') vim.cmd('set path+=**')

View file

@ -42,6 +42,7 @@ return require('packer').startup(function()
end end
end end
utils.mapx("is", "<C-space>", "v:lua.complete('<C-n>', '<Tab>')")
utils.mapx("is", "<Tab>", "v:lua.complete('<C-n>', '<Tab>')") utils.mapx("is", "<Tab>", "v:lua.complete('<C-n>', '<Tab>')")
utils.mapx("is", "<S-Tab>", "v:lua.complete('<C-p>', '<C-h>')") utils.mapx("is", "<S-Tab>", "v:lua.complete('<C-p>', '<C-h>')")
utils.mapx("x", "<CR>", "compe:#confirm('<CR')") utils.mapx("x", "<CR>", "compe:#confirm('<CR')")
@ -57,6 +58,13 @@ return require('packer').startup(function()
config = function() config = function()
require('gitsigns').setup { require('gitsigns').setup {
numhl = true, numhl = true,
signs = {
add = {hl = 'GitSignsAdd' , text = '', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'},
change = {hl = 'GitSignsChange', text = '', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
delete = {hl = 'GitSignsDelete', text = '', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
topdelete = {hl = 'GitSignsDelete', text = '', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
},
} }
end end
} }

View file

@ -1,6 +1,6 @@
[core] [core]
excludesfile = "~/.gitignore" excludesfile = "~/.gitignore"
pager = delta --line-numbers -s pager = delta --line-numbers
[user] [user]
useConfigOnly = true useConfigOnly = true