Add basic nvim conf, still wip

This commit is contained in:
Martin Larsson 2024-01-20 01:30:13 +01:00
parent d1c2ea53a5
commit 13549985ce
21 changed files with 480 additions and 0 deletions

View file

@ -0,0 +1,5 @@
return {
"windwp/nvim-autopairs",
event = "InsertEnter",
opts = {},
}

View file

@ -0,0 +1,9 @@
return {
"numToStr/Comment.nvim",
opts = {
mappings = {
extra = false,
},
},
lazy = false,
}

View file

@ -0,0 +1,3 @@
return {
"github/copilot.vim",
}

View file

@ -0,0 +1,3 @@
return {
"nvim-tree/nvim-web-devicons",
}

31
nvim/lua/plugs/leap.lua Normal file
View file

@ -0,0 +1,31 @@
return {
"ggandor/leap.nvim",
dependencies = {
"tpope/vim-repeat",
},
config = function()
require("leap").create_default_mappings()
-- Hide the (real) cursor when leaping, and restore it afterwards.
vim.api.nvim_create_autocmd(
"User",
{
pattern = "LeapEnter",
callback = function()
vim.cmd.hi("Cursor", "blend=100")
vim.opt.guicursor:append { "a:Cursor/lCursor" }
end,
}
)
vim.api.nvim_create_autocmd(
"User",
{
pattern = "LeapLeave",
callback = function()
vim.cmd.hi("Cursor", "blend=0")
vim.opt.guicursor:remove { "a:Cursor/lCursor" }
end,
}
)
end,
}

View file

@ -0,0 +1,9 @@
return {
"nvim-lualine/lualine.nvim",
dependencies = {
"nvim-tree/nvim-web-devicons"
},
opts = {
theme = "tokyonight-storm",
},
}

View file

@ -0,0 +1,35 @@
return {
"williamboman/mason.nvim",
dependencies = {
"williamboman/mason-lspconfig.nvim",
"neovim/nvim-lspconfig",
"WhoIsSethDaniel/mason-tool-installer.nvim",
"RubixDev/mason-update-all",
},
config = function()
-- Missing Rust because rust-analyzer is deprecated, and rustaceanvim is not included in mason yet, so it needs a custom setup.
-- Make sure that these are named according to lspconfig and not mason packages
local servers_names = {
"lua_ls",
}
require("mason").setup()
require("mason-lspconfig").setup()
require("mason-tool-installer").setup({
ensure_installed = servers_names,
})
require("mason-update-all").setup()
-- Iterate each server and setup
local lspconfig = require("lspconfig")
for _, server_name in ipairs(servers_names) do
local server = lspconfig[server_name]
if server then
server.setup(require("lua/language_servers/" .. server_name))
else
error("LSP server not found: " .. server_name)
end
end
end,
}

View file

@ -0,0 +1,3 @@
return {
"nvim-lua/plenary.nvim",
}

View file

@ -0,0 +1,3 @@
return {
"tpope/vim-repeat",
}

View file

@ -0,0 +1,8 @@
return {
"kylechui/nvim-surround",
version = "*",
event = "VeryLazy",
config = function()
require("nvim-surround").setup({})
end,
}

View file

@ -0,0 +1,45 @@
return {
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope-fzf-native.nvim",
},
config = function()
require("telescope").setup({ })
require("telescope").load_extension("fzf")
local keymaps = {
n = {
-- File search
["<leader>to"] = {
cmd = ":Telescope find_files <CR>",
},
["<leader>tf"] = {
cmd = ":Telescope current_buffer_fuzzy_find<CR>",
},
["<leader>ta"] = {
cmd = ":Telescope live_grep find_command=rg,--ignore-file,.gitignore,--exclude,*.git,--exclude,*.svn,--exclude,*.vs,--exclude,*.idea<CR>",
},
-- Git
["<leader>gc"] = {
cmd = "<cmd> Telescope git_commits <CR>",
},
["<leader>gs"] = {
cmd = "<cmd> Telescope git_status <CR>",
},
["<leader>gh"] = {
cmd = "<cmd> Telescope git_bcommits <CR>",
},
["<leader>gb"] = {
cmd = "<cmd> Telescope git_branches <CR>",
},
-- Misc
["<leader>tb"] = {
cmd = "<cmd> Telescope marks <CR>",
}
}
}
require("utils").add_keymaps(keymaps)
end,
}

View file

@ -0,0 +1,4 @@
return {
"nvim-telescope/telescope-fzf-native.nvim",
build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
}

View file

@ -0,0 +1,77 @@
return {
"folke/tokyonight.nvim",
lazy = false,
priority = 1000,
config = function()
require("tokyonight").setup({
style = "storm",
light_style = "day",
transparent = true,
terminal_colors = true,
styles = {
comments = {},
keywords = {},
functions = {},
variables = {},
sidebars = "dark",
floats = "dark"
},
sidebars = { "qf", "help" },
day_brightness = 0.3,
hide_inactive_statusline = false,
dim_inactive = false,
lualine_bold = true,
--- You can override specific color groups to use other groups or a hex color
--- function will be called with a ColorScheme table
---@param colors ColorScheme
on_colors = function(colors) end,
--- You can override specific highlights to use other groups or a hex color
--- function will be called with a Highlights and ColorScheme table
---@param highlights Highlights
---@param colors ColorScheme
on_highlights = function(highlights, colors)
local prompt = "#2d3149"
highlights.TelescopeNormal = {
bg = colors.bg_dark,
fg = colors.fg_dark,
}
highlights.TelescopeBorder = {
bg = colors.bg_dark,
fg = colors.bg_dark,
}
highlights.TelescopePromptNormal = {
bg = prompt,
}
highlights.TelescopePromptBorder = {
bg = prompt,
fg = prompt,
}
highlights.TelescopePromptTitle = {
bg = prompt,
fg = prompt,
}
highlights.TelescopePreviewTitle = {
bg = colors.bg_dark,
fg = colors.bg_dark,
}
highlights.TelescopeResultsTitle = {
bg = colors.bg_dark,
fg = colors.bg_dark,
}
end,
})
vim.cmd[[colorscheme tokyonight-storm]]
end
}
-- Usecase example for other plugins when adding colorscheme support
--[[
local colors = require("tokyonight.colors").setup() -- pass in any of the config options as explained above
local util = require("tokyonight.util")
aplugin.background = colors.bg_dark
aplugin.my_error = util.lighten(colors.red1, 0.3) -- number between 0 and 1. 0 results in white, 1 results in red1
]]--

View file

@ -0,0 +1,18 @@
return {
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"vim",
"vimdoc",
"lua"
},
sync_install = false,
-- This can be updated to a list of languages instead of defaulting to true
highlight = { enable = true },
indent = {enable = true },
},
build = ":TSUpdate",
dependencies = {
"nvim-treesitter/nvim-treesitter-context"
}
}

View file

@ -0,0 +1,3 @@
return {
"nvim-treesitter/nvim-treesitter-context"
}