init
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
vim.opt.rtp:prepend(vim.fn.stdpath("config"))
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
vim.pack.add({
|
||||||
|
{ src = "https://github.com/neovim/nvim-lspconfig" },
|
||||||
|
{ src = "https://github.com/goolord/alpha-nvim" },
|
||||||
|
{ src = "https://github.com/stevearc/oil.nvim" },
|
||||||
|
{ src = "https://github.com/ibhagwan/fzf-lua" },
|
||||||
|
{ src = "https://github.com/nvim-lualine/lualine.nvim" },
|
||||||
|
{ src = "https://github.com/nvim-mini/mini.nvim" },
|
||||||
|
{ src = "https://github.com/rafamadriz/friendly-snippets" },
|
||||||
|
})
|
||||||
|
|
||||||
|
require('lspconf')
|
||||||
|
require('settings')
|
||||||
|
require('lualineconf')
|
||||||
|
require('mini')
|
||||||
|
require('ui')
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
vim.lsp.enable({ "lua_ls", "nixd", "clang", "rust-analyzer"})
|
||||||
|
|
||||||
|
-- RUST
|
||||||
|
vim.lsp.config('rust-analyzer', {
|
||||||
|
cmd = { 'rust-analyzer' },
|
||||||
|
filetypes = { 'rust' },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- NIX
|
||||||
|
vim.lsp.config('nixd', {
|
||||||
|
cmd = { 'nixd' },
|
||||||
|
filetypes = { 'nix' },
|
||||||
|
root_markers = { 'flake.nix', '.git' },
|
||||||
|
settings = {
|
||||||
|
nixd = {
|
||||||
|
formatting = {
|
||||||
|
command = { "alejandra" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
-- lua/conf_statusline.lua
|
||||||
|
require('lualine').setup({
|
||||||
|
options = {
|
||||||
|
theme = 'auto', -- Automatically matches your colorscheme
|
||||||
|
component_separators = { left = '', right = ''},
|
||||||
|
section_separators = { left = '', right = ''},
|
||||||
|
globalstatus = true, -- Single statusline at the bottom for all windows
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
lualine_a = {'mode'},
|
||||||
|
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||||
|
lualine_c = {'filename'},
|
||||||
|
lualine_x = {
|
||||||
|
{
|
||||||
|
-- Custom function to show which LSP is active
|
||||||
|
function()
|
||||||
|
local msg = 'No Active LSP'
|
||||||
|
local buf_ft = vim.api.nvim_get_option_value('filetype', { buf = 0 })
|
||||||
|
local clients = vim.lsp.get_clients({ bufnr = 0 })
|
||||||
|
if next(clients) == nil then return msg end
|
||||||
|
for _, client in ipairs(clients) do
|
||||||
|
local filetypes = client.config.filetypes
|
||||||
|
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||||
|
return client.name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return msg
|
||||||
|
end,
|
||||||
|
icon = ' ',
|
||||||
|
color = { fg = '#ffffff', gui = 'bold' },
|
||||||
|
},
|
||||||
|
'encoding',
|
||||||
|
'fileformat',
|
||||||
|
'filetype'
|
||||||
|
},
|
||||||
|
lualine_y = {'progress'},
|
||||||
|
lualine_z = {'location'}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
require('mini.pairs').setup()
|
||||||
|
require('mini.comment').setup()
|
||||||
|
require('mini.surround').setup()
|
||||||
|
require('mini.icons').setup()
|
||||||
|
|
||||||
|
require('mini.notify').setup({
|
||||||
|
-- only show messages
|
||||||
|
content = {
|
||||||
|
format = function(notif)
|
||||||
|
return notif.msg
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
require('mini.cmdline').setup({
|
||||||
|
autocorrect = { enable = false }
|
||||||
|
})
|
||||||
|
|
||||||
|
local MiniCompletion = require('mini.completion')
|
||||||
|
MiniCompletion.setup({
|
||||||
|
lsp_completion = {
|
||||||
|
auto_setup = true,
|
||||||
|
process_items = function(items, base)
|
||||||
|
return MiniCompletion.default_process_items(items, base, {
|
||||||
|
filtersort = "fuzzy",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
local MiniSnipets = require('mini.snippets')
|
||||||
|
MiniSnipets.setup({
|
||||||
|
snippets = {
|
||||||
|
MiniSnipets.gen_loader.from_lang(),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
MiniSnipets.start_lsp_server({ match = false })
|
||||||
|
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
vim.g.mapleader = " "
|
||||||
|
vim.o.number = true
|
||||||
|
vim.o.relativenumber = true
|
||||||
|
vim.o.wrap = true
|
||||||
|
vim.o.winborder = "rounded"
|
||||||
|
|
||||||
|
-- vim.o.signcolumn = "no"
|
||||||
|
vim.o.signcolumn = "yes"
|
||||||
|
vim.o.tabstop = 2
|
||||||
|
vim.o.shiftwidth = 2
|
||||||
|
vim.o.expandtab = true
|
||||||
|
vim.o.breakindent = true
|
||||||
|
vim.o.undofile = true
|
||||||
|
vim.o.swapfile = false
|
||||||
|
vim.o.backup = false
|
||||||
|
|
||||||
|
vim.o.clipboard = 'unnamedplus'
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>o', ':update<CR> :source<CR>')
|
||||||
|
vim.keymap.set('n', '<ESC>', "<cmd>nohlsearch<CR>")
|
||||||
|
vim.keymap.set('n', '<leader>lf', vim.lsp.buf.format)
|
||||||
|
|
||||||
|
vim.keymap.set({ 'n', 'v', 'x' }, '<leader>y', '"+y<CR>')
|
||||||
|
vim.keymap.set({ 'n', 'v', 'x' }, '<leader>d', '"+d<CR>')
|
||||||
|
|
||||||
|
-- delete without yanking
|
||||||
|
vim.keymap.set("n", "d", '"_d', opts)
|
||||||
|
vim.keymap.set("v", "d", '"_d', opts)
|
||||||
|
vim.keymap.set("n", "x", '"_x', opts)
|
||||||
|
vim.keymap.set("n", "D", '"_D', opts)
|
||||||
|
|
||||||
|
-- delete with leader to yank
|
||||||
|
vim.keymap.set("n", "<leader>d", '""d')
|
||||||
|
vim.keymap.set("n", "<leader>D", '""D')
|
||||||
|
vim.keymap.set("v", "<leader>d", '""d')
|
||||||
|
|
||||||
|
-- Plugin Keybinds
|
||||||
|
vim.keymap.set('n', '<leader>e', '<cmd>Oil<CR>', { desc = "Open parent directory" })
|
||||||
|
vim.keymap.set('n', '<leader>D', '<cmd>Alpha<CR>', { desc = "Open dashboard" })
|
||||||
|
|
||||||
|
-- Fuzzy find files and open them (or their directory in Oil)
|
||||||
|
vim.keymap.set('n', '<leader>ff', "<cmd>FzfLua files<CR>", { desc = "Fuzzy Find Files" })
|
||||||
|
|
||||||
|
vim.o.autocomplete = true
|
||||||
|
vim.opt.completeopt = { 'menuone', 'noselect' }
|
||||||
|
vim.opt.shortmess:append('c')
|
||||||
|
|
||||||
|
vim.keymap.set('n', 'gl', vim.diagnostic.open_float)
|
||||||
|
|
||||||
|
vim.o.pumheight = 5
|
||||||
|
vim.o.pumborder = 'rounded'
|
||||||
|
|
||||||
|
vim.g.vimtex_view_method = "zathura"
|
||||||
|
vim.cmd("filetype plugin indent on")
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
group = vim.api.nvim_create_augroup('my.lsp', {}),
|
||||||
|
callback = function(ev)
|
||||||
|
local client = assert(vim.lsp.get_client_by_id(ev.data.client_id))
|
||||||
|
if client:supports_method('textDocument/completion') then
|
||||||
|
vim.lsp.completion.enable(true, client.id, ev.buf, {autotrigger = true})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
vim.cmd("syntax enable")
|
||||||
|
|
||||||
+58
@@ -0,0 +1,58 @@
|
|||||||
|
-- Dashboard
|
||||||
|
local alpha = require('alpha')
|
||||||
|
local dashboard = require('alpha.themes.dashboard')
|
||||||
|
|
||||||
|
-- Custom Header (Minimalist)
|
||||||
|
dashboard.section.header.val = {
|
||||||
|
-- [[ __ ]],
|
||||||
|
[[ ___ ___ ___ __ __ /\_\ ___ ___ ]],
|
||||||
|
[[ /' _ `\ /' __`\/\__\ /\ \/\ \\/\ \ /' __` __`\ ]],
|
||||||
|
[[ /\ \/\ \/\ __/\/_/\ \ \ \_/ |\ \ \ /\ \/\ \/\ \ ]],
|
||||||
|
[[ \ \_\ \_\ \____\ \ \_\ \___/ \ \_\\ \_\ \_\ \_\]],
|
||||||
|
[[ \/_/\/_/\/____/ \/_/\/__/ \/_/ \/_/\/_/\/_/]],
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Custom Buttons (Integrating your Zsh logic)
|
||||||
|
dashboard.section.buttons.val = {
|
||||||
|
dashboard.button("n", " Nix Configuration", ":cd ~/nicksOs | Oil<CR>"),
|
||||||
|
dashboard.button("v", " Neovim Config", ":cd ~/.config/nvim | Oil<CR>"),
|
||||||
|
dashboard.button("h", " Habits", ":cd ~/Documents | :e habits.md <CR>"),
|
||||||
|
dashboard.button("f", " Find File", ":Oil<CR>"),
|
||||||
|
dashboard.button("q", " Quit", ":qa<CR>"),
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Recent Files Section (Last 5 files)
|
||||||
|
local function get_mru(count)
|
||||||
|
local mru = {}
|
||||||
|
for _, file in ipairs(vim.v.oldfiles) do
|
||||||
|
if #mru >= count then break end
|
||||||
|
if vim.fn.filereadable(file) == 1 then
|
||||||
|
table.insert(mru, dashboard.button(tostring(#mru + 1), " " .. vim.fn.fnamemodify(file, ":t"), ":e " .. file .. "<CR>"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return mru
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Assemble the layout
|
||||||
|
dashboard.config.layout = {
|
||||||
|
{ type = "padding", val = 2 },
|
||||||
|
dashboard.section.header,
|
||||||
|
{ type = "padding", val = 2 },
|
||||||
|
{ type = "group", val = dashboard.section.buttons.val },
|
||||||
|
{ type = "padding", val = 2 }, { type = "text", val = "Recent Files", opts = { hl = "Special", align = "center" } }, { type = "padding", val = 1 },
|
||||||
|
{ type = "group", val = function() return get_mru(5) end },
|
||||||
|
}
|
||||||
|
|
||||||
|
alpha.setup(dashboard.config)
|
||||||
|
|
||||||
|
-- File Browser
|
||||||
|
vim.g.loaded_netrw = 1
|
||||||
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
require("oil").setup({
|
||||||
|
columns = { "icon" },
|
||||||
|
view_options = { show_hidden = true },
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.cmd("colorscheme habamax")
|
||||||
|
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||||
|
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
{
|
||||||
|
"plugins": {
|
||||||
|
"Comment.nvim": {
|
||||||
|
"rev": "e30b7f2008e52442154b66f7c519bfd2f1e32acb",
|
||||||
|
"src": "https://github.com/numToStr/Comment.nvim"
|
||||||
|
},
|
||||||
|
"alpha-nvim": {
|
||||||
|
"rev": "6c6a89d5b068b5251c8bdf0dd57bb921bcfeeb09",
|
||||||
|
"src": "https://github.com/goolord/alpha-nvim"
|
||||||
|
},
|
||||||
|
"blink.lib": {
|
||||||
|
"rev": "5876dd95deeb70aadbe9f1c0b7117a135061cdac",
|
||||||
|
"src": "https://github.com/saghen/blink.lib"
|
||||||
|
},
|
||||||
|
"blink.nvim": {
|
||||||
|
"rev": "d1e7c7c45d45c6b6a25427bf62db4db73b03ff3d",
|
||||||
|
"src": "https://github.com/Saghen/blink.nvim"
|
||||||
|
},
|
||||||
|
"friendly-snippets": {
|
||||||
|
"rev": "6cd7280adead7f586db6fccbd15d2cac7e2188b9",
|
||||||
|
"src": "https://github.com/rafamadriz/friendly-snippets"
|
||||||
|
},
|
||||||
|
"fzf-lua": {
|
||||||
|
"rev": "511651f198068ef5841ee1635ade58daa2486ef7",
|
||||||
|
"src": "https://github.com/ibhagwan/fzf-lua"
|
||||||
|
},
|
||||||
|
"lualine.nvim": {
|
||||||
|
"rev": "221ce6b2d999187044529f49da6554a92f740a96",
|
||||||
|
"src": "https://github.com/nvim-lualine/lualine.nvim"
|
||||||
|
},
|
||||||
|
"mini.nvim": {
|
||||||
|
"rev": "946ae64e0ee807ae3c41f382f0114b4ed4915b2c",
|
||||||
|
"src": "https://github.com/nvim-mini/mini.nvim"
|
||||||
|
},
|
||||||
|
"nvim-autopairs": {
|
||||||
|
"rev": "7b9923abad60b903ece7c52940e1321d39eccc79",
|
||||||
|
"src": "https://github.com/windwp/nvim-autopairs"
|
||||||
|
},
|
||||||
|
"nvim-lspconfig": {
|
||||||
|
"rev": "d592c1e6ad9a0a01b3d5ed3f0345d68407167181",
|
||||||
|
"src": "https://github.com/neovim/nvim-lspconfig"
|
||||||
|
},
|
||||||
|
"nvim-treesitter": {
|
||||||
|
"rev": "61df84986b4b4ec469ee745a182e433d49f8c27e",
|
||||||
|
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||||
|
},
|
||||||
|
"nvim-web-devicons": {
|
||||||
|
"rev": "2ae6958df7ced50baac5035cec0c15799eedfbf7",
|
||||||
|
"src": "https://github.com/nvim-tree/nvim-web-devicons"
|
||||||
|
},
|
||||||
|
"oil.nvim": {
|
||||||
|
"rev": "b73018b75affd13fa38e2fc94ef753b465f770d7",
|
||||||
|
"src": "https://github.com/stevearc/oil.nvim"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user