Initial add
Separate nvim config into separate project, to be used as submodule for main dotfile
This commit is contained in:
commit
4054030afc
19
init.lua
Normal file
19
init.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
vim.g.mapleader = " "
|
||||
|
||||
-- bootstrap lazy.nvim
|
||||
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)
|
||||
require("lazy").setup(require "config.lazy")
|
||||
|
||||
-- Set vim options
|
||||
require "config"
|
8
lua/config/aerial.lua
Normal file
8
lua/config/aerial.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
-- optionally use on_attach to set keymaps when aerial has attached to a buffer
|
||||
on_attach = function(bufnr)
|
||||
-- Jump forwards/backwards with '{' and '}'
|
||||
vim.keymap.set("n", "{", "<cmd>AerialPrev<CR>", { buffer = bufnr })
|
||||
vim.keymap.set("n", "}", "<cmd>AerialNext<CR>", { buffer = bufnr })
|
||||
end,
|
||||
}
|
6
lua/config/barbar.lua
Normal file
6
lua/config/barbar.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
auto_hide = false,
|
||||
hide = { extensions = true },
|
||||
modified = { button = "●" },
|
||||
pinned = { button = "車", filename = true, separator = { right = "" } },
|
||||
}
|
1
lua/config/barbecue.lua
Normal file
1
lua/config/barbecue.lua
Normal file
|
@ -0,0 +1 @@
|
|||
return { theme = "catppuccin" }
|
41
lua/config/catppuccin.lua
Normal file
41
lua/config/catppuccin.lua
Normal file
|
@ -0,0 +1,41 @@
|
|||
local M = {
|
||||
flavour = "macchiato",
|
||||
term_colors = true,
|
||||
transparent_background = true,
|
||||
integrations = {
|
||||
barbar = true,
|
||||
barbecue = {
|
||||
dim_dirname = true,
|
||||
},
|
||||
dashboard = true,
|
||||
gitsigns = true,
|
||||
hop = true,
|
||||
indent_blankline = {
|
||||
enabled = true,
|
||||
colored_indent_levels = true,
|
||||
},
|
||||
cmp = true,
|
||||
mason = true,
|
||||
native_lsp = {
|
||||
enabled = true,
|
||||
},
|
||||
neogit = true,
|
||||
notify = true,
|
||||
nvimtree = true,
|
||||
navic = {
|
||||
enabled = false,
|
||||
custom_bg = "NONE",
|
||||
},
|
||||
treesitter = true,
|
||||
treesitter_context = true,
|
||||
telescope = true,
|
||||
lsp_trouble = true,
|
||||
which_key = true,
|
||||
},
|
||||
}
|
||||
|
||||
if vim.g.neovide then
|
||||
M.transparent_background = false
|
||||
end
|
||||
|
||||
return M
|
58
lua/config/dashboard.lua
Normal file
58
lua/config/dashboard.lua
Normal file
|
@ -0,0 +1,58 @@
|
|||
return {
|
||||
theme = "hyper",
|
||||
config = {
|
||||
week_header = {
|
||||
enable = true,
|
||||
},
|
||||
shortcut = {
|
||||
{ icon = " ", desc = "Lazy", group = "@property", action = "Lazy", key = "l" },
|
||||
{
|
||||
icon = " ",
|
||||
icon_hl = "@variable",
|
||||
desc = "Files",
|
||||
group = "Files",
|
||||
action = "Telescope find_files",
|
||||
key = "f",
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
icon_hl = "@variable",
|
||||
desc = "Projects",
|
||||
group = "Files",
|
||||
action = "Telescope projects",
|
||||
key = "p",
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
icon_hl = "@variable",
|
||||
desc = "Terminal",
|
||||
group = "Files",
|
||||
action = "ToggleTerm",
|
||||
key = "t",
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
desc = "Neotree",
|
||||
group = "Files",
|
||||
action = "Neotree float reveal reveal_force_cwd",
|
||||
key = "n",
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
icon_hl = "@variable",
|
||||
desc = "Neogit",
|
||||
group = "Label",
|
||||
action = "Neogit",
|
||||
key = "g",
|
||||
},
|
||||
{
|
||||
icon = " ",
|
||||
icon_hl = "@variable",
|
||||
desc = "Git commit",
|
||||
group = "Label",
|
||||
action = "Neogit commit",
|
||||
key = "c",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
6
lua/config/diffview.lua
Normal file
6
lua/config/diffview.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
enhanced_diff_hl = true,
|
||||
file_panel = {
|
||||
listing_style = "list",
|
||||
},
|
||||
}
|
2
lua/config/feline.lua
Normal file
2
lua/config/feline.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
local components = require("ui.feline_components").get()
|
||||
return { components = components }
|
45
lua/config/gitsigns.lua
Normal file
45
lua/config/gitsigns.lua
Normal file
|
@ -0,0 +1,45 @@
|
|||
return {
|
||||
signcolumn = true,
|
||||
numhl = true,
|
||||
linehl = false,
|
||||
current_line_blame = true,
|
||||
word_diff = false,
|
||||
on_attach = function(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map("n", "]c", function()
|
||||
if vim.wo.diff then return "]c" end
|
||||
vim.schedule(function() gs.next_hunk() end)
|
||||
return "<Ignore>"
|
||||
end, { expr = true })
|
||||
|
||||
map("n", "[c", function()
|
||||
if vim.wo.diff then return "[c" end
|
||||
vim.schedule(function() gs.prev_hunk() end)
|
||||
return "<Ignore>"
|
||||
end, { expr = true })
|
||||
|
||||
-- Actions
|
||||
map({ "n", "v" }, "<leader>hs", ":Gitsigns stage_hunk<CR>")
|
||||
map({ "n", "v" }, "<leader>hr", ":Gitsigns reset_hunk<CR>")
|
||||
map("n", "<leader>hS", gs.stage_buffer)
|
||||
map("n", "<leader>hu", gs.undo_stage_hunk)
|
||||
map("n", "<leader>hR", gs.reset_buffer)
|
||||
map("n", "<leader>hp", gs.preview_hunk)
|
||||
map("n", "<leader>hb", function() gs.blame_line { full = true } end)
|
||||
map("n", "<leader>tb", gs.toggle_current_line_blame)
|
||||
map("n", "<leader>hd", gs.diffthis)
|
||||
map("n", "<leader>hD", function() gs.diffthis "~" end)
|
||||
map("n", "<leader>td", gs.toggle_deleted)
|
||||
|
||||
-- Text object
|
||||
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")
|
||||
end,
|
||||
}
|
4
lua/config/indent_blankline.lua
Normal file
4
lua/config/indent_blankline.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
show_current_context = true,
|
||||
show_current_context_start = false,
|
||||
}
|
23
lua/config/init.lua
Normal file
23
lua/config/init.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
-- Opt
|
||||
vim.opt.laststatus = 3
|
||||
vim.opt.showtabline = 2
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.listchars = { lead = ".", trail = ".", tab = ">-" }
|
||||
vim.opt.list = true
|
||||
vim.opt.splitbelow = true
|
||||
vim.opt.splitright = true
|
||||
|
||||
if vim.g.neovide then
|
||||
require "config.neovide"
|
||||
end
|
||||
|
||||
-- Global
|
||||
-- vim.g.python3_host_prog = vim.fn.stdpath "config" .. "/.venv/bin/python"
|
||||
vim.g.loaded_ruby_provider = 0
|
||||
vim.g.loaded_perl_provider = 0
|
||||
|
||||
-- Keymaps
|
||||
require "config.keymaps"
|
102
lua/config/keymaps.lua
Normal file
102
lua/config/keymaps.lua
Normal file
|
@ -0,0 +1,102 @@
|
|||
vim.keymap.set("i", "jk", "<esc>")
|
||||
vim.keymap.set("n", "<leader>l", "<cmd>Lazy<CR>")
|
||||
vim.keymap.set("n", "<leader>m", "<cmd>Mason<CR>")
|
||||
vim.keymap.set("n", "<leader>s", "<cmd>Dashboard<CR>")
|
||||
vim.keymap.set("n", "<leader>z", "<cmd>ZenMode<CR>")
|
||||
vim.keymap.set("n", "<leader>gf", "<cmd>Neogit<CR>")
|
||||
vim.keymap.set("n", "<leader>gg", "<cmd>Neogit kind=split<CR>")
|
||||
vim.keymap.set("n", "<leader>cc", "<cmd>Neogit commit<CR>")
|
||||
vim.keymap.set("n", "<leader>gp", "<cmd>Neogit kind=split pull<CR>")
|
||||
vim.keymap.set("n", "<leader>gP", "<cmd>Neogit kind=split push<CR>")
|
||||
vim.keymap.set("n", "<leader>tt", "<cmd>ToggleTerm direction=horizontal<CR>")
|
||||
vim.keymap.set({ "n", "t" }, "<A-h>", "<CMD>NavigatorLeft<CR>")
|
||||
vim.keymap.set({ "n", "t" }, "<A-l>", "<CMD>NavigatorRight<CR>")
|
||||
vim.keymap.set({ "n", "t" }, "<A-k>", "<CMD>NavigatorUp<CR>")
|
||||
vim.keymap.set({ "n", "t" }, "<A-j>", "<CMD>NavigatorDown<CR>")
|
||||
vim.keymap.set({ "n", "t" }, "<A-p>", "<CMD>NavigatorPrevious<CR>")
|
||||
|
||||
-- Telescope
|
||||
vim.keymap.set("n", "<leader>;", "<cmd>Telescope builtin<cr>")
|
||||
vim.keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>")
|
||||
vim.keymap.set("n", "<leader>fg", "<cmd>Telescope live_grep<cr>")
|
||||
vim.keymap.set("n", "<leader>fb", "<cmd>Telescope buffers<cr>")
|
||||
vim.keymap.set("n", "<leader>fl", "<cmd>Telescope lsp_document_symbols<cr>")
|
||||
vim.keymap.set("n", "<leader>fe", "<cmd>Telescope diagnostics<cr>")
|
||||
vim.keymap.set("n", "<leader>fs", "<cmd>Telescope treesitter<cr>")
|
||||
vim.keymap.set("n", "<leader>fz", "<cmd>Telescope current_buffer_fuzzy_find<cr>")
|
||||
vim.keymap.set("n", "<leader>fp", "<cmd>Telescope projects<cr>")
|
||||
|
||||
-- Hop
|
||||
vim.keymap.set("n", "<leader>hw", "<cmd>HopWord<cr>")
|
||||
vim.keymap.set("n", "<leader>hl", "<cmd>HopLine<cr>")
|
||||
|
||||
-- Neotree
|
||||
vim.keymap.set("n", "<leader>nn", "<cmd>Neotree float reveal reveal_force_cwd<cr>")
|
||||
vim.keymap.set("n", "<leader>nb", "<cmd>Neotree toggle show buffers right<cr>")
|
||||
vim.keymap.set("n", "<leader>ns", "<cmd>Neotree float git_status<cr>")
|
||||
|
||||
-- Aerial
|
||||
vim.keymap.set("n", "<leader>a", "<cmd>AerialToggle!<CR>")
|
||||
|
||||
-- Trouble
|
||||
vim.keymap.set("n", "<leader>xx", "<cmd>TroubleToggle<cr>")
|
||||
vim.keymap.set("n", "<leader>xw", "<cmd>TroubleToggle workspace_diagnostics<cr>")
|
||||
vim.keymap.set("n", "<leader>xd", "<cmd>TroubleToggle document_diagnostics<cr>")
|
||||
vim.keymap.set("n", "<leader>xq", "<cmd>TroubleToggle quickfix<cr>")
|
||||
vim.keymap.set("n", "<leader>xl", "<cmd>TroubleToggle loclist<cr>")
|
||||
|
||||
-- nvim-test
|
||||
vim.keymap.set("n", "<leader>ts", "<cmd>TestSuite<cr>")
|
||||
vim.keymap.set("n", "<leader>tf", "<cmd>TestFile<cr>")
|
||||
vim.keymap.set("n", "<leader>te", "<cmd>TestEdit<cr>")
|
||||
vim.keymap.set("n", "<leader>tn", "<cmd>TestNearest<cr>")
|
||||
vim.keymap.set("n", "<leader>tl", "<cmd>TestLast<cr>")
|
||||
vim.keymap.set("n", "<leader>tv", "<cmd>TestVisit<cr>")
|
||||
vim.keymap.set("n", "<leader>ti", "<cmd>TestInfo<cr>")
|
||||
|
||||
-- barbar
|
||||
-- local map = vim.api.nvim_set_keymap
|
||||
local map = vim.keymap.set
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
-- Move to previous/next
|
||||
map('n', '<A-,>', '<Cmd>BufferPrevious<CR>', opts)
|
||||
map('n', '<A-.>', '<Cmd>BufferNext<CR>', opts)
|
||||
-- Re-order to previous/next
|
||||
map('n', '<A-<>', '<Cmd>BufferMovePrevious<CR>', opts)
|
||||
map('n', '<A->>', '<Cmd>BufferMoveNext<CR>', opts)
|
||||
-- Goto buffer in position...
|
||||
map('n', '<A-1>', '<Cmd>BufferGoto 1<CR>', opts)
|
||||
map('n', '<A-2>', '<Cmd>BufferGoto 2<CR>', opts)
|
||||
map('n', '<A-3>', '<Cmd>BufferGoto 3<CR>', opts)
|
||||
map('n', '<A-4>', '<Cmd>BufferGoto 4<CR>', opts)
|
||||
map('n', '<A-5>', '<Cmd>BufferGoto 5<CR>', opts)
|
||||
map('n', '<A-6>', '<Cmd>BufferGoto 6<CR>', opts)
|
||||
map('n', '<A-7>', '<Cmd>BufferGoto 7<CR>', opts)
|
||||
map('n', '<A-8>', '<Cmd>BufferGoto 8<CR>', opts)
|
||||
map('n', '<A-9>', '<Cmd>BufferGoto 9<CR>', opts)
|
||||
map('n', '<A-0>', '<Cmd>BufferLast<CR>', opts)
|
||||
-- Pin/unpin buffer
|
||||
map('n', '<A-p>', '<Cmd>BufferPin<CR>', opts)
|
||||
-- Close buffer
|
||||
map('n', '<A-c>', '<Cmd>BufferClose<CR>', opts)
|
||||
map('n', '<A-C>', '<Cmd>BufferCloseAllButCurrentOrPinned<CR>', opts)
|
||||
-- Wipeout buffer
|
||||
-- :BufferWipeout
|
||||
-- Close commands
|
||||
-- :BufferCloseAllButCurrent
|
||||
-- :BufferCloseAllButPinned
|
||||
-- :BufferCloseAllButCurrentOrPinned
|
||||
-- :BufferCloseBuffersLeft
|
||||
-- :BufferCloseBuffersRight
|
||||
-- Magic buffer-picking mode
|
||||
map('n', '<C-p>', '<Cmd>BufferPick<CR>', opts)
|
||||
-- Sort automatically by...
|
||||
map('n', '<Space>bb', '<Cmd>BufferOrderByBufferNumber<CR>', opts)
|
||||
map('n', '<Space>bd', '<Cmd>BufferOrderByDirectory<CR>', opts)
|
||||
map('n', '<Space>bl', '<Cmd>BufferOrderByLanguage<CR>', opts)
|
||||
map('n', '<Space>bw', '<Cmd>BufferOrderByWindowNumber<CR>', opts)
|
||||
|
||||
-- Other:
|
||||
-- :BarbarEnable - enables barbar (enabled by default)
|
||||
-- :BarbarDisable - very bad command, should never be used
|
49
lua/config/lazy.lua
Normal file
49
lua/config/lazy.lua
Normal file
|
@ -0,0 +1,49 @@
|
|||
return {
|
||||
root = vim.fn.stdpath "data" .. "/lazy",
|
||||
spec = "plugins",
|
||||
lockfile = vim.fn.stdpath "data" .. "/lazy-lock.json",
|
||||
dev = {
|
||||
path = "~/Projects/lua/nvim",
|
||||
},
|
||||
install = {
|
||||
colorscheme = { "catppuccin" },
|
||||
},
|
||||
ui = {
|
||||
border = "rounded",
|
||||
icons = {
|
||||
cmd = "⌘",
|
||||
config = "",
|
||||
event = "",
|
||||
ft = "",
|
||||
init = "",
|
||||
keys = "",
|
||||
plugin = "",
|
||||
runtime = "",
|
||||
source = "",
|
||||
start = "",
|
||||
task = "",
|
||||
lazy = " ",
|
||||
},
|
||||
},
|
||||
diff = {
|
||||
cmd = "diffview.nvim",
|
||||
},
|
||||
checker = {
|
||||
enabled = true,
|
||||
frequency = 3600,
|
||||
},
|
||||
performance = {
|
||||
rtp = {
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
"matchit",
|
||||
"matchparen",
|
||||
"netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
6
lua/config/neogit.lua
Normal file
6
lua/config/neogit.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
kind = "floating",
|
||||
integrations = {
|
||||
diffview = true,
|
||||
},
|
||||
}
|
29
lua/config/neotree.lua
Normal file
29
lua/config/neotree.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
return {
|
||||
close_if_last_window = true,
|
||||
use_popups_for_input = false,
|
||||
filesystem = {
|
||||
window = {
|
||||
mappings = {
|
||||
["Z"] = "expand_all_nodes",
|
||||
["<tab>"] = "toggle_node",
|
||||
},
|
||||
},
|
||||
filtered_items = {
|
||||
hide_dotfiles = false,
|
||||
},
|
||||
group_empty_dirs = true,
|
||||
hijack_netrw_behavior = "open_current",
|
||||
},
|
||||
buffers = {
|
||||
bind_to_cwd = true,
|
||||
follow_current_file = true,
|
||||
group_empty_dirs = true,
|
||||
},
|
||||
git_status = {
|
||||
group_empty_dirs = true,
|
||||
},
|
||||
source_selector = {
|
||||
winbar = true,
|
||||
statusline = false,
|
||||
},
|
||||
}
|
13
lua/config/neovide.lua
Normal file
13
lua/config/neovide.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
vim.opt.winblend = 50
|
||||
vim.opt.pumblend = 50
|
||||
|
||||
vim.g.neovide_padding_top = 5
|
||||
vim.g.neovide_padding_bottom = 5
|
||||
vim.g.neovide_padding_left = 5
|
||||
vim.g.neovide_padding_right = 5
|
||||
|
||||
vim.g.neovide_floating_blur_amount_x = 2.0
|
||||
vim.g.neovide_floating_blur_amount_y = 2.0
|
||||
|
||||
vim.g.neovide_hide_mouse_when_typing = true
|
||||
vim.g.neovide_remember_window_size = false
|
5
lua/config/notify.lua
Normal file
5
lua/config/notify.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
background_colour = "#000000",
|
||||
fps = 60,
|
||||
render = "default", -- "minimal", "simple"
|
||||
}
|
5
lua/config/nvim-autopairs.lua
Normal file
5
lua/config/nvim-autopairs.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
disable_in_macro = true,
|
||||
disable_in_visualblock = true,
|
||||
check_ts = true,
|
||||
}
|
1
lua/config/nvim-navic.lua
Normal file
1
lua/config/nvim-navic.lua
Normal file
|
@ -0,0 +1 @@
|
|||
return { highlight = true }
|
6
lua/config/nvim_test.lua
Normal file
6
lua/config/nvim_test.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
termOpts = {
|
||||
direction = "horizontal",
|
||||
keep_one = true,
|
||||
},
|
||||
}
|
5
lua/config/project.lua
Normal file
5
lua/config/project.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
ignore_lsp = { "efm", "null-ls" },
|
||||
show_hidden = true,
|
||||
silent_chdir = true,
|
||||
}
|
18
lua/config/telescope.lua
Normal file
18
lua/config/telescope.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
local trouble = require "trouble.providers.telescope"
|
||||
return {
|
||||
defaults = {
|
||||
layout_strategy = "flex",
|
||||
mappings = {
|
||||
i = { ["<c-t>"] = trouble.open_with_trouble },
|
||||
n = { ["<c-t>"] = trouble.open_with_trouble },
|
||||
},
|
||||
winblend = vim.o.winblend,
|
||||
},
|
||||
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
|
||||
},
|
||||
},
|
||||
}
|
32
lua/config/treesitter.lua
Normal file
32
lua/config/treesitter.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
return {
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "gnn",
|
||||
node_incremental = "gnr",
|
||||
scope_incremental = "gnc",
|
||||
node_decremental = "gnm",
|
||||
},
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
refactor = {
|
||||
smart_rename = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
smart_rename = "grr",
|
||||
},
|
||||
},
|
||||
navigation = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
goto_definition_lsp_fallback = "gnd",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
7
lua/config/trouble.lua
Normal file
7
lua/config/trouble.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
return {
|
||||
mode = "workspace_diagnostics",
|
||||
auto_open = false,
|
||||
auto_close = false,
|
||||
auto_preview = true,
|
||||
auto_jump = { "lsp_definitions", "lsp_references", "lsp_implementations" },
|
||||
}
|
4
lua/config/twilight.lua
Normal file
4
lua/config/twilight.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
context = 10,
|
||||
treesitter = true,
|
||||
}
|
23
lua/config/zen_mode.lua
Normal file
23
lua/config/zen_mode.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
return {
|
||||
window = {
|
||||
options = {
|
||||
signcolumn = "no", -- disable signcolumn
|
||||
number = false, -- disable number column
|
||||
relativenumber = false, -- disable relative numbers
|
||||
cursorline = false, -- disable cursorline
|
||||
cursorcolumn = false, -- disable cursor column
|
||||
foldcolumn = "0", -- disable fold column
|
||||
list = false, -- disable whitespace characters
|
||||
},
|
||||
},
|
||||
plugins = {
|
||||
options = {
|
||||
enabled = true,
|
||||
},
|
||||
twilight = { enabled = true },
|
||||
gitsigns = { enabled = true },
|
||||
tmux = { enabled = true },
|
||||
},
|
||||
on_open = function(win) vim.wo.scrolloff = 999 end,
|
||||
on_close = function(win) vim.wo.scrolloff = 0 end,
|
||||
}
|
23
lua/lsp/attach.lua
Normal file
23
lua/lsp/attach.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(_, bufnr)
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set("n", "gd", "<cmd>Trouble lsp_definitions<cr>", bufopts)
|
||||
vim.keymap.set("n", "gR", vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set("n", "gr", "<cmd>Trouble lsp_references<cr>", bufopts)
|
||||
vim.keymap.set("n", "gI", vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set("n", "gi", "<cmd>Trouble lsp_implementations<cr>", bufopts)
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set("n", "<leader>wr", vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set("n", "<leader>wl", function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, bufopts)
|
||||
vim.keymap.set("n", "<leader>D", vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set("n", "<leader>i", require "lsp.formatting", bufopts)
|
||||
end
|
||||
return on_attach
|
98
lua/lsp/cmp.lua
Normal file
98
lua/lsp/cmp.lua
Normal file
|
@ -0,0 +1,98 @@
|
|||
local cmp = require "cmp"
|
||||
local luasnip = require "luasnip"
|
||||
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
|
||||
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body) -- For `luasnip` users.
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
["<C-u>"] = cmp.mapping.scroll_docs(-4), -- Up
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(4), -- Down
|
||||
["<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()
|
||||
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" },
|
||||
},
|
||||
}
|
||||
|
||||
-- Set configuration for specific filetype.
|
||||
cmp.setup.filetype("python", {
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
},
|
||||
})
|
||||
|
||||
cmp.setup.filetype("nix", {
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
},
|
||||
})
|
||||
|
||||
cmp.setup.filetype("gitcommit", {
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "git" },
|
||||
{ name = "spell" },
|
||||
{ name = "commit" },
|
||||
{ name = "buffer" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "latex_symbols" },
|
||||
},
|
||||
})
|
||||
|
||||
cmp.setup.filetype("markdown", {
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "spell" },
|
||||
{ name = "buffer" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "latex_symbols" },
|
||||
},
|
||||
})
|
||||
|
||||
cmp.setup.cmdline("/", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "buffer" },
|
||||
},
|
||||
})
|
||||
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "path" },
|
||||
{ name = "cmdline" },
|
||||
},
|
||||
})
|
||||
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
39
lua/lsp/config.lua
Normal file
39
lua/lsp/config.lua
Normal file
|
@ -0,0 +1,39 @@
|
|||
local M = {}
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, opts)
|
||||
|
||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||
end
|
||||
|
||||
require("neodev").setup()
|
||||
|
||||
M.on_attach = require "lsp.attach"
|
||||
M.lsp_flags = require "lsp.flags"
|
||||
M.capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
local servers = { "jedi_language_server", "lua_ls", "rnix", "nil_ls", "fortls" }
|
||||
for _, name in ipairs(servers) do
|
||||
require("lspconfig")[name].setup {
|
||||
on_attach = M.on_attach,
|
||||
flags = M.lsp_flags,
|
||||
capabilities = M.capabilities,
|
||||
}
|
||||
end
|
||||
|
||||
require("null-ls").setup {
|
||||
sources = require "lsp.null_ls_sources",
|
||||
on_attach = M.on_attach,
|
||||
flags = M.lsp_flags,
|
||||
capabilities = M.capabilities,
|
||||
}
|
||||
|
||||
return M
|
5
lua/lsp/flags.lua
Normal file
5
lua/lsp/flags.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
local lsp_flags = {
|
||||
-- This is the default in Nvim 0.7+
|
||||
debounce_text_changes = 150,
|
||||
}
|
||||
return lsp_flags
|
11
lua/lsp/formatting.lua
Normal file
11
lua/lsp/formatting.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
local lsp_formatting = function(bufnr)
|
||||
vim.lsp.buf.format {
|
||||
bufnr = bufnr,
|
||||
timeout_ms = 2000,
|
||||
async = true,
|
||||
filter = function(client)
|
||||
return client.name ~= "jedi_language_server" and client.name ~= "lua_ls"
|
||||
end,
|
||||
}
|
||||
end
|
||||
return lsp_formatting
|
13
lua/lsp/null_ls_sources.lua
Normal file
13
lua/lsp/null_ls_sources.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local null_ls = require "null-ls"
|
||||
return {
|
||||
null_ls.builtins.code_actions.gitsigns,
|
||||
null_ls.builtins.diagnostics.zsh,
|
||||
null_ls.builtins.diagnostics.mypy,
|
||||
null_ls.builtins.diagnostics.ruff,
|
||||
null_ls.builtins.formatting.black,
|
||||
null_ls.builtins.formatting.isort,
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.formatting.prettier,
|
||||
null_ls.builtins.formatting.trim_whitespace,
|
||||
null_ls.builtins.hover.dictionary,
|
||||
}
|
17
lua/plugins/aerial.lua
Normal file
17
lua/plugins/aerial.lua
Normal file
|
@ -0,0 +1,17 @@
|
|||
return {
|
||||
"stevearc/aerial.nvim",
|
||||
name = "aerial",
|
||||
cmd = {
|
||||
"AerialOpen",
|
||||
"AerialOpenAll",
|
||||
"AerialNext",
|
||||
"AerialPrev",
|
||||
"AerialGo",
|
||||
"AerialInfo",
|
||||
"AerialToggle",
|
||||
},
|
||||
config = function()
|
||||
require("aerial").setup(require "config.aerial")
|
||||
vim.keymap.set("n", "<leader>fa", "<cmd>Telescope aerial<cr>")
|
||||
end,
|
||||
}
|
9
lua/plugins/barbar.lua
Normal file
9
lua/plugins/barbar.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
"romgrk/barbar.nvim",
|
||||
dependencies = "nvim-tree/nvim-web-devicons",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
init = function() vim.g.barbar_auto_setup = false end,
|
||||
config = true,
|
||||
opts = require "config.barbar",
|
||||
version = "^1.0.0", -- optional: only update when a new 1.x version is released
|
||||
}
|
12
lua/plugins/barbecue.lua
Normal file
12
lua/plugins/barbecue.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
return {
|
||||
"utilyre/barbecue.nvim",
|
||||
name = "barbecue",
|
||||
version = "*",
|
||||
dependencies = {
|
||||
"SmiteshP/nvim-navic",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
-- opts = require "config.barbecue",
|
||||
config = function() require("barbecue").setup(require "config.barbecue") end,
|
||||
}
|
14
lua/plugins/catppuccin.lua
Normal file
14
lua/plugins/catppuccin.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
return {
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
init = function()
|
||||
vim.opt.termguicolors = true
|
||||
require "ui.fillchars"
|
||||
end,
|
||||
config = function()
|
||||
require("catppuccin").setup(require "config.catppuccin")
|
||||
vim.cmd.colorscheme "catppuccin"
|
||||
end,
|
||||
}
|
9
lua/plugins/diffview.lua
Normal file
9
lua/plugins/diffview.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
"sindrets/diffview.nvim",
|
||||
dependencies = { "nvim-lua/plenary.nvim", "nvim-tree/nvim-web-devicons" },
|
||||
cmd = {
|
||||
"DiffviewFileHistory",
|
||||
"DiffviewOpen",
|
||||
},
|
||||
config = function() require("diffview").setup(require "config.diffview") end,
|
||||
}
|
9
lua/plugins/direnv.lua
Normal file
9
lua/plugins/direnv.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
"https://github.com/direnv/direnv.vim.git",
|
||||
name = "direnv.vim",
|
||||
lazy = false,
|
||||
config = function()
|
||||
vim.g.direnv_auto = 1
|
||||
vim.g.direnv_silent_load = 1
|
||||
end,
|
||||
}
|
1
lua/plugins/dressing.lua
Normal file
1
lua/plugins/dressing.lua
Normal file
|
@ -0,0 +1 @@
|
|||
return { "stevearc/dressing.nvim" }
|
6
lua/plugins/feline.lua
Normal file
6
lua/plugins/feline.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
"feline-nvim/feline.nvim",
|
||||
dependencies = { require "plugins.catppuccin" },
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function() require("feline").setup(require "config.feline") end,
|
||||
}
|
5
lua/plugins/fugitive.lua
Normal file
5
lua/plugins/fugitive.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
"tpope/vim-fugitive",
|
||||
cmd = { "G", "Git" },
|
||||
lazy = true,
|
||||
}
|
5
lua/plugins/gitsigns.lua
Normal file
5
lua/plugins/gitsigns.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function() require("gitsigns").setup(require "config.gitsigns") end,
|
||||
}
|
5
lua/plugins/hop.lua
Normal file
5
lua/plugins/hop.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
'phaazon/hop.nvim',
|
||||
cmd = {"HopWord", "HopLine"},
|
||||
config = true,
|
||||
}
|
5
lua/plugins/indent_blankline.lua
Normal file
5
lua/plugins/indent_blankline.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function() require("indent_blankline").setup(require "config.indent_blankline") end,
|
||||
}
|
3
lua/plugins/init.lua
Normal file
3
lua/plugins/init.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
{ "folke/lazy.nvim", cmd = "Lazy" },
|
||||
}
|
41
lua/plugins/lspconfig.lua
Normal file
41
lua/plugins/lspconfig.lua
Normal file
|
@ -0,0 +1,41 @@
|
|||
return {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
cmd = {
|
||||
"LspLog",
|
||||
"LspStop",
|
||||
"LspStart",
|
||||
"LspRestart",
|
||||
"LspInfo",
|
||||
},
|
||||
dependencies = {
|
||||
{ "hrsh7th/nvim-cmp" },
|
||||
{ "rafamadriz/friendly-snippets" },
|
||||
{ "windwp/nvim-autopairs" },
|
||||
},
|
||||
config = function()
|
||||
require "lsp.config"
|
||||
require "lsp.cmp"
|
||||
end,
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
{ "hrsh7th/cmp-nvim-lsp" },
|
||||
{ "hrsh7th/cmp-buffer" },
|
||||
{ "hrsh7th/cmp-path" },
|
||||
{ "hrsh7th/cmp-cmdline" },
|
||||
{ "f3fora/cmp-spell" },
|
||||
{ "petertriho/cmp-git" },
|
||||
{ "Dosx001/cmp-commit" },
|
||||
{ "kdheepak/cmp-latex-symbols" },
|
||||
{ "L3MON4D3/LuaSnip" },
|
||||
{ "saadparwaiz1/cmp_luasnip" },
|
||||
},
|
||||
cmd = "CmpStatus",
|
||||
},
|
||||
{ "jose-elias-alvarez/null-ls.nvim", dependencies = { "neovim/nvim-lspconfig" }, lazy = true },
|
||||
{ "mfussenegger/nvim-dap", dependencies = { "neovim/nvim-lspconfig" }, lazy = true },
|
||||
{ "folke/neodev.nvim", dependencies = { "neovim/nvim-lspconfig", "hrsh7th/nvim-cmp" }, lazy = true },
|
||||
}
|
11
lua/plugins/navigator.lua
Normal file
11
lua/plugins/navigator.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
return {
|
||||
"numToStr/Navigator.nvim",
|
||||
cmd = {
|
||||
"NavigatorUp",
|
||||
"NavigatorDown",
|
||||
"NavigatorLeft",
|
||||
"NavigatorRight",
|
||||
"NavigatorPrevious",
|
||||
},
|
||||
config = function() require("Navigator").setup() end,
|
||||
}
|
9
lua/plugins/neogit.lua
Normal file
9
lua/plugins/neogit.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
"TimUntersberger/neogit",
|
||||
config = function() require("neogit").setup(require "config.neogit") end,
|
||||
cmd = "Neogit",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"sindrets/diffview.nvim",
|
||||
},
|
||||
}
|
17
lua/plugins/neotree.lua
Normal file
17
lua/plugins/neotree.lua
Normal file
|
@ -0,0 +1,17 @@
|
|||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v2.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
cmd = "NeoTree",
|
||||
event = { "BufEnter" },
|
||||
init = function()
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
vim.g.neo_tree_remove_legacy_commands = 1
|
||||
end,
|
||||
config = function() require("neo-tree").setup(require "config.neotree") end,
|
||||
}
|
7
lua/plugins/notify.lua
Normal file
7
lua/plugins/notify.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
return {
|
||||
"rcarriga/nvim-notify",
|
||||
config = function()
|
||||
require("notify").setup(require "config.notify")
|
||||
vim.notify = require "notify"
|
||||
end,
|
||||
}
|
9
lua/plugins/nvim_autopairs.lua
Normal file
9
lua/plugins/nvim_autopairs.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
lazy = true,
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"hrsh7th/nvim-cmp",
|
||||
},
|
||||
config = function() require("nvim-autopairs").setup(require "config.nvim-autopairs") end,
|
||||
}
|
6
lua/plugins/nvim_navic.lua
Normal file
6
lua/plugins/nvim_navic.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
"SmiteshP/nvim-navic",
|
||||
dependencies = "neovim/nvim-lspconfig",
|
||||
lazy = true,
|
||||
opts = require "config.nvim-navic",
|
||||
}
|
13
lua/plugins/nvim_test.lua
Normal file
13
lua/plugins/nvim_test.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
return {
|
||||
"klen/nvim-test",
|
||||
cmd = {
|
||||
"TestFile",
|
||||
"TestEdit",
|
||||
"TestNearest",
|
||||
"TestLast",
|
||||
"TestVisit",
|
||||
"TestInfo",
|
||||
"TestSuite",
|
||||
},
|
||||
config = function() require("nvim-test").setup(require "config.nvim_test") end,
|
||||
}
|
5
lua/plugins/project.lua
Normal file
5
lua/plugins/project.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
"ahmedkhalf/project.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function() require("project_nvim").setup(require "config.project") end,
|
||||
}
|
46
lua/plugins/telescope.lua
Normal file
46
lua/plugins/telescope.lua
Normal file
|
@ -0,0 +1,46 @@
|
|||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
branch = "0.1.x",
|
||||
cmd = "Telescope",
|
||||
config = function()
|
||||
require("telescope").setup(require "config.telescope")
|
||||
require("telescope").load_extension "fzf"
|
||||
require("telescope").load_extension "lazy"
|
||||
require("telescope").load_extension "luasnip"
|
||||
require("telescope").load_extension "git_diffs"
|
||||
require("telescope").load_extension "command_center"
|
||||
require("telescope").load_extension "http"
|
||||
require("telescope").load_extension "advanced_git_search"
|
||||
require("telescope").load_extension "projects"
|
||||
end,
|
||||
dependencies = {
|
||||
{
|
||||
"nvim-lua/plenary.nvim",
|
||||
{
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
build = "make",
|
||||
},
|
||||
{
|
||||
"tsakirist/telescope-lazy.nvim",
|
||||
dependencies = { "folke/lazy.nvim" },
|
||||
},
|
||||
{
|
||||
"benfowler/telescope-luasnip.nvim",
|
||||
dependencies = { "L3MON4D3/LuaSnip" },
|
||||
},
|
||||
{
|
||||
"paopaol/telescope-git-diffs.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"sindrets/diffview.nvim",
|
||||
},
|
||||
},
|
||||
"FeiyouG/command_center.nvim",
|
||||
{
|
||||
"barrett-ruth/telescope-http.nvim",
|
||||
dependencies = { "savq/paq-nvim" },
|
||||
},
|
||||
"aaronhallaert/advanced-git-search.nvim",
|
||||
},
|
||||
},
|
||||
}
|
6
lua/plugins/toggleterm.lua
Normal file
6
lua/plugins/toggleterm.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
"akinsho/toggleterm.nvim",
|
||||
version = "*",
|
||||
config = true,
|
||||
cmd = { "ToggleTerm" },
|
||||
}
|
16
lua/plugins/treesitter.lua
Normal file
16
lua/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
cmd = {
|
||||
"TSToggle",
|
||||
"TSBufEnable",
|
||||
"TSBufToggle",
|
||||
"TSInstall",
|
||||
"TSUpdate",
|
||||
"TSEnable",
|
||||
},
|
||||
config = function() require("nvim-treesitter.configs").setup(require "config.treesitter") end,
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter-refactor",
|
||||
},
|
||||
}
|
6
lua/plugins/trouble.lua
Normal file
6
lua/plugins/trouble.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
"folke/trouble.nvim",
|
||||
dependencies = "nvim-tree/nvim-web-devicons",
|
||||
cmd = "TroubleToggle",
|
||||
config = function() require("trouble").setup(require "config.trouble") end,
|
||||
}
|
8
lua/plugins/which_key.lua
Normal file
8
lua/plugins/which_key.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
"folke/which-key.nvim",
|
||||
config = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
require("which-key").setup {}
|
||||
end,
|
||||
}
|
13
lua/plugins/zen_mode.lua
Normal file
13
lua/plugins/zen_mode.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
return {
|
||||
"folke/zen-mode.nvim",
|
||||
cmd = "ZenMode",
|
||||
config = function() require("zen-mode").setup(require "config.zen_mode") end,
|
||||
dependencies = {
|
||||
"folke/twilight.nvim",
|
||||
cmd = "Twilight",
|
||||
config = function() require("twilight").setup(require "config.twilight") end,
|
||||
dependencies = {
|
||||
"nvim-treesitter",
|
||||
},
|
||||
},
|
||||
}
|
478
lua/ui/feline_components.lua
Normal file
478
lua/ui/feline_components.lua
Normal file
|
@ -0,0 +1,478 @@
|
|||
local M = {}
|
||||
|
||||
local C = require("catppuccin.palettes").get_palette()
|
||||
local lsp = require "feline.providers.lsp"
|
||||
|
||||
local assets = {
|
||||
left_separator = "",
|
||||
right_separator = "",
|
||||
mode_icon = "",
|
||||
dir = "",
|
||||
file = "",
|
||||
lsp = {
|
||||
server = "",
|
||||
error = "",
|
||||
warning = "",
|
||||
info = "",
|
||||
hint = "",
|
||||
},
|
||||
git = {
|
||||
branch = "",
|
||||
added = "",
|
||||
changed = "",
|
||||
removed = "",
|
||||
},
|
||||
}
|
||||
|
||||
local sett = {
|
||||
text = C.surface0,
|
||||
bkg = C.surface0,
|
||||
diffs = C.mauve,
|
||||
extras = C.overlay1,
|
||||
curr_file = C.maroon,
|
||||
curr_dir = C.flamingo,
|
||||
show_modified = false,
|
||||
}
|
||||
|
||||
if require("catppuccin").flavour == "latte" then
|
||||
local latte = require("catppuccin.palettes").get_palette "latte"
|
||||
sett.text = latte.base
|
||||
sett.bkg = latte.crust
|
||||
end
|
||||
|
||||
if require("catppuccin").options.transparent_background then sett.bkg = "NONE" end
|
||||
|
||||
local mode_colors = {
|
||||
["n"] = { "NORMAL", C.lavender },
|
||||
["no"] = { "N-PENDING", C.lavender },
|
||||
["i"] = { "INSERT", C.green },
|
||||
["ic"] = { "INSERT", C.green },
|
||||
["t"] = { "TERMINAL", C.green },
|
||||
["v"] = { "VISUAL", C.flamingo },
|
||||
["V"] = { "V-LINE", C.flamingo },
|
||||
[""] = { "V-BLOCK", C.flamingo },
|
||||
["R"] = { "REPLACE", C.maroon },
|
||||
["Rv"] = { "V-REPLACE", C.maroon },
|
||||
["s"] = { "SELECT", C.maroon },
|
||||
["S"] = { "S-LINE", C.maroon },
|
||||
[""] = { "S-BLOCK", C.maroon },
|
||||
["c"] = { "COMMAND", C.peach },
|
||||
["cv"] = { "COMMAND", C.peach },
|
||||
["ce"] = { "COMMAND", C.peach },
|
||||
["r"] = { "PROMPT", C.teal },
|
||||
["rm"] = { "MORE", C.teal },
|
||||
["r?"] = { "CONFIRM", C.mauve },
|
||||
["!"] = { "SHELL", C.green },
|
||||
}
|
||||
|
||||
function M.setup(opts)
|
||||
if opts then
|
||||
opts.assets = opts.assets or {}
|
||||
opts.sett = opts.sett or {}
|
||||
opts.mode_colors = opts.mode_colors or {}
|
||||
else
|
||||
opts = {}
|
||||
end
|
||||
assets = vim.tbl_deep_extend("force", assets, opts.assets)
|
||||
sett = vim.tbl_deep_extend("force", sett, opts.sett)
|
||||
mode_colors = vim.tbl_deep_extend("force", mode_colors, opts.mode_colors)
|
||||
end
|
||||
|
||||
function M.get()
|
||||
local shortline = false
|
||||
|
||||
local components = {
|
||||
active = { {}, {} }, -- left, right
|
||||
inactive = { {} },
|
||||
}
|
||||
|
||||
local function is_enabled(min_width)
|
||||
if shortline then return true end
|
||||
|
||||
return vim.api.nvim_win_get_width(0) > min_width
|
||||
end
|
||||
|
||||
-- global components
|
||||
local invi_sep = {
|
||||
str = " ",
|
||||
hl = {
|
||||
fg = sett.bkg,
|
||||
bg = sett.bkg,
|
||||
},
|
||||
}
|
||||
|
||||
-- helpers
|
||||
local function any_git_changes()
|
||||
local gst = vim.b.gitsigns_status_dict -- git stats
|
||||
if gst then
|
||||
if
|
||||
gst["added"] and gst["added"] > 0
|
||||
or gst["removed"] and gst["removed"] > 0
|
||||
or gst["changed"] and gst["changed"] > 0
|
||||
then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- #################### STATUSLINE ->
|
||||
|
||||
-- ######## Left
|
||||
|
||||
-- Current vi mode ------>
|
||||
local vi_mode_hl = function()
|
||||
return {
|
||||
fg = sett.text,
|
||||
bg = mode_colors[vim.fn.mode()][2],
|
||||
style = "bold",
|
||||
}
|
||||
end
|
||||
|
||||
components.active[1][1] = {
|
||||
provider = " " .. assets.mode_icon .. " ",
|
||||
hl = function()
|
||||
return {
|
||||
fg = sett.text,
|
||||
bg = mode_colors[vim.fn.mode()][2],
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
||||
components.active[1][2] = {
|
||||
provider = function() return mode_colors[vim.fn.mode()][1] .. " " end,
|
||||
hl = vi_mode_hl,
|
||||
}
|
||||
|
||||
-- there is a dilema: we need to hide Diffs if ther is no git info. We can do that, but this will
|
||||
-- leave the right_separator colored with purple, and since we can't change the color conditonally
|
||||
-- then the solution is to create two right_separators: one with a mauve sett.bkg and the other one normal
|
||||
-- sett.bkg; both have the same fg (vi mode). The mauve one appears if there is git info, else the one with
|
||||
-- the normal sett.bkg appears. Fixed :)
|
||||
|
||||
-- enable if git diffs are not available
|
||||
components.active[1][3] = {
|
||||
provider = assets.right_separator,
|
||||
hl = function()
|
||||
return {
|
||||
fg = mode_colors[vim.fn.mode()][2],
|
||||
bg = sett.bkg,
|
||||
}
|
||||
end,
|
||||
enabled = function() return not any_git_changes() end,
|
||||
}
|
||||
|
||||
-- enable if git diffs are available
|
||||
components.active[1][4] = {
|
||||
provider = assets.right_separator,
|
||||
hl = function()
|
||||
return {
|
||||
fg = mode_colors[vim.fn.mode()][2],
|
||||
bg = sett.diffs,
|
||||
}
|
||||
end,
|
||||
enabled = function() return any_git_changes() end,
|
||||
}
|
||||
-- Current vi mode ------>
|
||||
|
||||
-- Diffs ------>
|
||||
components.active[1][5] = {
|
||||
provider = "git_diff_added",
|
||||
hl = {
|
||||
fg = sett.text,
|
||||
bg = sett.diffs,
|
||||
},
|
||||
icon = " " .. assets.git.added .. " ",
|
||||
}
|
||||
|
||||
components.active[1][6] = {
|
||||
provider = "git_diff_changed",
|
||||
hl = {
|
||||
fg = sett.text,
|
||||
bg = sett.diffs,
|
||||
},
|
||||
icon = " " .. assets.git.changed .. " ",
|
||||
}
|
||||
|
||||
components.active[1][7] = {
|
||||
provider = "git_diff_removed",
|
||||
hl = {
|
||||
fg = sett.text,
|
||||
bg = sett.diffs,
|
||||
},
|
||||
icon = " " .. assets.git.removed .. " ",
|
||||
}
|
||||
|
||||
components.active[1][8] = {
|
||||
provider = " ",
|
||||
hl = {
|
||||
fg = sett.bkg,
|
||||
bg = sett.diffs,
|
||||
},
|
||||
enabled = function() return any_git_changes() end,
|
||||
}
|
||||
|
||||
components.active[1][9] = {
|
||||
provider = assets.right_separator,
|
||||
hl = {
|
||||
fg = sett.diffs,
|
||||
bg = sett.bkg,
|
||||
},
|
||||
enabled = function() return any_git_changes() end,
|
||||
}
|
||||
-- Diffs ------>
|
||||
|
||||
-- Extras ------>
|
||||
|
||||
-- file progess
|
||||
components.active[1][10] = {
|
||||
provider = function()
|
||||
local current_line = vim.fn.line "."
|
||||
local total_line = vim.fn.line "$"
|
||||
|
||||
if current_line == 1 then
|
||||
return "Top"
|
||||
elseif current_line == vim.fn.line "$" then
|
||||
return "Bot"
|
||||
end
|
||||
local result, _ = math.modf((current_line / total_line) * 100)
|
||||
return result .. "%%"
|
||||
end,
|
||||
-- enabled = shortline or function(winid)
|
||||
-- return vim.api.nvim_win_get_width(winid) > 90
|
||||
-- end,
|
||||
hl = {
|
||||
fg = sett.extras,
|
||||
bg = sett.bkg,
|
||||
},
|
||||
left_sep = invi_sep,
|
||||
}
|
||||
|
||||
-- position
|
||||
components.active[1][11] = {
|
||||
provider = "position",
|
||||
-- enabled = shortline or function(winid)
|
||||
-- return vim.api.nvim_win_get_width(winid) > 90
|
||||
-- end,
|
||||
hl = {
|
||||
fg = sett.extras,
|
||||
bg = sett.bkg,
|
||||
},
|
||||
left_sep = invi_sep,
|
||||
}
|
||||
|
||||
-- macro
|
||||
components.active[1][12] = {
|
||||
provider = "macro",
|
||||
enabled = function() return vim.api.nvim_get_option "cmdheight" == 0 end,
|
||||
hl = {
|
||||
fg = sett.extras,
|
||||
bg = sett.bkg,
|
||||
},
|
||||
left_sep = invi_sep,
|
||||
}
|
||||
|
||||
-- search count
|
||||
components.active[1][13] = {
|
||||
provider = "search_count",
|
||||
enabled = function() return vim.api.nvim_get_option "cmdheight" == 0 end,
|
||||
hl = {
|
||||
fg = sett.extras,
|
||||
bg = sett.bkg,
|
||||
},
|
||||
left_sep = invi_sep,
|
||||
}
|
||||
-- Extras ------>
|
||||
|
||||
-- ######## Left
|
||||
-- treesitter position
|
||||
-- components.active[1][14] = {
|
||||
-- provider = function()
|
||||
-- -- if not require("vim.treesitter.language").require_language("lua") then
|
||||
-- -- return ""
|
||||
-- -- end
|
||||
-- local pos = require("nvim-treesitter").statusline {
|
||||
-- indicator_size = 50,
|
||||
-- transform_fn = function(line) return line:gsub("%s*[%[%(%{]+.*$", "") end,
|
||||
-- }
|
||||
-- if pos and pos ~= "" then return pos end
|
||||
-- return ""
|
||||
-- end,
|
||||
-- hl = {
|
||||
-- fg = sett.extras,
|
||||
-- bg = sett.bkg,
|
||||
-- },
|
||||
-- left_sep = invi_sep,
|
||||
-- }
|
||||
|
||||
-- ######## Right
|
||||
|
||||
-- Diagnostics ------>
|
||||
-- workspace loader
|
||||
components.active[2][1] = {
|
||||
provider = function()
|
||||
local Lsp = vim.lsp.util.get_progress_messages()[1]
|
||||
|
||||
if Lsp then
|
||||
local msg = Lsp.message or ""
|
||||
local percentage = Lsp.percentage
|
||||
if not percentage then return "" end
|
||||
local title = Lsp.title or ""
|
||||
local spinners = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
}
|
||||
local success_icon = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
}
|
||||
local ms = vim.loop.hrtime() / 1000000
|
||||
local frame = math.floor(ms / 120) % #spinners
|
||||
|
||||
if percentage >= 70 then
|
||||
return string.format(" %%<%s %s %s (%s%%%%) ", success_icon[frame + 1], title, msg, percentage)
|
||||
end
|
||||
|
||||
return string.format(" %%<%s %s %s (%s%%%%) ", spinners[frame + 1], title, msg, percentage)
|
||||
end
|
||||
|
||||
return ""
|
||||
end,
|
||||
enabled = is_enabled(80),
|
||||
hl = {
|
||||
fg = sett.extras,
|
||||
bg = sett.bkg,
|
||||
},
|
||||
right_sep = invi_sep,
|
||||
}
|
||||
|
||||
components.active[2][2] = {
|
||||
provider = "git_branch",
|
||||
enabled = is_enabled(70),
|
||||
hl = {
|
||||
fg = sett.extras,
|
||||
bg = sett.bkg,
|
||||
},
|
||||
icon = assets.git.branch .. " ",
|
||||
right_sep = invi_sep,
|
||||
}
|
||||
|
||||
components.active[2][3] = {
|
||||
provider = function()
|
||||
if next(vim.lsp.buf_get_clients()) ~= nil then
|
||||
return assets.lsp.server .. " " .. "Lsp"
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end,
|
||||
hl = {
|
||||
fg = sett.extras,
|
||||
bg = sett.bkg,
|
||||
},
|
||||
right_sep = invi_sep,
|
||||
}
|
||||
|
||||
-- genral diagnostics (errors, warnings. info and hints)
|
||||
components.active[2][4] = {
|
||||
provider = "diagnostic_errors",
|
||||
enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.ERROR) end,
|
||||
|
||||
hl = {
|
||||
fg = C.red,
|
||||
bg = sett.bkg,
|
||||
},
|
||||
icon = " " .. assets.lsp.error .. " ",
|
||||
right_sep = invi_sep,
|
||||
}
|
||||
|
||||
components.active[2][5] = {
|
||||
provider = "diagnostic_warnings",
|
||||
enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.WARN) end,
|
||||
hl = {
|
||||
fg = C.yellow,
|
||||
bg = sett.bkg,
|
||||
},
|
||||
icon = " " .. assets.lsp.warning .. " ",
|
||||
right_sep = invi_sep,
|
||||
}
|
||||
|
||||
components.active[2][6] = {
|
||||
provider = "diagnostic_info",
|
||||
enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.INFO) end,
|
||||
hl = {
|
||||
fg = C.sky,
|
||||
bg = sett.bkg,
|
||||
},
|
||||
icon = " " .. assets.lsp.info .. " ",
|
||||
right_sep = invi_sep,
|
||||
}
|
||||
|
||||
components.active[2][7] = {
|
||||
provider = "diagnostic_hints",
|
||||
enabled = function() return lsp.diagnostics_exist(vim.diagnostic.severity.HINT) end,
|
||||
hl = {
|
||||
fg = C.rosewater,
|
||||
bg = sett.bkg,
|
||||
},
|
||||
icon = " " .. assets.lsp.hint .. " ",
|
||||
right_sep = invi_sep,
|
||||
}
|
||||
-- Diagnostics ------>
|
||||
|
||||
components.active[2][8] = {
|
||||
provider = function()
|
||||
local filename = vim.fn.expand "%:t"
|
||||
local extension = vim.fn.expand "%:e"
|
||||
local present, icons = pcall(require, "nvim-web-devicons")
|
||||
local icon = present and icons.get_icon(filename, extension) or assets.file
|
||||
return (sett.show_modified and "%m" or "") .. " " .. icon .. " " .. filename .. " "
|
||||
end,
|
||||
enabled = is_enabled(70),
|
||||
hl = {
|
||||
fg = sett.text,
|
||||
bg = sett.curr_file,
|
||||
},
|
||||
left_sep = {
|
||||
str = assets.left_separator,
|
||||
hl = {
|
||||
fg = sett.curr_file,
|
||||
bg = sett.bkg,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
components.active[2][9] = {
|
||||
provider = function()
|
||||
local dir_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
|
||||
return " " .. assets.dir .. " " .. dir_name .. " "
|
||||
end,
|
||||
enabled = is_enabled(80),
|
||||
hl = {
|
||||
fg = sett.text,
|
||||
bg = sett.curr_dir,
|
||||
},
|
||||
left_sep = {
|
||||
str = assets.left_separator,
|
||||
hl = {
|
||||
fg = sett.curr_dir,
|
||||
bg = sett.curr_file,
|
||||
},
|
||||
},
|
||||
}
|
||||
-- ######## Right
|
||||
|
||||
-- Inanctive components
|
||||
components.inactive[1][1] = {
|
||||
provider = function() return " " .. string.upper(vim.bo.ft) .. " " end,
|
||||
hl = {
|
||||
fg = C.overlay2,
|
||||
bg = C.mantle,
|
||||
},
|
||||
}
|
||||
|
||||
return components
|
||||
end
|
||||
|
||||
return M
|
9
lua/ui/fillchars.lua
Normal file
9
lua/ui/fillchars.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
vim.opt.fillchars:append {
|
||||
horiz = "━",
|
||||
horizup = "┻",
|
||||
horizdown = "┳",
|
||||
vert = "┃",
|
||||
vertleft = "┨",
|
||||
vertright = "┣",
|
||||
verthoriz = "╋",
|
||||
}
|
Loading…
Reference in a new issue