init
This commit is contained in:
@@ -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" })
|
||||
|
||||
Reference in New Issue
Block a user