my first commit
This commit is contained in:
28
nvim/lua/config/keymaps.lua
Normal file
28
nvim/lua/config/keymaps.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
local map = vim.keymap.set
|
||||
|
||||
-- WhichKey will automatically pick these up if they have descriptions
|
||||
map("n", "<leader>e", "<cmd>NvimTreeToggle<cr>", { desc = "Toggle Explorer" })
|
||||
map("n", "<leader>f", "<cmd>Telescope find_files<cr>", { desc = "Find Files" })
|
||||
map("n", "<leader>g", "<cmd>Telescope live_grep<cr>", { desc = "Grep" })
|
||||
map("n", "<leader>w", "<cmd>w<cr>", { desc = "Save" })
|
||||
map("n", "<leader>q", "<cmd>q<cr>", { desc = "Quit" })
|
||||
map("n", "<leader>t", "<cmd>ToggleTerm<cr>", { desc = "Terminal" })
|
||||
|
||||
-- Clear search with <esc>
|
||||
map({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>", { desc = "Escape and clear hlsearch" })
|
||||
|
||||
-- Better escape
|
||||
map("i", "jj", "<esc>", { desc = "Escape insert mode" })
|
||||
|
||||
-- Better window navigation
|
||||
map("n", "<C-h>", "<C-w>h", { desc = "Go to left window" })
|
||||
map("n", "<C-j>", "<C-w>j", { desc = "Go to lower window" })
|
||||
map("n", "<C-k>", "<C-w>k", { desc = "Go to upper window" })
|
||||
map("n", "<C-l>", "<C-w>l", { desc = "Go to right window" })
|
||||
|
||||
-- Buffers
|
||||
map("n", "<S-h>", "<cmd>bprevious<cr>", { desc = "Prev buffer" })
|
||||
map("n", "<S-l>", "<cmd>bnext<cr>", { desc = "Next buffer" })
|
||||
|
||||
-- Strudel
|
||||
map("n", "ss", "<cmd>StrudelUpdate<cr>", { desc = "Update Strudel" })
|
||||
40
nvim/lua/config/lazy.lua
Normal file
40
nvim/lua/config/lazy.lua
Normal file
@@ -0,0 +1,40 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable",
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
{ import = "plugins" },
|
||||
},
|
||||
defaults = {
|
||||
lazy = false,
|
||||
version = false,
|
||||
},
|
||||
checker = { enabled = true },
|
||||
performance = {
|
||||
rtp = {
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
"matchit",
|
||||
"matchparen",
|
||||
"netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
23
nvim/lua/config/options.lua
Normal file
23
nvim/lua/config/options.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
local opt = vim.opt
|
||||
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
opt.mouse = "a"
|
||||
opt.clipboard = "unnamedplus"
|
||||
opt.breakindent = true
|
||||
opt.undofile = true
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
opt.updatetime = 250
|
||||
opt.timeoutlen = 300
|
||||
opt.splitright = true
|
||||
opt.splitbelow = true
|
||||
opt.list = true
|
||||
opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
|
||||
opt.inccommand = "split"
|
||||
opt.cursorline = true
|
||||
opt.scrolloff = 10
|
||||
opt.expandtab = true
|
||||
opt.shiftwidth = 2
|
||||
opt.tabstop = 2
|
||||
opt.termguicolors = true
|
||||
67
nvim/lua/plugins/editor.lua
Normal file
67
nvim/lua/plugins/editor.lua
Normal file
@@ -0,0 +1,67 @@
|
||||
return {
|
||||
-- File explorer
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
dependencies = "nvim-tree/nvim-web-devicons",
|
||||
opts = {
|
||||
view = {
|
||||
width = 30,
|
||||
side = "left",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Fuzzy finder
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = {},
|
||||
},
|
||||
|
||||
-- Treesitter
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
enabled = false,
|
||||
},
|
||||
|
||||
-- Git integration
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
opts = {},
|
||||
},
|
||||
|
||||
-- Terminal
|
||||
{
|
||||
"akinsho/toggleterm.nvim",
|
||||
version = "*",
|
||||
opts = {
|
||||
open_mapping = [[<c-\>]],
|
||||
direction = "float",
|
||||
},
|
||||
},
|
||||
|
||||
-- Comments
|
||||
{ "numToStr/Comment.nvim", opts = {} },
|
||||
|
||||
-- Autopairs
|
||||
{ "windwp/nvim-autopairs", opts = {} },
|
||||
|
||||
{
|
||||
"gruvw/strudel.nvim",
|
||||
build = "npm ci",
|
||||
keys = {
|
||||
{ "<leader>sl", "<cmd>StrudelLaunch<CR>", desc = "Strudel Launch" },
|
||||
{ "<leader>k", "<cmd>StrudelToggle<CR>", desc = "Strudel Toggle (Play/Stop)" },
|
||||
{ "<leader>su", "<cmd>StrudelUpdate<CR>", desc = "Strudel Update" },
|
||||
{ "<leader><leader>", "<cmd>StrudelUpdate<CR>", desc = "Strudel Update" },
|
||||
{ "<leader>sq", "<cmd>StrudelQuit<CR>", desc = "Strudel Quit" },
|
||||
},
|
||||
config = function()
|
||||
require("strudel").setup({
|
||||
browser_exec_path = "/run/current-system/sw/bin/chromium",
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
}
|
||||
85
nvim/lua/plugins/lsp.lua
Normal file
85
nvim/lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,85 @@
|
||||
return {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"hrsh7th/nvim-cmp",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"L3MON4D3/LuaSnip",
|
||||
},
|
||||
config = function()
|
||||
local on_attach = function(_, bufnr)
|
||||
local opts = { buffer = bufnr }
|
||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
|
||||
end
|
||||
|
||||
-- Setup LSPs using new vim.lsp.config API (Nvim 0.11+)
|
||||
-- These assume the language servers are installed on your system PATH via Nix
|
||||
local servers = { "lua_ls", "bashls", "ansiblels", "yamlls", "pyright", "nil_ls", "powershell_es", "ts_ls", "clangd" }
|
||||
for _, lsp in ipairs(servers) do
|
||||
vim.lsp.config(lsp, {
|
||||
on_attach = on_attach,
|
||||
})
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
-- Autocompletion
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump(1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
68
nvim/lua/plugins/ui.lua
Normal file
68
nvim/lua/plugins/ui.lua
Normal file
@@ -0,0 +1,68 @@
|
||||
return {
|
||||
-- Colorscheme
|
||||
{
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require("catppuccin").setup({
|
||||
flavour = "mocha", -- latte, frappe, macchiato, mocha
|
||||
})
|
||||
vim.cmd([[colorscheme catppuccin]])
|
||||
end,
|
||||
},
|
||||
|
||||
-- Statusline
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
opts = {
|
||||
options = {
|
||||
theme = "catppuccin",
|
||||
component_separators = "|",
|
||||
section_separators = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Bufferline
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
version = "*",
|
||||
dependencies = "nvim-tree/nvim-web-devicons",
|
||||
opts = {
|
||||
options = {
|
||||
mode = "buffers",
|
||||
separator_style = "slant",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Dashboard
|
||||
{
|
||||
"goolord/alpha-nvim",
|
||||
config = function()
|
||||
local alpha = require("alpha")
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
dashboard.section.header.val = {
|
||||
" [ ███╗ ███╗██╗██████╗ ██████╗ ██████╗ ██╗ ]",
|
||||
" [ ████╗ ████║██║██╔══██╗██╔═══██╗██╔══██╗██║ ]",
|
||||
" [ ██╔████╔██║██║██║ ██║██║ ██║██████╔╝██║ ]",
|
||||
" [ ██║╚██╔╝██║██║██║ ██║██║ ██║██╔══██╗██║ ]",
|
||||
" [ ██║ ╚═╝ ██║██║██████╔╝╚██████╔╝██║ ██║██║ ]",
|
||||
" [ ╚═╝ ╚═╝╚═╝╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ]",
|
||||
}
|
||||
alpha.setup(dashboard.config)
|
||||
end,
|
||||
},
|
||||
|
||||
-- Which-key
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
},
|
||||
|
||||
-- Icons
|
||||
{ "nvim-tree/nvim-web-devicons", lazy = true },
|
||||
}
|
||||
13
nvim/lua/plugins/which-key.lua
Normal file
13
nvim/lua/plugins/which-key.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
return {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end,
|
||||
opts = {
|
||||
-- your configuration comes here
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user