From 77f5dd9693576af7fde80bdc99700f21eff01d6b Mon Sep 17 00:00:00 2001 From: Ariel D'Alessandro Date: Wed, 9 Feb 2022 17:53:48 +0100 Subject: WIP moving to all lua and new structure --- lua/alpha/colors.lua | 16 ----- lua/alpha/completition.lua | 96 ----------------------------- lua/alpha/dap.lua | 2 +- lua/alpha/disable_builtin.lua | 20 ++++++ lua/alpha/first_load.lua | 27 ++++++++ lua/alpha/global.lua | 13 ---- lua/alpha/globals.lua | 13 ++++ lua/alpha/harpoon.lua | 7 --- lua/alpha/init.lua | 2 - lua/alpha/lsp.lua | 43 ------------- lua/alpha/plugins.lua | 139 ++++++++++++++++++++++++++++++++++++++++++ lua/alpha/status-line.lua | 31 ---------- lua/alpha/treesitter.lua | 60 ------------------ lua/plugins.lua | 138 ----------------------------------------- 14 files changed, 200 insertions(+), 407 deletions(-) delete mode 100644 lua/alpha/colors.lua delete mode 100644 lua/alpha/completition.lua create mode 100644 lua/alpha/disable_builtin.lua create mode 100644 lua/alpha/first_load.lua delete mode 100644 lua/alpha/global.lua create mode 100644 lua/alpha/globals.lua delete mode 100644 lua/alpha/harpoon.lua delete mode 100644 lua/alpha/lsp.lua create mode 100644 lua/alpha/plugins.lua delete mode 100644 lua/alpha/status-line.lua delete mode 100644 lua/alpha/treesitter.lua delete mode 100644 lua/plugins.lua (limited to 'lua') diff --git a/lua/alpha/colors.lua b/lua/alpha/colors.lua deleted file mode 100644 index d6d0d18..0000000 --- a/lua/alpha/colors.lua +++ /dev/null @@ -1,16 +0,0 @@ -local Color, colors, Group, groups, styles = require('colorbuddy').setup() - --- Use Color.new(, <#rrggbb>) to create new colors --- They can be accessed through colors. -Color.new('background', '#282c34') -Color.new('red', '#cc6666') -Color.new('green', '#99cc99') -Color.new('yellow', '#f0c674') - --- Define highlights in terms of `colors` and `groups` -Group.new('Comment' , colors.yellow , colors.background , styles.bold) -Group.new('Special' , groups.Comment , groups.Comment , groups.Comment) -Group.new('NonText' , groups.Comment , groups.Comment , groups.Comment) - --- Define highlights in relative terms of other colors -Group.new('Error' , colors.red:light() , nil , styles.bold) diff --git a/lua/alpha/completition.lua b/lua/alpha/completition.lua deleted file mode 100644 index 7140ca5..0000000 --- a/lua/alpha/completition.lua +++ /dev/null @@ -1,96 +0,0 @@ -local lspkind = require "lspkind" - -local luasnip = require("luasnip") -local cmp = require "cmp" -local cmp_autopairs = require('nvim-autopairs.completion.cmp') -cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } })) - -cmp.setup { - mapping = { - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = 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" }), - [""] = 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" }), - [""] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Insert, - select = true, - }, - [""] = cmp.mapping.complete(), - }, - sources = { - { name = "nvim_lua" }, - { name = "nvim_lsp" }, - { name = "path" }, - { name = "luasnip" }, - { - name = "buffer", - keyword_length = 5, - 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]", - } - } - }, - - experimental = { - native_menu = false, - - ghost_text = true, - } -} --- Setup lspconfig. - local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) - -- Replace with each lsp server you've enabled. - require('lspconfig')['emmet_ls'].setup { - capabilities = capabilities - } - -local Group = require("colorbuddy.group").Group -local g = require("colorbuddy.group").groups -local s = require("colorbuddy.style").styles - -Group.new("CmpItemAbbr", g.Comment) -Group.new("CmpItemAbbrDeprecated", g.Error) -Group.new("CmpItemAbbrMatchFuzzy", g.CmpItemAbbr.fg:dark(), nil, s.italic) -Group.new("CmpItemKind", g.Special) -Group.new("CmpItemMenu", g.NonText) diff --git a/lua/alpha/dap.lua b/lua/alpha/dap.lua index fdd2150..bd1a403 100644 --- a/lua/alpha/dap.lua +++ b/lua/alpha/dap.lua @@ -13,7 +13,7 @@ dap_install.config("php", { port = 9003, pathMappings = function () local sail = vim.call('composer#query', 'require-dev.laravel/sail') - if sail == nil then + if sail == "" then return {['/app'] = vim.fn.getcwd()} end return {['/var/www/html'] = vim.fn.getcwd()} diff --git a/lua/alpha/disable_builtin.lua b/lua/alpha/disable_builtin.lua new file mode 100644 index 0000000..6177c82 --- /dev/null +++ b/lua/alpha/disable_builtin.lua @@ -0,0 +1,20 @@ +vim.g.loaded_gzip = 1 +vim.g.loaded_zip = 1 +vim.g.loaded_zipPlugin = 1 +vim.g.loaded_tar = 1 +vim.g.loaded_tarPlugin = 1 + +vim.g.loaded_getscript = 1 +vim.g.loaded_getscriptPlugin = 1 +vim.g.loaded_vimball = 1 +vim.g.loaded_vimballPlugin = 1 +vim.g.loaded_2html_plugin = 1 + +vim.g.loaded_matchit = 1 +vim.g.loaded_matchparen = 1 +vim.g.loaded_logiPat = 1 +vim.g.loaded_rrhelper = 1 + +-- vim.g.loaded_netrw = 1 +-- vim.g.loaded_netrwPlugin = 1 +-- vim.g.loaded_netrwSettings = 1 diff --git a/lua/alpha/first_load.lua b/lua/alpha/first_load.lua new file mode 100644 index 0000000..9ef6658 --- /dev/null +++ b/lua/alpha/first_load.lua @@ -0,0 +1,27 @@ +local download_packer = function() + if vim.fn.input "Download Packer? (y for yes)" ~= "y" then + return + end + + local directory = string.format("%s/site/pack/packer/start/", vim.fn.stdpath "data") + + vim.fn.mkdir(directory, "p") + + local out = vim.fn.system( + string.format("git clone %s %s", "https://github.com/wbthomason/packer.nvim", directory .. "/packer.nvim") + ) + + print(out) + print "Downloading packer.nvim..." + print "( You'll need to restart now )" +end + +return function() + if not pcall(require, "packer") then + download_packer() + + return true + end + + return false +end diff --git a/lua/alpha/global.lua b/lua/alpha/global.lua deleted file mode 100644 index 5fcee70..0000000 --- a/lua/alpha/global.lua +++ /dev/null @@ -1,13 +0,0 @@ -P = function (v) - print(vim.inspect(v)) - return v -end - -RELOAD = function (...) - return require("plenary.reload").reload_module(...) -end - -R = function (name) - RELOAD(name) - return require(name) -end diff --git a/lua/alpha/globals.lua b/lua/alpha/globals.lua new file mode 100644 index 0000000..5fcee70 --- /dev/null +++ b/lua/alpha/globals.lua @@ -0,0 +1,13 @@ +P = function (v) + print(vim.inspect(v)) + return v +end + +RELOAD = function (...) + return require("plenary.reload").reload_module(...) +end + +R = function (name) + RELOAD(name) + return require(name) +end diff --git a/lua/alpha/harpoon.lua b/lua/alpha/harpoon.lua deleted file mode 100644 index c4fa9df..0000000 --- a/lua/alpha/harpoon.lua +++ /dev/null @@ -1,7 +0,0 @@ -vim.api.nvim_set_keymap("n", "ss", [[ lua require("harpoon.ui").toggle_quick_menu()]], {noremap = true, silent = true, expr = false}) - -vim.api.nvim_set_keymap("n", "sa", [[ lua require("harpoon.mark").add_file()]], {noremap = true, silent = true, expr = false}) -vim.api.nvim_set_keymap("n", "su", [[ lua require("harpoon.ui").nav_file(1)]], {noremap = true, silent = true, expr = false}) -vim.api.nvim_set_keymap("n", "si", [[ lua require("harpoon.ui").nav_file(2)]], {noremap = true, silent = true, expr = false}) -vim.api.nvim_set_keymap("n", "so", [[ lua require("harpoon.ui").nav_file(3)]], {noremap = true, silent = true, expr = false}) -vim.api.nvim_set_keymap("n", "sp", [[ lua require("harpoon.ui").nav_file(4)]], {noremap = true, silent = true, expr = false}) diff --git a/lua/alpha/init.lua b/lua/alpha/init.lua index cd38f36..0b14730 100644 --- a/lua/alpha/init.lua +++ b/lua/alpha/init.lua @@ -14,6 +14,4 @@ require("alpha.dap") vim.api.nvim_set_keymap('n', 'rs', ':lua require(\'alpha.refactor\').setter_getter()', {noremap = true}) vim.api.nvim_set_keymap('n', 'rn', ':lua require(\'alpha.refactor\').new_property()', {noremap = true}) -vim.api.nvim_set_keymap('n', 'x', ':call alpha#save_and_exec()', {noremap = true}) - vim.api.nvim_set_keymap('n', 'm', ':MaximizerToggle', {noremap = true}) diff --git a/lua/alpha/lsp.lua b/lua/alpha/lsp.lua deleted file mode 100644 index 40a56d6..0000000 --- a/lua/alpha/lsp.lua +++ /dev/null @@ -1,43 +0,0 @@ -local function on_attach() - -- keymaps for lsp - vim.api.nvim_set_keymap('n', 'K', ':lua vim.lsp.buf.hover()', {noremap = true}) - vim.api.nvim_set_keymap('n', 'vd', ':lua vim.lsp.buf.definition()', {noremap = true}) - - - vim.api.nvim_set_keymap('n', 'vo', ':LspRestart', {noremap = true}) - - -- diagnostics to move between info and errors - vim.api.nvim_set_keymap('n', 'vn', ':lua vim.lsp.diagnostic.goto_next()', {noremap = true}) - vim.api.nvim_set_keymap('n', 'vp', ':lua vim.lsp.diagnostic.goto_prev()', {noremap = true}) - - - vim.api.nvim_set_keymap('n', 'vca', ':lua vim.lsp.buf.code_action()', {noremap = true}) - vim.api.nvim_set_keymap('n', 'vf', ':lua vim.lsp.buf.formatting()', {noremap = true}) - - vim.api.nvim_set_keymap('n', 'vi', ':lua vim.lsp.buf.implementation()', {noremap = true}) - vim.api.nvim_set_keymap('n', 'vrn', ':lua vim.lsp.buf.rename()', {noremap = true}) - - require "lsp_signature".on_attach() - - vim.cmd [[au Filetype php setl omnifunc=v:lua.vim.lsp.omnifunc]] - vim.cmd [[autocmd FileType go setlocal omnifunc=v:lua.vim.lsp.omnifunc]] - - vim.g.completion_matching_strategy_list = { 'exact', 'substring', 'fuzzy' } - -end - -local lsp_installer = require("nvim-lsp-installer") - -lsp_installer.on_server_ready(function(server) - local opts = {} - - -- (optional) Customize the options passed to the server - if server.name == "emmet_ls" then - opts.filetypes = {"html", "css", "blade"} - end - - opts.on_attach = on_attach - -- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart) - server:setup(opts) - vim.cmd [[ do User LspAttachBuffers ]] -end) diff --git a/lua/alpha/plugins.lua b/lua/alpha/plugins.lua new file mode 100644 index 0000000..d427aca --- /dev/null +++ b/lua/alpha/plugins.lua @@ -0,0 +1,139 @@ +vim.cmd [[packadd packer.nvim]] +vim.cmd([[autocmd BufWritePost plugins.lua source | PackerCompile]]) + +return require('packer').startup(function(use) + use 'wbthomason/packer.nvim' + use "lewis6991/impatient.nvim" + + use { + 'ThePrimeagen/refactoring.nvim', + requires = { + {'nvim-lua/plenary.nvim'}, + {'nvim-treesitter/nvim-treesitter'} + } + } + + use { + 'nvim-treesitter/nvim-treesitter', + run = ':TSUpdate', + requires = { + 'nvim-treesitter/playground', + 'nvim-treesitter/nvim-treesitter-refactor', + 'nvim-treesitter/nvim-treesitter-textobjects', + } + } + + use { + 'ThePrimeagen/harpoon', + requires = { + 'nvim-lua/plenary.nvim', + 'nvim-lua/popup.nvim', + }, + } + + use 'tpope/vim-dispatch' + + -- Completition + use { + "hrsh7th/nvim-cmp", + requires = { + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-nvim-lua", + "hrsh7th/cmp-nvim-lsp", + "saadparwaiz1/cmp_luasnip", + "onsails/lspkind-nvim", + "L3MON4D3/LuaSnip", + } + } + + use "windwp/nvim-autopairs" + + use "tjdevries/colorbuddy.nvim" + + use { + 'neovim/nvim-lspconfig', + 'williamboman/nvim-lsp-installer', + 'hrsh7th/cmp-nvim-lsp-signature-help', + 'ray-x/lsp_signature.nvim' + } + + use { + 'nvim-telescope/telescope.nvim', + requires = { + { 'nvim-lua/plenary.nvim'}, + { 'nvim-lua/popup.nvim' }, + { 'nvim-telescope/telescope-fzy-native.nvim' }, + { 'kyazdani42/nvim-web-devicons' }, + { 'nvim-telescope/telescope-file-browser.nvim' } + } + } + + use { + 'nvim-lualine/lualine.nvim', + requires = {'kyazdani42/nvim-web-devicons', opt = true} + } + + use { + 'leoluz/nvim-dap-go', + requires = { + 'rcarriga/nvim-dap-ui', + 'mfussenegger/nvim-dap', + "Pocco81/DAPInstall.nvim", + 'leoluz/nvim-dap-go', + } + } + + use 'szw/vim-maximizer' + + use 'vim-test/vim-test' + + use 'fatih/vim-go' + + use { + 'noahfrederick/vim-laravel', + requires = { + { 'tpope/vim-projectionist' }, + { 'noahfrederick/vim-composer' } + } + } + + use 'jwalton512/vim-blade' + + use 'dracula/vim' + + use 'Raimondi/delimitMate' + use 'tpope/vim-surround' + use 'tpope/vim-dotenv' + use 'tpope/vim-fugitive' + use 'tpope/vim-repeat' + use 'tpope/vim-obsession' + use 'tpope/vim-vinegar' + use 'tpope/vim-eunuch' + use 'tpope/vim-commentary' + + use { + 'lewis6991/gitsigns.nvim', + requires = { + 'nvim-lua/plenary.nvim' + }, + config = function() + require('gitsigns').setup() + end + } + + use 'tpope/vim-tbone' + + use { + 'tpope/vim-dadbod', + requires = { + 'kristijanhusak/vim-dadbod-ui', + } + } + + use { 'nicwest/vim-http', opt = true, cmd = {'Http'}} + use { 'vimwiki/vimwiki', opt = true, cmd = {'VimwikiIndex'}} + + -- Local plugins can be included + use '~/code/neovim/telescope-projectionist.nvim' +end) diff --git a/lua/alpha/status-line.lua b/lua/alpha/status-line.lua deleted file mode 100644 index e504b2d..0000000 --- a/lua/alpha/status-line.lua +++ /dev/null @@ -1,31 +0,0 @@ -require('lualine').setup{ - options = { - theme = 'dracula', - icons_enabled = true, - }, - extensions = {'quickfix', 'fugitive'}, - sections = { - lualine_a = { { 'mode', upper = true } }, - lualine_b = { { 'branch', icon = '' }, 'diff' }, - lualine_c = { { 'filename', file_status = true, path = 1 } }, - lualine_x = { { 'diagnostics', sources = { 'nvim_diagnostic' } },'encoding', 'fileformat', 'filetype' }, - lualine_y = { 'progress' }, - lualine_z = { 'location' }, - }, - inactive_sections = { - lualine_a = { }, - lualine_b = { }, - lualine_c = { 'filename' }, - lualine_x = { 'location' }, - lualine_y = { }, - lualine_z = { }, - }, - -- tabline = { - -- lualine_a = {'buffers'}, - -- lualine_b = {}, - -- lualine_c = {}, - -- lualine_x = {}, - -- lualine_y = {}, - -- lualine_z = {'tabs'} - -- } - } diff --git a/lua/alpha/treesitter.lua b/lua/alpha/treesitter.lua deleted file mode 100644 index 14b1295..0000000 --- a/lua/alpha/treesitter.lua +++ /dev/null @@ -1,60 +0,0 @@ -require "nvim-treesitter.configs".setup { - ensure_installed = {"php", "go", "comment", "css", "html", "javascript", "lua", "typescript"}, - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, - indent = { - enable = true, - }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "gnn", - node_incremental = "grn", - scope_incremental = "grc", - node_decremental = "grm", - }, - }, - refactor = { - highlight_definitions = { enable = true }, - smart_rename = { - enable = true, - keymaps = { - smart_rename = "grr", - }, - }, - }, - textobjects = { - select = { - enable = true, - lookahead = true, - keymaps = { - ["af"] = "@function.outer", - ["if"] = "@function.inner", - ["ac"] = "@conditional.outer", - ["ic"] = "@conditional.inner", - ["al"] = "@loop.outer", - ["il"] = "@loop.inner", - } - } - }, - playground = { - enable = true, - disable = {}, - updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code - persist_queries = false, -- Whether the query persists across vim sessions - keybindings = { - toggle_query_editor = 'o', - toggle_hl_groups = 'i', - toggle_injected_languages = 't', - toggle_anonymous_nodes = 'a', - toggle_language_display = 'I', - focus_language = 'f', - unfocus_language = 'F', - update = 'R', - goto_node = '', - show_help = '?', - }, - } -} diff --git a/lua/plugins.lua b/lua/plugins.lua deleted file mode 100644 index 31a3aad..0000000 --- a/lua/plugins.lua +++ /dev/null @@ -1,138 +0,0 @@ -vim.cmd [[packadd packer.nvim]] -vim.cmd([[autocmd BufWritePost plugins.lua source | PackerCompile]]) - -return require('packer').startup(function(use) - use {'wbthomason/packer.nvim', opt = true} - - use { - 'ThePrimeagen/refactoring.nvim', - requires = { - {'nvim-lua/plenary.nvim'}, - {'nvim-treesitter/nvim-treesitter'} - } - } - - use { - 'nvim-treesitter/nvim-treesitter', - run = ':TSUpdate', - requires = { - 'nvim-treesitter/playground', - 'nvim-treesitter/nvim-treesitter-refactor', - 'nvim-treesitter/nvim-treesitter-textobjects', - } - } - - use { - 'ThePrimeagen/harpoon', - requires = { - 'nvim-lua/plenary.nvim', - 'nvim-lua/popup.nvim', - }, - } - - use 'tpope/vim-dispatch' - - -- Completition - use { - "hrsh7th/nvim-cmp", - requires = { - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-nvim-lua", - "hrsh7th/cmp-nvim-lsp", - "saadparwaiz1/cmp_luasnip", - "onsails/lspkind-nvim", - "L3MON4D3/LuaSnip", - } - } - - use "windwp/nvim-autopairs" - - use "tjdevries/colorbuddy.nvim" - - use { - 'neovim/nvim-lspconfig', - 'williamboman/nvim-lsp-installer', - 'hrsh7th/cmp-nvim-lsp-signature-help', - 'ray-x/lsp_signature.nvim' - } - - use { - 'nvim-telescope/telescope.nvim', - requires = { - { 'nvim-lua/plenary.nvim'}, - { 'nvim-lua/popup.nvim' }, - { 'nvim-telescope/telescope-fzy-native.nvim' }, - { 'kyazdani42/nvim-web-devicons' }, - { 'nvim-telescope/telescope-file-browser.nvim' } - } - } - - use { - 'nvim-lualine/lualine.nvim', - requires = {'kyazdani42/nvim-web-devicons', opt = true} - } - - use { - 'leoluz/nvim-dap-go', - requires = { - 'rcarriga/nvim-dap-ui', - 'mfussenegger/nvim-dap', - "Pocco81/DAPInstall.nvim", - 'leoluz/nvim-dap-go', - } - } - - use 'szw/vim-maximizer' - - use 'vim-test/vim-test' - - use 'fatih/vim-go' - - use { - 'noahfrederick/vim-laravel', - requires = { - { 'tpope/vim-projectionist' }, - { 'noahfrederick/vim-composer' } - } - } - - use 'jwalton512/vim-blade' - - use 'dracula/vim' - - use 'Raimondi/delimitMate' - use 'tpope/vim-surround' - use 'tpope/vim-dotenv' - use 'tpope/vim-fugitive' - use 'tpope/vim-repeat' - use 'tpope/vim-obsession' - use 'tpope/vim-vinegar' - use 'tpope/vim-eunuch' - use 'tpope/vim-commentary' - - use { - 'lewis6991/gitsigns.nvim', - requires = { - 'nvim-lua/plenary.nvim' - }, - config = function() - require('gitsigns').setup() - end - } - - use 'tpope/vim-tbone' - - use { - 'tpope/vim-dadbod', - requires = { - 'kristijanhusak/vim-dadbod-ui', - } - } - - use { 'nicwest/vim-http', opt = true, cmd = {'Http'}} - use { 'vimwiki/vimwiki', opt = true, cmd = {'VimwikiIndex'}} - - -- Local plugins can be included - use '~/code/neovim/telescope-projectionist.nvim' -end) -- cgit v1.2.3