New nvim config, not finished

This commit is contained in:
afonsofrancof 2022-10-19 00:47:07 +01:00
parent 58a0da692e
commit 671fbe40e1
15 changed files with 398 additions and 49 deletions

28
.config/nvim/init.lua Normal file
View file

@ -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"

View file

@ -1,5 +0,0 @@
local M = {}
M.plugins = require("custom.plugins")
return M

View file

@ -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"

View file

@ -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
}
}

View file

@ -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,
}

View file

@ -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{}

View file

@ -0,0 +1,2 @@
local present, luasnip = pcall(require, "luasnip")
require("luasnip.loaders.from_vscode").lazy_load()

View file

@ -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 = "<CR>",
install_server = "i",
update_server = "u",
check_server_version = "c",
update_all_servers = "U",
check_outdated_servers = "C",
uninstall_server = "X",
cancel_installation = "<C-c>",
},
},
max_concurrent_installers = 10,
}
mason.setup(options)

View file

@ -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 = "",
},
}
})

View file

@ -0,0 +1,6 @@
local colorscheme = "onedark"
local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
if not status_ok then
return
end

View file

@ -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)

View file

@ -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