testing nixvim
This commit is contained in:
24
home/extra/neovimbak/nvim/init.lua
Normal file
24
home/extra/neovimbak/nvim/init.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
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", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
vim.g.mapleader = " "
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.guicursor = ""
|
||||
|
||||
require("lazy").setup("plugins", {
|
||||
rocks = { enabled = false },
|
||||
dev = {
|
||||
path = "~/.local/share/nvim/nix",
|
||||
fallback = false,
|
||||
},
|
||||
})
|
||||
require("cnst")
|
||||
109
home/extra/neovimbak/nvim/lua/cnst/remap.lua
Normal file
109
home/extra/neovimbak/nvim/lua/cnst/remap.lua
Normal file
@@ -0,0 +1,109 @@
|
||||
local map = vim.keymap.set
|
||||
|
||||
local close_nvim = function()
|
||||
vim.cmd("Neotree close")
|
||||
vim.cmd("qa")
|
||||
end
|
||||
|
||||
--- General
|
||||
map("n", "+", "/", { desc = "Forward search", nowait = true })
|
||||
map("n", "-", "?", { desc = "Backward search", nowait = true })
|
||||
map("n", "<leader>n", "<cmd>enew<cr>", { desc = "New Buffer" })
|
||||
map({ "n", "t" }, "<A-w>", "<cmd>q<cr>", { desc = "Close Window" })
|
||||
map({ "n", "t" }, "<C-q>", close_nvim, { desc = "Quick Quit" })
|
||||
map({ "n", "x" }, ",", ":", { desc = "Enter command mode", nowait = true })
|
||||
|
||||
map("n", "<leader>ll", "<cmd>Lazy<cr>", { desc = "Open Lazy" })
|
||||
map("n", "<leader>mm", "<cmd>Mason<cr>", { desc = "Open Mason" })
|
||||
|
||||
map("i", "<C-v>", "<esc>p", { desc = "Paste Clipboard" })
|
||||
map("n", "<C-c>", "<cmd> %y+ <CR>", { desc = "Copy File to [C]lipboard" })
|
||||
|
||||
map({ "i", "x", "n", "s" }, "<C-s>", '<cmd>w "++p"<cr><esc>', { desc = "Save File" })
|
||||
map(
|
||||
{ "i", "x", "n", "s" },
|
||||
"<Esc><C-s>", -- <Alt>+<Control-s>
|
||||
'<cmd>wa "++p"<cr><esc>',
|
||||
{ desc = "Save All Files" }
|
||||
)
|
||||
|
||||
map(
|
||||
"n",
|
||||
"<leader>cr",
|
||||
"<cmd>let @+ = expand('%:~:.')<cr><cmd>echo 'Copied path:' @+<cr>",
|
||||
{ desc = "[C]opy [R]elative Path to Clipboard" }
|
||||
)
|
||||
map(
|
||||
"n",
|
||||
"<leader>cp",
|
||||
"<cmd>let @+ = expand('%:p')<cr><cmd>echo 'Copied path:' @+<cr>",
|
||||
{ desc = "[C]opy Full [P]ath to Clipboard" }
|
||||
)
|
||||
map("n", "<leader>gp", ":e <C-r>+<CR>", { desc = "[G]o to [P]ath from Clipboard" })
|
||||
|
||||
map("v", ">", ">gv", { desc = "Indent Right" })
|
||||
map("v", "<", "<gv", { desc = "Indent Left" })
|
||||
|
||||
-- Don't copy the replaced text after pasting in visual mode
|
||||
-- https://vim.fandom.com/wiki/Replace_a_word_with_yanked_text#Alternative_mapping_for_paste
|
||||
map("x", "p", 'p:let @+=@0<CR>:let @"=@0<CR>', { desc = "Dont copy replaced text", silent = true })
|
||||
|
||||
-- Don't reset clipboard after first paste in Visual mode
|
||||
map("v", "p", "P")
|
||||
|
||||
--- Tab motions
|
||||
-- map('n', '<C-t>s', '<cmd>tab split<cr>', { desc = 'Split Window to New Tab' })
|
||||
-- map('n', '<C-t>t', '<C-w>T', { desc = 'Maximize Window' })
|
||||
map("n", "<ESC><C-j>", "<cmd>tabprevious<cr>", { desc = "Previous Tab" })
|
||||
map("n", "<ESC><C-k>", "<cmd>tabnext<cr>", { desc = "Next Tab" })
|
||||
map("n", "<leader>tc", "<cmd>tabclose<cr>", { desc = "[T]ab [C]lose" })
|
||||
map("n", "<leader>te", "<cmd>tabedit<cr>", { desc = "[T]ab [E]dit" })
|
||||
map("n", "<leader>tn", "<cmd>tabnew<cr>", { desc = "[T]ab [N]ew" })
|
||||
|
||||
-- Buffer Motions
|
||||
-- map('n', '<A-j>', '<cmd>bprevious<cr>', { desc = 'Prev Buffer' })
|
||||
-- map('n', '<A-k>', '<cmd>bnext<cr>', { desc = 'Next Buffer' })
|
||||
-- map('n', '<A-c>', '<cmd>bdelete<cr>', { desc = 'Close Buffer' })
|
||||
|
||||
--- Debugging
|
||||
map("n", "<leader>ms", "<cmd>messages<cr>", { desc = "Show Messages" })
|
||||
map("n", "<leader>mn", "<cmd>Noice<cr>", { desc = "Show Noice Messages" })
|
||||
|
||||
map("x", "<M-s>", ":sort<cr>", { desc = "Sort Selection" })
|
||||
|
||||
--- Terminal
|
||||
-- switch between windows
|
||||
map("t", "<C-h>", "<C-\\><C-N><C-w>h", { desc = "Terminal Window Left" })
|
||||
map("t", "<C-l>", "<C-\\><C-N><C-w>l", { desc = "Terminal Window Right" })
|
||||
map("t", "<C-j>", "<C-\\><C-N><C-w>j", { desc = "Terminal Window Down" })
|
||||
map("t", "<C-k>", "<C-\\><C-N><C-w>k", { desc = "Terminal Window Up" })
|
||||
map("t", "<C-x>", vim.api.nvim_replace_termcodes("<C-\\><C-N>", true, true, true), { desc = "Escape Terminal Mode" })
|
||||
|
||||
-- Better Movements
|
||||
map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||
map({ "n", "x" }, "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||
-- map({ 'n', 'x' }, '<Down>', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||
-- map({ 'n', 'x' }, '<Up>', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||
|
||||
-- Move Lines
|
||||
-- map('n', '<A-j>', '<cmd>m .+1<cr>==', { desc = 'Move Down' })
|
||||
-- map('n', '<A-k>', '<cmd>m .-2<cr>==', { desc = 'Move Up' })
|
||||
-- map('i', '<A-j>', '<esc><cmd>m .+1<cr>==gi', { desc = 'Move Down' })
|
||||
-- map('i', '<A-k>', '<esc><cmd>m .-2<cr>==gi', { desc = 'Move Up' })
|
||||
-- map('v', '<A-j>', ":m '>+1<cr>gv=gv", { desc = 'Move Down' })
|
||||
-- map('v', '<A-k>', ":m '<-2<cr>gv=gv", { desc = 'Move Up' })
|
||||
|
||||
-- Resize window using <ctrl> arrow keys
|
||||
map({ "n", "t" }, "<C-Up>", "<cmd>resize +2<cr>", { desc = "Increase Window Height" })
|
||||
map({ "n", "t" }, "<C-Down>", "<cmd>resize -2<cr>", { desc = "Decrease Window Height" })
|
||||
map({ "n", "t" }, "<C-Left>", "<cmd>vertical resize -2<cr>", { desc = "Decrease Window Width" })
|
||||
map({ "n", "t" }, "<C-Right>", "<cmd>vertical resize +2<cr>", { desc = "Increase Window Width" })
|
||||
|
||||
-- Clear search, diff update and redraw
|
||||
-- taken from runtime/lua/_editor.lua
|
||||
map(
|
||||
"n",
|
||||
"<leader>ur",
|
||||
"<Cmd>nohlsearch<Bar>diffupdate<Bar>normal! <C-L><CR>",
|
||||
{ desc = "Redraw / Clear hlsearch / Diff Update" }
|
||||
)
|
||||
118
home/extra/neovimbak/nvim/lua/cnst/set.lua
Normal file
118
home/extra/neovimbak/nvim/lua/cnst/set.lua
Normal file
@@ -0,0 +1,118 @@
|
||||
-- Set <space> as the leader key
|
||||
-- See `:help mapleader`
|
||||
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
||||
vim.g.mapleader = ' '
|
||||
|
||||
-- Set to true if you have a Nerd Font installed
|
||||
vim.g.have_nerd_font = true
|
||||
|
||||
-- [[ Setting options ]]
|
||||
-- See `:help vim.opt`
|
||||
-- NOTE: You can change these options as you wish!
|
||||
-- For more options, you can see `:help option-list`
|
||||
|
||||
-- Make line numbers default
|
||||
vim.opt.number = true
|
||||
-- You can also add relative line numbers, to help with jumping.
|
||||
-- Experiment for yourself to see if you like it!
|
||||
vim.opt.relativenumber = false
|
||||
|
||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||
vim.opt.mouse = 'a'
|
||||
|
||||
-- Don't show the mode, since it's already in the status line
|
||||
vim.opt.showmode = false
|
||||
|
||||
-- Sync clipboard between OS and Neovim.
|
||||
-- Remove this option if you want your OS clipboard to remain independent.
|
||||
-- See `:help 'clipboard'`
|
||||
vim.opt.clipboard = 'unnamedplus'
|
||||
|
||||
-- Enable break indent
|
||||
vim.opt.breakindent = true
|
||||
|
||||
-- Save undo history
|
||||
vim.opt.undofile = true
|
||||
|
||||
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
|
||||
-- Keep signcolumn on by default
|
||||
vim.opt.signcolumn = 'yes'
|
||||
|
||||
-- Decrease update time
|
||||
vim.opt.updatetime = 250
|
||||
|
||||
-- Decrease mapped sequence wait time
|
||||
-- Displays which-key popup sooner
|
||||
vim.opt.timeoutlen = 300
|
||||
|
||||
-- Configure how new splits should be opened
|
||||
vim.opt.splitright = true
|
||||
vim.opt.splitbelow = true
|
||||
|
||||
-- Sets how neovim will display certain whitespace characters in the editor.
|
||||
-- See `:help 'list'`
|
||||
-- and `:help 'listchars'`
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
|
||||
|
||||
-- Preview substitutions live, as you type!
|
||||
vim.opt.inccommand = 'split'
|
||||
|
||||
-- Show which line your cursor is on
|
||||
vim.opt.cursorline = true
|
||||
|
||||
-- Minimal number of screen lines to keep above and below the cursor.
|
||||
vim.opt.scrolloff = 10
|
||||
|
||||
-- [[ Basic Keymaps ]]
|
||||
-- See `:help vim.keymap.set()`
|
||||
|
||||
-- Set highlight on search, but clear on pressing <Esc> in normal mode
|
||||
vim.opt.hlsearch = true
|
||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
|
||||
vim.keymap.set('n', '<leader>de', vim.diagnostic.open_float, { desc = 'Show [D]iagnostic [E]rror messages' })
|
||||
vim.keymap.set('n', '<leader>dq', vim.diagnostic.setloclist, { desc = 'Open [D]iagnostic [Q]uickfix list' })
|
||||
|
||||
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
||||
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
|
||||
-- is not what someone will guess without a bit more experience.
|
||||
--
|
||||
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
|
||||
-- or just use <C-\><C-n> to exit terminal mode
|
||||
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
|
||||
|
||||
-- TIP: Disable arrow keys in normal mode
|
||||
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
||||
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
||||
|
||||
-- Keybinds to make split navigation easier.
|
||||
-- Use CTRL+<hjkl> to switch between windows
|
||||
--
|
||||
-- See `:help wincmd` for a list of all window commands
|
||||
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
|
||||
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
|
||||
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
||||
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||
|
||||
-- [[ Basic Autocommands ]]
|
||||
-- See `:help lua-guide-autocommands`
|
||||
|
||||
-- Highlight when yanking (copying) text
|
||||
-- Try it with `yap` in normal mode
|
||||
-- See `:help vim.highlight.on_yank()`
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
desc = 'Highlight when yanking (copying) text',
|
||||
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
end,
|
||||
})
|
||||
84
home/extra/neovimbak/nvim/lua/plugins/alpha.lua
Normal file
84
home/extra/neovimbak/nvim/lua/plugins/alpha.lua
Normal file
@@ -0,0 +1,84 @@
|
||||
return {
|
||||
"goolord/alpha-nvim",
|
||||
event = "VimEnter",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
local alpha = require("alpha")
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
|
||||
-- Header
|
||||
local logo = [[
|
||||
▄████▄ ███▄ █ ██▓▒██ ██▒ ██▒ █▓ ██▓ ███▄ ▄███▓
|
||||
▒██▀ ▀█ ██ ▀█ █ ▓██▒▒▒ █ █ ▒░▓██░ █▒▓██▒▓██▒▀█▀ ██▒
|
||||
▒▓█ ▄ ▓██ ▀█ ██▒▒██▒░░ █ ░ ▓██ █▒░▒██▒▓██ ▓██░
|
||||
▒▓▓▄ ▄██▒▓██▒ ▐▌██▒░██░ ░ █ █ ▒ ▒██ █░░░██░▒██ ▒██
|
||||
▒ ▓███▀ ░▒██░ ▓██░░██░▒██▒ ▒██▒ ▒▀█░ ░██░▒██▒ ░██▒
|
||||
░ ░▒ ▒ ░░ ▒░ ▒ ▒ ░▓ ▒▒ ░ ░▓ ░ ░ ▐░ ░▓ ░ ▒░ ░ ░
|
||||
░ ▒ ░ ░░ ░ ▒░ ▒ ░░░ ░▒ ░ ░ ░░ ▒ ░░ ░ ░
|
||||
░ ░ ░ ░ ▒ ░ ░ ░ ░░ ▒ ░░ ░
|
||||
░ ░ ░ ░ ░ ░ ░ ░ ░
|
||||
░ ░
|
||||
]]
|
||||
dashboard.section.header.val = vim.split(logo, "\n")
|
||||
|
||||
-- Buttons
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button("n", " " .. " New file", "<cmd> ene <BAR> startinsert <cr>"),
|
||||
dashboard.button("f", " " .. " Find file", "<cmd> Telescope find_files <cr>"),
|
||||
dashboard.button("g", " " .. " Live grep", "<cmd> Telescope live_grep <cr>"),
|
||||
dashboard.button("r", " " .. " Recent files", "<cmd> Telescope oldfiles <cr>"),
|
||||
-- dashboard.button('s', ' ' .. ' Restore Session', "<cmd>lua require('persistence').load()<cr>"),
|
||||
dashboard.button("s", " " .. " Restore Session", "<cmd>SessionLoad<cr>"),
|
||||
dashboard.button("l", " " .. " Lazy", "<cmd> Lazy <cr>"),
|
||||
dashboard.button("h", " " .. " Check Health", "<cmd>checkhealth<cr>"),
|
||||
dashboard.button("q", " " .. " Quit", "<cmd> qa <cr>"),
|
||||
}
|
||||
for _, button in ipairs(dashboard.section.buttons) do
|
||||
button.opts.hl = "AlphaButtons"
|
||||
button.opts.hl_shortcut = "AlphaShortcut"
|
||||
end
|
||||
dashboard.section.header.opts.hl = "AlphaHeader"
|
||||
dashboard.section.buttons.opts.hl = "AlphaButtons"
|
||||
dashboard.section.footer.opts.hl = "AlphaFooter"
|
||||
dashboard.opts.layout[1].val = 8
|
||||
|
||||
-- Footer (Lazy statistics)
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
callback = function()
|
||||
local stats = require("lazy").stats()
|
||||
local ms = math.floor(stats.startuptime * 100) / 100
|
||||
dashboard.section.footer.val = " Lazy-loaded "
|
||||
.. stats.loaded
|
||||
.. "/"
|
||||
.. stats.count
|
||||
.. " plugins in "
|
||||
.. ms
|
||||
.. "ms"
|
||||
pcall(vim.cmd.AlphaRedraw)
|
||||
end,
|
||||
})
|
||||
|
||||
-- -- Fortune
|
||||
-- local fortune = ""
|
||||
-- if vim.fn.executable "fortune" == 1 then
|
||||
-- local handle = io.popen "fortune"
|
||||
-- if handle ~= nil then
|
||||
-- fortune = handle:read "*a"
|
||||
-- handle:close()
|
||||
-- end
|
||||
-- end
|
||||
-- local buttons = {
|
||||
-- type = "group",
|
||||
-- val = {
|
||||
-- { type = "padding", val = 2 },
|
||||
-- { type = "text", val = fortune, opts = { position = "center" } },
|
||||
-- { type = "padding", val = 2 },
|
||||
-- },
|
||||
-- position = "center",
|
||||
-- }
|
||||
-- dashboard.opts.layout[6] = buttons
|
||||
|
||||
dashboard.config.opts.noautocmd = true
|
||||
alpha.setup(dashboard.config)
|
||||
end,
|
||||
}
|
||||
13
home/extra/neovimbak/nvim/lua/plugins/autopairs.lua
Normal file
13
home/extra/neovimbak/nvim/lua/plugins/autopairs.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
-- Optional dependency
|
||||
dependencies = { "hrsh7th/nvim-cmp" },
|
||||
config = function()
|
||||
require("nvim-autopairs").setup({})
|
||||
-- If you want to automatically add `(` after selecting a function or method
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
local cmp = require("cmp")
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
}
|
||||
6
home/extra/neovimbak/nvim/lua/plugins/better-escape.lua
Normal file
6
home/extra/neovimbak/nvim/lua/plugins/better-escape.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
"max397574/better-escape.nvim",
|
||||
config = function()
|
||||
require("better_escape").setup()
|
||||
end,
|
||||
}
|
||||
3
home/extra/neovimbak/nvim/lua/plugins/devicons.lua
Normal file
3
home/extra/neovimbak/nvim/lua/plugins/devicons.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
{ "nvim-tree/nvim-web-devicons", opts = {}, lazy = true },
|
||||
}
|
||||
9
home/extra/neovimbak/nvim/lua/plugins/gitsigns.lua
Normal file
9
home/extra/neovimbak/nvim/lua/plugins/gitsigns.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
lazy = true,
|
||||
tag = "v0.8.0",
|
||||
event = { "BufReadPost" },
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
5
home/extra/neovimbak/nvim/lua/plugins/hmts.lua
Normal file
5
home/extra/neovimbak/nvim/lua/plugins/hmts.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
return {
|
||||
"calops/hmts.nvim",
|
||||
version = "*",
|
||||
ft = "nix",
|
||||
}
|
||||
11
home/extra/neovimbak/nvim/lua/plugins/init.lua
Normal file
11
home/extra/neovimbak/nvim/lua/plugins/init.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
return {
|
||||
{
|
||||
"sainnhe/gruvbox-material",
|
||||
enabled = true,
|
||||
priority = 1000,
|
||||
opts = {},
|
||||
config = function()
|
||||
vim.cmd([[colorscheme gruvbox-material]])
|
||||
end,
|
||||
},
|
||||
}
|
||||
144
home/extra/neovimbak/nvim/lua/plugins/lsp.lua
Normal file
144
home/extra/neovimbak/nvim/lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,144 @@
|
||||
return {
|
||||
{
|
||||
"VonHeikemen/lsp-zero.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
branch = "v2.x",
|
||||
dependencies = {
|
||||
-- LSP Support
|
||||
{ "neovim/nvim-lspconfig" },
|
||||
{ "williamboman/mason.nvim" },
|
||||
{ "williamboman/mason-lspconfig.nvim" },
|
||||
|
||||
-- Autocompletion
|
||||
{ "hrsh7th/nvim-cmp" },
|
||||
{ "hrsh7th/cmp-buffer" },
|
||||
{ "hrsh7th/cmp-path" },
|
||||
{ "saadparwaiz1/cmp_luasnip" },
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
{ "hrsh7th/cmp-nvim-lua" },
|
||||
|
||||
-- Snippets
|
||||
{ "L3MON4D3/LuaSnip" },
|
||||
-- Snippet Collection (Optional)
|
||||
{ "rafamadriz/friendly-snippets" },
|
||||
|
||||
{ "onsails/lspkind.nvim" },
|
||||
},
|
||||
config = function()
|
||||
local lsp = require("lsp-zero")
|
||||
lsp.preset("recommended")
|
||||
|
||||
-- don't initialize this language server
|
||||
-- we will use rust-tools to setup rust_analyzer
|
||||
lsp.skip_server_setup({ "rust_analyzer" })
|
||||
|
||||
local cmp = require("cmp")
|
||||
local cmp_select = { behavior = cmp.SelectBehavior.Select }
|
||||
local cmp_mappings = lsp.defaults.cmp_mappings({
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(cmp_select),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(cmp_select),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
})
|
||||
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
lsp.setup_nvim_cmp({
|
||||
mapping = cmp_mappings,
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = "symbol_text",
|
||||
maxwidth = 75,
|
||||
ellipsis_char = "...",
|
||||
symbol_map = {
|
||||
Copilot = "",
|
||||
},
|
||||
}),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "buffer" },
|
||||
{ name = "copilot" },
|
||||
{ name = "path" },
|
||||
{ name = "luasnip" },
|
||||
},
|
||||
})
|
||||
|
||||
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
|
||||
|
||||
parser_config.nu = {
|
||||
install_info = {
|
||||
url = "https://github.com/nushell/tree-sitter-nu",
|
||||
files = { "src/parser.c" },
|
||||
branch = "main",
|
||||
},
|
||||
filetype = "nu",
|
||||
}
|
||||
|
||||
local format_sync_grp = vim.api.nvim_create_augroup("Format", {})
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ timeout_ms = 200 })
|
||||
end,
|
||||
group = format_sync_grp,
|
||||
})
|
||||
|
||||
lsp.on_attach(function(client, bufnr)
|
||||
local opts = { buffer = bufnr, remap = false }
|
||||
|
||||
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>vws", vim.lsp.buf.workspace_symbol, opts)
|
||||
vim.keymap.set("n", "<leader>vd", vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set("n", "<leader>vca", vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set("n", "<leader>a", vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set("n", "<leader>vrr", vim.lsp.buf.references, opts)
|
||||
vim.keymap.set("n", "<leader>vrn", vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set("i", "<C-h>", vim.lsp.buf.signature_help, opts)
|
||||
end)
|
||||
|
||||
lsp.configure("nil_ls", {
|
||||
settings = {
|
||||
["nil"] = {
|
||||
formatting = { command = { "alejandra" } },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
lsp.configure("nushell", {
|
||||
command = { "nu", "--lsp" },
|
||||
filetypes = { "nu" },
|
||||
root_dir = require("lspconfig.util").find_git_ancestor,
|
||||
singe_file_support = true,
|
||||
})
|
||||
|
||||
lsp.configure("tsserver", {
|
||||
filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue", "json" },
|
||||
})
|
||||
|
||||
lsp.set_server_config({
|
||||
on_init = function(client)
|
||||
client.server_capabilities.semanticTokensProvider = nil
|
||||
end,
|
||||
})
|
||||
|
||||
lsp.nvim_workspace()
|
||||
lsp.setup()
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
signs = true,
|
||||
update_in_insert = true,
|
||||
underline = true,
|
||||
severity_sort = false,
|
||||
float = true,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
41
home/extra/neovimbak/nvim/lua/plugins/lualine.lua
Normal file
41
home/extra/neovimbak/nvim/lua/plugins/lualine.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
local go_package = function()
|
||||
for _, line in ipairs(vim.api.nvim_buf_get_lines(0, 0, -1, true)) do
|
||||
if line:match("^package ") then
|
||||
return "⬡ " .. string.sub(line, 9)
|
||||
end
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons", optional = true },
|
||||
opts = {
|
||||
options = {
|
||||
theme = "gruvbox-material",
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch", "diff", "diagnostics" },
|
||||
lualine_c = {
|
||||
{
|
||||
go_package,
|
||||
cond = function()
|
||||
return vim.bo.filetype == "go"
|
||||
end,
|
||||
},
|
||||
{ "filename" },
|
||||
},
|
||||
lualine_x = {
|
||||
"encoding",
|
||||
"fileformat",
|
||||
"filetype",
|
||||
},
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = { "location" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
53
home/extra/neovimbak/nvim/lua/plugins/neo-tree.lua
Normal file
53
home/extra/neovimbak/nvim/lua/plugins/neo-tree.lua
Normal file
@@ -0,0 +1,53 @@
|
||||
return {
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
version = "*",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons", -- optional, but recommended
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
cmd = { "Neotree" },
|
||||
opts = {
|
||||
close_if_last_window = true,
|
||||
window = {
|
||||
mappings = {
|
||||
["l"] = "open",
|
||||
["h"] = "open_split",
|
||||
-- TODO: `v` is for select. Find another key for vsplit
|
||||
-- ['v'] = 'open_vsplit',
|
||||
},
|
||||
},
|
||||
filesystem = {
|
||||
follow_current_file = { enabled = true },
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "<C-n>", "<CMD>Neotree toggle<CR>", mode = { "n", "x", "t" }, desc = "Toggle [N]eoTree", nowait = true },
|
||||
-- {
|
||||
-- '<C-b>',
|
||||
-- '<CMD>Neotree toggle buffers<CR>',
|
||||
-- mode = { 'n', 'x', 't' },
|
||||
-- desc = 'Toggle Neotree [B]uffers',
|
||||
-- nowait = true,
|
||||
-- },
|
||||
{
|
||||
"<C-f>",
|
||||
"<CMD>Neotree toggle position=current<CR>",
|
||||
mode = { "n", "x" },
|
||||
desc = "Toggle [F]ull NeoTree",
|
||||
nowait = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- file operations using built-in LSP
|
||||
{
|
||||
"antosha417/nvim-lsp-file-operations",
|
||||
config = true,
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
},
|
||||
},
|
||||
}
|
||||
10
home/extra/neovimbak/nvim/lua/plugins/notify.lua
Normal file
10
home/extra/neovimbak/nvim/lua/plugins/notify.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
return {
|
||||
{
|
||||
"rcarriga/nvim-notify",
|
||||
lazy = true,
|
||||
opts = {
|
||||
render = "compact",
|
||||
background_colour = "#000000",
|
||||
},
|
||||
},
|
||||
}
|
||||
47
home/extra/neovimbak/nvim/lua/plugins/rust.lua
Normal file
47
home/extra/neovimbak/nvim/lua/plugins/rust.lua
Normal file
@@ -0,0 +1,47 @@
|
||||
return {
|
||||
{
|
||||
"mrcjkb/rustaceanvim",
|
||||
version = "^3",
|
||||
event = { "BufReadPost *.rs" },
|
||||
keys = {
|
||||
{
|
||||
"<Leader>a",
|
||||
mode = "n",
|
||||
function()
|
||||
vim.cmd.RustLsp("codeAction")
|
||||
end,
|
||||
{ buffer = vim.api.nvim_get_current_buf() },
|
||||
desc = "LSP Code Action",
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
vim.g.rustaceanvim = {
|
||||
tools = {
|
||||
inlay_hints = {
|
||||
auto = false,
|
||||
highlight = "Debug",
|
||||
},
|
||||
hover_actions = {
|
||||
auto_focus = true,
|
||||
},
|
||||
},
|
||||
server = {
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
checkOnSave = {
|
||||
enable = true,
|
||||
command = "clippy",
|
||||
},
|
||||
cargo = {
|
||||
allFeatures = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
on_attach = function(client, _)
|
||||
client.server_capabilities.semanticTokensProvider = nil
|
||||
end,
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
68
home/extra/neovimbak/nvim/lua/plugins/telescope.lua
Normal file
68
home/extra/neovimbak/nvim/lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,68 @@
|
||||
return {
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
cmd = "Telescope",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
{
|
||||
"nvim-telescope/telescope-file-browser.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
},
|
||||
},
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{
|
||||
"<leader>pf",
|
||||
mode = "n",
|
||||
function() require("telescope.builtin").find_files() end,
|
||||
desc = "telescope find files"
|
||||
},
|
||||
{
|
||||
"<C-p>",
|
||||
mode = "n",
|
||||
function() require("telescope.builtin").git_files() end,
|
||||
desc = "telescope find files"
|
||||
},
|
||||
{
|
||||
"<leader>ps",
|
||||
mode = "n",
|
||||
function()
|
||||
require("telescope.builtin").live_grep()
|
||||
end,
|
||||
desc = "telescope grep string"
|
||||
},
|
||||
{
|
||||
"<leader>pt",
|
||||
mode = "n",
|
||||
function()
|
||||
require("telescope.builtin").treesitter()
|
||||
end,
|
||||
desc = "telescope treesitter"
|
||||
},
|
||||
{
|
||||
"<leader>pb",
|
||||
mode = "n",
|
||||
function() require("telescope.builtin").buffers() end,
|
||||
desc = "telescope buffers"
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local opts = {
|
||||
extensions = {
|
||||
file_browser = {
|
||||
respect_gitignore = false,
|
||||
hijack_netrw = true,
|
||||
hidden = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
require("telescope").setup(opts)
|
||||
require("telescope").load_extension("file_browser")
|
||||
end,
|
||||
},
|
||||
}
|
||||
25
home/extra/neovimbak/nvim/lua/plugins/treesitter.lua
Normal file
25
home/extra/neovimbak/nvim/lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
main = "nvim-treesitter.configs",
|
||||
dev = true,
|
||||
opts = {
|
||||
-- autotag = {
|
||||
-- enable = true
|
||||
-- },
|
||||
highlight = {
|
||||
-- `false` will disable the whole extension
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<CR>",
|
||||
node_incremental = "<CR>",
|
||||
scope_incremental = "<S-CR>",
|
||||
node_decremental = "<BS>",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
7
home/extra/neovimbak/nvim/lua/plugins/which-key.lua
Normal file
7
home/extra/neovimbak/nvim/lua/plugins/which-key.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
return {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user