aboutsummaryrefslogtreecommitdiff
path: root/lua/pml68/configs
diff options
context:
space:
mode:
authorpml68 <tutorialmester@gmail.com>2024-03-18 21:33:54 +0100
committerpml68 <tutorialmester@gmail.com>2024-03-18 21:33:54 +0100
commit30073d82a57a4839f9687c9dbcde627c112b1839 (patch)
treeefe4ff05512462fc94edeea7c1f5996149cfa96c /lua/pml68/configs
parentfeat: missed the Float part (diff)
downloadnvim-30073d82a57a4839f9687c9dbcde627c112b1839.tar.gz
feat: autocompletion, keymaps and more
Diffstat (limited to '')
-rw-r--r--lua/pml68/configs/cmp.lua21
-rw-r--r--lua/pml68/configs/lspconfig.lua1
-rw-r--r--lua/pml68/configs/settings/lua_ls.lua24
-rw-r--r--lua/pml68/configs/toggleterm.lua15
4 files changed, 48 insertions, 13 deletions
diff --git a/lua/pml68/configs/cmp.lua b/lua/pml68/configs/cmp.lua
new file mode 100644
index 0000000..ff69651
--- /dev/null
+++ b/lua/pml68/configs/cmp.lua
@@ -0,0 +1,21 @@
+local cmp = require("cmp")
+
+cmp.setup({
+ sources = {
+ {name = 'nvim_lsp'},
+ },
+ preselect = 'item',
+ completion = {
+ completeopt = 'menu,menuone,noinsert'
+ },
+ mapping = cmp.mapping.preset.insert({
+ ['<CR>'] = cmp.mapping.confirm({select = false}),
+ ['<S-Tab>'] = cmp.mapping.select_prev_item({behavior = 'select'}),
+ ['<Tab>'] = cmp.mapping.select_next_item({behavior = 'select'}),
+ }),
+ snippet = {
+ expand = function(args)
+ require('luasnip').lsp_expand(args.body)
+ end,
+ },
+})
diff --git a/lua/pml68/configs/lspconfig.lua b/lua/pml68/configs/lspconfig.lua
index 12aacf8..40badc3 100644
--- a/lua/pml68/configs/lspconfig.lua
+++ b/lua/pml68/configs/lspconfig.lua
@@ -1,5 +1,4 @@
local capabilities = require("cmp_nvim_lsp").default_capabilities()
-
local lspconfig = require("lspconfig")
local servers = {
diff --git a/lua/pml68/configs/settings/lua_ls.lua b/lua/pml68/configs/settings/lua_ls.lua
index 7db368c..de4124c 100644
--- a/lua/pml68/configs/settings/lua_ls.lua
+++ b/lua/pml68/configs/settings/lua_ls.lua
@@ -2,18 +2,18 @@ return {
settings = {
Lua = {
diagnostics = {
- globals = { "vim " },
- },
- workspace = {
- library = {
- [vim.fn.expand "$VIMRUNTIME/lua"] = true,
- [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
- [vim.fn.stdpath "data" .. "/lazy/ui/nvchad_types"] = true,
- [vim.fn.stdpath "data" .. "/lazy/lazy.nvim/lua/lazy"] = true,
- },
- maxPreload = 100000,
- preloadFileSize = 10000,
- }
+ globals = { "vim " },
+ },
+ workspace = {
+ library = {
+ [vim.fn.expand "$VIMRUNTIME/lua"] = true,
+ [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
+ [vim.fn.stdpath "data" .. "/lazy/ui/nvchad_types"] = true,
+ [vim.fn.stdpath "data" .. "/lazy/lazy.nvim/lua/lazy"] = true,
+ },
+ maxPreload = 100000,
+ preloadFileSize = 10000,
+ }
}
}
}
diff --git a/lua/pml68/configs/toggleterm.lua b/lua/pml68/configs/toggleterm.lua
new file mode 100644
index 0000000..6bf4f14
--- /dev/null
+++ b/lua/pml68/configs/toggleterm.lua
@@ -0,0 +1,15 @@
+local Terminal = require('toggleterm.terminal').Terminal
+local lazygit = Terminal:new({
+ cmd = "lazygit",
+ hidden = true,
+ direction = "float",
+ float_opts = {
+ border = "double",
+ },
+})
+
+function _lazygit_toggle()
+ lazygit:toggle()
+end
+
+vim.keymap.set("n", "<leader>g", "<cmd> lua _lazygit_toggle() <CR>", {noremap = true, silent = true})