partial completion of upgrade of vim to lua

This commit is contained in:
Solomon Laing 2022-08-18 17:48:11 +09:30
parent dca2e807de
commit c367e57366
55 changed files with 9668 additions and 6 deletions

View File

@ -123,7 +123,7 @@ font:
# family: Monofur Nerd Font
# family: TerminessTTF Nerd Font
# family: SauceCodePro Nerd Font
family: Fira Code
family: FiraCode Nerd Font
# The `style` can be specified to pick a specific face.
style: Regular
@ -143,7 +143,7 @@ font:
# family: Monofur Nerd Font
# family: TerminessTTF Nerd Font
# family: SauceCodePro Nerd Font
family: Fira Code
family: FiraCode Nerd Font
# The `style` can be specified to pick a specific face.
style: Bold
@ -163,7 +163,7 @@ font:
# family: Monofuritalic Nerd Font Mono
# family: TerminessTTF Nerd Font
# family: SauceCodePro Nerd Font
family: Fira Code
family: FiraCode Nerd Font
# The `style` can be specified to pick a specific face.
style: Italic
@ -183,7 +183,7 @@ font:
# family: Monofuritalic Nerd Font Mono
# family: TerminessTTF Nerd Font
# family: SauceCodePro Nerd Font
family: Fira Code
family: FiraCode Nerd Font
# The `style` can be specified to pick a specific face.
style: Bold Italic

View File

@ -73,3 +73,7 @@ set_prompt() {
}
PROMPT_COMMAND=set_prompt
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"

41
.config/nvim/init.lua Normal file
View File

@ -0,0 +1,41 @@
require("user.keymaps")
require("user.plugins")
require("user.colorscheme")
require("user.autocommands")
require("user.cmp")
require("user.navic")
-- require("user.lsp-inlayhints")
-- require("user.lsp")
require("user.telescope")
require("user.treesitter")
require("user.autopairs")
require("user.comment")
require("user.gitsigns")
require("user.nvim-tree")
require("user.toggleterm")
require("user.project")
require("user.impatient")
require("user.indentline")
require("user.alpha")
require("user.whichkey")
require("user.hop")
require("user.matchup")
require("user.numb")
require("user.colorizer")
require("user.spectre")
require("user.zen-mode")
require("user.neoscroll")
require("user.todo-comments")
require("user.symbol-outline")
require("user.notify")
require("user.ts-context")
require("user.illuminate")
require("user.dap")
require("user.lir")
require("user.options")
require("user.nvim-webdev-icons")
require("user.fidget")
require("user.browse")
require("user.surround")
require("user.harpoon")
require("user.vim-slash")

View File

@ -0,0 +1,53 @@
local status_ok, alpha = pcall(require, "alpha")
if not status_ok then
return
end
local dashboard = require "alpha.themes.dashboard"
local function button(sc, txt, keybind, keybind_opts)
local b = dashboard.button(sc, txt, keybind, keybind_opts)
b.opts.hl_shortcut = "Macro"
return b
end
local icons = require "user.icons"
dashboard.section.header.val = {
[[ __ ]],
[[ ___ ___ ___ __ __ /\_\ ___ ___ ]],
[[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]],
[[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]],
[[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]],
[[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]],
}
dashboard.section.buttons.val = {
button("f", icons.documents.Files .. " Find file", ":Telescope find_files <CR>"),
button("e", icons.ui.NewFile .. " New file", ":ene <BAR> startinsert <CR>"),
button("p", icons.git.Repo .. " Find project", ":lua require('telescope').extensions.projects.projects()<CR>"),
button("r", icons.ui.History .. " Recent files", ":Telescope oldfiles <CR>"),
button("t", icons.ui.List .. " Find text", ":Telescope live_grep <CR>"),
-- dashboard.button("s", icons.ui.SignIn .. " Find Session", ":silent Autosession search <CR>"),
button("s", icons.ui.SignIn .. " Find Session", ":SearchSession<CR>"),
button("c", icons.ui.Gear .. " Config", ":e ~/.config/nvim/init.lua <CR>"),
button("u", icons.ui.CloudDownload .. " Update", ":PackerSync<CR>"),
button("q", icons.ui.SignOut .. " Quit", ":qa<CR>"),
}
local function footer()
-- NOTE: requires the fortune-mod package to work
-- local handle = io.popen("fortune")
-- local fortune = handle:read("*a")
-- handle:close()
-- return fortune
return "chrisatmachine.com"
end
dashboard.section.footer.val = footer()
dashboard.section.header.opts.hl = "Include"
dashboard.section.buttons.opts.hl = "Macro"
dashboard.section.footer.opts.hl = "Type"
dashboard.opts.opts.noautocmd = true
-- vim.cmd([[autocmd User AlphaReady echo 'ready']])
alpha.setup(dashboard.opts)

View File

@ -0,0 +1,189 @@
-- vim.api.nvim_create_autocmd({ "User" }, {
-- pattern = { "AlphaReady" },
-- callback = function()
-- vim.cmd [[
-- set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2
-- ]]
-- end,
-- })
vim.api.nvim_create_autocmd({ "User" }, {
pattern = { "AlphaReady" },
callback = function()
vim.cmd [[
set laststatus=0 | autocmd BufUnload <buffer> set laststatus=3
]]
end,
})
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = {
"Jaq",
"qf",
"help",
"man",
"lspinfo",
"spectre_panel",
"lir",
"DressingSelect",
"tsplayground",
"Markdown",
},
callback = function()
vim.cmd [[
nnoremap <silent> <buffer> q :close<CR>
nnoremap <silent> <buffer> <esc> :close<CR>
set nobuflisted
]]
end,
})
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "Jaq" },
callback = function()
vim.cmd [[
nnoremap <silent> <buffer> <m-r> :close<CR>
" nnoremap <silent> <buffer> <m-r> <NOP>
set nobuflisted
]]
end,
})
vim.api.nvim_create_autocmd({ "BufEnter" }, {
pattern = { "" },
callback = function()
local buf_ft = vim.bo.filetype
if buf_ft == "" or buf_ft == nil then
vim.cmd [[
nnoremap <silent> <buffer> q :close<CR>
nnoremap <silent> <buffer> <c-j> j<CR>
nnoremap <silent> <buffer> <c-k> k<CR>
set nobuflisted
]]
end
end,
})
vim.api.nvim_create_autocmd({ "BufEnter" }, {
pattern = { "" },
callback = function()
local get_project_dir = function()
local cwd = vim.fn.getcwd()
local project_dir = vim.split(cwd, "/")
local project_name = project_dir[#project_dir]
return project_name
end
vim.opt.titlestring = get_project_dir() .. " - nvim"
end,
})
vim.api.nvim_create_autocmd({ "BufEnter" }, {
pattern = { "term://*" },
callback = function()
vim.cmd "startinsert!"
-- TODO: if java = 2
vim.cmd "set cmdheight=1"
end,
})
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "gitcommit", "markdown" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
})
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "lir" },
callback = function()
vim.opt_local.number = false
vim.opt_local.relativenumber = false
end,
})
vim.cmd "autocmd BufEnter * ++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif"
-- vim.api.nvim_create_autocmd({ "BufEnter" }, {
-- callback = function()
-- vim.cmd [[
-- if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif
-- ]]
-- end,
-- })
vim.api.nvim_create_autocmd({ "VimResized" }, {
callback = function()
vim.cmd "tabdo wincmd ="
end,
})
vim.api.nvim_create_autocmd({ "CmdWinEnter" }, {
callback = function()
vim.cmd "quit"
end,
})
vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
callback = function()
vim.cmd "set formatoptions-=cro"
end,
})
vim.api.nvim_create_autocmd({ "TextYankPost" }, {
callback = function()
vim.highlight.on_yank { higroup = "Visual", timeout = 200 }
end,
})
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
pattern = { "*.java" },
callback = function()
vim.lsp.codelens.refresh()
end,
})
vim.api.nvim_create_autocmd({ "VimEnter" }, {
callback = function()
vim.cmd "hi link illuminatedWord LspReferenceText"
end,
})
vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
pattern = { "*" },
callback = function()
vim.cmd "checktime"
end,
})
vim.api.nvim_create_autocmd({ "CursorHold" }, {
callback = function()
local status_ok, luasnip = pcall(require, "luasnip")
if not status_ok then
return
end
if luasnip.expand_or_jumpable() then
-- ask maintainer for option to make this silent
-- luasnip.unlink_current()
vim.cmd [[silent! lua require("luasnip").unlink_current()]]
end
end,
})
-- vim.api.nvim_create_autocmd({ "ModeChanged" }, {
-- callback = function()
-- local luasnip = require "luasnip"
-- if luasnip.expand_or_jumpable() then
-- -- ask maintainer for option to make this silent
-- -- luasnip.unlink_current()
-- vim.cmd [[silent! lua require("luasnip").unlink_current()]]
-- end
-- end,
-- })
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
pattern = { "*.ts" },
callback = function()
vim.lsp.buf.format { async = true }
end,
})

View File

@ -0,0 +1,33 @@
-- Setup nvim-cmp.
local status_ok, npairs = pcall(require, "nvim-autopairs")
if not status_ok then
return
end
npairs.setup {
check_ts = true,
ts_config = {
lua = { "string", "source" },
javascript = { "string", "template_string" },
java = false,
},
disable_filetype = { "TelescopePrompt", "spectre_panel" },
fast_wrap = {
map = "<M-e>",
chars = { "{", "[", "(", '"', "'" },
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
offset = 0, -- Offset from pattern match
end_key = "$",
keys = "qwertyuiopzxcvbnmasdfghjkl",
check_comma = true,
highlight = "PmenuSel",
highlight_grey = "LineNr",
},
}
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
local cmp_status_ok, cmp = pcall(require, "cmp")
if not cmp_status_ok then
return
end
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done { map_char = { tex = "" } })

View File

@ -0,0 +1,56 @@
local status_ok, browse = pcall(require, "browse")
if not status_ok then
return
end
browse.setup {
provider = "brave",
}
local bookmarks = {
"https://www.chrisatmachine.com/",
"https://github.com/christianchiarulli",
"https://github.com/rockerBOO/awesome-neovim",
"https://signin.aws.amazon.com/signin",
"https://doc.rust-lang.org/book/",
"https://aur.archlinux.org/packages/",
"https://news.ycombinator.com/",
-- "https://github.com/neovim/neovim",
-- "https://neovim.discourse.group/",
}
local function command(name, rhs, opts)
opts = opts or {}
vim.api.nvim_create_user_command(name, rhs, opts)
end
command("BrowseInputSearch", function()
browse.input_search()
end, {})
command("Browse", function()
browse.browse { bookmarks = bookmarks }
end, {})
command("BrowseBookmarks", function()
browse.open_bookmarks { bookmarks = bookmarks }
end, {})
command("BrowseDevdocsSearch", function()
browse.devdocs.search()
end, {})
command("BrowseDevdocsFiletypeSearch", function()
browse.devdocs.search_with_filetype()
end, {})
command("BrowseMdnSearch", function()
browse.mdn.search()
end, {})
local opts = { noremap = true, silent = true }
local keymap = vim.api.nvim_set_keymap
keymap("n", "<m-o>", "<cmd>BrowseBookmarks<cr>", opts)
keymap("n", "<m-i>", "<cmd>BrowseInputSearch<cr>", opts)

View File

@ -0,0 +1,168 @@
local status_ok, bufferline = pcall(require, "bufferline")
if not status_ok then
return
end
bufferline.setup {
options = {
numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string,
close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
right_mouse_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions"
middle_mouse_command = nil, -- can be a string | function, see "Mouse actions"
-- NOTE: this plugin is designed with this icon in mind,
-- and so changing this is NOT recommended, this is intended
-- as an escape hatch for people who cannot bear it for whatever reason
indicator_icon = "",
-- indicator_icon = "▎",
buffer_close_icon = "",
-- buffer_close_icon = '',
modified_icon = "",
close_icon = "",
-- close_icon = '',
left_trunc_marker = "",
right_trunc_marker = "",
--- name_formatter can be used to change the buffer's label in the bufferline.
--- Please note some names can/will break the
--- bufferline so use this at your discretion knowing that it has
--- some limitations that will *NOT* be fixed.
-- name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr"
-- -- remove extension from markdown files for example
-- if buf.name:match('%.md') then
-- return vim.fn.fnamemodify(buf.name, ':t:r')
-- end
-- end,
max_name_length = 30,
max_prefix_length = 30, -- prefix used when a buffer is de-duplicated
tab_size = 21,
diagnostics = false, -- | "nvim_lsp" | "coc",
diagnostics_update_in_insert = false,
-- diagnostics_indicator = function(count, level, diagnostics_dict, context)
-- return "("..count..")"
-- end,
-- NOTE: this will be called a lot so don't do any heavy processing here
-- custom_filter = function(buf_number)
-- -- filter out filetypes you don't want to see
-- if vim.bo[buf_number].filetype ~= "<i-dont-want-to-see-this>" then
-- return true
-- end
-- -- filter out by buffer name
-- if vim.fn.bufname(buf_number) ~= "<buffer-name-I-dont-want>" then
-- return true
-- end
-- -- filter out based on arbitrary rules
-- -- e.g. filter out vim wiki buffer from tabline in your work repo
-- if vim.fn.getcwd() == "<work-repo>" and vim.bo[buf_number].filetype ~= "wiki" then
-- return true
-- end
-- end,
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
show_buffer_icons = true,
show_buffer_close_icons = true,
show_close_icon = true,
show_tab_indicators = true,
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
-- can also be a table containing 2 custom separators
-- [focused and unfocused]. eg: { '|', '|' }
separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' },
enforce_regular_tabs = true,
always_show_bufferline = true,
-- sort_by = 'id' | 'extension' | 'relative_directory' | 'directory' | 'tabs' | function(buffer_a, buffer_b)
-- -- add custom logic
-- return buffer_a.modified > buffer_b.modified
-- end
},
highlights = {
fill = {
guifg = { attribute = "fg", highlight = "#ff0000" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
background = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
-- buffer_selected = {
-- guifg = {attribute='fg',highlight='#ff0000'},
-- guibg = {attribute='bg',highlight='#0000ff'},
-- gui = 'none'
-- },
buffer_visible = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
close_button = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
close_button_visible = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
-- close_button_selected = {
-- guifg = {attribute='fg',highlight='TabLineSel'},
-- guibg ={attribute='bg',highlight='TabLineSel'}
-- },
tab_selected = {
guifg = { attribute = "fg", highlight = "Normal" },
guibg = { attribute = "bg", highlight = "Normal" },
},
tab = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
tab_close = {
-- guifg = {attribute='fg',highlight='LspDiagnosticsDefaultError'},
guifg = { attribute = "fg", highlight = "TabLineSel" },
guibg = { attribute = "bg", highlight = "Normal" },
},
duplicate_selected = {
guifg = { attribute = "fg", highlight = "TabLineSel" },
guibg = { attribute = "bg", highlight = "TabLineSel" },
gui = "italic",
},
duplicate_visible = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
gui = "italic",
},
duplicate = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
gui = "italic",
},
modified = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
modified_selected = {
guifg = { attribute = "fg", highlight = "Normal" },
guibg = { attribute = "bg", highlight = "Normal" },
},
modified_visible = {
guifg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
separator = {
guifg = { attribute = "bg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" },
},
separator_selected = {
guifg = { attribute = "bg", highlight = "Normal" },
guibg = { attribute = "bg", highlight = "Normal" },
},
-- separator_visible = {
-- guifg = {attribute='bg',highlight='TabLine'},
-- guibg = {attribute='bg',highlight='TabLine'}
-- },
indicator_selected = {
guifg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" },
guibg = { attribute = "bg", highlight = "Normal" },
},
},
}

View File

@ -0,0 +1,256 @@
local cmp_status_ok, cmp = pcall(require, "cmp")
if not cmp_status_ok then
return
end
local snip_status_ok, luasnip = pcall(require, "luasnip")
if not snip_status_ok then
return
end
local tabnine_status_ok, _ = pcall(require, "user.tabnine")
if not tabnine_status_ok then
return
end
local buffer_fts = {
"markdown",
"toml",
"yaml",
"json",
}
local function contains(t, value)
for _, v in pairs(t) do
if v == value then
return true
end
end
return false
end
local compare = require "cmp.config.compare"
require("luasnip/loaders/from_vscode").lazy_load()
-- local check_backspace = function()
-- local col = vim.fn.col "." - 1
-- return col == 0 or vim.fn.getline("."):sub(col, col):match "%s"
-- end
local check_backspace = function()
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
local icons = require "user.icons"
local kind_icons = icons.kind
vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#6CC644" })
vim.api.nvim_set_hl(0, "CmpItemKindTabnine", { fg = "#CA42F0" })
vim.api.nvim_set_hl(0, "CmpItemKindEmoji", { fg = "#FDE030" })
vim.api.nvim_set_hl(0, "CmpItemKindCrate", { fg = "#F64D00" })
vim.g.cmp_active = true
cmp.setup {
enabled = function()
local buftype = vim.api.nvim_buf_get_option(0, "buftype")
if buftype == "prompt" then
return false
end
return vim.g.cmp_active
end,
preselect = cmp.PreselectMode.None,
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body) -- For `luasnip` users.
end,
},
mapping = cmp.mapping.preset.insert {
["<C-k>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
["<C-j>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<m-o>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
-- ["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
["<C-c>"] = cmp.mapping {
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
},
["<m-j>"] = cmp.mapping {
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
},
["<m-k>"] = cmp.mapping {
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
},
["<m-c>"] = cmp.mapping {
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
},
["<S-CR>"] = cmp.mapping {
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
},
-- Accept currently selected item. If none selected, `select` first item.
-- Set `select` to `false` to only confirm explicitly selected items.
["<CR>"] = cmp.mapping.confirm { select = false },
["<Right>"] = cmp.mapping.confirm { select = true },
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.jumpable(1) then
luasnip.jump(1)
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif luasnip.expandable() then
luasnip.expand()
elseif check_backspace() then
-- cmp.complete()
fallback()
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",
}),
},
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
-- Kind icons
vim_item.kind = kind_icons[vim_item.kind]
if entry.source.name == "cmp_tabnine" then
vim_item.kind = icons.misc.Robot
vim_item.kind_hl_group = "CmpItemKindTabnine"
end
if entry.source.name == "copilot" then
vim_item.kind = icons.git.Octoface
vim_item.kind_hl_group = "CmpItemKindCopilot"
end
if entry.source.name == "emoji" then
vim_item.kind = icons.misc.Smiley
vim_item.kind_hl_group = "CmpItemKindEmoji"
end
if entry.source.name == "crates" then
vim_item.kind = icons.misc.Package
vim_item.kind_hl_group = "CmpItemKindCrate"
end
if entry.source.name == "lab.quick_data" then
vim_item.kind = icons.misc.CircuitBoard
vim_item.kind_hl_group = "CmpItemKindConstant"
end
-- NOTE: order matters
vim_item.menu = ({
nvim_lsp = "",
nvim_lua = "",
luasnip = "",
buffer = "",
path = "",
emoji = "",
})[entry.source.name]
return vim_item
end,
},
sources = {
{ name = "crates", group_index = 1 },
{
name = "copilot",
-- keyword_length = 0,
max_item_count = 3,
-- trigger_characters = {
-- { ".", ":", "(", "'", '"', "[", ",", "#", "*", "@", "|", "=", "-", "{", "/", "\\", "+", "?", " ", "\t", "\n" },
-- },
group_index = 2,
},
{
name = "nvim_lsp",
filter = function(entry, ctx)
local kind = require("cmp.types.lsp").CompletionItemKind[entry:get_kind()]
if kind == "Snippet" and ctx.prev_context.filetype == "java" then
return true
end
if kind == "Text" then
return true
end
end,
group_index = 2,
},
{ name = "nvim_lua", group_index = 2 },
{ name = "luasnip", group_index = 2 },
{
name = "buffer",
group_index = 2,
filter = function(entry, ctx)
if not contains(buffer_fts, ctx.prev_context.filetype) then
return true
end
end,
},
{ name = "cmp_tabnine", group_index = 2 },
{ name = "path", group_index = 2 },
{ name = "emoji", group_index = 2 },
{ name = "lab.quick_data", keyword_length = 4, group_index = 2 },
},
sorting = {
priority_weight = 2,
comparators = {
-- require("copilot_cmp.comparators").prioritize,
-- require("copilot_cmp.comparators").score,
compare.offset,
compare.exact,
-- compare.scopes,
compare.score,
compare.recently_used,
compare.locality,
-- compare.kind,
compare.sort_text,
compare.length,
compare.order,
-- require("copilot_cmp.comparators").prioritize,
-- require("copilot_cmp.comparators").score,
},
},
confirm_opts = {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
},
window = {
documentation = false,
-- documentation = {
-- border = "rounded",
-- winhighlight = "NormalFloat:Pmenu,NormalFloat:Pmenu,CursorLine:PmenuSel,Search:None",
-- },
completion = {
border = "rounded",
winhighlight = "NormalFloat:Pmenu,NormalFloat:Pmenu,CursorLine:PmenuSel,Search:None",
},
},
experimental = {
ghost_text = true,
},
}

View File

@ -0,0 +1,17 @@
local status_ok, colorizer = pcall(require, "colorizer")
if not status_ok then
return
end
colorizer.setup({ "*" }, {
RGB = true, -- #RGB hex codes
RRGGBB = true, -- #RRGGBB hex codes
names = false, -- "Name" codes like Blue oe blue
RRGGBBAA = true, -- #RRGGBBAA hex codes
rgb_fn = true, -- CSS rgb() and rgba() functions
hsl_fn = true, -- CSS hsl() and hsla() functions
css = false, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
css_fn = false, -- Enable all CSS *functions*: rgb_fn, hsl_fn
-- Available modes: foreground, background, virtualtext
mode = "background", -- Set the display mode.)
})

View File

@ -0,0 +1,7 @@
local colorscheme = "tokyonight"
local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
if not status_ok then
vim.notify("colorscheme " .. colorscheme .. " not found!")
return
end

View File

@ -0,0 +1,43 @@
local status_ok, comment = pcall(require, "Comment")
if not status_ok then
return
end
local status_ok_1, _ = pcall(require, "lsp-inlayhints")
if not status_ok_1 then
return
end
comment.setup {
pre_hook = function(ctx)
-- For inlay hints
local line_start = (ctx.srow or ctx.range.srow) - 1
local line_end = ctx.erow or ctx.range.erow
require("lsp-inlayhints.core").clear(0, line_start, line_end)
if
vim.bo.filetype == "typescriptreact"
or vim.bo.filetype == "javascriptreact"
or vim.bo.filetype == "javascript"
or vim.bo.filetype == "typescript"
then
local U = require "Comment.utils"
-- Determine whether to use linewise or blockwise commentstring
local type = ctx.ctype == U.ctype.linewise and "__default" or "__multiline"
-- Determine the location where to calculate commentstring from
local location = nil
if ctx.ctype == U.ctype.blockwise then
location = require("ts_context_commentstring.utils").get_cursor_location()
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
location = require("ts_context_commentstring.utils").get_visual_start_location()
end
return require("ts_context_commentstring.internal").calculate_commentstring {
key = type,
location = location,
}
end
end,
}

View File

@ -0,0 +1,80 @@
local dap_status_ok, dap = pcall(require, "dap")
if not dap_status_ok then
return
end
local dap_ui_status_ok, dapui = pcall(require, "dapui")
if not dap_ui_status_ok then
return
end
-- dapui.setup()
dapui.setup {
icons = { expanded = "", collapsed = "" },
mappings = {
-- Use a table to apply multiple mappings
expand = { "<CR>", "<2-LeftMouse>" },
open = "o",
remove = "d",
edit = "e",
repl = "r",
toggle = "t",
},
-- Expand lines larger than the window
-- Requires >= 0.7
expand_lines = vim.fn.has "nvim-0.7",
-- Layouts define sections of the screen to place windows.
-- The position can be "left", "right", "top" or "bottom".
-- The size specifies the height/width depending on position. It can be an Int
-- or a Float. Integer specifies height/width directly (i.e. 20 lines/columns) while
-- Float value specifies percentage (i.e. 0.3 - 30% of available lines/columns)
-- Elements are the elements shown in the layout (in order).
-- Layouts are opened in order so that earlier layouts take priority in window sizing.
layouts = {
{
elements = {
-- Elements can be strings or table with id and size keys.
{ id = "scopes", size = 0.25 },
"breakpoints",
-- "stacks",
-- "watches",
},
size = 40, -- 40 columns
position = "right",
},
{
elements = {
"repl",
"console",
},
size = 0.25, -- 25% of total lines
position = "bottom",
},
},
floating = {
max_height = nil, -- These can be integers or a float between 0 and 1.
max_width = nil, -- Floats will be treated as percentage of your screen.
border = "single", -- Border style. Can be "single", "double" or "rounded"
mappings = {
close = { "q", "<Esc>" },
},
},
windows = { indent = 1 },
render = {
max_type_length = nil, -- Can be integer or nil.
},
}
local icons = require "user.icons"
vim.fn.sign_define("DapBreakpoint", { text = icons.ui.Bug, texthl = "DiagnosticSignError", linehl = "", numhl = "" })
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open {}
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close {}
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close {}
end

View File

@ -0,0 +1,121 @@
local status_ok, dressing = pcall(require, "dressing")
if not status_ok then
return
end
dressing.setup {
input = {
-- Set to false to disable the vim.ui.input implementation
enabled = true,
-- Default prompt string
default_prompt = "Input:",
-- Can be 'left', 'right', or 'center'
prompt_align = "left",
-- When true, <Esc> will close the modal
insert_only = true,
-- These are passed to nvim_open_win
anchor = "SW",
border = "rounded",
-- 'editor' and 'win' will default to being centered
relative = "cursor",
-- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
prefer_width = 40,
width = nil,
-- min_width and max_width can be a list of mixed types.
-- min_width = {20, 0.2} means "the greater of 20 columns or 20% of total"
max_width = { 140, 0.9 },
min_width = { 20, 0.2 },
-- Window transparency (0-100)
winblend = 10,
-- Change default highlight groups (see :help winhl)
winhighlight = "",
override = function(conf)
-- This is the config that will be passed to nvim_open_win.
-- Change values here to customize the layout
return conf
end,
-- see :help dressing_get_config
get_config = nil,
},
select = {
-- Set to false to disable the vim.ui.select implementation
enabled = true,
-- Priority list of preferred vim.select implementations
-- backend = { "telescope", "fzf_lua", "fzf", "builtin", "nui" },
backend = { "builtin", "telescope", "nui" },
-- Trim trailing `:` from prompt
trim_prompt = true,
-- Options for telescope selector
-- These are passed into the telescope picker directly. Can be used like:
-- telescope = require('telescope.themes').get_ivy({...})
telescope = nil,
-- Options for nui Menu
nui = {
position = "50%",
size = nil,
relative = "editor",
border = {
style = "rounded",
},
buf_options = {
swapfile = false,
filetype = "DressingSelect",
},
win_options = {
winblend = 10,
},
max_width = 80,
max_height = 40,
min_width = 40,
min_height = 10,
},
-- Options for built-in selector
builtin = {
-- These are passed to nvim_open_win
anchor = "NW",
border = "rounded",
-- 'editor' and 'win' will default to being centered
relative = "editor",
-- Window transparency (0-100)
winblend = 10,
-- Change default highlight groups (see :help winhl)
winhighlight = "",
-- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
-- the min_ and max_ options can be a list of mixed types.
-- max_width = {140, 0.8} means "the lesser of 140 columns or 80% of total"
width = nil,
max_width = { 140, 0.8 },
min_width = { 40, 0.2 },
height = nil,
max_height = 0.9,
min_height = { 10, 0.2 },
override = function(conf)
-- This is the config that will be passed to nvim_open_win.
-- Change values here to customize the layout
return conf
end,
},
-- Used to override format_item. See :help dressing-format
format_item_override = {},
-- see :help dressing_get_config
get_config = nil,
},
}

View File

@ -0,0 +1,6 @@
local status_ok, fidget = pcall(require, "fidget")
if not status_ok then
return
end
fidget.setup()

View File

@ -0,0 +1,48 @@
local status_ok, gitsigns = pcall(require, "gitsigns")
if not status_ok then
return
end
gitsigns.setup {
signs = {
add = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
change = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
delete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
topdelete = { hl = "GitSignsDelete", text = "", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
changedelete = { hl = "GitSignsChange", text = "", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
},
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 = 1000,
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 = "eol", -- 'eol' | 'overlay' | 'right_align'
delay = 1000,
ignore_whitespace = false,
},
current_line_blame_formatter_opts = {
relative_time = false,
},
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
max_file_length = 40000,
preview_config = {
-- Options passed to nvim_open_win
border = "rounded",
style = "minimal",
relative = "cursor",
row = 0,
col = 1,
},
yadm = {
enable = false,
},
}

View File

@ -0,0 +1,10 @@
local status_ok, telescope = pcall(require, "telescope")
if not status_ok then
return
end
local h_status_ok, harpoon = pcall(require, "harpoon")
if not h_status_ok then
return
end
telescope.load_extension "harpoon"

View File

@ -0,0 +1,25 @@
local status_ok, hop = pcall(require, "hop")
if not status_ok then
return
end
hop.setup()
local opts = { noremap = true, silent = true }
local keymap = vim.api.nvim_set_keymap
keymap("", "L", ":HopWordCurrentLine<cr>", { silent = true })
-- keymap("", "S", ":HopChar2<cr>", { silent = true })
-- keymap("", "Q", ":HopPattern<cr>", { silent = true })
keymap("", "H", ":HopChar2<cr>", { silent = true })
keymap("o", "f", ":lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })<CR>", opts)
keymap("o", "F", ":lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })<CR>", opts)
keymap("o", "t", ":lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true, hint_offset = -1 })<CR>", opts)
keymap("o", "T", ":lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true, hint_offset = 1 })<CR>", opts)
keymap("n", "f", ":lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true })<CR>", opts)
keymap("n", "F", ":lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true })<CR>", opts)
keymap("n", "t", ":lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.AFTER_CURSOR, current_line_only = true, hint_offset = -1 })<CR>", opts)
keymap("n", "T", ":lua require'hop'.hint_char1({ direction = require'hop.hint'.HintDirection.BEFORE_CURSOR, current_line_only = true, hint_offset = 1 })<CR>", opts)

View File

@ -0,0 +1,222 @@
-- https://github.com/microsoft/vscode/blob/main/src/vs/base/common/codicons.ts
-- go to the above and then enter <c-v>u<unicode> and the symbold should appear
-- or go here and upload the font file: https://mathew-kurian.github.io/CharacterMap/
-- find more here: https://www.nerdfonts.com/cheat-sheet
vim.g.use_nerd_icons = false
if vim.fn.has "mac" == 1 or vim.g.use_nerd_icons then
-- elseif vim.fn.has "mac" == 1 then
return {
kind = {
Text = "",
-- Method = "m",
-- Function = "",
-- Constructor = "",
Method = "",
Function = "",
Constructor = "",
Field = "",
-- Variable = "",
Variable = "",
Class = "",
Interface = "",
-- Module = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
-- Keyword = "",
Keyword = "",
-- Snippet = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
},
type = {
Array = "",
Number = "",
String = "",
Boolean = "",
Object = "",
},
documents = {
File = "",
Files = "",
Folder = "",
OpenFolder = "",
},
git = {
Add = "",
Mod = "",
Remove = "",
Ignore = "",
Rename = "",
Diff = "",
Repo = "",
Octoface = "",
},
ui = {
ArrowClosed = "",
ArrowOpen = "",
Lock = "",
Circle = "",
BigCircle = "",
BigUnfilledCircle = "",
Close = "",
NewFile = "",
Search = "",
Lightbulb = "",
Project = "",
Dashboard = "",
History = "",
Comment = "",
Bug = "",
Code = "",
Telescope = "",
Gear = "",
Package = "",
List = "",
SignIn = "",
SignOut = "",
Check = "",
Fire = "",
Note = "",
BookMark = "",
Pencil = "",
-- ChevronRight = "",
ChevronRight = ">",
Table = "",
Calendar = "",
CloudDownload = "",
},
diagnostics = {
Error = "",
Warning = "",
Information = "",
Question = "",
Hint = "",
},
misc = {
Robot = "",
Squirrel = "",
Tag = "",
Watch = "",
Smiley = "",
Package = "",
CircuitBoard = "",
},
}
else
--   פּ ﯟ   蘒練 some other good icons
return {
kind = {
Text = "",
Method = "",
Function = "",
Constructor = "",
Field = "",
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
Misc = "",
},
type = {
Array = "",
Number = "",
String = "",
Boolean = "",
Object = "",
},
documents = {
File = "",
Files = "",
Folder = "",
OpenFolder = "",
},
git = {
Add = "",
Mod = "",
Remove = "",
Ignore = "",
Rename = "",
Diff = "",
Repo = "",
Octoface = "",
},
ui = {
ArrowClosed = "",
ArrowOpen = "",
Lock = "",
Circle = "",
BigCircle = "",
BigUnfilledCircle = "",
Close = "",
NewFile = " ",
Search = "",
Lightbulb = "",
Project = "",
Dashboard = "",
History = "",
Comment = "",
Bug = "",
Code = "",
Telescope = "",
Gear = "",
Package = "",
List = "",
SignIn = "",
SignOut = "",
NoteBook = "",
Check = "",
Fire = "",
Note = "",
BookMark = "",
Pencil = "",
ChevronRight = "",
Table = "",
Calendar = "",
CloudDownload = "",
},
diagnostics = {
Error = "",
Warning = "",
Information = "",
Question = "",
Hint = "",
},
misc = {
Robot = "",
Squirrel = "",
Tag = "",
Watch = "",
Smiley = "",
Package = "",
CircuitBoard = "",
},
}
end

View File

@ -0,0 +1,11 @@
-- vim.g.Illuminate_delay = 0
-- vim.g.Illuminate_highlightUnderCursor = 0
vim.g.Illuminate_ftblacklist = { "alpha", "NvimTree", "DressingSelect", "harpoon" }
-- vim.g.Illuminate_highlightUnderCursor = 0
vim.api.nvim_set_keymap("n", "<a-n>", '<cmd>lua require"illuminate".next_reference{wrap=true}<cr>', { noremap = true })
vim.api.nvim_set_keymap(
"n",
"<a-p>",
'<cmd>lua require"illuminate".next_reference{reverse=true,wrap=true}<cr>',
{ noremap = true }
)

View File

@ -0,0 +1,6 @@
local status_ok, impatient = pcall(require, "impatient")
if not status_ok then
return
end
impatient.enable_profile()

View File

@ -0,0 +1,73 @@
local status_ok, indent_blankline = pcall(require, "indent_blankline")
if not status_ok then
return
end
vim.g.indent_blankline_buftype_exclude = { "terminal", "nofile" }
vim.g.indent_blankline_filetype_exclude = {
"help",
"startify",
"dashboard",
"packer",
"neogitstatus",
"NvimTree",
"Trouble",
"text"
}
vim.g.indentLine_enabled = 1
-- vim.g.indent_blankline_char = "│"
vim.g.indent_blankline_char = ""
-- vim.g.indent_blankline_char = "▎"
vim.g.indent_blankline_show_trailing_blankline_indent = false
vim.g.indent_blankline_show_first_indent_level = true
vim.g.indent_blankline_use_treesitter = false
-- vim.g.indent_blankline_use_treesitter_scope = 1
vim.g.indent_blankline_show_current_context = true
-- vim.g.indent_blankline_context_patterns = {
-- "class",
-- "return",
-- "function",
-- "method",
-- "^if",
-- "^while",
-- "jsx_element",
-- "^for",
-- "^object",
-- "^table",
-- "block",
-- "arguments",
-- "if_statement",
-- "else_clause",
-- "jsx_element",
-- "jsx_self_closing_element",
-- "try_statement",
-- "catch_clause",
-- "import_statement",
-- "operation_type",
-- }
-- HACK: work-around for https://github.com/lukas-reineke/indent-blankline.nvim/issues/59
-- vim.wo.colorcolumn = "99999"
-- vim.cmd [[highlight IndentBlanklineIndent1 guifg=#E06C75 gui=nocombine]]
-- vim.cmd [[highlight IndentBlanklineIndent2 guifg=#E5C07B gui=nocombine]]
-- vim.cmd [[highlight IndentBlanklineIndent3 guifg=#98C379 gui=nocombine]]
-- vim.cmd [[highlight IndentBlanklineIndent4 guifg=#56B6C2 gui=nocombine]]
-- vim.cmd [[highlight IndentBlanklineIndent5 guifg=#61AFEF gui=nocombine]]
-- vim.cmd [[highlight IndentBlanklineIndent6 guifg=#C678DD gui=nocombine]]
-- vim.opt.list = true
-- vim.opt.listchars:append "space:⋅"
-- vim.opt.listchars:append "space:"
-- vim.opt.listchars:append "eol:↴"
indent_blankline.setup {
-- show_end_of_line = true,
-- space_char_blankline = " ",
show_current_context = true,
-- show_current_context_start = true,
-- char_highlight_list = {
-- "IndentBlanklineIndent1",
-- "IndentBlanklineIndent2",
-- "IndentBlanklineIndent3",
-- },
}

View File

@ -0,0 +1,90 @@
local opts = { noremap = true, silent = true }
local term_opts = { silent = true }
-- Shorten function name
local keymap = vim.api.nvim_set_keymap
--Remap space as leader key
keymap("n", "<Space>", "", opts)
vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- Modes
-- normal_mode = "n",
-- insert_mode = "i",
-- visual_mode = "v",
-- visual_block_mode = "x",
-- term_mode = "t",
-- command_mode = "c",
-- Normal --
-- Better window navigation
keymap("n", "<C-h>", "<C-w>h", opts)
keymap("n", "<C-j>", "<C-w>j", opts)
keymap("n", "<C-k>", "<C-w>k", opts)
keymap("n", "<C-l>", "<C-w>l", opts)
-- Resize with arrows
keymap("n", "<C-Up>", ":resize -2<CR>", opts)
keymap("n", "<C-Down>", ":resize +2<CR>", opts)
keymap("n", "<C-Left>", ":vertical resize -2<CR>", opts)
keymap("n", "<C-Right>", ":vertical resize +2<CR>", opts)
-- Naviagate buffers
keymap("n", "<S-l>", ":bnext<CR>", opts)
keymap("n", "<S-h>", ":bprevious<CR>", opts)
-- Move text up and down
keymap("n", "<A-j>", "<Esc>:m .+1<CR>==gi", opts)
keymap("n", "<A-k>", "<Esc>:m .-2<CR>==gi", opts)
-- Insert --
-- Press jk fast to enter
keymap("i", "jk", "<ESC>", opts)
-- Visual --
-- Stay in indent mode
keymap("v", "<", "<gv", opts)
keymap("v", ">", ">gv", opts)
-- Move text up and down
keymap("v", "<A-j>", ":m .+1<CR>==", opts)
keymap("v", "<A-k>", ":m .-2<CR>==", opts)
keymap("v", "p", '"_dP', opts)
keymap("v", "P", '"_dP', opts)
-- Visual Block --
-- Move text up and down
keymap("x", "J", ":move '>+1<CR>gv-gv", opts)
keymap("x", "K", ":move '<-2<CR>gv-gv", opts)
keymap("x", "<A-j>", ":move '>+1<CR>gv-gv", opts)
keymap("x", "<A-k>", ":move '<-2<CR>gv-gv", opts)
-- My bit's an pieces currently unsorted
-- Spellcheck
keymap("n", "<leader>o", ":setlocal spell! spelllang=en_us<CR>", opts)
-- Tree
keymap("n", "<leader>n", ":NvimTreeToggle<CR>", opts)
-- Copy and Paste
keymap("n", "<C-c>", "\"+y", opts)
keymap("n", "<C-p", "\"+p", opts)
-- Replace All is S
keymap("n", "S", ":%s//g<Left><Left>", opts)
-- Compile the document with default compiler script
keymap("n", "<leader>c", ":w! | !compiler <c-r>%<CR>", opts)
-- Open compiled document
keymap("n", "<leader>p", ":!opout <c-r>%<CR><CR>", opts)
-- Attempt sudo for files that require it
keymap("n", "w!!", "execute 'silent! write !sudo tee % >/dev/null' <bar> edit!", opts)

View File

@ -0,0 +1,84 @@
local status_ok, lir = pcall(require, "lir")
if not status_ok then
return
end
local actions = require "lir.actions"
local mark_actions = require "lir.mark.actions"
local clipboard_actions = require "lir.clipboard.actions"
lir.setup {
show_hidden_files = false,
devicons_enable = true,
mappings = {
["l"] = actions.edit,
["<C-s>"] = actions.split,
["v"] = actions.vsplit,
["<C-t>"] = actions.tabedit,
["h"] = actions.up,
["q"] = actions.quit,
["A"] = actions.mkdir,
["a"] = actions.newfile,
["r"] = actions.rename,
["@"] = actions.cd,
["Y"] = actions.yank_path,
["i"] = actions.toggle_show_hidden,
["d"] = actions.delete,
["J"] = function()
mark_actions.toggle_mark()
vim.cmd "normal! j"
end,
["c"] = clipboard_actions.copy,
["x"] = clipboard_actions.cut,
["p"] = clipboard_actions.paste,
},
float = {
winblend = 0,
curdir_window = {
enable = false,
highlight_dirname = true,
},
-- -- You can define a function that returns a table to be passed as the third
-- -- argument of nvim_open_win().
win_opts = function()
local width = math.floor(vim.o.columns * 0.7)
local height = math.floor(vim.o.lines * 0.7)
return {
border = "rounded",
width = width,
height = height,
-- row = 1,
-- col = math.floor((vim.o.columns - width) / 2),
}
end,
},
hide_cursor = false,
on_init = function()
-- use visual mode
vim.api.nvim_buf_set_keymap(
0,
"x",
"J",
':<C-u>lua require"lir.mark.actions".toggle_mark("v")<CR>',
{ noremap = true, silent = true }
)
-- echo cwd
-- vim.api.nvim_echo({ { vim.fn.expand "%:p", "Normal" } }, false, {})
end,
}
-- custom folder icon
require("nvim-web-devicons").set_icon {
lir_folder_icon = {
icon = "",
-- color = "#7ebae4",
-- color = "#569CD6",
color = "#42A5F5",
name = "LirFolderNode",
},
}

View File

@ -0,0 +1,471 @@
M = {}
local status_ok, lualine = pcall(require, "lualine")
if not status_ok then
return
end
local lualine_scheme = "darkplus_dark"
-- local lualine_scheme = "onedarker_alt"
local status_theme_ok, theme = pcall(require, "lualine.themes." .. lualine_scheme)
if not status_theme_ok then
return
end
-- check if value in table
local function contains(t, value)
for _, v in pairs(t) do
if v == value then
return true
end
end
return false
end
local gray = "#32363e"
local dark_gray = "#282C34"
local dark_gray = "#282C34"
local red = "#D16969"
local blue = "#569CD6"
local green = "#6A9955"
local cyan = "#4EC9B0"
local orange = "#CE9178"
local indent = "#CE9178"
local yellow = "#DCDCAA"
local yellow_orange = "#D7BA7D"
local purple = "#C586C0"
if lualine_scheme == "darkplus_dark" then
-- gray = "#3e3e3e"
gray = "#303030"
dark_gray = "#303030"
red = "#bf616a"
blue = "#5e81ac"
indent = "#A3BE8C"
green = "#A3BE8C"
cyan = "#88c0d0"
orange = "#C68A75"
yellow = "#DCDCAA"
yellow_orange = "#D7BA7D"
purple = "#B48EAD"
end
local sl_hl = vim.api.nvim_get_hl_by_name("StatusLine", true)
local sl_hl_sep = vim.api.nvim_get_hl_by_name("StatusLineSeparator", true)
vim.api.nvim_set_hl(0, "SLGitIcon", { fg = "#E8AB53", bg = dark_gray })
vim.api.nvim_set_hl(0, "SLTermIcon", { fg = purple, bg = gray })
vim.api.nvim_set_hl(0, "SLBranchName", { fg = "#abb2bf", bg = dark_gray, bold = false })
vim.api.nvim_set_hl(0, "SLProgress", { fg = purple, bg = gray })
vim.api.nvim_set_hl(0, "SLLocation", { fg = blue, bg = gray })
vim.api.nvim_set_hl(0, "SLFT", { fg = cyan, bg = gray })
vim.api.nvim_set_hl(0, "SLIndent", { fg = indent, bg = gray })
vim.api.nvim_set_hl(0, "SLLSP", { fg = "#6b727f", bg = "NONE" })
vim.api.nvim_set_hl(0, "SLSep", { fg = gray, bg = "NONE" })
vim.api.nvim_set_hl(0, "SLFG", { fg = "#abb2bf", bg = "NONE" })
vim.api.nvim_set_hl(0, "SLSeparator", { fg = "#6b727f", bg = "NONE", italic = true })
vim.api.nvim_set_hl(0, "SLError", { fg = "#bf616a", bg = "NONE" })
vim.api.nvim_set_hl(0, "SLWarning", { fg = "#D7BA7D", bg = "NONE" })
vim.api.nvim_set_hl(0, "SLCopilot", { fg = "#6CC644", bg = "NONE" })
local hl_str = function(str, hl)
return "%#" .. hl .. "#" .. str .. "%*"
end
local mode_color = {
n = blue,
i = orange,
v = "#b668cd",
[""] = "#b668cd",
V = "#b668cd",
-- c = '#B5CEA8',
-- c = '#D7BA7D',
c = "#46a6b2",
no = "#D16D9E",
s = green,
S = orange,
[""] = orange,
ic = red,
R = "#D16D9E",
Rv = red,
cv = blue,
ce = blue,
r = red,
rm = "#46a6b2",
["r?"] = "#46a6b2",
["!"] = "#46a6b2",
t = red,
}
local left_pad = {
function()
return ""
end,
padding = 0,
color = function()
return { fg = gray }
end,
}
local right_pad = {
function()
return ""
end,
padding = 0,
color = function()
return { fg = dark_gray }
end,
}
local left_pad_alt = {
function()
return ""
end,
padding = 0,
color = function()
return { fg = gray }
end,
}
local right_pad_alt = {
function()
return ""
end,
padding = 0,
color = function()
return { fg = gray }
end,
}
local mode = {
-- mode component
function()
-- return "▊"
return ""
-- return "  "
end,
color = function()
-- auto change color according to neovims mode
return { fg = mode_color[vim.fn.mode()], bg = gray }
end,
padding = 0,
}
local hide_in_width_60 = function()
return vim.o.columns > 60
end
local hide_in_width = function()
return vim.o.columns > 80
end
local hide_in_width_100 = function()
return vim.o.columns > 100
end
local icons = require "user.icons"
local diagnostics = {
"diagnostics",
sources = { "nvim_diagnostic" },
sections = { "error", "warn" },
symbols = {
error = "%#SLError#" .. icons.diagnostics.Error .. "%*" .. " ",
warn = "%#SLWarning#" .. icons.diagnostics.Warning .. "%*" .. " ",
},
colored = false,
update_in_insert = false,
always_visible = true,
padding = 0,
}
local diff = {
"diff",
colored = false,
symbols = { added = icons.git.Add .. " ", modified = icons.git.Mod .. " ", removed = icons.git.Remove .. " " }, -- changes diff symbols
cond = hide_in_width_60,
separator = "%#SLSeparator#" .. "" .. "%*",
}
local filetype = {
"filetype",
fmt = function(str)
local ui_filetypes = {
"help",
"packer",
"neogitstatus",
"NvimTree",
"Trouble",
"lir",
"Outline",
"spectre_panel",
"toggleterm",
"DressingSelect",
"",
"nil",
}
local return_val = function(str)
return hl_str("", "SLSep") .. hl_str(str, "SLFT") .. hl_str("", "SLSep")
end
if str == "TelescopePrompt" then
return return_val(icons.ui.Telescope)
end
local function get_term_num()
local t_status_ok, toggle_num = pcall(vim.api.nvim_buf_get_var, 0, "toggle_number")
if not t_status_ok then
return ""
end
return toggle_num
end
if str == "toggleterm" then
-- 
local term = "%#SLTermIcon#" .. "" .. "%*" .. "%#SLFT#" .. get_term_num() .. "%*"
return return_val(term)
end
if contains(ui_filetypes, str) then
return ""
else
return return_val(str)
end
end,
icons_enabled = false,
padding = 0,
}
local branch = {
"branch",
icons_enabled = true,
icon = "%#SLGitIcon#" .. "" .. "%*" .. "%#SLBranchName#",
-- color = "Constant",
colored = false,
padding = 0,
-- cond = hide_in_width_100,
fmt = function(str)
if str == "" or str == nil then
return "!=vcs"
end
return str
end,
}
local progress = {
"progress",
fmt = function(str)
-- return "▊"
return hl_str("", "SLSep") .. hl_str("%P/%L", "SLProgress") .. hl_str("", "SLSep")
-- return "  "
end,
-- color = "SLProgress",
padding = 0,
}
local current_signature = {
function()
local buf_ft = vim.bo.filetype
if buf_ft == "toggleterm" or buf_ft == "TelescopePrompt" then
return ""
end
if not pcall(require, "lsp_signature") then
return ""
end
local sig = require("lsp_signature").status_line(30)
local hint = sig.hint
if not require("user.functions").isempty(hint) then
-- return "%#SLSeparator#│ : " .. hint .. "%*"
-- return "%#SLSeparator#│ " .. hint .. "%*"
return "%#SLSeparator# " .. hint .. "%*"
end
return ""
end,
cond = hide_in_width_100,
padding = 0,
}
-- cool function for progress
-- local progress = function()
-- local current_line = vim.fn.line "."
-- local total_lines = vim.fn.line "$"
-- local chars = { "__", "▁▁", "▂▂", "▃▃", "▄▄", "▅▅", "▆▆", "▇▇", "██" }
-- local line_ratio = current_line / total_lines
-- local index = math.ceil(line_ratio * #chars)
-- -- return chars[index]
-- return "%#SLProgress#" .. chars[index] .. "%*"
-- end
local spaces = {
function()
local buf_ft = vim.bo.filetype
local ui_filetypes = {
"help",
"packer",
"neogitstatus",
"NvimTree",
"Trouble",
"lir",
"Outline",
"spectre_panel",
"DressingSelect",
"",
}
local space = ""
if contains(ui_filetypes, buf_ft) then
space = " "
end
local shiftwidth = vim.api.nvim_buf_get_option(0, "shiftwidth")
if shiftwidth == nil then
return ""
end
-- TODO: update codicons and use their indent
return hl_str("", "SLSep") .. hl_str("" .. shiftwidth .. space, "SLIndent") .. hl_str("", "SLSep")
end,
padding = 0,
-- separator = "%#SLSeparator#" .. " │" .. "%*",
-- cond = hide_in_width_100,
}
local lanuage_server = {
function()
local buf_ft = vim.bo.filetype
local ui_filetypes = {
"help",
"packer",
"neogitstatus",
"NvimTree",
"Trouble",
"lir",
"Outline",
"spectre_panel",
"toggleterm",
"DressingSelect",
"TelescopePrompt",
"lspinfo",
"lsp-installer",
"",
}
if contains(ui_filetypes, buf_ft) then
if M.language_servers == nil then
return ""
else
return M.language_servers
end
end
local clients = vim.lsp.buf_get_clients()
local client_names = {}
local copilot_active = false
-- add client
for _, client in pairs(clients) do
if client.name ~= "copilot" and client.name ~= "null-ls" then
table.insert(client_names, client.name)
end
if client.name == "copilot" then
copilot_active = true
end
end
-- add formatter
local s = require "null-ls.sources"
local available_sources = s.get_available(buf_ft)
local registered = {}
for _, source in ipairs(available_sources) do
for method in pairs(source.methods) do
registered[method] = registered[method] or {}
table.insert(registered[method], source.name)
end
end
local formatter = registered["NULL_LS_FORMATTING"]
local linter = registered["NULL_LS_DIAGNOSTICS"]
if formatter ~= nil then
vim.list_extend(client_names, formatter)
end
if linter ~= nil then
vim.list_extend(client_names, linter)
end
-- join client names with commas
local client_names_str = table.concat(client_names, ", ")
-- check client_names_str if empty
local language_servers = ""
local client_names_str_len = #client_names_str
if client_names_str_len ~= 0 then
language_servers = hl_str("", "SLSep") .. hl_str(client_names_str, "SLSeparator") .. hl_str("", "SLSep")
end
if copilot_active then
language_servers = language_servers .. "%#SLCopilot#" .. " " .. icons.git.Octoface .. "%*"
end
if client_names_str_len == 0 and not copilot_active then
return ""
else
M.language_servers = language_servers
return language_servers:gsub(", anonymous source", "")
end
end,
padding = 0,
cond = hide_in_width,
-- separator = "%#SLSeparator#" .. " │" .. "%*",
}
local location = {
"location",
fmt = function(str)
-- return "▊"
return hl_str("", "SLSep") .. hl_str(str, "SLLocation") .. hl_str("", "SLSep")
-- return "  "
end,
padding = 0,
}
lualine.setup {
options = {
globalstatus = true,
icons_enabled = true,
-- theme = "auto",
theme = theme,
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = { "alpha", "dashboard" },
always_divide_middle = true,
},
sections = {
lualine_a = { left_pad, mode, branch, right_pad },
lualine_b = { left_pad_alt, diagnostics, right_pad_alt },
-- lualine_c = {},
lualine_c = { current_signature },
-- lualine_x = { diff, spaces, "encoding", filetype },
-- lualine_x = { diff, lanuage_server, spaces, filetype },
-- lualine_x = { lanuage_server, spaces, filetype },
lualine_x = { lanuage_server, spaces, filetype },
lualine_y = {},
lualine_z = { location, progress },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {},
lualine_x = { "location" },
lualine_y = {},
lualine_z = {},
},
tabline = {},
extensions = {},
}

View File

@ -0,0 +1,3 @@
-- vim.g.matchup_enabled = 0
vim.g.matchup_matchparen_offscreen = { method = nil }
vim.g.matchup_matchpref = { html = { nolists = 1 } }

View File

@ -0,0 +1,44 @@
local status_ok, navic = pcall(require, "nvim-navic")
if not status_ok then
return
end
local icons = require "user.icons"
navic.setup {
icons = {
File = '',
Module = '',
Namespace = '',
Package = '',
Class = '',
Method = '',
Property = '',
Field = '',
Constructor = '',
Enum = '',
Interface = '',
Function = '',
Variable = '',
Constant = '',
String = '',
Number = '',
Boolean = '',
Array = '',
Object = '',
Key = '',
Null = '',
EnumMember = '',
Struct = '',
Event = '',
Operator = '',
TypeParameter = ''
},
highlight = true,
separator = " " .. icons.ui.ChevronRight .. " ",
depth_limit = 0,
depth_limit_indicator = "..",
}

View File

@ -0,0 +1,35 @@
local status_ok, neoscroll = pcall(require, "neoscroll")
if not status_ok then
return
end
neoscroll.setup {
-- All these keys will be mapped to their corresponding default scrolling animation
mappings = { "<C-u>", "<C-d>", "<C-b>", "<C-f>", "<C-y>", "<C-e>", "zt", "zz", "zb" },
hide_cursor = true, -- Hide cursor while scrolling
stop_eof = true, -- Stop at <EOF> when scrolling downwards
use_local_scrolloff = false, -- Use the local scope of scrolloff instead of the global scope
respect_scrolloff = true, -- Stop scrolling when the cursor reaches the scrolloff margin of the file
cursor_scrolls_alone = false, -- The cursor will keep on scrolling even if the window cannot scroll further
-- easing_function = nil, -- Default easing function
-- pre_hook = nil, -- Function to run before the scrolling animation starts
-- post_hook = nil, -- Function to run after the scrolling animation ends
}
local t = {}
-- Syntax: t[keys] = {function, {function arguments}}
-- t['<C-u>'] = {'scroll', {'-vim.wo.scroll', 'true', '250'}}
-- t['<C-d>'] = {'scroll', { 'vim.wo.scroll', 'true', '250'}}
-- t['<C-b>'] = {'scroll', {'-vim.api.nvim_win_get_height(0)', 'true', '450'}}
-- t['<C-f>'] = {'scroll', { 'vim.api.nvim_win_get_height(0)', 'true', '450'}}
-- t['<C-y>'] = {'scroll', {'-0.10', 'false', '100'}}
-- t['<C-e>'] = {'scroll', { '0.10', 'false', '100'}}
-- t['H'] = {'scroll', {'-0.10', 'true', '100'}}
-- t['L'] = {'scroll', { '0.10', 'true', '100'}}
t["<c-k>"] = { "scroll", { "-vim.wo.scroll", "true", "250" } }
t["<c-j>"] = { "scroll", { "vim.wo.scroll", "true", "250" } }
-- t['zt'] = {'zt', {'250'}}
-- t['zz'] = {'zz', {'250'}}
-- t['zb'] = {'zb', {'250'}}
require("neoscroll.config").set_mappings(t)

View File

@ -0,0 +1,53 @@
local status_ok, notify = pcall(require, "notify")
if not status_ok then
return
end
local icons = require "user.icons"
notify.setup {
-- Animation style (see below for details)
stages = "fade_in_slide_out",
-- Function called when a new window is opened, use for changing win settings/config
on_open = nil,
-- Function called when a window is closed
on_close = nil,
-- Render function for notifications. See notify-render()
render = "default",
-- Default timeout for notifications
timeout = 175,
-- For stages that change opacity this is treated as the highlight behind the window
-- Set this to either a highlight group or an RGB hex value e.g. "#000000"
background_colour = "Normal",
-- Minimum width for notification windows
minimum_width = 10,
-- Icons for the different levels
icons = {
ERROR = icons.diagnostics.Error,
WARN = icons.diagnostics.Warning,
INFO = icons.diagnostics.Information,
DEBUG = icons.ui.Bug,
TRACE = icons.ui.Pencil,
},
}
vim.notify = notify
local notify_filter = vim.notify
vim.notify = function(msg, ...)
if msg:match "character_offset must be called" then
return
end
if msg:match "method textDocument" then
return
end
notify_filter(msg, ...)
end

View File

@ -0,0 +1,8 @@
local status_ok, numb = pcall(require, "numb")
if not status_ok then
return
end
numb.setup({
show_numbers = true, -- Enable 'number' for the window while peeking
show_cursorline = true, -- Enable 'cursorline' for the window while peeking
})

View File

@ -0,0 +1,141 @@
local status_ok, nvim_tree = pcall(require, "nvim-tree")
if not status_ok then
return
end
local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
if not config_status_ok then
return
end
local icons = require "user.icons"
local tree_cb = nvim_tree_config.nvim_tree_callback
nvim_tree.setup {
hijack_directories = {
enable = false,
},
-- update_to_buf_dir = {
-- enable = false,
-- },
-- disable_netrw = true,
-- hijack_netrw = true,
-- open_on_setup = false,
ignore_ft_on_setup = {
"startify",
"dashboard",
"alpha",
},
filters = {
custom = { ".git" },
exclude = { ".gitignore" },
},
-- auto_close = true,
-- open_on_tab = false,
-- hijack_cursor = false,
update_cwd = true,
-- update_to_buf_dir = {
-- enable = true,
-- auto_open = true,
-- },
-- --  error
-- --  info
-- --  question
-- --  warning
-- --  lightbulb
renderer = {
add_trailing = false,
group_empty = false,
highlight_git = false,
highlight_opened_files = "none",
root_folder_modifier = ":t",
indent_markers = {
enable = false,
icons = {
corner = "",
edge = "",
none = " ",
},
},
icons = {
webdev_colors = true,
git_placement = "before",
padding = " ",
symlink_arrow = "",
show = {
file = true,
folder = true,
folder_arrow = true,
git = true,
},
glyphs = {
default = "",
symlink = "",
folder = {
arrow_open = icons.ui.ArrowOpen,
arrow_closed = icons.ui.ArrowClosed,
default = "",
open = "",
empty = "",
empty_open = "",
symlink = "",
symlink_open = "",
},
git = {
unstaged = "",
staged = "S",
unmerged = "",
renamed = "",
untracked = "U",
deleted = "",
ignored = "",
},
},
},
},
diagnostics = {
enable = true,
icons = {
hint = icons.diagnostics.Hint,
info = icons.diagnostics.Information,
warning = icons.diagnostics.Warning,
error = icons.diagnostics.Error,
},
},
update_focused_file = {
enable = true,
update_cwd = true,
ignore_list = {},
},
-- system_open = {
-- cmd = nil,
-- args = {},
-- },
-- filters = {
-- dotfiles = false,
-- custom = {},
-- },
git = {
enable = true,
ignore = true,
timeout = 500,
},
view = {
width = 30,
height = 30,
hide_root_folder = false,
side = "left",
-- auto_resize = true,
mappings = {
custom_only = false,
list = {
{ key = { "l", "<CR>", "o" }, cb = tree_cb "edit" },
{ key = "h", cb = tree_cb "close_node" },
{ key = "v", cb = tree_cb "vsplit" },
},
},
number = false,
relativenumber = false,
},
}

View File

@ -0,0 +1,67 @@
local status_ok, nvim_web_devicons = pcall(require, "nvim-web-devicons")
if not status_ok then
return
end
nvim_web_devicons.set_icon {
sh = {
icon = "",
color = "#1DC123",
cterm_color = "61",
name = "Sy",
},
["py"] = {
icon = "",
color = "#519BB7",
cterm_color = "59",
name = "Py",
},
-- ["js"] = {
-- icon = "",
-- color = "#cbcb41",
-- cterm_color = "185",
-- name = "Js",
-- },
-- ["ts"] = {
-- icon = "ﯤ",
-- color = "#519aba",
-- cterm_color = "67",
-- name = "Ts",
-- },
[".gitattributes"] = {
icon = "",
color = "#e24329",
cterm_color = "59",
name = "GitAttributes",
},
[".gitconfig"] = {
icon = "",
color = "#e24329",
cterm_color = "59",
name = "GitConfig",
},
[".gitignore"] = {
icon = "",
color = "#e24329",
cterm_color = "59",
name = "GitIgnore",
},
[".gitlab-ci.yml"] = {
icon = "",
color = "#e24329",
cterm_color = "166",
name = "GitlabCI",
},
[".gitmodules"] = {
icon = "",
color = "#e24329",
cterm_color = "59",
name = "GitModules",
},
["diff"] = {
icon = "",
color = "#e24329",
cterm_color = "59",
name = "Diff",
},
}

View File

@ -0,0 +1,77 @@
local options = {
backup = false, -- creates a backup file
clipboard = "unnamedplus", -- allows neovim to access the system clipboard
cmdheight = 1, -- more space in the neovim command line for displaying messages
completeopt = { "menuone", "noselect" }, -- mostly just for cmp
conceallevel = 0, -- so that `` is visible in markdown files
fileencoding = "utf-8", -- the encoding written to a file
hlsearch = true, -- highlight all matches on previous search pattern
ignorecase = true, -- ignore case in search patterns
mouse = "a", -- allow the mouse to be used in neovim
pumheight = 10, -- pop up menu height
showmode = false, -- we don't need to see things like -- INSERT -- anymore
showtabline = 0, -- always show tabs
smartcase = true, -- smart case
smartindent = true, -- make indenting smarter again
splitbelow = true, -- force all horizontal splits to go below current window
splitright = true, -- force all vertical splits to go to the right of current window
swapfile = false, -- creates a swapfile
termguicolors = true, -- set term gui colors (most terminals support this)
timeoutlen = 1000, -- time to wait for a mapped sequence to complete (in milliseconds)
undofile = true, -- enable persistent undo
updatetime = 100, -- faster completion (4000ms default)
writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
expandtab = true, -- convert tabs to spaces
shiftwidth = 2, -- the number of spaces inserted for each indentation
tabstop = 2, -- insert 2 spaces for a tab
cursorline = true, -- highlight the current line
number = true, -- set numbered lines
laststatus = 3,
showcmd = false,
ruler = false,
relativenumber = true, -- set relative numbered lines
numberwidth = 4, -- set number column width to 2 {default 4}
signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
wrap = false, -- display lines as one long line
scrolloff = 8, -- is one of my fav
sidescrolloff = 8,
guifont = "monospace:h17", -- the font used in graphical neovim applications
title = true,
-- colorcolumn = "80",
-- colorcolumn = "120",
}
-- vim.g.loaded_netrw = 1
-- vim.g.loaded_netrwPlugin = 1
-- vim.opt.fillchars.eob = " "
-- vim.opt.fillchars = vim.opt.fillchars + "vertleft: "
-- vim.opt.fillchars = vim.opt.fillchars + "vertright: "
vim.opt.fillchars = vim.opt.fillchars + 'eob: '
vim.opt.fillchars:append {
stl = ' ',
}
vim.opt.shortmess:append "c"
for k, v in pairs(options) do
vim.opt[k] = v
end
vim.cmd "set whichwrap+=<,>,[,],h,l"
vim.cmd [[set iskeyword+=-]]
-- I don't know enough yet to get these working so here's a work around
vim.api.nvim_command([[autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o]])
vim.cmd [[autocmd BufRead,BufNewFile *.tex set filetype=tex]]
vim.api.nvim_command([[
augroup TrimAndReset
autocmd BufWritePre * let currPos = getpos(".")
autocmd BufWritePre * %s/\s\+$//e
autocmd BufWritePre * %s/\n\+\%$//e
autocmd BufWritePre *.[ch] %s/\%$/\r/e
autocmd BufWritePre * cal cursor(currPos[1], currPos[2])
augroup END
]])
vim.cmd [[autocmd BufWritePost ~/.xmonad/xmonad.hs,~/.config/xmobar/xmobar-main.hs,~/.config/xmobar/xmobar-sub.hs,~/.config/xmobar/xmobar-single.hs !xmonad --recompile && xmonad --restart]]

5525
.config/nvim/lua/user/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
{
"dependencies": {
"node-gyp": "^9.1.0",
"npm": "^8.17.0",
"tree-sitter-php": "^0.19.0"
}
}

View File

@ -0,0 +1,187 @@
local fn = vim.fn
-- Automatically install packer
local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim"
---@diagnostic disable-next-line: missing-parameter
if fn.empty(fn.glob(install_path)) > 0 then
PACKER_BOOTSTRAP = fn.system {
"git",
"clone",
"--depth",
"1",
"https://github.com/wbthomason/packer.nvim",
install_path,
}
print "Installing packer close and reopen Neovim..."
vim.cmd [[packadd packer.nvim]]
end
-- Autocommand that reloads neovim whenever you save the plugins.lua file
vim.cmd [[
augroup packer_user_config
autocmd!
autocmd BufWritePost plugins.lua source <afile> | PackerSync
augroup end
]]
-- Use a protected call so we don't error out on first use
local status_ok, packer = pcall(require, "packer")
if not status_ok then
return
end
-- Have packer use a popup window
packer.init {
-- snapshot = "july-24",
snapshot_path = fn.stdpath "config" .. "/snapshots",
max_jobs = 50,
display = {
open_fn = function()
return require("packer.util").float { border = "rounded" }
end,
prompt_border = "rounded", -- Border style of prompt popups.
},
}
-- Install your plugins here
return packer.startup(function(use)
-- Plugin Mangager
use "wbthomason/packer.nvim" -- Have packer manage itself
-- Lua Development
use "nvim-lua/plenary.nvim" -- Useful lua functions used ny lots of plugins
use "nvim-lua/popup.nvim"
-- LSP
use "neovim/nvim-lspconfig" -- enable LSP
use "williamboman/nvim-lsp-installer" -- simple to use language server installer
use "jose-elias-alvarez/null-ls.nvim" -- for formatters and linters
use "ray-x/lsp_signature.nvim"
use "SmiteshP/nvim-navic"
use "simrat39/symbols-outline.nvim"
use "RRethy/vim-illuminate"
use "j-hui/fidget.nvim"
-- Completion
use "hrsh7th/nvim-cmp"
use "hrsh7th/cmp-buffer" -- buffer completions
use "hrsh7th/cmp-path" -- path completions
use "saadparwaiz1/cmp_luasnip" -- snippet completions
use "hrsh7th/cmp-nvim-lsp"
use "hrsh7th/cmp-nvim-lua"
-- Snippet
use "L3MON4D3/LuaSnip" --snippet engine
use "rafamadriz/friendly-snippets" -- a bunch of snippets to use
-- Syntax/Treesitter
use "nvim-treesitter/nvim-treesitter"
use "JoosepAlviste/nvim-ts-context-commentstring"
use "nvim-treesitter/playground"
use "kylechui/nvim-surround"
-- Marks
use "christianchiarulli/harpoon"
use "MattesGroeger/vim-bookmarks"
-- Fuzzy Finder/Telescope
use "nvim-telescope/telescope.nvim"
use "nvim-telescope/telescope-media-files.nvim"
-- Note Taking
use "mickael-menu/zk-nvim"
-- Color
use "NvChad/nvim-colorizer.lua"
use "ziontee113/color-picker.nvim"
-- Colorschemes
use "folke/tokyonight.nvim"
-- Utility
use "rcarriga/nvim-notify"
use "stevearc/dressing.nvim"
use "ghillb/cybu.nvim"
use "moll/vim-bbye"
use "lewis6991/impatient.nvim"
use "lalitmee/browse.nvim"
-- Icon
use "kyazdani42/nvim-web-devicons"
-- Debugging
use "mfussenegger/nvim-dap"
use "rcarriga/nvim-dap-ui"
-- Tabline
use "akinsho/bufferline.nvim"
use "tiagovla/scope.nvim"
-- Statusline
use "christianchiarulli/lualine.nvim"
-- Startup
use "goolord/alpha-nvim"
-- Indent
use "lukas-reineke/indent-blankline.nvim"
-- File Explorer
use "kyazdani42/nvim-tree.lua"
use "christianchiarulli/lir.nvim"
-- Comment
use "numToStr/Comment.nvim"
use "folke/todo-comments.nvim"
-- Terminal
use "akinsho/toggleterm.nvim"
-- Project
use "ahmedkhalf/project.nvim"
use "windwp/nvim-spectre"
-- Quickfix
use "kevinhwang91/nvim-bqf"
-- Git
use "lewis6991/gitsigns.nvim"
use "f-person/git-blame.nvim"
use "ruifm/gitlinker.nvim"
use "mattn/vim-gist"
use "mattn/webapi-vim"
-- Github
use "pwntester/octo.nvim"
-- Editing Support
use "windwp/nvim-autopairs"
use "monaqa/dial.nvim"
use "nacro90/numb.nvim"
use "andymass/vim-matchup"
use "folke/zen-mode.nvim"
use "karb94/neoscroll.nvim"
use "junegunn/vim-slash"
-- Motion
use "phaazon/hop.nvim"
-- Keybinding
use "folke/which-key.nvim"
-- Typescript TODO: set this up, also add keybinds to ftplugin
use "jose-elias-alvarez/typescript.nvim"
-- Markdown
use {
"iamcco/markdown-preview.nvim",
run = "cd app && npm install",
ft = "markdown",
}
-- Automatically set up your configuration after cloning packer.nvim
-- Put this at the end after all plugins
if PACKER_BOOTSTRAP then
require("packer").sync()
end
end)

View File

@ -0,0 +1,48 @@
local status_ok, project = pcall(require, "project_nvim")
if not status_ok then
return
end
project.setup({
---@usage set to false to disable project.nvim.
--- This is on by default since it's currently the expected behavior.
active = true,
on_config_done = nil,
---@usage set to true to disable setting the current-woriking directory
--- Manual mode doesn't automatically change your root directory, so you have
--- the option to manually do so using `:ProjectRoot` command.
manual_mode = false,
---@usage Methods of detecting the root directory
--- Allowed values: **"lsp"** uses the native neovim lsp
--- **"pattern"** uses vim-rooter like glob pattern matching. Here
--- order matters: if one is not detected, the other is used as fallback. You
--- can also delete or rearangne the detection methods.
-- detection_methods = { "lsp", "pattern" }, -- NOTE: lsp detection will get annoying with multiple langs in one project
detection_methods = { "pattern" },
---@usage patterns used to detect root dir, when **"pattern"** is in detection_methods
patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" },
---@ Show hidden files in telescope when searching for files in a project
show_hidden = false,
---@usage When set to false, you will get a message when project.nvim changes your directory.
-- When set to false, you will get a message when project.nvim changes your directory.
silent_chdir = true,
---@usage list of lsp client names to ignore when using **lsp** detection. eg: { "efm", ... }
ignore_lsp = {},
---@type string
---@usage path to store the project history for use in telescope
datapath = vim.fn.stdpath("data"),
})
local tele_status_ok, telescope = pcall(require, "telescope")
if not tele_status_ok then
return
end
telescope.load_extension('projects')

View File

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

View File

@ -0,0 +1,135 @@
local status_ok, spectre = pcall(require, "spectre")
if not status_ok then
return
end
spectre.setup({
color_devicons = true,
highlight = {
ui = "String",
search = "DiffChange",
replace = "DiffDelete",
},
mapping = {
["toggle_line"] = {
map = "t",
cmd = "<cmd>lua require('spectre').toggle_line()<CR>",
desc = "toggle current item",
},
["enter_file"] = {
map = "<cr>",
cmd = "<cmd>lua require('spectre.actions').select_entry()<CR>",
desc = "goto current file",
},
["send_to_qf"] = {
map = "Q",
cmd = "<cmd>lua require('spectre.actions').send_to_qf()<CR>",
desc = "send all item to quickfix",
},
["replace_cmd"] = {
map = "c",
cmd = "<cmd>lua require('spectre.actions').replace_cmd()<CR>",
desc = "input replace vim command",
},
["show_option_menu"] = {
map = "o",
cmd = "<cmd>lua require('spectre').show_options()<CR>",
desc = "show option",
},
["run_replace"] = {
map = "R",
cmd = "<cmd>lua require('spectre.actions').run_replace()<CR>",
desc = "replace all",
},
["change_view_mode"] = {
map = "m",
cmd = "<cmd>lua require('spectre').change_view()<CR>",
desc = "change result view mode",
},
["toggle_ignore_case"] = {
map = "I",
cmd = "<cmd>lua require('spectre').change_options('ignore-case')<CR>",
desc = "toggle ignore case",
},
["toggle_ignore_hidden"] = {
map = "H",
cmd = "<cmd>lua require('spectre').change_options('hidden')<CR>",
desc = "toggle search hidden",
},
-- you can put your mapping here it only use normal mode
},
find_engine = {
-- rg is map with finder_cmd
["rg"] = {
cmd = "rg",
-- default args
args = {
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
},
options = {
["ignore-case"] = {
value = "--ignore-case",
icon = "[I]",
desc = "ignore case",
},
["hidden"] = {
value = "--hidden",
desc = "hidden file",
icon = "[H]",
},
-- you can put any option you want here it can toggle with
-- show_option function
},
},
["ag"] = {
cmd = "ag",
args = {
"--vimgrep",
"-s",
},
options = {
["ignore-case"] = {
value = "-i",
icon = "[I]",
desc = "ignore case",
},
["hidden"] = {
value = "--hidden",
desc = "hidden file",
icon = "[H]",
},
},
},
},
replace_engine = {
["sed"] = {
cmd = "sed",
args = nil,
},
options = {
["ignore-case"] = {
value = "--ignore-case",
icon = "[I]",
desc = "ignore case",
},
},
},
default = {
find = {
--pick one of item in find_engine
cmd = "rg",
options = { "ignore-case" },
},
replace = {
--pick one of item in replace_engine
cmd = "sed",
},
},
replace_vim_cmd = "cdo",
is_open_target_win = true, --open file on opener window
is_insert_mode = false, -- start open panel on is_insert_mode
})

View File

@ -0,0 +1,76 @@
local status_ok, surround = pcall(require, "nvim-surround")
if not status_ok then
return
end
surround.setup {
keymaps = { -- vim-surround style keymaps
insert = "<C-g>s",
insert_line = "<C-g>S",
normal = "s",
normal_cur = "ss",
normal_line = "S",
normal_cur_line = "SS",
visual = "s",
visual_line = "gS",
delete = "ds",
change = "cs",
},
-- TODO: come back and fix this
-- surrounds = {
-- pairs = {
-- ["("] = { "( ", " )" },
-- [")"] = { "(", ")" },
-- ["{"] = { "{ ", " }" },
-- ["}"] = { "{", "}" },
-- ["<"] = { "< ", " >" },
-- [">"] = { "<", ">" },
-- ["["] = { "[ ", " ]" },
-- ["]"] = { "[", "]" },
-- -- Define pairs based on function evaluations!
-- ["i"] = function()
-- return {
-- require("nvim-surround.utils").get_input "Enter the left delimiter: ",
-- require("nvim-surround.utils").get_input "Enter the right delimiter: ",
-- }
-- end,
-- ["f"] = function()
-- return {
-- require("nvim-surround.utils").get_input "Enter the function name: " .. "(",
-- ")",
-- }
-- end,
-- },
-- separators = {
-- ["'"] = { "'", "'" },
-- ['"'] = { '"', '"' },
-- ["`"] = { "`", "`" },
-- },
-- HTML = {
-- ["t"] = "type", -- Change just the tag type
-- ["T"] = "whole", -- Change the whole tag contents
-- },
-- aliases = {
-- ["a"] = ">", -- Single character aliases apply everywhere
-- ["p"] = ")",
-- ["b"] = "]",
-- ["r"] = "}",
-- -- Table aliases only apply for changes/deletions
-- ["q"] = { '"', "'", "`" }, -- Any quote character
-- ["s"] = { ")", "]", "}", ">", "'", '"', "`" }, -- Any surrounding delimiter
-- },
-- invalid_key_behavior = function()
-- vim.notify ("Invalid surround character", vim.log.levels.INFO)
-- end,
-- },
-- highlight = { -- Highlight before inserting/changing surrounds
-- duration = 0,
-- },
}
-- local opts = { noremap = true, silent = true }
-- local keymap = vim.api.nvim_set_keymap
-- keymap("n", "<leader>'", [[ysiw']], opts)
vim.cmd [[nmap <leader>' siw']]

View File

@ -0,0 +1,50 @@
local icons = require "user.icons"
vim.g.symbols_outline = {
highlight_hovered_item = true,
show_guides = true,
auto_preview = false,
position = "right",
width = 40,
show_numbers = false,
show_relative_numbers = false,
show_symbol_details = true,
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 = "r",
code_actions = "a",
},
lsp_blacklist = {},
symbol_blacklist = {},
symbols = {
File = { icon = icons.documents.File, hl = "CmpItemKindFile" },
Module = { icon = icons.kind.Module, hl = "CmpItemKindModule" },
Namespace = { icon = icons.kind.Module, hl = "CmpItemKindModule" },
Package = { icon = icons.kind.Module, hl = "CmpItemKindModule" },
Class = { icon = icons.kind.Class, hl = "CmpItemKindClass" },
Method = { icon = icons.kind.Method, hl = "CmpItemKindMethod" },
Property = { icon = icons.kind.Property, hl = "CmpItemKindProperty" },
Field = { icon = icons.kind.Field, hl = "CmpItemKindField" },
Constructor = { icon = icons.kind.Constructor, hl = "CmpItemKindConstructor" },
Enum = { icon = icons.kind.Enum, hl = "CmpItemKindEnum" },
Interface = { icon = icons.kind.Interface, hl = "CmpItemKindInterface" },
Function = { icon = icons.kind.Function, hl = "CmpItemKindFunction" },
Variable = { icon = icons.kind.Variable, hl = "CmpItemKindVariable" },
Constant = { icon = icons.kind.Constant, hl = "CmpItemKindConstant" },
String = { icon = icons.type.String, hl = "TSString" },
Number = { icon = icons.type.Number, hl = "TSNumber" },
Boolean = { icon = icons.type.Boolean, hl = "TSBoolean" },
Array = { icon = icons.type.Array, hl = "TSKeyword" },
Object = { icon = icons.type.Object, hl = "TSKeyword" },
Key = { icon = icons.kind.Keyword, hl = "CmpItemKeyword" },
Null = { icon = "NULL", hl = "TSKeyword" },
EnumMember = { icon = icons.kind.EnumMember, hl = "CmpItemKindEnumMember" },
Struct = { icon = icons.kind.Struct, hl = "CmpItemKindStruct" },
Event = { icon = icons.kind.Event, hl = "CmpItemKindEvent" },
Operator = { icon = icons.kind.Operator, hl = "CmpItemKindOperator" },
TypeParameter = { icon = icons.kind.TypeParameter, hl = "CmpItemKindTypeParameter" },
},
}

View File

@ -0,0 +1,25 @@
local status_ok, tabout = pcall(require, "tabout")
if not status_ok then
return
end
tabout.setup {
tabkey = "<tab>", -- key to trigger tabout, set to an empty string to disable
backwards_tabkey = "<s-tab>", -- key to trigger backwards tabout, set to an empty string to disable
act_as_tab = true, -- shift content if tab out is not possible
act_as_shift_tab = false, -- reverse shift content if tab out is not possible (if your keyboard/terminal supports <S-Tab>)
default_tab = "<C-t>", -- shift default action (only at the beginning of a line, otherwise <TAB> is used)
default_shift_tab = "<C-d>", -- reverse shift default action,
enable_backwards = false, -- well ...
completion = true, -- if the tabkey is used in a completion pum
tabouts = {
{ open = "'", close = "'" },
{ open = '"', close = '"' },
{ open = "`", close = "`" },
{ open = "(", close = ")" },
{ open = "[", close = "]" },
{ open = "{", close = "}" },
},
ignore_beginning = false, --[[ if the cursor is at the beginning of a filled element it will rather tab out than shift the content ]]
exclude = { "markdown" }, -- tabout will ignore these filetypes
}

View File

@ -0,0 +1,207 @@
local status_ok, telescope = pcall(require, "telescope")
if not status_ok then
return
end
local actions = require "telescope.actions"
telescope.load_extension "media_files"
local icons = require "user.icons"
telescope.setup {
defaults = {
prompt_prefix = icons.ui.Telescope .. " ",
selection_caret = "",
path_display = { "smart" },
file_ignore_patterns = {
".git/",
"target/",
"docs/",
"vendor/*",
"%.lock",
"__pycache__/*",
"%.sqlite3",
"%.ipynb",
"node_modules/*",
-- "%.jpg",
-- "%.jpeg",
-- "%.png",
"%.svg",
"%.otf",
"%.ttf",
"%.webp",
".dart_tool/",
".github/",
".gradle/",
".idea/",
".settings/",
".vscode/",
"__pycache__/",
"build/",
"env/",
"gradle/",
"node_modules/",
"%.pdb",
"%.dll",
"%.class",
"%.exe",
"%.cache",
"%.ico",
"%.pdf",
"%.dylib",
"%.jar",
"%.docx",
"%.met",
"smalljre_*/*",
".vale/",
"%.burp",
"%.mp4",
"%.mkv",
"%.rar",
"%.zip",
"%.7z",
"%.tar",
"%.bz2",
"%.epub",
"%.flac",
"%.tar.gz",
},
mappings = {
i = {
["<C-n>"] = actions.cycle_history_next,
["<C-p>"] = actions.cycle_history_prev,
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<C-b>"] = actions.results_scrolling_up,
["<C-f>"] = actions.results_scrolling_down,
["<C-c>"] = actions.close,
["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous,
["<CR>"] = actions.select_default,
["<C-s>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical,
["<C-t>"] = actions.select_tab,
["<c-d>"] = require("telescope.actions").delete_buffer,
-- ["<C-u>"] = actions.preview_scrolling_up,
-- ["<C-d>"] = actions.preview_scrolling_down,
-- ["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
["<Tab>"] = actions.close,
["<S-Tab>"] = actions.close,
-- ["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
["<C-l>"] = actions.complete_tag,
["<C-h>"] = actions.which_key, -- keys from pressing <C-h>
["<esc>"] = actions.close,
},
n = {
["<esc>"] = actions.close,
["<CR>"] = actions.select_default,
["<C-x>"] = actions.select_horizontal,
["<C-v>"] = actions.select_vertical,
["<C-t>"] = actions.select_tab,
["<C-b>"] = actions.results_scrolling_up,
["<C-f>"] = actions.results_scrolling_down,
["<Tab>"] = actions.close,
["<S-Tab>"] = actions.close,
-- ["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
-- ["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
["j"] = actions.move_selection_next,
["k"] = actions.move_selection_previous,
["H"] = actions.move_to_top,
["M"] = actions.move_to_middle,
["L"] = actions.move_to_bottom,
["q"] = actions.close,
["dd"] = require("telescope.actions").delete_buffer,
["s"] = actions.select_horizontal,
["v"] = actions.select_vertical,
["t"] = actions.select_tab,
["<Down>"] = actions.move_selection_next,
["<Up>"] = actions.move_selection_previous,
["gg"] = actions.move_to_top,
["G"] = actions.move_to_bottom,
["<C-u>"] = actions.preview_scrolling_up,
["<C-d>"] = actions.preview_scrolling_down,
["<PageUp>"] = actions.results_scrolling_up,
["<PageDown>"] = actions.results_scrolling_down,
["?"] = actions.which_key,
},
},
},
pickers = {
live_grep = {
theme = "dropdown",
},
grep_string = {
theme = "dropdown",
},
find_files = {
theme = "dropdown",
previewer = false,
},
buffers = {
theme = "dropdown",
previewer = false,
initial_mode = "normal",
},
planets = {
show_pluto = true,
show_moon = true,
},
colorscheme = {
-- enable_preview = true,
},
lsp_references = {
theme = "dropdown",
initial_mode = "normal",
},
lsp_definitions = {
theme = "dropdown",
initial_mode = "normal",
},
lsp_declarations = {
theme = "dropdown",
initial_mode = "normal",
},
lsp_implementations = {
theme = "dropdown",
initial_mode = "normal",
},
-- Default configuration for builtin pickers goes here:
-- picker_name = {
-- picker_config_key = value,
-- ...
-- }
-- Now the picker_config_key will be applied every time you call this
-- builtin picker
},
extensions = {
media_files = {
-- filetypes whitelist
-- defaults to {"png", "jpg", "mp4", "webm", "pdf"}
filetypes = { "png", "webp", "jpg", "jpeg" },
find_cmd = "rg", -- find command (defaults to `fd`)
},
},
}

View File

@ -0,0 +1,70 @@
local status_ok, todo_comments = pcall(require, "todo-comments")
if not status_ok then
return
end
local icons = require "user.icons"
local error_red = "#F44747"
local warning_orange = "#ff8800"
-- local info_yellow = "#FFCC66"
local hint_blue = "#4FC1FF"
local perf_purple = "#7C3AED"
local note_green = '#10B981'
todo_comments.setup {
signs = true, -- show icons in the signs column
sign_priority = 8, -- sign priority
-- keywords recognized as todo comments
keywords = {
FIX = {
icon = icons.ui.Bug, -- icon used for the sign, and in search results
color = error_red, -- 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 = icons.ui.Check, color = hint_blue, alt = { "TIP" } },
HACK = { icon = icons.ui.Fire, color = warning_orange },
WARN = { icon = icons.diagnostics.Warning, color = warning_orange, alt = { "WARNING", "XXX" } },
PERF = { icon = icons.ui.Dashboard, color = perf_purple, alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
NOTE = { icon = icons.ui.Note, color = note_green, alt = { "INFO" } },
},
-- 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 = {
before = "", -- "fg" or "bg" or empty
-- keyword = "wide", -- "fg", "bg", "wide" or empty. (wide is the same as bg, but will also highlight surrounding characters)
keyword = "wide", -- "fg", "bg", "wide" or empty. (wide is the same as bg, but will also highlight surrounding characters)
after = "fg", -- "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 = { "markdown" }, -- list of file types to exclude highlighting
},
-- list of named colors where we try to extract the guifg from the
-- list of hilight groups or use the hex color if hl not found as a fallback
-- colors = {
-- error = { "LspDiagnosticsDefaultError", "ErrorMsg", "#DC2626" },
-- warning = { "LspDiagnosticsDefaultWarning", "WarningMsg", "#FBBF24" },
-- info = { "LspDiagnosticsDefaultInformation", "#2563EB" },
-- hint = { "LspDiagnosticsDefaultHint", "#10B981" },
-- default = { "Identifier", "#7C3AED" },
-- },
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

@ -0,0 +1,211 @@
local status_ok, toggleterm = pcall(require, "toggleterm")
if not status_ok then
return
end
toggleterm.setup {
size = 20,
open_mapping = [[<m-0>]],
hide_numbers = true,
shade_filetypes = {},
shade_terminals = true,
shading_factor = 2,
start_in_insert = true,
insert_mappings = true,
persist_size = true,
direction = "float",
close_on_exit = true,
shell = vim.o.shell,
float_opts = {
border = "curved",
winblend = 0,
highlights = {
border = "Normal",
background = "Normal",
},
},
}
function _G.set_terminal_keymaps()
local opts = { noremap = true }
-- vim.api.nvim_buf_set_keymap(0, 't', '<esc>', [[<C-\><C-n>]], opts)
-- vim.api.nvim_buf_set_keymap(0, "t", "jk", [[<C-\><C-n>]], opts)
vim.api.nvim_buf_set_keymap(0, "t", "<m-h>", [[<C-\><C-n><C-W>h]], opts)
vim.api.nvim_buf_set_keymap(0, "t", "<m-j>", [[<C-\><C-n><C-W>j]], opts)
vim.api.nvim_buf_set_keymap(0, "t", "<m-k>", [[<C-\><C-n><C-W>k]], opts)
vim.api.nvim_buf_set_keymap(0, "t", "<m-l>", [[<C-\><C-n><C-W>l]], opts)
end
vim.cmd "autocmd! TermOpen term://* lua set_terminal_keymaps()"
local Terminal = require("toggleterm.terminal").Terminal
local lazygit = Terminal:new {
cmd = "lazygit",
hidden = true,
direction = "float",
float_opts = {
border = "none",
width = 100000,
height = 100000,
},
on_open = function(_)
vim.cmd "startinsert!"
-- vim.cmd "set laststatus=0"
end,
on_close = function(_)
-- vim.cmd "set laststatus=3"
end,
count = 99,
}
function _LAZYGIT_TOGGLE()
lazygit:toggle()
end
local node = Terminal:new { cmd = "node", hidden = true }
function _NODE_TOGGLE()
node:toggle()
end
local ncdu = Terminal:new { cmd = "ncdu", hidden = true }
function _NCDU_TOGGLE()
ncdu:toggle()
end
local htop = Terminal:new { cmd = "htop", hidden = true }
function _HTOP_TOGGLE()
htop:toggle()
end
local python = Terminal:new { cmd = "python", hidden = true }
function _PYTHON_TOGGLE()
python:toggle()
end
local cargo_run = Terminal:new { cmd = "cargo run", hidden = true }
function _CARGO_RUN()
cargo_run:toggle()
end
local cargo_test = Terminal:new { cmd = "cargo test", hidden = true }
function _CARGO_TEST()
cargo_test:toggle()
end
local float_term = Terminal:new {
direction = "float",
on_open = function(term)
vim.cmd "startinsert!"
vim.api.nvim_buf_set_keymap(
term.bufnr,
"n",
"<m-1>",
"<cmd>1ToggleTerm direction=float<cr>",
{ noremap = true, silent = true }
)
vim.api.nvim_buf_set_keymap(
term.bufnr,
"t",
"<m-1>",
"<cmd>1ToggleTerm direction=float<cr>",
{ noremap = true, silent = true }
)
vim.api.nvim_buf_set_keymap(
term.bufnr,
"i",
"<m-1>",
"<cmd>1ToggleTerm direction=float<cr>",
{ noremap = true, silent = true }
)
vim.api.nvim_buf_set_keymap(term.bufnr, "", "<m-2>", "<nop>", { noremap = true, silent = true })
vim.api.nvim_buf_set_keymap(term.bufnr, "", "<m-3>", "<nop>", { noremap = true, silent = true })
end,
count = 1,
}
function _FLOAT_TERM()
float_term:toggle()
end
vim.api.nvim_set_keymap("n", "<m-1>", "<cmd>lua _FLOAT_TERM()<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("i", "<m-1>", "<cmd>lua _FLOAT_TERM()<CR>", { noremap = true, silent = true })
local vertical_term = Terminal:new {
direction = "vertical",
on_open = function(term)
vim.cmd "startinsert!"
vim.api.nvim_buf_set_keymap(
term.bufnr,
"n",
"<m-2>",
"<cmd>2ToggleTerm size=60 direction=vertical<cr>",
{ noremap = true, silent = true }
)
vim.api.nvim_buf_set_keymap(
term.bufnr,
"t",
"<m-2>",
"<cmd>2ToggleTerm size=60 direction=vertical<cr>",
{ noremap = true, silent = true }
)
vim.api.nvim_buf_set_keymap(
term.bufnr,
"i",
"<m-2>",
"<cmd>2ToggleTerm size=60 direction=vertical<cr>",
{ noremap = true, silent = true }
)
vim.api.nvim_buf_set_keymap(term.bufnr, "", "<m-3>", "<nop>", { noremap = true, silent = true })
end,
count = 2,
}
function _VERTICAL_TERM()
vertical_term:toggle(60)
end
vim.api.nvim_set_keymap("n", "<m-2>", "<cmd>lua _VERTICAL_TERM()<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("i", "<m-2>", "<cmd>lua _VERTICAL_TERM()<CR>", { noremap = true, silent = true })
local horizontal_term = Terminal:new {
direction = "horizontal",
on_open = function(term)
vim.cmd "startinsert!"
vim.api.nvim_buf_set_keymap(
term.bufnr,
"n",
"<m-3>",
"<cmd>3ToggleTerm size=10 direction=horizontal<cr>",
{ noremap = true, silent = true }
)
vim.api.nvim_buf_set_keymap(
term.bufnr,
"t",
"<m-3>",
"<cmd>3ToggleTerm size=10 direction=horizontal<cr>",
{ noremap = true, silent = true }
)
vim.api.nvim_buf_set_keymap(
term.bufnr,
"i",
"<m-3>",
"<cmd>3ToggleTerm size=10 direction=horizontal<cr>",
{ noremap = true, silent = true }
)
vim.api.nvim_buf_set_keymap(term.bufnr, "", "<m-2>", "<nop>", { noremap = true, silent = true })
end,
count = 3,
}
function _HORIZONTAL_TERM()
horizontal_term:toggle(10)
end
vim.api.nvim_set_keymap("n", "<m-3>", "<cmd>lua _HORIZONTAL_TERM()<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("i", "<m-3>", "<cmd>lua _HORIZONTAL_TERM()<CR>", { noremap = true, silent = true })

View File

@ -0,0 +1,119 @@
local status_ok, configs = pcall(require, "nvim-treesitter.configs")
if not status_ok then
return
end
-- local ft_to_parser = require("nvim-treesitter.parsers").filetype_to_parsername
-- ft_to_parser.motoko = "typescript"
configs.setup {
ensure_installed = "all", -- one of "all" or a list of languages
sync_install = false, -- install languages synchronously (only applied to `ensure_installed`)
ignore_install = { "phpdoc" }, -- List of parsers to ignore installing
matchup = {
enable = true, -- mandatory, false will disable the whole extension
disable_virtual_text = true,
disable = { "html" }, -- optional, list of language that will be disabled
-- include_match_words = false
},
highlight = {
-- use_languagetree = true,
enable = true, -- false will disable the whole extension
-- disable = { "css", "html" }, -- list of language that will be disabled
-- disable = { "css", "markdown" }, -- list of language that will be disabled
disable = { "markdown" }, -- list of language that will be disabled
-- additional_vim_regex_highlighting = true,
},
autopairs = {
enable = true,
},
indent = { enable = true, disable = { "python", "css", "rust" } },
context_commentstring = {
enable = true,
enable_autocmd = false,
},
autotag = {
enable = true,
disable = { "xml", "markdown" },
},
rainbow = {
enable = true,
extended_mode = false,
colors = {
-- "#68a0b0",
-- "#946EaD",
-- "#c7aA6D",
"Gold",
"Orchid",
"DodgerBlue",
-- "Cornsilk",
-- "Salmon",
-- "LawnGreen",
},
disable = { "html" },
},
playground = {
enable = true,
},
textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["at"] = "@class.outer",
["it"] = "@class.inner",
["ac"] = "@call.outer",
["ic"] = "@call.inner",
["aa"] = "@parameter.outer",
["ia"] = "@parameter.inner",
["al"] = "@loop.outer",
["il"] = "@loop.inner",
["ai"] = "@conditional.outer",
["ii"] = "@conditional.inner",
["a/"] = "@comment.outer",
["i/"] = "@comment.inner",
["ab"] = "@block.outer",
["ib"] = "@block.inner",
["as"] = "@statement.outer",
["is"] = "@scopename.inner",
["aA"] = "@attribute.outer",
["iA"] = "@attribute.inner",
["aF"] = "@frame.outer",
["iF"] = "@frame.inner",
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]m"] = "@function.outer",
["]]"] = "@class.outer",
},
goto_next_end = {
["]M"] = "@function.outer",
["]["] = "@class.outer",
},
goto_previous_start = {
["[m"] = "@function.outer",
["[["] = "@class.outer",
},
goto_previous_end = {
["[M"] = "@function.outer",
["[]"] = "@class.outer",
},
},
swap = {
enable = true,
swap_next = {
["<leader>."] = "@parameter.inner",
},
swap_previous = {
["<leader>,"] = "@parameter.inner",
},
},
},
}

View File

@ -0,0 +1,36 @@
local status_ok, context = pcall(require, "treesitter-context")
if not status_ok then
return
end
context.setup{
enable = false, -- Enable this plugin (Can be enabled/disabled later via commands)
throttle = true, -- Throttles plugin updates (may improve performance)
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries.
-- For all filetypes
-- Note that setting an entry here replaces all other patterns for this entry.
-- By setting the 'default' entry below, you can control which nodes you want to
-- appear in the context window.
-- default = {
-- 'class',
-- 'function',
-- 'method',
-- -- 'for', -- These won't appear in the context
-- -- 'while',
-- -- 'if',
-- -- 'switch',
-- -- 'case',
-- },
-- Example for a specific filetype.
-- If a pattern is missing, *open a PR* so everyone can benefit.
-- rust = {
-- 'impl_item',
-- },
},
}
-- Commands
-- TSContextEnable, TSContextDisable and TSContextToggle.
--
-- Appearance
-- Use the highlight group TreesitterContext to change the colors of the context. Per default it links to NormalFloat.

View File

@ -0,0 +1 @@
vim.cmd [[noremap <plug>(slash-after) zz]]

View File

@ -0,0 +1,373 @@
local status_ok, which_key = pcall(require, "which-key")
if not status_ok then
return
end
local setup = {
plugins = {
marks = true, -- shows a list of your marks on ' and `
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
spelling = {
enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
suggestions = 20, -- how many suggestions should be shown in the list?
},
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
-- No actual key bindings are created
presets = {
operators = false, -- adds help for operators like d, y, ... and registers them for motion / text object completion
motions = false, -- adds help for motions
text_objects = false, -- help for text objects triggered after entering an operator
windows = true, -- default bindings on <c-w>
nav = true, -- misc bindings to work with windows
z = true, -- bindings for folds, spelling and others prefixed with z
g = true, -- bindings for prefixed with g
},
},
-- add operators that will trigger motion and text object completion
-- to enable all native operators, set the preset / operators plugin above
-- operators = { gc = "Comments" },
key_labels = {
-- override the label used to display some keys. It doesn't effect WK in any other way.
-- For example:
-- ["<space>"] = "SPC",
["<leader>"] = "SPC",
-- ["<cr>"] = "RET",
-- ["<tab>"] = "TAB",
},
icons = {
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
separator = "", -- symbol used between a key and it's label
group = "+", -- symbol prepended to a group
},
popup_mappings = {
scroll_down = "<c-d>", -- binding to scroll down inside the popup
scroll_up = "<c-u>", -- binding to scroll up inside the popup
},
window = {
border = "rounded", -- none, single, double, shadow
position = "bottom", -- bottom, top
margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
winblend = 0,
},
layout = {
height = { min = 4, max = 25 }, -- min and max height of the columns
width = { min = 20, max = 50 }, -- min and max width of the columns
spacing = 3, -- spacing between columns
align = "center", -- align columns left, center or right
},
ignore_missing = true, -- enable this to hide mappings for which you didn't specify a label
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate
show_help = false, -- show help message on the command line when the popup is visible
-- triggers = "auto", -- automatically setup triggers
-- triggers = {"<leader>"} -- or specify a list manually
triggers_blacklist = {
-- list of mode / prefixes that should never be hooked by WhichKey
-- this is mostly relevant for key maps that start with a native binding
-- most people should not need to change this
i = { "j", "k" },
v = { "j", "k" },
},
}
local opts = {
mode = "n", -- NORMAL mode
prefix = "<leader>",
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
silent = true, -- use `silent` when creating keymaps
noremap = true, -- use `noremap` when creating keymaps
nowait = true, -- use `nowait` when creating keymaps
}
local m_opts = {
mode = "n", -- NORMAL mode
prefix = "m",
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
silent = true, -- use `silent` when creating keymaps
noremap = true, -- use `noremap` when creating keymaps
nowait = true, -- use `nowait` when creating keymaps
}
local m_mappings = {
a = { "<cmd>silent BookmarkAnnotate<cr>", "Annotate" },
c = { "<cmd>silent BookmarkClear<cr>", "Clear" },
b = { "<cmd>silent BookmarkToggle<cr>", "Toggle" },
m = { '<cmd>lua require("harpoon.mark").add_file()<cr>', "Harpoon" },
["."] = { '<cmd>lua require("harpoon.ui").nav_next()<cr>', "Harpoon Next" },
[","] = { '<cmd>lua require("harpoon.ui").nav_prev()<cr>', "Harpoon Prev" },
l = { "<cmd>lua require('user.bfs').open()<cr>", "Buffers" },
j = { "<cmd>silent BookmarkNext<cr>", "Next" },
s = { "<cmd>Telescope harpoon marks<cr>", "Search Files" },
k = { "<cmd>silent BookmarkPrev<cr>", "Prev" },
S = { "<cmd>silent BookmarkShowAll<cr>", "Prev" },
-- s = {
-- "<cmd>lua require('telescope').extensions.vim_bookmarks.all({ hide_filename=false, prompt_title=\"bookmarks\", shorten_path=false })<cr>",
-- "Show",
-- },
x = { "<cmd>BookmarkClearAll<cr>", "Clear All" },
[";"] = { '<cmd>lua require("harpoon.ui").toggle_quick_menu()<cr>', "Harpoon UI" },
}
local mappings = {
-- ["1"] = "which_key_ignore",
a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "Action" },
b = { "<cmd>Telescope buffers<cr>", "Buffers" },
e = { "<cmd>NvimTreeToggle<cr>", "Explorer" },
v = { "<cmd>vsplit<cr>", "vsplit" },
h = { "<cmd>split<cr>", "split" },
w = { "<cmd>w<CR>", "Write" },
-- h = { "<cmd>nohlsearch<CR>", "No HL" },
q = { '<cmd>lua require("user.functions").smart_quit()<CR>', "Quit" },
["/"] = { '<cmd>lua require("Comment.api").toggle.linewise.current()<CR>', "Comment" },
-- ["c"] = { "<cmd>Bdelete!<CR>", "Close Buffer" },
c = { "<cmd>Bdelete!<CR>", "Close Buffer" },
-- :lua require'lir.float'.toggle()
-- ["f"] = {
-- "<cmd>lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})<cr>",
-- "Find files",
-- },
-- ["F"] = { "<cmd>Telescope live_grep theme=ivy<cr>", "Find Text" },
-- P = { "<cmd>lua require('telescope').extensions.projects.projects()<cr>", "Projects" },
-- ["R"] = { '<cmd>lua require("renamer").rename()<cr>', "Rename" },
-- ["z"] = { "<cmd>ZenMode<cr>", "Zen" },
["gy"] = "Link",
B = {
name = "Browse",
i = { "<cmd>BrowseInputSearch<cr>", "Input Search" },
b = { "<cmd>Browse<cr>", "Browse" },
d = { "<cmd>BrowseDevdocsSearch<cr>", "Devdocs" },
f = { "<cmd>BrowseDevdocsFiletypeSearch<cr>", "Devdocs Filetype" },
m = { "<cmd>BrowseMdnSearch<cr>", "Mdn" },
},
p = {
name = "Packer",
c = { "<cmd>PackerCompile<cr>", "Compile" },
i = { "<cmd>PackerInstall<cr>", "Install" },
s = { "<cmd>PackerSync<cr>", "Sync" },
S = { "<cmd>PackerStatus<cr>", "Status" },
u = { "<cmd>PackerUpdate<cr>", "Update" },
},
o = {
name = "Options",
c = { '<cmd>lua vim.g.cmp_active=false<cr>', "Completion off" },
C = { '<cmd>lua vim.g.cmp_active=true<cr>', "Completion on" },
w = { '<cmd>lua require("user.functions").toggle_option("wrap")<cr>', "Wrap" },
r = { '<cmd>lua require("user.functions").toggle_option("relativenumber")<cr>', "Relative" },
l = { '<cmd>lua require("user.functions").toggle_option("cursorline")<cr>', "Cursorline" },
s = { '<cmd>lua require("user.functions").toggle_option("spell")<cr>', "Spell" },
t = { '<cmd>lua require("user.functions").toggle_tabline()<cr>', "Tabline" },
},
-- s = {
-- name = "Split",
-- s = { "<cmd>split<cr>", "HSplit" },
-- v = { "<cmd>vsplit<cr>", "VSplit" },
-- },
s = {
name = "Session",
s = { "<cmd>SaveSession<cr>", "Save" },
r = { "<cmd>RestoreSession<cr>", "Restore" },
x = { "<cmd>DeleteSession<cr>", "Delete" },
f = { "<cmd>Autosession search<cr>", "Find" },
d = { "<cmd>Autosession delete<cr>", "Find Delete" },
-- a = { ":SaveSession<cr>", "test" },
-- a = { ":RestoreSession<cr>", "test" },
-- a = { ":RestoreSessionFromFile<cr>", "test" },
-- a = { ":DeleteSession<cr>", "test" },
},
r = {
name = "Replace",
r = { "<cmd>lua require('spectre').open()<cr>", "Replace" },
w = { "<cmd>lua require('spectre').open_visual({select_word=true})<cr>", "Replace Word" },
f = { "<cmd>lua require('spectre').open_file_search()<cr>", "Replace Buffer" },
},
d = {
name = "Debug",
b = { "<cmd>lua require'dap'.toggle_breakpoint()<cr>", "Breakpoint" },
c = { "<cmd>lua require'dap'.continue()<cr>", "Continue" },
i = { "<cmd>lua require'dap'.step_into()<cr>", "Into" },
o = { "<cmd>lua require'dap'.step_over()<cr>", "Over" },
O = { "<cmd>lua require'dap'.step_out()<cr>", "Out" },
r = { "<cmd>lua require'dap'.repl.toggle()<cr>", "Repl" },
l = { "<cmd>lua require'dap'.run_last()<cr>", "Last" },
u = { "<cmd>lua require'dapui'.toggle()<cr>", "UI" },
x = { "<cmd>lua require'dap'.terminate()<cr>", "Exit" },
},
-- nnoremap <silent> <leader>B :lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>
-- nnoremap <silent> <leader>lp :lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))<CR>
-- require("dapui").open()
-- require("dapui").close()
-- require("dapui").toggle()
f = {
name = "Find",
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" },
f = { "<cmd>Telescope find_files<cr>", "Find files" },
t = { "<cmd>Telescope live_grep<cr>", "Find Text" },
s = { "<cmd>Telescope grep_string<cr>", "Find String" },
h = { "<cmd>Telescope help_tags<cr>", "Help" },
H = { "<cmd>Telescope highlights<cr>", "Highlights" },
i = { "<cmd>lua require('telescope').extensions.media_files.media_files()<cr>", "Media" },
l = { "<cmd>Telescope resume<cr>", "Last Search" },
M = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
r = { "<cmd>Telescope oldfiles<cr>", "Recent File" },
R = { "<cmd>Telescope registers<cr>", "Registers" },
k = { "<cmd>Telescope keymaps<cr>", "Keymaps" },
C = { "<cmd>Telescope commands<cr>", "Commands" },
},
g = {
name = "Git",
g = { "<cmd>lua _LAZYGIT_TOGGLE()<CR>", "Lazygit" },
j = { "<cmd>lua require 'gitsigns'.next_hunk()<cr>", "Next Hunk" },
k = { "<cmd>lua require 'gitsigns'.prev_hunk()<cr>", "Prev Hunk" },
l = { "<cmd>GitBlameToggle<cr>", "Blame" },
p = { "<cmd>lua require 'gitsigns'.preview_hunk()<cr>", "Preview Hunk" },
r = { "<cmd>lua require 'gitsigns'.reset_hunk()<cr>", "Reset Hunk" },
R = { "<cmd>lua require 'gitsigns'.reset_buffer()<cr>", "Reset Buffer" },
s = { "<cmd>lua require 'gitsigns'.stage_hunk()<cr>", "Stage Hunk" },
u = {
"<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>",
"Undo Stage Hunk",
},
o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" },
d = {
"<cmd>Gitsigns diffthis HEAD<cr>",
"Diff",
},
G = {
name = "Gist",
a = { "<cmd>Gist -b -a<cr>", "Create Anon" },
d = { "<cmd>Gist -d<cr>", "Delete" },
f = { "<cmd>Gist -f<cr>", "Fork" },
g = { "<cmd>Gist -b<cr>", "Create" },
l = { "<cmd>Gist -l<cr>", "List" },
p = { "<cmd>Gist -b -p<cr>", "Create Private" },
},
},
l = {
name = "LSP",
a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "Code Action" },
c = { "<cmd>lua require('user.lsp').server_capabilities()<cr>", "Get Capabilities" },
d = { "<cmd>TroubleToggle<cr>", "Diagnostics" },
w = {
"<cmd>Telescope lsp_workspace_diagnostics<cr>",
"Workspace Diagnostics",
},
f = { "<cmd>lua vim.lsp.buf.format({ async = true })<cr>", "Format" },
F = { "<cmd>LspToggleAutoFormat<cr>", "Toggle Autoformat" },
i = { "<cmd>LspInfo<cr>", "Info" },
h = { "<cmd>lua require('lsp-inlayhints').toggle()<cr>", "Toggle Hints" },
H = { "<cmd>IlluminationToggle<cr>", "Toggle Doc HL" },
I = { "<cmd>LspInstallInfo<cr>", "Installer Info" },
j = {
"<cmd>lua vim.diagnostic.goto_next({buffer=0})<CR>",
"Next Diagnostic",
},
k = {
"<cmd>lua vim.diagnostic.goto_prev({buffer=0})<cr>",
"Prev Diagnostic",
},
v = { "<cmd>lua require('lsp_lines').toggle()<cr>", "Virtual Text" },
l = { "<cmd>lua vim.lsp.codelens.run()<cr>", "CodeLens Action" },
o = { "<cmd>SymbolsOutline<cr>", "Outline" },
q = { "<cmd>lua vim.lsp.diagnostic.set_loclist()<cr>", "Quickfix" },
r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" },
R = { "<cmd>TroubleToggle lsp_references<cr>", "References" },
s = { "<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols" },
S = {
"<cmd>Telescope lsp_dynamic_workspace_symbols<cr>",
"Workspace Symbols",
},
t = { '<cmd>lua require("user.functions").toggle_diagnostics()<cr>', "Toggle Diagnostics" },
u = { "<cmd>LuaSnipUnlinkCurrent<cr>", "Unlink Snippet" },
},
-- s = {
-- name = "Surround",
-- ["."] = { "<cmd>lua require('surround').repeat_last()<cr>", "Repeat" },
-- a = { "<cmd>lua require('surround').surround_add(true)<cr>", "Add" },
-- d = { "<cmd>lua require('surround').surround_delete()<cr>", "Delete" },
-- r = { "<cmd>lua require('surround').surround_replace()<cr>", "Replace" },
-- q = { "<cmd>lua require('surround').toggle_quotes()<cr>", "Quotes" },
-- b = { "<cmd>lua require('surround').toggle_brackets()<cr>", "Brackets" },
-- },
S = {
-- name = "Session",
-- s = { "<cmd>SaveSession<cr>", "Save" },
-- l = { "<cmd>LoadLastSession!<cr>", "Load Last" },
-- d = { "<cmd>LoadCurrentDirSession!<cr>", "Load Last Dir" },
-- f = { "<cmd>Telescope sessions save_current=false<cr>", "Find Session" },
name = "SnipRun",
c = { "<cmd>SnipClose<cr>", "Close" },
f = { "<cmd>%SnipRun<cr>", "Run File" },
i = { "<cmd>SnipInfo<cr>", "Info" },
m = { "<cmd>SnipReplMemoryClean<cr>", "Mem Clean" },
r = { "<cmd>SnipReset<cr>", "Reset" },
t = { "<cmd>SnipRunToggle<cr>", "Toggle" },
x = { "<cmd>SnipTerminate<cr>", "Terminate" },
},
t = {
name = "Terminal",
["1"] = { ":1ToggleTerm<cr>", "1" },
["2"] = { ":2ToggleTerm<cr>", "2" },
["3"] = { ":3ToggleTerm<cr>", "3" },
["4"] = { ":4ToggleTerm<cr>", "4" },
n = { "<cmd>lua _NODE_TOGGLE()<cr>", "Node" },
u = { "<cmd>lua _NCDU_TOGGLE()<cr>", "NCDU" },
t = { "<cmd>lua _HTOP_TOGGLE()<cr>", "Htop" },
p = { "<cmd>lua _PYTHON_TOGGLE()<cr>", "Python" },
f = { "<cmd>ToggleTerm direction=float<cr>", "Float" },
h = { "<cmd>ToggleTerm size=10 direction=horizontal<cr>", "Horizontal" },
v = { "<cmd>ToggleTerm size=80 direction=vertical<cr>", "Vertical" },
},
T = {
name = "Treesitter",
h = { "<cmd>TSHighlightCapturesUnderCursor<cr>", "Highlight" },
p = { "<cmd>TSPlaygroundToggle<cr>", "Playground" },
r = { "<cmd>TSToggle rainbow<cr>", "Rainbow" },
},
-- z = {
-- name = "Zen",
-- z = { "<cmd>TZAtaraxis<cr>", "Zen" },
-- m = { "<cmd>TZMinimalist<cr>", "Minimal" },
-- n = { "<cmd>TZNarrow<cr>", "Narrow" },
-- f = { "<cmd>TZFocus<cr>", "Focus" },
-- },
}
local vopts = {
mode = "v", -- VISUAL mode
prefix = "<leader>",
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
silent = true, -- use `silent` when creating keymaps
noremap = true, -- use `noremap` when creating keymaps
nowait = true, -- use `nowait` when creating keymaps
}
local vmappings = {
["/"] = { '<ESC><CMD>lua require("Comment.api").toggle.linewise(vim.fn.visualmode())<CR>', "Comment" },
s = { "<esc><cmd>'<,'>SnipRun<cr>", "Run range" },
-- z = { "<cmd>TZNarrow<cr>", "Narrow" },
}
which_key.setup(setup)
which_key.register(mappings, opts)
which_key.register(vmappings, vopts)
which_key.register(m_mappings, m_opts)

View File

@ -0,0 +1,45 @@
local status_ok, zen_mode = pcall(require, "zen-mode")
if not status_ok then
return
end
zen_mode.setup {
window = {
backdrop = 1,
height = 0.9,
-- width = 0.5,
width = 80,
options = {
signcolumn = "no",
number = false,
relativenumber = false,
cursorline = true,
cursorcolumn = false, -- disable cursor column
-- foldcolumn = "0", -- disable fold column
-- list = false, -- disable whitespace characters
},
},
plugins = {
gitsigns = { enabled = false },
tmux = { enabled = false },
twilight = { enabled = false },
},
on_open = function()
require("lsp-inlayhints").toggle()
vim.g.cmp_active = false
vim.cmd [[LspStop]]
local status_ok, _ = pcall(vim.api.nvim_set_option_value, "winbar", nil, { scope = "local" })
if not status_ok then
return
end
if vim.fn.exists("#" .. "_winbar") == 1 then
vim.cmd("au! " .. "_winbar")
end
end,
on_close = function()
require("lsp-inlayhints").toggle()
vim.g.cmp_active = true
vim.cmd [[LspStart]]
require("user.winbar").create_winbar()
end,
}

View File

@ -1,7 +1,7 @@
Config {
-- appearance
font = "xft:Fira Code:size=9:antialias=true:hinting=true"
font = "xft:FiraCode Nerd Font:size=9:antialias=true:hinting=true"
, additionalFonts = [ "xft:FiraCode Nerd Font:size=9:antialias=true:hinting=true" ]
, bgColor = "#282a36"
, fgColor = "#f8f8f2"

View File

@ -1,7 +1,7 @@
Config {
-- appearance
font = "xft:Fira Code:size=9:antialias=true:hinting=true"
font = "xft:FiraCode Nerd Font:size=9:antialias=true:hinting=true"
, bgColor = "#282a36"
, fgColor = "#f8f8f2"
, position = Top

View File

@ -191,3 +191,7 @@ ZSH_HIGHLIGHT_STYLES[redirection]='fg=#F8F8F2'
ZSH_HIGHLIGHT_STYLES[arg0]='fg=#F8F8F2'
ZSH_HIGHLIGHT_STYLES[default]='fg=#F8F8F2'
ZSH_HIGHLIGHT_STYLES[cursor]='standout'
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"