ref(nvim): refactored config structure

This commit is contained in:
Léana 江 2023-04-04 00:50:57 +02:00
parent 76a64639a2
commit 7bbf5ee03b
29 changed files with 23 additions and 81 deletions

View file

@ -1,87 +0,0 @@
local auto_dark_mode = require "auto-dark-mode"
Set_light_mode = function()
vim.api.nvim_create_autocmd(
"ColorScheme",
{
callback = function()
-- LSP window border color
vim.cmd("highlight NormalFloat guibg=white")
vim.cmd("highlight FloatBorder guifg=black guibg=white")
-- Tune virtual text colors
-- vim.cmd ("highlight DiagnosticError gui=bold")
-- vim.cmd ("highlight DiagnosticWarn gui=italic")
-- vim.cmd ("highlight DiagnosticInfo guibg=black guibg=italic")
-- vim.cmd ("highlight DiagnosticHint guibg=black")
-- TreesitterContext border
vim.cmd("highlight TreesitterContext guibg=#EEEEEE")
vim.cmd("highlight TreesitterContextBottom guibg=#EEEEEE gui=underline guisp=Grey")
-- Diff colors override
vim.cmd("highlight DiffAdd guibg=#f0f0f0")
vim.cmd("highlight DiffChange guibg=#f0f0f0")
vim.cmd("highlight DiffDelete guibg=#f0f0f0")
vim.cmd("highlight DiffText guibg=#f0f0f0")
vim.cmd("highlight DiffAdded guibg=#f0f0f0")
vim.cmd("highlight DiffFile guibg=#f0f0f0")
vim.cmd("highlight DiffNewFile guibg=#f0f0f0")
vim.cmd("highlight DiffLine guibg=#f0f0f0")
vim.cmd("highlight DiffRemoved guibg=#f0f0f0")
end,
group = vim.api.nvim_create_augroup("MyColorOverride", { clear = true }),
pattern = '*',
}
)
vim.o.background = "light"
end
Set_dark_mode = function()
vim.api.nvim_create_autocmd(
"ColorScheme",
{
callback = function()
-- LSP window border color
vim.cmd "highlight NormalFloat guibg=black"
vim.cmd "highlight FloatBorder guifg=white guibg=black"
-- Tune virtual text colors
-- vim.cmd "highlight DiagnosticError gui=bold"
-- vim.cmd "highlight DiagnosticWarn gui=italic"
-- vim.cmd "highlight DiagnosticInfo guifg=white guibg=black"
-- vim.cmd "highlight DiagnosticHint guifg=white guibg=black"
-- TreesitterContext border
vim.cmd "highlight TreesitterContext guibg=#555555"
vim.cmd "highlight TreesitterContextBottom guibg=#555555 gui=underline guisp=LightGrey"
-- Diff colors override
vim.cmd("highlight DiffAdd guibg=#303030")
vim.cmd("highlight DiffChange guibg=#303030")
vim.cmd("highlight DiffDelete guibg=#303030")
vim.cmd("highlight DiffText guibg=#303030")
vim.cmd("highlight DiffAdded guibg=#303030")
vim.cmd("highlight DiffFile guibg=#303030")
vim.cmd("highlight DiffNewFile guibg=#303030")
vim.cmd("highlight DiffLine guibg=#303030")
vim.cmd("highlight DiffRemoved guibg=#303030")
end,
group = vim.api.nvim_create_augroup("MyColorOverride", { clear = true }),
pattern = '*',
}
)
vim.o.background = "dark"
end
-- Use light by default
Set_light_mode()
auto_dark_mode.setup({
update_interval = 5000,
set_light_mode = Set_light_mode,
set_dark_mode = Set_dark_mode,
})
auto_dark_mode.init()

View file

@ -1 +0,0 @@
require('Comment').setup()

View file

@ -1,253 +0,0 @@
local actions = require("diffview.actions")
require("diffview").setup({
diff_binaries = false, -- Show diffs for binaries
enhanced_diff_hl = false, -- See ':h diffview-config-enhanced_diff_hl'
git_cmd = { "git" }, -- The git executable followed by default args.
hg_cmd = { "hg" }, -- The hg executable followed by default args.
use_icons = true, -- Requires nvim-web-devicons
show_help_hints = true, -- Show hints for how to open the help panel
watch_index = true, -- Update views and index buffers when the git index changes.
icons = {
-- Only applies when use_icons is true.
folder_closed = "",
folder_open = "",
},
signs = {
fold_closed = "",
fold_open = "",
done = "",
},
view = {
-- Configure the layout and behavior of different types of views.
-- Available layouts:
-- 'diff1_plain'
-- |'diff2_horizontal'
-- |'diff2_vertical'
-- |'diff3_horizontal'
-- |'diff3_vertical'
-- |'diff3_mixed'
-- |'diff4_mixed'
-- For more info, see ':h diffview-config-view.x.layout'.
default = {
-- Config for changed files, and staged files in diff views.
layout = "diff2_horizontal",
winbar_info = false, -- See ':h diffview-config-view.x.winbar_info'
},
merge_tool = {
-- Config for conflicted files in diff views during a merge or rebase.
layout = "diff3_horizontal",
disable_diagnostics = true, -- Temporarily disable diagnostics for conflict buffers while in the view.
winbar_info = true, -- See ':h diffview-config-view.x.winbar_info'
},
file_history = {
-- Config for changed files in file history views.
layout = "diff2_horizontal",
winbar_info = false, -- See ':h diffview-config-view.x.winbar_info'
},
},
file_panel = {
listing_style = "list", -- One of 'list' or 'tree'
tree_options = {
-- Only applies when listing_style is 'tree'
flatten_dirs = true, -- Flatten dirs that only contain one single dir
folder_statuses = "only_folded", -- One of 'never', 'only_folded' or 'always'.
},
win_config = {
-- See ':h diffview-config-win_config'
position = "left",
width = 35,
win_opts = {}
},
},
file_history_panel = {
log_options = {
-- See ':h diffview-config-log_options'
git = {
single_file = {
diff_merges = "combined",
},
multi_file = {
diff_merges = "first-parent",
},
},
hg = {
single_file = {},
multi_file = {},
},
},
win_config = {
-- See ':h diffview-config-win_config'
position = "bottom",
height = 16,
win_opts = {}
},
},
commit_log_panel = {
win_config = { -- See ':h diffview-config-win_config'
win_opts = {},
}
},
default_args = {
-- Default args prepended to the arg-list for the listed commands
DiffviewOpen = {},
DiffviewFileHistory = {},
},
hooks = {}, -- See ':h diffview-config-hooks'
keymaps = {
disable_defaults = false, -- Disable the default keymaps
view = {
-- The `view` bindings are active in the diff buffers, only when the current
-- tabpage is a Diffview.
{ "n", "<tab>", actions.select_next_entry, { desc = "Open the diff for the next file" } },
{ "n", "<S-tab>", actions.select_prev_entry, { desc = "Open the diff for the previous file" } },
{ "n", "gf", actions.goto_file_edit, { desc = "Open the file in the previous tabpage" } },
{ "n", "<C-w><C-f>", actions.goto_file_split, { desc = "Open the file in a new split" } },
{ "n", "<C-w>gf", actions.goto_file_tab, { desc = "Open the file in a new tabpage" } },
{ "n", "<leader>e", actions.focus_files, { desc = "Bring focus to the file panel" } },
{ "n", "<leader>b", actions.toggle_files, { desc = "Toggle the file panel." } },
{ "n", "g<C-x>", actions.cycle_layout, { desc = "Cycle through available layouts." } },
{ "n", "[x", actions.prev_conflict, {
desc =
"In the merge-tool: jump to the previous conflict"
} },
{ "n", "]x", actions.next_conflict, {
desc =
"In the merge-tool: jump to the next conflict"
} },
{ "n", "<leader>co", actions.conflict_choose("ours"), { desc = "Choose the OURS version of a conflict" } },
{ "n", "<leader>ct", actions.conflict_choose("theirs"), { desc = "Choose the THEIRS version of a conflict" } },
{ "n", "<leader>cb", actions.conflict_choose("base"), { desc = "Choose the BASE version of a conflict" } },
{ "n", "<leader>ca", actions.conflict_choose("all"), { desc = "Choose all the versions of a conflict" } },
{ "n", "dx", actions.conflict_choose("none"), { desc = "Delete the conflict region" } },
},
diff1 = {
-- Mappings in single window diff layouts
{ "n", "g?", actions.help({ "view", "diff1" }), { desc = "Open the help panel" } },
},
diff2 = {
-- Mappings in 2-way diff layouts
{ "n", "g?", actions.help({ "view", "diff2" }), { desc = "Open the help panel" } },
},
diff3 = {
-- Mappings in 3-way diff layouts
{ { "n", "x" }, "2do", actions.diffget("ours"),
{
desc =
"Obtain the diff hunk from the OURS version of the file"
} },
{ { "n", "x" }, "3do", actions.diffget("theirs"),
{
desc =
"Obtain the diff hunk from the THEIRS version of the file"
} },
{ "n", "g?", actions.help({ "view", "diff3" }), { desc = "Open the help panel" } },
},
diff4 = {
-- Mappings in 4-way diff layouts
{ { "n", "x" }, "1do", actions.diffget("base"),
{
desc =
"Obtain the diff hunk from the BASE version of the file"
} },
{ { "n", "x" }, "2do", actions.diffget("ours"),
{
desc =
"Obtain the diff hunk from the OURS version of the file"
} },
{ { "n", "x" }, "3do", actions.diffget("theirs"),
{
desc =
"Obtain the diff hunk from the THEIRS version of the file"
} },
{ "n", "g?", actions.help({ "view", "diff4" }), { desc = "Open the help panel" } },
},
file_panel = {
{ "n", "j", actions.next_entry, { desc = "Bring the cursor to the next file entry" } },
{ "n", "<down>", actions.next_entry, { desc = "Bring the cursor to the next file entry" } },
{ "n", "k", actions.prev_entry, { desc = "Bring the cursor to the previous file entry." } },
{ "n", "<up>", actions.prev_entry, { desc = "Bring the cursor to the previous file entry." } },
{ "n", "<cr>", actions.select_entry, { desc = "Open the diff for the selected entry." } },
{ "n", "o", actions.select_entry, { desc = "Open the diff for the selected entry." } },
{ "n", "<2-LeftMouse>", actions.select_entry, { desc = "Open the diff for the selected entry." } },
{ "n", "-", actions.toggle_stage_entry, { desc = "Stage / unstage the selected entry." } },
{ "n", "S", actions.stage_all, { desc = "Stage all entries." } },
{ "n", "U", actions.unstage_all, { desc = "Unstage all entries." } },
{ "n", "X", actions.restore_entry, { desc = "Restore entry to the state on the left side." } },
{ "n", "L", actions.open_commit_log, { desc = "Open the commit log panel." } },
{ "n", "<c-b>", actions.scroll_view(-0.25), { desc = "Scroll the view up" } },
{ "n", "<c-f>", actions.scroll_view(0.25), { desc = "Scroll the view down" } },
{ "n", "<tab>", actions.select_next_entry, { desc = "Open the diff for the next file" } },
{ "n", "<s-tab>", actions.select_prev_entry, { desc = "Open the diff for the previous file" } },
{ "n", "gf", actions.goto_file_edit, { desc = "Open the file in the previous tabpage" } },
{ "n", "<C-w><C-f>", actions.goto_file_split, { desc = "Open the file in a new split" } },
{ "n", "<C-w>gf", actions.goto_file_tab, { desc = "Open the file in a new tabpage" } },
{ "n", "i", actions.listing_style, { desc = "Toggle between 'list' and 'tree' views" } },
{ "n", "f", actions.toggle_flatten_dirs,
{
desc =
"Flatten empty subdirectories in tree listing style."
} },
{ "n", "R", actions.refresh_files, { desc = "Update stats and entries in the file list." } },
{ "n", "<leader>e", actions.focus_files, { desc = "Bring focus to the file panel" } },
{ "n", "<leader>b", actions.toggle_files, { desc = "Toggle the file panel" } },
{ "n", "g<C-x>", actions.cycle_layout, { desc = "Cycle available layouts" } },
{ "n", "[x", actions.prev_conflict, { desc = "Go to the previous conflict" } },
{ "n", "]x", actions.next_conflict, { desc = "Go to the next conflict" } },
{ "n", "g?", actions.help("file_panel"), { desc = "Open the help panel" } },
},
file_history_panel = {
{ "n", "g!", actions.options, { desc = "Open the option panel" } },
{ "n", "<C-A-d>", actions.open_in_diffview, {
desc =
"Open the entry under the cursor in a diffview"
} },
{ "n", "y", actions.copy_hash, {
desc =
"Copy the commit hash of the entry under the cursor"
} },
{ "n", "L", actions.open_commit_log, { desc = "Show commit details" } },
{ "n", "zR", actions.open_all_folds, { desc = "Expand all folds" } },
{ "n", "zM", actions.close_all_folds, { desc = "Collapse all folds" } },
{ "n", "j", actions.next_entry, {
desc =
"Bring the cursor to the next file entry"
} },
{ "n", "<down>", actions.next_entry, {
desc =
"Bring the cursor to the next file entry"
} },
{ "n", "k", actions.prev_entry, {
desc =
"Bring the cursor to the previous file entry."
} },
{ "n", "<up>", actions.prev_entry, {
desc =
"Bring the cursor to the previous file entry."
} },
{ "n", "<cr>", actions.select_entry, { desc = "Open the diff for the selected entry." } },
{ "n", "o", actions.select_entry, { desc = "Open the diff for the selected entry." } },
{ "n", "<2-LeftMouse>", actions.select_entry, { desc = "Open the diff for the selected entry." } },
{ "n", "<c-b>", actions.scroll_view(-0.25), { desc = "Scroll the view up" } },
{ "n", "<c-f>", actions.scroll_view(0.25), { desc = "Scroll the view down" } },
{ "n", "<tab>", actions.select_next_entry, { desc = "Open the diff for the next file" } },
{ "n", "<s-tab>", actions.select_prev_entry, { desc = "Open the diff for the previous file" } },
{ "n", "gf", actions.goto_file_edit, { desc = "Open the file in the previous tabpage" } },
{ "n", "<C-w><C-f>", actions.goto_file_split, { desc = "Open the file in a new split" } },
{ "n", "<C-w>gf", actions.goto_file_tab, { desc = "Open the file in a new tabpage" } },
{ "n", "<leader>e", actions.focus_files, { desc = "Bring focus to the file panel" } },
{ "n", "<leader>b", actions.toggle_files, { desc = "Toggle the file panel" } },
{ "n", "g<C-x>", actions.cycle_layout, { desc = "Cycle available layouts" } },
{ "n", "g?", actions.help("file_history_panel"), { desc = "Open the help panel" } },
},
option_panel = {
{ "n", "<tab>", actions.select_entry, { desc = "Change the current option" } },
{ "n", "q", actions.close, { desc = "Close the panel" } },
{ "n", "g?", actions.help("option_panel"), { desc = "Open the help panel" } },
},
help_panel = {
{ "n", "q", actions.close, { desc = "Close help menu" } },
{ "n", "<esc>", actions.close, { desc = "Close help menu" } },
},
},
})

View file

@ -1,6 +0,0 @@
require('fidget').setup({
text = {
spinner = "dots",
-- done = "[Ok]",
}
})

View file

@ -1 +0,0 @@
vim.keymap.set('n', "<leader>G", vim.cmd.Git, { desc = "open fugitive" })

View file

@ -1,42 +0,0 @@
require('gitsigns').setup({
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '-' },
topdelete = { text = '-' },
changedelete = { text = '~' },
untracked = { text = '·' },
},
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = {
interval = 2500,
follow_files = true
},
attach_to_untracked = true,
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = 'right_align', -- 'eol' | 'overlay' | 'right_align'
delay = 0,
ignore_whitespace = false,
},
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
max_file_length = 40000, -- Disable if file is longer than this (in lines)
preview_config = {
-- Options passed to nvim_open_win
border = 'single',
style = 'minimal',
relative = 'cursor',
row = 0,
col = 1
},
yadm = {
enable = false
},
})

View file

@ -1,11 +0,0 @@
require "glow".setup {
glow_path = "glow", -- will be filled automatically with your glow bin in $PATH, if any
install_path = "~/.local/bin", -- default path for installing glow binary
border = "shadow", -- floating window border config
style = "light", -- filled automatically with your current editor background, you can override using glow json style
pager = false,
width = 80,
height = 100,
width_ratio = 0.7, -- maximum width of the Glow window compared to the nvim window size (overrides `width`)
height_ratio = 0.7,
}

View file

@ -1,14 +0,0 @@
require("harpoon").setup {}
local ui = require("harpoon.ui")
local mark = require("harpoon.mark")
-- add and view
vim.keymap.set({ 'n', 'i' }, '<A-a>', function() mark.add_file() end, { desc = "add file to harpoon" })
vim.keymap.set({ 'n', 'i' }, '<A-e>', function() ui.toggle_quick_menu() end, { desc = "show harpoon menu" })
-- switch it up!
vim.keymap.set({ 'n', 'i' }, '<A-h>', function() ui.nav_file(1) end, { desc = "harpoon 1 (the magic finger)" })
vim.keymap.set({ 'n', 'i' }, '<A-t>', function() ui.nav_file(2) end, { desc = "harpoon 2" })
vim.keymap.set({ 'n', 'i' }, '<A-n>', function() ui.nav_file(3) end, { desc = "harpoon 3" })
vim.keymap.set({ 'n', 'i' }, '<A-s>', function() ui.nav_file(4) end, { desc = "harpoon 4" })

View file

@ -1,5 +0,0 @@
require('indent_blankline').setup({
-- char = '┊',
char = ' ',
show_trailing_blankline_indent = false,
})

View file

@ -1,45 +0,0 @@
require("iswap").setup {
-- The keys that will be used as a selection, in order
-- ('asdfghjklqwertyuiopzxcvbnm' by default)
-- keys = "aoeuhtns",
-- Grey out the rest of the text when making a selection
-- (enabled by default)
grey = "disable",
-- Highlight group for the sniping value (asdf etc.)
-- default 'Search'
-- hl_snipe = 'ErrorMsg',
-- Highlight group for the visual selection of terms
-- default 'Visual'
-- hl_selection = 'WarningMsg',
-- Highlight group for the greyed background
-- default 'Comment'
-- hl_grey = 'LineNr',
-- Post-operation flashing highlight style,
-- either 'simultaneous' or 'sequential', or false to disable
-- default 'sequential'
-- flash_style = false,
-- Highlight group for flashing highlight afterward
-- default 'IncSearch'
-- hl_flash = 'ModeMsg',
-- Move cursor to the other element in ISwap*With commands
-- default false
-- move_cursor = true,
-- Automatically swap with only two arguments
-- default nil
autoswap = true,
-- Other default options you probably should not change:
debug = nil,
hl_grey_priority = '1000',
}
vim.keymap.set('n', "s<Left>", ":ISwapNodeWithLeft<CR>", { desc = "Swap argument with left" })
vim.keymap.set('n', "s<Right>", ":ISwapNodeWithRight<CR>", { desc = "Swap argument with right" })

View file

@ -1,146 +0,0 @@
require "mason".setup()
require "mason-lspconfig".setup({
ensure_installed = {},
automatic_installation = false
})
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = "open diagnostic in a float window" })
vim.keymap.set('n', '<leader>pe', vim.diagnostic.goto_prev, { desc = "goto [P]revious [E]rror" })
vim.keymap.set('n', '<leader>ne', vim.diagnostic.goto_next, { desc = "goto [N]ext [E]rror" })
vim.keymap.set('n', '<leader>el', vim.diagnostic.setloclist, { desc = "show [E]rror [L]ocations" })
local on_attach = function(_, bufnr)
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-- See `:help vim.lsp.*`
local bufopts = { buffer = bufnr }
local rename = function()
vim.ui.input(
{ prompt = "Rename symbol: " },
function(new_name) if (new_name ~= nil) then vim.lsp.buf.rename(new_name) end end)
end
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', 'gD', vim.lsp.buf.declaration, bufopts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
vim.keymap.set('n', 'gtd', vim.lsp.buf.type_definition, bufopts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
vim.keymap.set('n', 'gu', vim.lsp.buf.references, bufopts)
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', '<leader>f', function() vim.lsp.buf.format { async = true } end, bufopts)
vim.keymap.set('n', '<leader>r', rename, bufopts)
end
-- Gutter symbols setup
vim.fn.sign_define("DiagnosticSignError", { text = 'E', texthl = "DiagnosticSignError", numhl = "DiagnosticSignError" })
vim.fn.sign_define("DiagnosticSignWarn", { text = 'W', texthl = "DiagnosticSignWarn", numhl = "DiagnosticSignWarn" })
vim.fn.sign_define("DiagnosticSignHint", { text = 'H', texthl = "DiagnosticSignHint", numhl = "DiagnosticSignHint" })
vim.fn.sign_define("DiagnosticSignInfo", { text = '·', texthl = "DiagnosticSignInfo", numhl = "DiagnosticSignInfo" })
-- Border setup
local border = {
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
{ "", "FloatBorder" },
}
local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
opts = opts or {}
opts.border = opts.border or border
return orig_util_open_floating_preview(contents, syntax, opts, ...)
end
-- Language servers
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require "cmp_nvim_lsp".default_capabilities(capabilities)
-- Spell check
local common_dictionary = {
"Yu", "Hui", "Léana", "Chiang",
"ISTIC",
}
require "lspconfig".ltex.setup {
on_attach = on_attach,
cmd = { "ltex-ls" },
filetypes = { "markdown", "text", "gitcommit" },
settings = {
ltex = {
language = "auto",
additionalRules = {
motherTongue = "en-US"
},
trace = { server = "verbose" },
dictionary = {
["en-US"] = common_dictionary,
["fr"] = common_dictionary
},
},
},
flags = { debounce_text_changes = 10000 },
capabilities = capabilities,
}
-- JSON
require "lspconfig".jsonls.setup {
on_attach = on_attach,
capabilities = capabilities,
}
-- XML
require "lspconfig".lemminx.setup {
on_attach = on_attach,
capabilities = capabilities,
}
-- CSS
require "lspconfig".cssls.setup {
on_attach = on_attach,
capabilities = capabilities,
}
-- Lua
require "lspconfig".lua_ls.setup {
on_attach = on_attach,
capabilities = capabilities,
settings = {
lua = {
formatting = {
enable = true,
indent = 2,
}
}
},
}
-- Rust
require "lspconfig".rust_analyzer.setup {
on_attach = on_attach,
capabilities = capabilities,
}
-- Golang
require "lspconfig".gopls.setup {
on_attach = on_attach,
capabilities = capabilities,
}
-- Python
require "lspconfig".pylsp.setup {
on_attach = on_attach,
capabilities = capabilities,
}
-- Scala
require "lspconfig".metals.setup {
on_attach = on_attach,
capabilities = capabilities,
}
-- C
require "lspconfig".clangd.setup {
on_attach = on_attach,
capabilities = capabilities,
}
-- R
require "lspconfig".r_language_server.setup {
on_attach = on_attach,
capabilities = capabilities,
}

View file

@ -1,40 +0,0 @@
require('lualine').setup({
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '', right = '' },
section_separators = { left = '', right = '' },
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff', 'diagnostics' },
lualine_c = { 'filename' },
lualine_x = { 'encoding' },
lualine_y = { 'progress' },
lualine_z = { 'location' }
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { 'filename' },
lualine_x = { 'location' },
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
})

View file

@ -1,24 +0,0 @@
require "neodev".setup({
library = {
enabled = true, -- when not enabled, neodev will not change any settings to the LSP server
-- these settings will be used for your Neovim config directory
runtime = true, -- runtime path
types = true, -- full signature, docs and completion of vim.api, vim.treesitter, vim.lsp and others
plugins = true, -- installed opt or start plugins in packpath
-- you can also specify the list of plugins to make available as a workspace library
-- plugins = { "nvim-treesitter", "plenary.nvim", "telescope.nvim" },
},
setup_jsonls = true, -- configures jsonls to provide completion for project specific .luarc.json files
-- for your Neovim config directory, the config.library settings will be used as is
-- for plugin directories (root_dirs having a /lua directory), config.library.plugins will be disabled
-- for any other directory, config.library.enabled will be set to false
override = function(root_dir, options)
end,
-- With lspconfig, Neodev will automatically setup your lua-language-server
-- If you disable this, then you have to set {before_init=require("neodev.lsp").before_init}
-- in your lsp start options
lspconfig = true,
-- much faster, but needs a recent built of lua-language-server
-- needs lua-language-server >= 3.6.0
pathStrict = true,
})

View file

@ -1 +0,0 @@
require "nvim-autopairs".setup()

View file

@ -1,53 +0,0 @@
local cmp = require("cmp")
local luasnip = require("luasnip")
require "luasnip.loaders.from_vscode".lazy_load({ paths = { "./snippets" } })
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert {
['<C-d>'] = cmp.mapping.scroll_docs( -4),
['<C-u>'] = cmp.mapping.scroll_docs(4),
-- ['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Insert,
select = true,
},
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- they way you will only jump inside the snippet region
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
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" },
},
})

View file

@ -1 +0,0 @@
require "colorizer".setup()

View file

@ -1,77 +0,0 @@
local install_path = vim.fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim"
local is_bootstrap = false
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
is_bootstrap = true
vim.fn.system { "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path }
vim.cmd "packadd packer.nvim"
end
require "packer".startup(function(use)
use "wbthomason/packer.nvim"
use "Th3Whit3Wolf/one-nvim"
use "ThePrimeagen/vim-be-good"
-- Make it rain :)
use "Eandrju/cellular-automaton.nvim"
use "simrat39/symbols-outline.nvim"
use "numToStr/Comment.nvim"
use "lewis6991/gitsigns.nvim"
use "lukas-reineke/indent-blankline.nvim"
use "lukoshkin/trailing-whitespace"
use "nvim-lualine/lualine.nvim"
use { "sindrets/diffview.nvim", requires = "nvim-lua/plenary.nvim" }
use "tpope/vim-sleuth"
use "andweeb/presence.nvim"
use "windwp/nvim-autopairs"
use "ur4ltz/surround.nvim"
use "ellisonleao/glow.nvim"
use "norcalli/nvim-colorizer.lua"
use "mg979/vim-visual-multi"
use "nvim-tree/nvim-web-devicons"
use { "ThePrimeagen/harpoon", requires = { "nvim-lua/plenary.nvim" } }
use { "nvim-telescope/telescope.nvim", branch = "0.1.x", requires = { "nvim-lua/plenary.nvim" } }
use { "nvim-telescope/telescope-fzf-native.nvim", run = "make", cond = vim.fn.executable "make" == 1 }
use "tpope/vim-fugitive"
use "f-person/auto-dark-mode.nvim"
use "rafamadriz/friendly-snippets"
use { "folke/todo-comments.nvim", requires = "nvim-lua/plenary.nvim" }
use "mbbill/undotree"
use { "akinsho/toggleterm.nvim", tag = '*' }
use { "hrsh7th/nvim-cmp", requires = { "hrsh7th/cmp-nvim-lsp", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip" } }
use "mizlan/iswap.nvim"
use { "nvim-treesitter/nvim-treesitter",
run = function()
local ts_update = require "nvim-treesitter.install".update({ with_sync = true })
ts_update()
end, }
use "nvim-treesitter/nvim-treesitter-context"
use "lukas-reineke/lsp-format.nvim"
use { "neovim/nvim-lspconfig",
requires = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"j-hui/fidget.nvim",
"folke/neodev.nvim",
},
}
if is_bootstrap then
require "packer".sync()
end
end)
-- When we are bootstrapping a configuration, it doesn't
-- make sense to execute the rest of the init.lua.
--
-- You'll need to restart nvim, and then it will work.
if is_bootstrap then
print "=================================="
print " Plugins are being installed"
print " Wait until Packer completes,"
print " then restart nvim"
print "=================================="
return
end

View file

@ -1,40 +0,0 @@
require "presence".setup({
-- General options
-- Update activity based on autocmd events (if `false`, map or manually execute `:lua package.loaded.presence:update()`)
auto_update = true,
-- Text displayed when hovered over the Neovim image
neovim_image_text = "I use NeoVim btw",
-- Main image display (either "neovim" or "file")
main_image = "file",
-- Use your own Discord application client id (not recommended)
client_id = "793271441293967371",
-- Log messages at or above this level (one of the following: "debug", "info", "warn", "error")
log_level = nil,
-- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(<filename>, true)`)
debounce_timeout = 10,
-- Displays the current line number instead of the current project
enable_line_number = false,
-- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches
blacklist = {},
-- Configure Rich Presence button(s), either a boolean to enable/disable, a static table (`{{ label = "<label>", url = "<url>" }, ...}`, or a function(buffer: string, repo_url: string|nil): table)
buttons = true,
-- Custom file asset definitions keyed by file names and extensions (see default config at `lua/presence/file_assets.lua` for reference)
file_assets = {},
-- Show the timer
show_time = false,
-- Rich Presence text options
-- Format string rendered when an editable file is loaded in the buffer (either string or function(filename: string): string)
editing_text = "Editing %s",
-- Format string rendered when browsing a file explorer (either string or function(file_explorer_name: string): string)
file_explorer_text = "Browsing %s",
-- Format string rendered when committing changes in git (either string or function(filename: string): string)
git_commit_text = "Committing changes",
-- Format string rendered when managing plugins (either string or function(plugin_manager_name: string): string)
plugin_manager_text = "Managing plugins",
-- Format string rendered when a read-only or unmodifiable file is loaded in the buffer (either string or function(filename: string): string)
reading_text = "Reading %s",
-- Format string rendered when in a git repository (either string or function(project_name: string|nil, filename: string): string)
workspace_text = "Natural Habitat: %s/",
-- Format string rendered when `enable_line_number` is set to true (either string or function(line_number: number, line_count: number): string)
line_number_text = "Line %s out of %s",
})

View file

@ -1 +0,0 @@
require "startup".setup()

View file

@ -1 +0,0 @@
require "surround".setup({ mappings_style = "surround" })

View file

@ -1,65 +0,0 @@
require "symbols-outline".setup({
highlight_hovered_item = true,
show_guides = true,
auto_preview = false,
position = 'left',
relative_width = true,
width = 25,
auto_close = false,
show_numbers = false,
show_relative_numbers = false,
show_symbol_details = true,
preview_bg_highlight = 'Pmenu',
autofold_depth = nil,
auto_unfold_hover = true,
fold_markers = { '', '' },
wrap = false,
keymaps = { -- These keymaps can be a string or a table for multiple keys
close = { "<Esc>", "q" },
goto_location = "<Cr>",
focus_location = "o",
hover_symbol = "<C-space>",
toggle_preview = "K",
rename_symbol = "<leader>rn",
code_actions = "a",
fold = "h",
unfold = "l",
fold_all = "W",
unfold_all = "E",
fold_reset = "R",
},
lsp_blacklist = {},
symbol_blacklist = {},
-- symbols = {
-- File = { icon = "", hl = "@text.uri" },
-- Module = { icon = "", hl = "@namespace" },
-- Namespace = { icon = "", hl = "@namespace" },
-- Package = { icon = "", hl = "@namespace" },
-- Class = { icon = "𝓒", hl = "@type" },
-- Method = { icon = "ƒ", hl = "@method" },
-- Property = { icon = "", hl = "@method" },
-- Field = { icon = "", hl = "@field" },
-- Constructor = { icon = "", hl = "@constructor" },
-- Enum = { icon = "", hl = "@type" },
-- Interface = { icon = "ﰮ", hl = "@type" },
-- Function = { icon = "", hl = "@function" },
-- Variable = { icon = "", hl = "@constant" },
-- Constant = { icon = "", hl = "@constant" },
-- String = { icon = "𝓐", hl = "@string" },
-- Number = { icon = "#", hl = "@number" },
-- Boolean = { icon = "⊨", hl = "@boolean" },
-- Array = { icon = "", hl = "@constant" },
-- Object = { icon = "⦿", hl = "@type" },
-- Key = { icon = "🔐", hl = "@type" },
-- Null = { icon = "NULL", hl = "@type" },
-- EnumMember = { icon = "", hl = "@field" },
-- Struct = { icon = "𝓢", hl = "@type" },
-- Event = { icon = "🗲", hl = "@type" },
-- Operator = { icon = "+", hl = "@operator" },
-- TypeParameter = { icon = "𝙏", hl = "@parameter" },
-- Component = { icon = "", hl = "@function" },
-- Fragment = { icon = "", hl = "@constant" },
-- },
})
vim.keymap.set('n', '<leader><leader>', function() vim.cmd("SymbolsOutline") end, { desc = "Open symbols outline" })

View file

@ -1,30 +0,0 @@
local telescope = require "telescope"
local actions = require "telescope.actions"
local themes = require "telescope.themes"
telescope.setup {
defaults = {
mappings = {
i = {
["<esc>"] = actions.close,
},
},
},
}
-- Enable telescope fzf native, if installed
pcall(require('telescope').load_extension, 'fzf')
local builtin = require "telescope.builtin"
vim.keymap.set('n', '<leader>?', builtin.oldfiles, { desc = '[?] Find recently opened files' })
vim.keymap.set('n', '<leader>/',
function() builtin.current_buffer_fuzzy_find(themes.get_dropdown { previewer = false }) end,
{ desc = '[/] Fuzzily search in current buffer]' }
)
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = 'Search [A]ll [F]iles' })
vim.keymap.set('n', '<leader>gf', builtin.git_files, { desc = 'Search [G]it [F]iles' })
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>b', builtin.buffers, { desc = 'Search [B]uffers' })

View file

@ -1,65 +0,0 @@
require "todo-comments".setup({
signs = true, -- show icons in the signs column
sign_priority = 10, -- sign priority
-- keywords recognized as todo comments
keywords = {
FIX = {
icon = "", -- icon used for the sign, and in search results
color = "error", -- can be a hex color, or a named color (see below)
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
-- signs = false, -- configure signs for some keywords individually
},
TODO = { icon = "", color = "info" },
HACK = { icon = "", color = "warning" },
WARN = { icon = "", color = "warning", alt = { "WARNING", "XXX" } },
PERF = { icon = "", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
NOTE = { icon = "", color = "hint", alt = { "INFO" } },
TEST = { icon = "", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
Q = { icon = "?", color = "warning" },
},
gui_style = {
fg = "NONE", -- The gui style to use for the fg highlight group.
bg = "BOLD", -- The gui style to use for the bg highlight group.
},
merge_keywords = true, -- when true, custom keywords will be merged with the defaults
-- highlighting of the line containing the todo comment
-- * before: highlights before the keyword (typically comment characters)
-- * keyword: highlights of the keyword
-- * after: highlights after the keyword (todo text)
highlight = {
multiline = true, -- enable multine todo comments
multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword
multiline_context = 8, -- extra lines that will be re-evaluated when changing a line
before = "", -- "fg" or "bg" or empty
keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg)
after = "bg", -- "fg" or "bg" or empty
pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlightng (vim regex)
comments_only = true, -- uses treesitter to match keywords in comments only
max_line_len = 400, -- ignore lines longer than this
exclude = {}, -- list of file types to exclude highlighting
},
-- list of named colors where we try to extract the guifg from the
-- list of highlight groups or use the hex color if hl not found as a fallback
colors = {
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
info = { "DiagnosticInfo", "#2563EB" },
hint = { "DiagnosticHint", "#10B981" },
default = { "Identifier", "#7C3AED" },
test = { "Identifier", "#FF00FF" }
},
search = {
command = "rg",
args = {
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
},
-- regex that will be used to match keywords.
-- don't replace the (KEYWORDS) placeholder
pattern = [[\b(KEYWORDS):]], -- ripgrep regex
-- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives
},
})

View file

@ -1,4 +0,0 @@
require "toggleterm".setup({
open_mapping = "<C-`>",
size = 20,
})

View file

@ -1,5 +0,0 @@
require 'trailing-whitespace'.setup {
patterns = { '\\s\\+$' },
palette = { markdown = 'Teal' },
default_color = '#EEEEEE',
}

View file

@ -1,40 +0,0 @@
require('nvim-treesitter.configs').setup({
-- A list of parser names, or "all" (the four listed parsers should always be installed)
ensure_installed = {
"c",
"cpp",
"lua",
"vim",
"help",
"rust",
"scala",
"python"
},
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
incremental_selection = {
enable = true,
keymaps = {
-- set to `false` to disable one of the mappings
init_selection = "false",
scope_incremental = "false",
node_incremental = "<A-Up>",
node_decremental = "<A-Down>",
},
},
refactor = {
smart_rename = {
enable = true,
keymaps = {
smart_rename = "grr"
}
}
}
})

View file

@ -1,13 +0,0 @@
require "treesitter-context".setup({
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
line_numbers = true,
multiline_threshold = 20, -- Maximum number of lines to collapse for a single context line
trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
mode = 'topline', -- Line used to calculate context. Choices: 'cursor', 'topline'
-- Separator between context and content. Should be a single character string, like '-'.
-- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
separator = nil,
zindex = 20, -- The Z-index of the context window
})

View file

@ -1 +0,0 @@
vim.keymap.set('n', "<leader>u", function() vim.cmd("UndotreeToggle") end, { desc = "Toggle undotree view" })