From 671fbe40e1979e129368aefea9b2987fdf337a53 Mon Sep 17 00:00:00 2001 From: afonsofrancof Date: Wed, 19 Oct 2022 00:47:07 +0100 Subject: [PATCH] New nvim config, not finished --- .config/nvim/init.lua | 28 +++ .config/nvim/lua/custom/chadrc.lua | 5 - .config/nvim/lua/custom/init.lua | 5 - .config/nvim/lua/custom/plugins/init.lua | 27 --- .config/nvim/lua/custom/plugins/lspconfig.lua | 12 -- .config/nvim/lua/plugins/lspconfig.lua | 19 ++ .config/nvim/lua/plugins/luasnip.lua | 2 + .../luasnippets/languages/latex.json | 0 .../luasnippets/package.json | 0 .config/nvim/lua/plugins/mason.lua | 31 +++ .config/nvim/lua/plugins/packer.lua | 85 ++++++++ .config/nvim/lua/plugins/theme.lua | 6 + .config/nvim/lua/plugins/treesitter.lua | 23 ++ .../nvim/lua/{custom => }/plugins/vimtex.lua | 0 .config/nvim/plugin/packer_compiled.lua | 204 ++++++++++++++++++ 15 files changed, 398 insertions(+), 49 deletions(-) create mode 100644 .config/nvim/init.lua delete mode 100644 .config/nvim/lua/custom/chadrc.lua delete mode 100644 .config/nvim/lua/custom/init.lua delete mode 100644 .config/nvim/lua/custom/plugins/init.lua delete mode 100644 .config/nvim/lua/custom/plugins/lspconfig.lua create mode 100644 .config/nvim/lua/plugins/lspconfig.lua create mode 100644 .config/nvim/lua/plugins/luasnip.lua rename .config/nvim/lua/{custom => plugins}/luasnippets/languages/latex.json (100%) rename .config/nvim/lua/{custom => plugins}/luasnippets/package.json (100%) create mode 100644 .config/nvim/lua/plugins/mason.lua create mode 100644 .config/nvim/lua/plugins/packer.lua create mode 100644 .config/nvim/lua/plugins/theme.lua create mode 100644 .config/nvim/lua/plugins/treesitter.lua rename .config/nvim/lua/{custom => }/plugins/vimtex.lua (100%) create mode 100644 .config/nvim/plugin/packer_compiled.lua diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..61dae3c --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,28 @@ + + +local install_path = vim.fn.stdpath("data").."/site/pack/packer/start/packer.nvim" +if vim.fn.empty(vim.fn.glob(install_path)) > 0 then + print("Downloading Packer ...") + vim.fn.system({"git", "clone", "https://github.com/wbthomason/packer.nvim", install_path}) + vim.api.nvim_command("packadd packer.nvim") + require("plugins.packer") + require("packer").sync() +end + +require('impatient') +require('plugins.theme') + +Config = { + theme="onedark", + statusline = { + minimal = false + } +} + +-- Theme + +vim.wo.number=true +vim.wo.relativenumber= true +vim.g.luasnippets_path = "~/.config/nvim/lua/plugins/configs/luasnippets" + + diff --git a/.config/nvim/lua/custom/chadrc.lua b/.config/nvim/lua/custom/chadrc.lua deleted file mode 100644 index 3b604b7..0000000 --- a/.config/nvim/lua/custom/chadrc.lua +++ /dev/null @@ -1,5 +0,0 @@ -local M = {} - -M.plugins = require("custom.plugins") - -return M diff --git a/.config/nvim/lua/custom/init.lua b/.config/nvim/lua/custom/init.lua deleted file mode 100644 index 49a65ff..0000000 --- a/.config/nvim/lua/custom/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -local autocmd = vim.api.nvim_create_autocmd - -vim.wo.number=true -vim.wo.relativenumber= true -vim.g.luasnippets_path = "~/.config/nvim/lua/custom/luasnippets" diff --git a/.config/nvim/lua/custom/plugins/init.lua b/.config/nvim/lua/custom/plugins/init.lua deleted file mode 100644 index 41218a1..0000000 --- a/.config/nvim/lua/custom/plugins/init.lua +++ /dev/null @@ -1,27 +0,0 @@ -return { - ["lervag/vimtex"]= { - config = function () - require "custom.plugins.vimtex" - end - }, - - ["L3MON4D3/LuaSnip"] = { - config = function() - require("plugins.configs.others").luasnip() - require("luasnip.loaders.from_vscode").lazy_load({ paths = vim.g.luasnippets_path }) - end - }, - ["ggandor/leap.nvim"] = { - config = function () - require('leap').add_default_mappings() - end - }, - ["neovim/nvim-lspconfig"] = { - config = function () - require("core.lazy_load").on_file_open "nvim-lspconfig" - require "plugins.configs.lspconfig" - require "custom.plugins.lspconfig" - end - } - -} diff --git a/.config/nvim/lua/custom/plugins/lspconfig.lua b/.config/nvim/lua/custom/plugins/lspconfig.lua deleted file mode 100644 index a4c6b37..0000000 --- a/.config/nvim/lua/custom/plugins/lspconfig.lua +++ /dev/null @@ -1,12 +0,0 @@ -local present, lspconfig = pcall(require,"lspconfig") - - -lspconfig.hls.setup{ - on_attach = on_attach, - capabilities = capabilities, -} - -lspconfig.rust_analyzer.setup{ - on_attach = on_attach, - capabilities = capabilities, -} diff --git a/.config/nvim/lua/plugins/lspconfig.lua b/.config/nvim/lua/plugins/lspconfig.lua new file mode 100644 index 0000000..8bd69d4 --- /dev/null +++ b/.config/nvim/lua/plugins/lspconfig.lua @@ -0,0 +1,19 @@ +local present, lspconfig = pcall(require,"lspconfig") + +on_attach = function(client, bufnr) + client.server_capabilities.documentFormattingProvider = false + client.server_capabilities.documentRangeFormattingProvider = false + + utils.load_mappings("lspconfig", { buffer = bufnr }) + +end + +capabilities = vim.lsp.protocol.make_client_capabilities() + + +lspconfig.hls.setup{ +on_attach = on_attach, +capabilities = capabilities +} + +lspconfig.rust_analyzer.setup{} diff --git a/.config/nvim/lua/plugins/luasnip.lua b/.config/nvim/lua/plugins/luasnip.lua new file mode 100644 index 0000000..2f599b7 --- /dev/null +++ b/.config/nvim/lua/plugins/luasnip.lua @@ -0,0 +1,2 @@ +local present, luasnip = pcall(require, "luasnip") +require("luasnip.loaders.from_vscode").lazy_load() diff --git a/.config/nvim/lua/custom/luasnippets/languages/latex.json b/.config/nvim/lua/plugins/luasnippets/languages/latex.json similarity index 100% rename from .config/nvim/lua/custom/luasnippets/languages/latex.json rename to .config/nvim/lua/plugins/luasnippets/languages/latex.json diff --git a/.config/nvim/lua/custom/luasnippets/package.json b/.config/nvim/lua/plugins/luasnippets/package.json similarity index 100% rename from .config/nvim/lua/custom/luasnippets/package.json rename to .config/nvim/lua/plugins/luasnippets/package.json diff --git a/.config/nvim/lua/plugins/mason.lua b/.config/nvim/lua/plugins/mason.lua new file mode 100644 index 0000000..09400ec --- /dev/null +++ b/.config/nvim/lua/plugins/mason.lua @@ -0,0 +1,31 @@ +local present, mason = pcall(require, "mason") + +vim.api.nvim_create_augroup("_mason", { clear = true }) + +local options = { + PATH = "skip", + + ui = { + icons = { + package_pending = " ", + package_installed = " ", + package_uninstalled = " ﮊ", + }, + + keymaps = { + toggle_server_expand = "", + install_server = "i", + update_server = "u", + check_server_version = "c", + update_all_servers = "U", + check_outdated_servers = "C", + uninstall_server = "X", + cancel_installation = "", + }, + }, + + max_concurrent_installers = 10, +} + + +mason.setup(options) diff --git a/.config/nvim/lua/plugins/packer.lua b/.config/nvim/lua/plugins/packer.lua new file mode 100644 index 0000000..0a1d197 --- /dev/null +++ b/.config/nvim/lua/plugins/packer.lua @@ -0,0 +1,85 @@ + +local packer = require("packer") + +local plugins = packer.startup({function(use) + + use { + "wbthomason/packer.nvim", + config = [[require("plugins.packer")]] + } + + use{ "lewis6991/impatient.nvim"} + + + use{ "lervag/vimtex", + config = function () + require "plugins.vimtex" + end + } + + use{ "L3MON4D3/LuaSnip", + config = function() + require "plugins.luasnip" + end + } + + use { "ggandor/leap.nvim", + config = function () + require('leap').add_default_mappings() + end + } + + use { "neovim/nvim-lspconfig", + config = function () + require "plugins.lspconfig" + end + } + + use { "williamboman/mason.nvim", + config = function () + require "plugins.mason" + end + } + + use { "feline-nvim/feline.nvim" } + + use {"joshdick/onedark.vim" } + + use {"nvim-tree/nvim-tree.lua", + requires = { + 'nvim-tree/nvim-web-devicons', + }, + config = function() + require("nvim-tree").setup() + end + } + + use {"nvim-treesitter/nvim-treesitter", + config = function() + require "plugins.treesitter" + end + } + + use {'akinsho/bufferline.nvim', + tag = "v3.*", + requires = 'kyazdani42/nvim-web-devicons', + config = function () + require("bufferline").setup{} + end + } + + end, + + config = { + auto_clean = true, + compile_on_sync = true, + git = { clone_timeout = 6000 }, + display = { + working_sym = "ﲊ", + error_sym = "✗ ", + done_sym = " ", + removed_sym = " ", + moved_sym = "", + }, + } +}) diff --git a/.config/nvim/lua/plugins/theme.lua b/.config/nvim/lua/plugins/theme.lua new file mode 100644 index 0000000..1c7b190 --- /dev/null +++ b/.config/nvim/lua/plugins/theme.lua @@ -0,0 +1,6 @@ +local colorscheme = "onedark" + +local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) +if not status_ok then + return +end diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..1ba7dad --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,23 @@ +local present, treesitter = pcall(require, "nvim-treesitter.configs") + +require('nvim-treesitter.install').update({ with_sync = true }) + + +if not present then + return +end + +local options = { + ensure_installed = {"lua", "haskell", "rust", }, + + highlight = { + enable = true, + use_languagetree = true, + }, + + indent = { + enable = true, + }, +} + +treesitter.setup(options) diff --git a/.config/nvim/lua/custom/plugins/vimtex.lua b/.config/nvim/lua/plugins/vimtex.lua similarity index 100% rename from .config/nvim/lua/custom/plugins/vimtex.lua rename to .config/nvim/lua/plugins/vimtex.lua diff --git a/.config/nvim/plugin/packer_compiled.lua b/.config/nvim/plugin/packer_compiled.lua new file mode 100644 index 0000000..bd7745f --- /dev/null +++ b/.config/nvim/plugin/packer_compiled.lua @@ -0,0 +1,204 @@ +-- Automatically generated packer.nvim plugin loader code + +if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then + vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') + return +end + +vim.api.nvim_command('packadd packer.nvim') + +local no_errors, error_msg = pcall(function() + +_G._packer = _G._packer or {} +_G._packer.inside_compile = true + +local time +local profile_info +local should_profile = false +if should_profile then + local hrtime = vim.loop.hrtime + profile_info = {} + time = function(chunk, start) + if start then + profile_info[chunk] = hrtime() + else + profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 + end + end +else + time = function(chunk, start) end +end + +local function save_profiles(threshold) + local sorted_times = {} + for chunk_name, time_taken in pairs(profile_info) do + sorted_times[#sorted_times + 1] = {chunk_name, time_taken} + end + table.sort(sorted_times, function(a, b) return a[2] > b[2] end) + local results = {} + for i, elem in ipairs(sorted_times) do + if not threshold or threshold and elem[2] > threshold then + results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' + end + end + if threshold then + table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)') + end + + _G._packer.profile_output = results +end + +time([[Luarocks path setup]], true) +local package_path_str = "/home/afonso/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/afonso/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/afonso/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/afonso/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" +local install_cpath_pattern = "/home/afonso/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" +if not string.find(package.path, package_path_str, 1, true) then + package.path = package.path .. ';' .. package_path_str +end + +if not string.find(package.cpath, install_cpath_pattern, 1, true) then + package.cpath = package.cpath .. ';' .. install_cpath_pattern +end + +time([[Luarocks path setup]], false) +time([[try_loadstring definition]], true) +local function try_loadstring(s, component, name) + local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) + if not success then + vim.schedule(function() + vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) + end) + end + return result +end + +time([[try_loadstring definition]], false) +time([[Defining packer_plugins]], true) +_G.packer_plugins = { + LuaSnip = { + config = { "\27LJ\2\n/\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\20plugins.luasnip\frequire\0" }, + loaded = true, + path = "/home/afonso/.local/share/nvim/site/pack/packer/start/LuaSnip", + url = "https://github.com/L3MON4D3/LuaSnip" + }, + ["bufferline.nvim"] = { + config = { "\27LJ\2\n<\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\15bufferline\frequire\0" }, + loaded = true, + path = "/home/afonso/.local/share/nvim/site/pack/packer/start/bufferline.nvim", + url = "https://github.com/akinsho/bufferline.nvim" + }, + ["feline.nvim"] = { + loaded = true, + path = "/home/afonso/.local/share/nvim/site/pack/packer/start/feline.nvim", + url = "https://github.com/feline-nvim/feline.nvim" + }, + ["impatient.nvim"] = { + loaded = true, + path = "/home/afonso/.local/share/nvim/site/pack/packer/start/impatient.nvim", + url = "https://github.com/lewis6991/impatient.nvim" + }, + ["leap.nvim"] = { + config = { "\27LJ\2\nA\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\25add_default_mappings\tleap\frequire\0" }, + loaded = true, + path = "/home/afonso/.local/share/nvim/site/pack/packer/start/leap.nvim", + url = "https://github.com/ggandor/leap.nvim" + }, + ["mason.nvim"] = { + config = { "\27LJ\2\n-\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\18plugins.mason\frequire\0" }, + loaded = true, + path = "/home/afonso/.local/share/nvim/site/pack/packer/start/mason.nvim", + url = "https://github.com/williamboman/mason.nvim" + }, + ["nvim-lspconfig"] = { + config = { "\27LJ\2\n1\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\22plugins.lspconfig\frequire\0" }, + loaded = true, + path = "/home/afonso/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", + url = "https://github.com/neovim/nvim-lspconfig" + }, + ["nvim-tree.lua"] = { + config = { "\27LJ\2\n7\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\14nvim-tree\frequire\0" }, + loaded = true, + path = "/home/afonso/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", + url = "https://github.com/nvim-tree/nvim-tree.lua" + }, + ["nvim-treesitter"] = { + config = { "\27LJ\2\n2\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\23plugins.treesitter\frequire\0" }, + loaded = true, + path = "/home/afonso/.local/share/nvim/site/pack/packer/start/nvim-treesitter", + url = "https://github.com/nvim-treesitter/nvim-treesitter" + }, + ["nvim-web-devicons"] = { + loaded = true, + path = "/home/afonso/.local/share/nvim/site/pack/packer/start/nvim-web-devicons", + url = "https://github.com/nvim-tree/nvim-web-devicons" + }, + ["onedark.vim"] = { + loaded = true, + path = "/home/afonso/.local/share/nvim/site/pack/packer/start/onedark.vim", + url = "https://github.com/joshdick/onedark.vim" + }, + ["packer.nvim"] = { + config = { 'require("plugins.packer")' }, + loaded = true, + path = "/home/afonso/.local/share/nvim/site/pack/packer/start/packer.nvim", + url = "https://github.com/wbthomason/packer.nvim" + }, + vimtex = { + config = { "\27LJ\2\n.\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\19plugins.vimtex\frequire\0" }, + loaded = true, + path = "/home/afonso/.local/share/nvim/site/pack/packer/start/vimtex", + url = "https://github.com/lervag/vimtex" + } +} + +time([[Defining packer_plugins]], false) +-- Config for: nvim-tree.lua +time([[Config for nvim-tree.lua]], true) +try_loadstring("\27LJ\2\n7\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\14nvim-tree\frequire\0", "config", "nvim-tree.lua") +time([[Config for nvim-tree.lua]], false) +-- Config for: nvim-lspconfig +time([[Config for nvim-lspconfig]], true) +try_loadstring("\27LJ\2\n1\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\22plugins.lspconfig\frequire\0", "config", "nvim-lspconfig") +time([[Config for nvim-lspconfig]], false) +-- Config for: mason.nvim +time([[Config for mason.nvim]], true) +try_loadstring("\27LJ\2\n-\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\18plugins.mason\frequire\0", "config", "mason.nvim") +time([[Config for mason.nvim]], false) +-- Config for: packer.nvim +time([[Config for packer.nvim]], true) +require("plugins.packer") +time([[Config for packer.nvim]], false) +-- Config for: leap.nvim +time([[Config for leap.nvim]], true) +try_loadstring("\27LJ\2\nA\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\25add_default_mappings\tleap\frequire\0", "config", "leap.nvim") +time([[Config for leap.nvim]], false) +-- Config for: LuaSnip +time([[Config for LuaSnip]], true) +try_loadstring("\27LJ\2\n/\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\20plugins.luasnip\frequire\0", "config", "LuaSnip") +time([[Config for LuaSnip]], false) +-- Config for: bufferline.nvim +time([[Config for bufferline.nvim]], true) +try_loadstring("\27LJ\2\n<\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\15bufferline\frequire\0", "config", "bufferline.nvim") +time([[Config for bufferline.nvim]], false) +-- Config for: nvim-treesitter +time([[Config for nvim-treesitter]], true) +try_loadstring("\27LJ\2\n2\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\23plugins.treesitter\frequire\0", "config", "nvim-treesitter") +time([[Config for nvim-treesitter]], false) +-- Config for: vimtex +time([[Config for vimtex]], true) +try_loadstring("\27LJ\2\n.\0\0\3\0\2\0\0046\0\0\0'\2\1\0B\0\2\1K\0\1\0\19plugins.vimtex\frequire\0", "config", "vimtex") +time([[Config for vimtex]], false) + +_G._packer.inside_compile = false +if _G._packer.needs_bufread == true then + vim.cmd("doautocmd BufRead") +end +_G._packer.needs_bufread = false + +if should_profile then save_profiles() end + +end) + +if not no_errors then + error_msg = error_msg:gsub('"', '\\"') + vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') +end