Initial Configurations

This commit is contained in:
dubnde 2023-08-20 11:00:16 +01:00
parent 01a1ebed38
commit 5c216504bb
15 changed files with 478 additions and 687 deletions

View file

@ -0,0 +1,37 @@
return {
"catppuccin/nvim",
lazy = true,
name = "catppuccin",
opts = {
integrations = {
alpha = true,
cmp = true,
flash = true,
gitsigns = true,
illuminate = true,
indent_blankline = { enabled = true },
lsp_trouble = true,
mason = true,
mini = true,
native_lsp = {
enabled = true,
underlines = {
errors = { "undercurl" },
hints = { "undercurl" },
warnings = { "undercurl" },
information = { "undercurl" },
},
},
navic = { enabled = true, custom_bg = "lualine" },
neotest = true,
noice = true,
notify = true,
neotree = true,
semantic_tokens = true,
telescope = true,
treesitter = true,
which_key = true,
},
},
}

43
lua/plugins/lualine.lua Normal file
View file

@ -0,0 +1,43 @@
local options = {
icons_enabled = false,
component_separators = '|',
section_separators = '',
disabled_filetypes = {},
always_divide_middle = true,
globalstatus = false,
}
local sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff', 'diagnostics' },
lualine_c = { '%f', '[%-m]', 'filesize' },
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' },
lualine_z = { 'location' },
}
local inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { 'filename' },
lualine_x = { 'location' },
lualine_y = { 'test' },
lualine_z = {},
}
local tabline = {}
local extensions = {}
return {
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function(_, opts)
table.insert(opts, { ['options'] = options })
table.insert(opts, { ['sections'] = sections })
table.insert(opts, { ['tabline'] = tabline })
table.insert(opts, { ['extensions'] = extensions })
end,
},
}

10
lua/plugins/neogit.lua Normal file
View file

@ -0,0 +1,10 @@
return {
"TimUntersberger/neogit",
dependencies = "nvim-lua/plenary.nvim",
keys = {
{ "<leader>gs", "<cmd>Neogit<CR>", desc = "Open neogit" },
},
opts = {
use_magit_keybindings = true,
},
}

24
lua/plugins/sensible.lua Normal file
View file

@ -0,0 +1,24 @@
return {
-- Easier comments (gc / gcc)
{
"numToStr/Comment.nvim",
event = "VeryLazy",
config = function()
require("Comment").setup()
end,
},
-- Actions that work on surrounding context
{ "tpope/vim-surround", event = "VeryLazy" },
{ "tpope/vim-unimpaired", event = "VeryLazy" },
{
"folke/todo-comments.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
},
event = "VeryLazy",
config = function()
require("todo-comments").setup()
end,
},
}

36
lua/plugins/telescope.lua Normal file
View file

@ -0,0 +1,36 @@
return {
"nvim-telescope/telescope.nvim",
cmd = "Telescope",
dependencies = {
{ "nvim-lua/plenary.nvim" },
{ 'nvim-telescope/telescope-fzf-native.nvim',
build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build',
},
},
keys = {
{ "<leader>ff", "<cmd>Telescope find_files<CR>", desc = "Find Files" },
{ "<leader>ft", "<cmd>Telescope live_grep<CR>", desc = "Find a string" },
{ "<leader>fb", "<cmd>Telescope buffers<CR>", desc = "Find buffers" },
{ "<leader>fh", "<cmd>Telescope help_tags<CR>", desc = "Help" },
{ "<leader>fk", "<cmd>Telescope keymaps<CR>", desc = "Find keymaps" },
},
opts = {
defaults = {
prompt_prefix = "> ",
selection_caret = "> ",
path_display = { "smart" },
file_ignore_patterns = { ".git", "node_modules", ".idea", ".cache", "build_*" },
},
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
},
},
},
config = function()
require("telescope").load_extension("fzf")
end,
}

View file

@ -0,0 +1,5 @@
return {
"folke/tokyonight.nvim",
lazy = true,
opts = { style = "moon" },
}

View file

@ -0,0 +1,82 @@
local load_textobjects = false
return {
{
"nvim-treesitter/nvim-treesitter",
version = false, -- last release is way too old and doesn't work on Windows
build = ":TSUpdate",
event = { "BufReadPost", "BufNewFile" },
dependencies = {
{
"nvim-treesitter/nvim-treesitter-textobjects",
init = function()
-- disable rtp plugin, as we only need its queries for mini.ai
-- In case other textobject modules are enabled, we will load them
-- once nvim-treesitter is loaded
require("lazy.core.loader").disable_rtp_plugin("nvim-treesitter-textobjects")
load_textobjects = true
end,
},
},
cmd = { "TSUpdateSync" },
keys = {
{ "<c-space>", desc = "Increment selection" },
{ "<bs>", desc = "Decrement selection", mode = "x" },
},
---@type TSConfig
opts = {
highlight = { enable = true },
indent = { enable = true },
ensure_installed = {
"bash",
"c",
"cpp",
"html",
"json",
"lua",
"markdown",
"python",
"rust",
"yaml",
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "<C-space>",
node_incremental = "<C-space>",
scope_incremental = false,
node_decremental = "<bs>",
},
},
},
---@param opts TSConfig
config = function(_, opts)
if type(opts.ensure_installed) == "table" then
---@type table<string, boolean>
local added = {}
opts.ensure_installed = vim.tbl_filter(function(lang)
if added[lang] then
return false
end
added[lang] = true
return true
end, opts.ensure_installed)
end
require("nvim-treesitter.configs").setup(opts)
if load_textobjects then
-- PERF: no need to load the plugin, if we only need its queries for mini.ai
if opts.textobjects then
for _, mod in ipairs({ "move", "select", "swap", "lsp_interop" }) do
if opts.textobjects[mod] and opts.textobjects[mod].enable then
local Loader = require("lazy.core.loader")
Loader.disabled_rtp_plugins["nvim-treesitter-textobjects"] = nil
local plugin = require("lazy.core.config").plugins["nvim-treesitter-textobjects"]
require("lazy.core.loader").source_runtime(plugin.dir, "plugin")
break
end
end
end
end
end,
},
}

View file

@ -0,0 +1,5 @@
return {
"folke/neodev.nvim",
"folke/which-key.nvim",
{ "folke/neoconf.nvim", cmd = "Neoconf" },
}