aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/alpha/completition/init.lua129
-rw-r--r--lua/alpha/lsp/attach.lua29
-rw-r--r--lua/alpha/lsp/init.lua12
-rw-r--r--lua/alpha/lsp/mason.lua12
-rw-r--r--lua/alpha/lsp/servers.lua11
-rw-r--r--lua/alpha/lsp/setups.lua65
-rw-r--r--lua/alpha/lsp/tools.lua4
-rw-r--r--lua/alpha/neovide.lua29
-rw-r--r--lua/alpha/plugins.lua21
-rw-r--r--lua/alpha/telescope/init.lua2
10 files changed, 274 insertions, 40 deletions
diff --git a/lua/alpha/completition/init.lua b/lua/alpha/completition/init.lua
new file mode 100644
index 0000000..0537a48
--- /dev/null
+++ b/lua/alpha/completition/init.lua
@@ -0,0 +1,129 @@
+local cmp = require("cmp")
+local lspkind = require("lspkind")
+local luasnip = require("luasnip")
+local cmp_autopairs = require("nvim-autopairs.completion.cmp")
+
+if cmp == nil then
+ return
+end
+
+cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
+
+cmp.setup({
+ mapping = {
+ ["<C-d>"] = cmp.mapping.scroll_docs(-4),
+ ["<C-f>"] = cmp.mapping.scroll_docs(4),
+ ["<C-e>"] = cmp.mapping(function(fallback)
+ if cmp.visible() then
+ cmp.close()
+ elseif luasnip.expand_or_jumpable() then
+ luasnip.expand_or_jump()
+ else
+ fallback()
+ end
+ end, { "i", "s" }),
+ ["<C-n>"] = cmp.mapping(function(fallback)
+ if cmp.visible() then
+ cmp.select_next_item()
+ elseif luasnip.choice_active() then
+ luasnip.change_choice(1)
+ else
+ fallback()
+ end
+ end, { "i", "s" }),
+ ["<C-p>"] = cmp.mapping.select_prev_item(),
+ ["<C-y>"] = cmp.mapping.confirm({
+ behavior = cmp.ConfirmBehavior.Insert,
+ select = true,
+ }),
+ ["<c-space>"] = cmp.mapping.complete(),
+ },
+ sources = {
+ { name = "nvim_lua" },
+ { name = "nvim_lsp" },
+ { name = "path" },
+ { name = "luasnip" },
+ {
+ name = "buffer",
+ keyword_length = 4,
+ option = {
+ get_bufnrs = function()
+ local bufs = {}
+ for _, win in ipairs(vim.api.nvim_list_wins()) do
+ bufs[vim.api.nvim_win_get_buf(win)] = true
+ end
+ return vim.tbl_keys(bufs)
+ end,
+ },
+ },
+ },
+
+ snippet = {
+ expand = function(args)
+ require("luasnip").lsp_expand(args.body)
+ end,
+ },
+
+ formatting = {
+ format = lspkind.cmp_format({
+ with_text = true,
+ menu = {
+ buffer = "[buf]",
+ nvim_lsp = "[LSP]",
+ nvim_lua = "[api]",
+ path = "[path]",
+ luasnip = "[snip]",
+ ["vim-dadbod-completion"] = "[DB]",
+ },
+ }),
+ },
+
+ experimental = {
+ native_menu = false,
+
+ ghost_text = true,
+ },
+})
+
+-- Set configuration for specific filetype.
+cmp.setup.filetype("gitcommit", {
+ sources = cmp.config.sources({
+ { name = "cmp_git" }, -- You can specify the `cmp_git` source if you were installed it.
+ }, {
+ { name = "buffer" },
+ }),
+})
+
+-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
+cmp.setup.cmdline("/", {
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = {
+ { name = "buffer" },
+ },
+})
+
+-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
+cmp.setup.cmdline(":", {
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = cmp.config.sources({
+ { name = "path" },
+ }, {
+ { name = "cmdline" },
+ }),
+})
+
+cmp.setup.filetype({ "sql", "mysql", "plsql" }, {
+ sources = cmp.config.sources({
+ { name = "vim-dadbod-completion" },
+ }, {
+ { name = "buffer" },
+ }),
+})
+
+cmp.setup.filetype({ "dap-repl", "dapui_watches" }, {
+ sources = cmp.config.sources({
+ { name = "dap" },
+ }, {
+ { name = "buffer" },
+ }),
+})
diff --git a/lua/alpha/lsp/attach.lua b/lua/alpha/lsp/attach.lua
new file mode 100644
index 0000000..ce63e02
--- /dev/null
+++ b/lua/alpha/lsp/attach.lua
@@ -0,0 +1,29 @@
+local telescope_mapper = require("alpha.telescope.mappings")
+
+local filetype_attach = setmetatable({}, {
+ __index = function()
+ return function() end
+ end,
+})
+return function (client, bufnr)
+ local filetype = vim.api.nvim_buf_get_option(0, "filetype")
+ -- keymaps for lsp
+ vim.keymap.set("n", "K", vim.lsp.buf.hover, { buffer = 0 })
+ vim.keymap.set("n", "<leader>vrn", vim.lsp.buf.rename, { buffer = 0 })
+ vim.keymap.set("i", "<c-h>", vim.lsp.buf.signature_help, { buffer = 0 })
+ vim.keymap.set("n", "<leader>vo", ":LspRestart<cr>", { noremap = true })
+ vim.keymap.set({ "n", "v" }, "<leader>vca", vim.lsp.buf.code_action, {})
+ vim.keymap.set("n", "<leader>vf", function()
+ return vim.lsp.buf.format({ async = true })
+ end, {})
+
+ telescope_mapper("gr", "lsp_references", nil, true)
+ telescope_mapper("<leader>pv", "find_symbol", nil, true)
+ telescope_mapper("<leader>pd", "lsp_document_symbols", nil, true)
+ telescope_mapper("<c-]>", "lsp_definitions", nil, true)
+
+ vim.bo.omnifunc = "v:lua.vim.lsp.omnifunc"
+
+ -- Attach any filetype specific options to the client
+ filetype_attach[filetype](client, bufnr)
+end
diff --git a/lua/alpha/lsp/init.lua b/lua/alpha/lsp/init.lua
new file mode 100644
index 0000000..86b06a6
--- /dev/null
+++ b/lua/alpha/lsp/init.lua
@@ -0,0 +1,12 @@
+-- LSP configuration
+
+-- install servers and tools
+require('alpha.lsp.mason')
+local setups = require("alpha.lsp.setups")
+
+local lspconfig = require('lspconfig')
+require('mason-lspconfig').setup_handlers({
+ function (server_name)
+ lspconfig[server_name].setup(setups[server_name]())
+ end
+})
diff --git a/lua/alpha/lsp/mason.lua b/lua/alpha/lsp/mason.lua
new file mode 100644
index 0000000..9dab32e
--- /dev/null
+++ b/lua/alpha/lsp/mason.lua
@@ -0,0 +1,12 @@
+local mason = require("mason")
+local mason_lspconfig = require("mason-lspconfig")
+
+mason.setup()
+
+mason_lspconfig.setup({
+ ensure_installed = require('alpha.lsp.servers'),
+})
+
+require('mason-tool-installer').setup({
+ ensure_installed = require('alpha.lsp.tools'),
+})
diff --git a/lua/alpha/lsp/servers.lua b/lua/alpha/lsp/servers.lua
new file mode 100644
index 0000000..921a628
--- /dev/null
+++ b/lua/alpha/lsp/servers.lua
@@ -0,0 +1,11 @@
+return {
+ "phpactor",
+ "rust_analyzer",
+ "gopls",
+ "sumneko_lua",
+ "emmet_ls",
+ "jsonls",
+ "html",
+ "tsserver",
+ "volar",
+}
diff --git a/lua/alpha/lsp/setups.lua b/lua/alpha/lsp/setups.lua
new file mode 100644
index 0000000..646eec1
--- /dev/null
+++ b/lua/alpha/lsp/setups.lua
@@ -0,0 +1,65 @@
+local lsp_attach = require("alpha.lsp.attach")
+
+local lsp_flags = {
+ debounce_text_changes = 150,
+}
+
+return setmetatable({
+ rust_analyzer = function()
+ return {
+ on_attach = lsp_attach,
+ flags = lsp_flags,
+ settings = {
+ ["rust-analyzer"] = {},
+ },
+ }
+ end,
+ phpactor = function()
+ return {
+ on_attach = lsp_attach,
+ flags = lsp_flags,
+ filetypes = { "php", "cucumber" },
+ }
+ end,
+ emmet_ls = function()
+ local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
+
+ return {
+ on_attach = lsp_attach,
+ flags = lsp_flags,
+ capabilities = capabilities,
+ filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "blade", "vue" },
+ }
+ end,
+ sumneko_lua = function()
+ return {
+ on_attach = lsp_attach,
+ flags = lsp_flags,
+ settings = {
+ Lua = {
+ runtime = {
+ version = "LuaJIT",
+ },
+ diagnostics = {
+ globals = { "vim" },
+ },
+ workspace = {
+ library = vim.api.nvim_get_runtime_file("", true),
+ },
+ telemetry = {
+ enable = false,
+ },
+ },
+ },
+ }
+ end,
+}, {
+ __index = function()
+ return function ()
+ return {
+ on_attach = lsp_attach,
+ flags = lsp_flags,
+ }
+ end
+ end,
+})
diff --git a/lua/alpha/lsp/tools.lua b/lua/alpha/lsp/tools.lua
new file mode 100644
index 0000000..23ef226
--- /dev/null
+++ b/lua/alpha/lsp/tools.lua
@@ -0,0 +1,4 @@
+return {
+ "go-debug-adapter",
+ "php-debug-adapter",
+}
diff --git a/lua/alpha/neovide.lua b/lua/alpha/neovide.lua
deleted file mode 100644
index 1e419d3..0000000
--- a/lua/alpha/neovide.lua
+++ /dev/null
@@ -1,29 +0,0 @@
-local default_font = "VictorMono Nerd Font:b"
-local default_size = 14;
-
-vim.g.neovide_transparency = 0.9
-vim.g.neovide_hide_mouse_when_typing = true
-
-local function set_font(font, size)
- font = font or default_font
- size = size or default_size
-
- vim.o.guifont = string.format("%s:h%d", font, size)
-end
-
-set_font()
-
-local maps = {
- f0 = 14,
- f1 = 15,
- f2 = 16,
- f3 = 18,
- f4 = 20,
- f5 = 22,
-}
-
-for key, value in pairs(maps) do
- vim.keymap.set("n", "<leader>" .. key, function ()
- set_font(nil, value)
- end)
-end
diff --git a/lua/alpha/plugins.lua b/lua/alpha/plugins.lua
index 0b83100..c0a4f82 100644
--- a/lua/alpha/plugins.lua
+++ b/lua/alpha/plugins.lua
@@ -18,8 +18,8 @@ return require("packer").startup(function(use)
home = first
end
- if vim.fn.isdirectory(vim.fn.expand("~/plugins/" .. plug_path)) == 1 then
- opts[1] = "~/plugins/" .. plug_path
+ if vim.fn.isdirectory(vim.fn.expand("~/code/plugins/" .. plug_path)) == 1 then
+ opts[1] = "~/code/plugins/" .. plug_path
else
opts[1] = string.format("%s/%s", home, plug_path)
end
@@ -30,6 +30,8 @@ return require("packer").startup(function(use)
use("wbthomason/packer.nvim")
use("lewis6991/impatient.nvim")
+ use("jwalton512/vim-blade")
+
use({
"ThePrimeagen/refactoring.nvim",
requires = {
@@ -85,25 +87,25 @@ return require("packer").startup(function(use)
"rcarriga/cmp-dap",
"saadparwaiz1/cmp_luasnip",
"onsails/lspkind-nvim",
+ "hrsh7th/cmp-nvim-lsp-signature-help",
{ "L3MON4D3/LuaSnip", tag = "v1.*" },
"windwp/nvim-autopairs",
},
})
- -- LSP
- use({
- "neovim/nvim-lspconfig",
- "hrsh7th/cmp-nvim-lsp-signature-help",
- "jose-elias-alvarez/null-ls.nvim",
- })
-
-- Installation of LSP/Debuggers/Other
use({
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
+ "neovim/nvim-lspconfig",
"WhoIsSethDaniel/mason-tool-installer.nvim",
})
+ -- Null ls
+ use({
+ "jose-elias-alvarez/null-ls.nvim",
+ })
+
use({
"nvim-telescope/telescope.nvim",
requires = {
@@ -206,7 +208,6 @@ return require("packer").startup(function(use)
use("junegunn/vim-easy-align")
- use("jwalton512/vim-blade")
use("jghauser/mkdir.nvim")
diff --git a/lua/alpha/telescope/init.lua b/lua/alpha/telescope/init.lua
index eaa5800..ccb1b9e 100644
--- a/lua/alpha/telescope/init.lua
+++ b/lua/alpha/telescope/init.lua
@@ -73,7 +73,7 @@ function M.projectionist()
end
function M.laravel_commands()
- return require("telescope").extensions.laravel.commands()
+ return require("telescope").extensions.laravel.laravel()
end
function M.api_specs()