added toggle-term

master
Niclas Thobaben 2024-03-09 10:23:44 +01:00
parent 7556d1b0dc
commit 1c6972cfa5
6 changed files with 176 additions and 0 deletions

View File

@ -0,0 +1,91 @@
return {
"neovim/nvim-lspconfig",
dependencies = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/nvim-cmp",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"j-hui/fidget.nvim",
},
config = function()
local cmp = require('cmp')
local cmp_lsp = require("cmp_nvim_lsp")
local capabilities = vim.tbl_deep_extend(
"force",
{},
vim.lsp.protocol.make_client_capabilities(),
cmp_lsp.default_capabilities())
require("fidget").setup({})
require("mason").setup()
require("mason-lspconfig").setup({
ensure_installed = {
"lua_ls",
"rust_analyzer",
"tsserver",
},
handlers = {
function(server_name) -- default handler (optional)
require("lspconfig")[server_name].setup {
capabilities = capabilities
}
end,
["lua_ls"] = function()
local lspconfig = require("lspconfig")
lspconfig.lua_ls.setup {
capabilities = capabilities,
settings = {
Lua = {
diagnostics = {
globals = { "vim", "it", "describe", "before_each", "after_each" },
}
}
}
}
end,
}
})
local cmp_select = { behavior = cmp.SelectBehavior.Select }
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = cmp.mapping.preset.insert({
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
['<C-y>'] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete(),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' }, -- For luasnip users.
}, {
{ name = 'buffer' },
})
})
vim.diagnostic.config({
-- update_in_insert = true,
float = {
focusable = false,
style = "minimal",
border = "rounded",
source = "always",
header = "",
prefix = "",
},
})
end
}

View File

@ -0,0 +1,8 @@
require("toggleterm").setup{
open_mapping = [[<leader>tt]],
size = 30,
start_in_insert = true,
float_ops = {
height = 120
}
}

View File

@ -1,3 +1,21 @@
require("nthobaben.remap")
require("nthobaben.color")
require("nthobaben.packer")
vim.wo.number = true
vim.wo.relativenumber = true
vim.opt.tabstop = 4
vim.opt.softtabstop = 44
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.wrap = false
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.scrolloff = 8

View File

@ -32,5 +32,25 @@ return require('packer').startup(function(use)
},
}
use 'nvim-tree/nvim-web-devicons'
use {
'VonHeikemen/lsp-zero.nvim',
branch = 'v3.x',
requires = {
--- Uncomment the two plugins below if you want to manage the language servers from neovim
-- {'williamboman/mason.nvim'},
-- {'williamboman/mason-lspconfig.nvim'},
-- LSP Support
{'neovim/nvim-lspconfig'},
-- Autocompletion
{'hrsh7th/nvim-cmp'},
{'hrsh7th/cmp-nvim-lsp'},
{'L3MON4D3/LuaSnip'},
}
}
use {"akinsho/toggleterm.nvim", tag = '*', config = function()
require("toggleterm").setup()
end}
end)

View File

@ -1,2 +1,6 @@
vim.g.mapleader = " "
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
vim.keymap.set("n", "<leader>tt", function()
vim.api.nvim_command('tab | term')
end)

View File

@ -74,6 +74,31 @@ end
time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
LuaSnip = {
loaded = true,
path = "/home/niclasthobaben/.local/share/nvim/site/pack/packer/start/LuaSnip",
url = "https://github.com/L3MON4D3/LuaSnip"
},
["cmp-nvim-lsp"] = {
loaded = true,
path = "/home/niclasthobaben/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
},
["lsp-zero.nvim"] = {
loaded = true,
path = "/home/niclasthobaben/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim",
url = "https://github.com/VonHeikemen/lsp-zero.nvim"
},
["nvim-cmp"] = {
loaded = true,
path = "/home/niclasthobaben/.local/share/nvim/site/pack/packer/start/nvim-cmp",
url = "https://github.com/hrsh7th/nvim-cmp"
},
["nvim-lspconfig"] = {
loaded = true,
path = "/home/niclasthobaben/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
url = "https://github.com/neovim/nvim-lspconfig"
},
["nvim-tree.lua"] = {
loaded = true,
path = "/home/niclasthobaben/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
@ -109,6 +134,12 @@ _G.packer_plugins = {
path = "/home/niclasthobaben/.local/share/nvim/site/pack/packer/start/telescope.nvim",
url = "https://github.com/nvim-telescope/telescope.nvim"
},
["toggleterm.nvim"] = {
config = { "\27LJ\2\0028\0\0\2\0\3\0\0066\0\0\0'\1\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\15toggleterm\frequire\0" },
loaded = true,
path = "/home/niclasthobaben/.local/share/nvim/site/pack/packer/start/toggleterm.nvim",
url = "https://github.com/akinsho/toggleterm.nvim"
},
undotree = {
loaded = true,
path = "/home/niclasthobaben/.local/share/nvim/site/pack/packer/start/undotree",
@ -122,6 +153,10 @@ _G.packer_plugins = {
}
time([[Defining packer_plugins]], false)
-- Config for: toggleterm.nvim
time([[Config for toggleterm.nvim]], true)
try_loadstring("\27LJ\2\0028\0\0\2\0\3\0\0066\0\0\0'\1\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\15toggleterm\frequire\0", "config", "toggleterm.nvim")
time([[Config for toggleterm.nvim]], false)
_G._packer.inside_compile = false
if _G._packer.needs_bufread == true then