Dotfiles with the latest changes

This commit is contained in:
2024-10-28 14:02:46 +01:00
parent d39336c479
commit fa6b78a382
108 changed files with 4459 additions and 467 deletions

View File

@@ -1,6 +1,7 @@
return {
"Mofiqul/dracula.nvim",
config = function()
vim.cmd([[colorscheme dracula]])
end,
"Mofiqul/dracula.nvim",
priority = 1000,
config = function()
vim.cmd([[colorscheme dracula]])
end,
}

View File

@@ -3,30 +3,42 @@ local opt = vim.opt
opt.relativenumber = true
opt.number = true
-- tabs & indentation
opt.tabstop = 2
opt.shiftwidth = 2
opt.expandtab = true
opt.autoindent = true
-- disable line wrapping
opt.wrap = false
-- search settings
opt.ignorecase = true
opt.smartcase = true
-- undo
opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
opt.undofile = true
-- search behaviour
opt.hlsearch = false
opt.incsearch = true
-- cursor always stays in the middle
opt.scrolloff = 999
-- colorscheme
opt.termguicolors = true
opt.background = "dark"
opt.signcolumn = "yes"
-- backspace
opt.backspace = "indent,eol,start"
-- clipboard
opt.clipboard:append("unnamedplus")
-- splitting windows
opt.splitright = true
opt.splitbelow = true

View File

@@ -1,14 +1,18 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({ { import = "jirr02.plugins" }, { import = "jirr02.core.colorscheme" }, { import = "jirr02.plugins.lsp"} })
require("lazy").setup({
{ import = "jirr02.plugins" },
{ import = "jirr02.core.colorscheme" },
{ import = "jirr02.plugins.lsp" },
})

View File

@@ -1,24 +1,25 @@
return {
"goolord/alpha-nvim",
event = "VimEnter",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
"goolord/alpha-nvim",
event = "VimEnter",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
local alpha = require("alpha")
local dashboard = require("alpha.themes.dashboard")
-- Set menu
dashboard.section.buttons.val = {
dashboard.button("e", " > New File", "<cmd>ene<CR>"),
dashboard.button("SPC ee", " > Toggle file explorer", "<cmd>NvimTreeToggle<CR>"),
dashboard.button("SPC ff", "󰱼 > Find File", "<cmd>Telescope find_files<CR>"),
dashboard.button("SPC fs", " > Find Word", "<cmd>Telescope live_grep<CR>"),
dashboard.button("q", " > Quit NVIM", "<cmd>qa<CR>"),
}
-- Set menu
dashboard.section.buttons.val = {
dashboard.button("e", " > New File", "<cmd>ene<CR>"),
dashboard.button("SPC ee", " > Toggle file explorer", "<cmd>NvimTreeToggle<CR>"),
dashboard.button("SPC ff", "󰱼 > Find File", "<cmd>Telescope find_files<CR>"),
dashboard.button("SPC fs", " > Find Word", "<cmd>Telescope live_grep<CR>"),
dashboard.button("SPC sr", "󰦛 > Resore Session", "<cmd>SessionRestore<CR>"),
dashboard.button("q", " > Quit NVIM", "<cmd>qa<CR>"),
}
-- Send config to alpha
alpha.setup(dashboard.opts)
-- Send config to alpha
alpha.setup(dashboard.opts)
-- Disable folding on alpha buffer
vim.cmd([[autocmd FileType alpha setlocal nofoldenable]])
end,
-- Disable folding on alpha buffer
vim.cmd([[autocmd FileType alpha setlocal nofoldenable]])
end,
}

View File

@@ -0,0 +1,17 @@
return {
"rmagatti/auto-session",
config = function()
local auto_session = require("auto-session")
local wk = require("which-key")
auto_session.setup({
auto_restore_enabled = false,
})
wk.add({
{ "<leader>s", group = "session", icon = "" },
{ "<leader>sr", "<cmd>SessionRestore<CR>", desc = "Restore session for cwd", icon = "󰦛" },
{ "<leader>sr", "<cmd>SessionSave<CR>", desc = "Save Session", icon = "" },
})
end,
}

View File

@@ -1,9 +1,18 @@
return {
"windwp/nvim-autopairs",
config = function()
local autopairs = require("nvim-autopairs")
"windwp/nvim-autopairs",
event = { "InsertEnter" },
dependencies = {
"hrsh7th/nvim-cmp",
},
config = function()
local autopairs = require("nvim-autopairs")
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local cmp = require("cmp")
autopairs.setup()
autopairs.setup({
check_ts = true,
})
end
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
end,
}

View File

@@ -15,13 +15,11 @@ return {
},
})
wk.register({
b = {
name = "buffer",
x = { "<cmd>BufDel<CR>", "Close Buffer" },
n = { "<cmd>BufferLineCycleNext<CR>", "Go to next buffer" },
p = { "<cmd>BufferLineCyclePrev<CR>", "Go to previous buffer" },
},
}, { prefix = "<leader>" })
wk.add({
{ "<leader>b", group = "buffer", icon = "󰓩" },
{ "<leader>bx", "<cmd>BufDel<CR>", desc = "Close Buffer", icon = "󰭌" },
{ "<leader>bn", "<cmd>BufferLineCycleNext<CR>", desc = "Go to next buffer", icon = "󰌒" },
{ "<leader>bp", "<cmd>BufferLineCyclePrev<CR>", desc = "Go to previous buffer", icon = "󰌥" },
})
end,
}

View File

@@ -1,8 +1,9 @@
return {
"numToStr/comment.nvim",
config = function()
local comment = require("Comment")
"numToStr/comment.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
local comment = require("Comment")
comment.setup({})
end,
comment.setup({})
end,
}

View File

@@ -0,0 +1,11 @@
return {
"hat0uma/csvview.nvim",
config = function()
require("csvview").setup({
view = {
display_mode = "border",
},
})
end,
}

View File

@@ -0,0 +1,22 @@
return {
"Myzel394/easytables.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
local easytables = require("easytables")
local wk = require("which-key")
easytables.setup({})
wk.add({
{ "<leader>m", group = "markdown", icon = "" },
{
"<leader>mt",
function()
vim.ui.input({ prompt = "width x height: " }, function(input)
vim.cmd("EasyTablesCreateNew " .. input)
end)
end,
},
})
end,
}

View File

@@ -1,8 +1,15 @@
return {
"AckslD/nvim-FeMaco.lua",
lazy = true,
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
local femaco = require("femaco")
local wk = require("which-key")
femaco.setup({})
wk.add({
{"<leader>me", "<cmd>FeMaco<CR>", desc = "Edit code block in buffer", icon = ""},
})
end,
}

View File

@@ -0,0 +1,21 @@
return {
"stevearc/conform.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
local conform = require("conform")
local wk = require("which-key")
conform.setup({
formatters_by_ft = {
markdown = { "prettier" },
python = { "black" },
lua = { "stylua" },
},
})
wk.add({
{ "<leader>l" , group = "lsp", icon = ""},
{"<leader>lf", function() conform.format({lsp_fallback = true, async = false, timeout_ms = 1000}) end, desc = "Format file", icon = "󰛖"},
})
end,
}

View File

@@ -0,0 +1,8 @@
return {
"lukas-reineke/indent-blankline.nvim",
event = { "BufReadPre", "BufNewFile" },
main = "ibl",
opts = {
indent = { char = "|" },
},
}

View File

@@ -1,7 +1,7 @@
return {
{ "nvim-lua/plenary.nvim" },
{ "tpope/vim-surround" },
{ "vim-scripts/ReplaceWithRegister" },
{ "mfussenegger/nvim-lint" },
{ "christoomey/vim-tmux-navigator" },
{ "tpope/vim-fugitive" },
{ "jghauser/follow-md-links.nvim" },
}

View File

@@ -0,0 +1,21 @@
return {
"mfussenegger/nvim-lint",
event = { "BufReadPre", "BufNewFile" },
config = function ()
local lint = require("lint")
lint.linters_by_ft = {
python = { "pylint" },
}
local lint_augroup = vim.api.nvim_create_augroup("lint", {clear = true})
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
group = lint_augroup,
callback = function ()
lint.try_lint()
end,
})
end,
}

View File

@@ -1,15 +1,27 @@
return {
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"onsails/lspkind.nvim",
{ "folke/neodev.nvim", opts = {} },
},
config = function()
local lspconfig = require("lspconfig")
local mason_lspconfig = require("mason-lspconfig")
local cmp_nvim_lsp = require("cmp_nvim_lsp")
local wk = require("which-key")
local capabilities = cmp_nvim_lsp.default_capabilities()
mason_lspconfig.setup_handlers({
function(server_name)
lspconfig[server_name].setup({
capabilities = capabilities,
})
end,
})
lspconfig["lua_ls"].setup({
capabilities = capabilities,
settings = { -- custom settings for lua
@@ -32,29 +44,24 @@ return {
capabilities = capabilities,
filetypes = { "python" },
})
lspconfig["clangd"].setup({
capabilities = capabilities,
})
lspconfig["marksman"].setup({
capabilities = capabilities,
})
lspconfig["texlab"].setup({
capabilities = capabilities,
})
wk.register({
l = {
name = "lsp",
r = { "<cmd>Telescope lsp_references<CR>", "Show references" },
D = { "<cmd>lua vim.lsp.buf.defenition()<CR>", "Show defenition" },
c = { "<cmd>lua vim.lsp.buf.code_action()<CR>", "Code actions" },
R = { "<cmd>lua vim.lsp.buf.rename()<CR>", "Smart rename" },
d = { "<cmd>Telescope diagnostics bufnr=0<CR>", "Diagnostics" },
l = { "<cmd>lua vim.lsp.buf.open_float()<CR>", "Line Diagnostics" },
n = { "<cmd>lua vim.diagnostics.goto_next()<CR>", "Go to next Diagnostic" },
p = { "<cmd>lua vim.diagnostics.goto_prev()<CR>", "Go to previous Diagnostic" },
i = { "<cmd>lua vim.lsp.buf.hover()<CR>", "Show documentation" },
L = { "<cmd>LspRestart<CR>", "Restart LSP" },
wk.add({
{ "<leader>l", group = "lsp", icon = "" },
{ "<leader>lr", "<cmd>Telescope lsp_references<CR>", desc = "Show references", icon = "" },
{ "<leader>lD", "<cmd>lua vim.lsp.buf.defenition()<CR>", desc = "Show defenition", icon = "" },
{ "<leader>lc", "<cmd>lua vim.lsp.buf.code_action()<CR>", desc = "Code actions", icon = "" },
{ "<leader>lR", "<cmd>lua vim.lsp.buf.rename()<CR>", desc = "Smart rename", icon = "󰑕" },
{ "<leader>ld", "<cmd>Telescope diagnostics bufnr=0<CR>", desc = "Diagnostics", icon = "󰍉" },
{ "<leader>ll", "<cmd>lua vim.lsp.buf.open_float()<CR>", desc = "Line Diagnostics", icon = "󰍉" },
{ "<leader>ln", "<cmd>lua vim.diagnostics.goto_next()<CR>", desc = "Go to next Diagnostic", icon = "" },
{
"<leader>lp",
"<cmd>lua vim.diagnostics.goto_prev()<CR>",
desc = "Go to previous Diagnostic",
icon = "",
},
}, { prefix = "<leader>" })
{ "<leader>li", "<cmd>lua vim.lsp.buf.hover()<CR>", desc = "Show documentation", icon = "󰈙" },
{ "<leader>lL", "<cmd>LspRestart<CR>", desc = "Restart LSP", icon = "" },
})
end,
}

View File

@@ -30,6 +30,8 @@ return {
"stylua",
"prettier",
"vale",
"pylint",
"latexindent",
},
})
end,

View File

@@ -1,52 +0,0 @@
return {
"nvimtools/none-ls.nvim",
dependencies = {
"jay-babu/mason-null-ls.nvim",
"nvimtools/none-ls-extras.nvim",
},
config = function()
local mason_null_ls = require("mason-null-ls")
local null_ls = require("null-ls")
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
local formatting = null_ls.builtins.formatting
local diagnostics = null_ls.builtins.diagnostics
mason_null_ls.setup()
null_ls.setup({
debug = true,
sources = {
formatting.stylua,
formatting.black,
formatting.clang_format,
formatting.prettier,
diagnostics.mypy.with({
extra_args = function()
local virtual = os.getenv("VIRTUAL_ENV") or os.getenv("CONDA_PREFIX") or "/usr"
return { "--python-executable", virtual .. "/bin/python3" }
end,
}),
-- diagnostics.ruff_lsp,
diagnostics.vale,
},
on_attach = function(current_client, bufnr)
if current_client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({
filter = function(client)
-- only use null-ls for formatting instead of lsp server
return client.name == "null-ls"
end,
bufnr = bufnr,
})
end,
})
end
end,
})
end,
}

View File

@@ -1,13 +1,13 @@
return {
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
local lualine = require("lualine")
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
local lualine = require("lualine")
lualine.setup({
options = {
theme = 'dracula-nvim',
},
})
end
lualine.setup({
options = {
theme = "dracula-nvim",
},
})
end,
}

View File

@@ -0,0 +1,9 @@
return {
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
ft = { "markdown" },
build = "cd app && yarn install",
init = function()
vim.g.mkdp_filetypes = { "markdown" }
end,
}

View File

@@ -0,0 +1,18 @@
return {
"hedyhli/markdown-toc.nvim",
ft = "markdown",
opts = {
fences = {
enabled = true,
start_text = "toc-start",
end_text = "toc-end",
},
auto_update = true,
toc_list = {
markers = "1.",
cycle_markers = false,
},
},
}

View File

@@ -0,0 +1,21 @@
return {
"MeanderingProgrammer/markdown.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = "nvim-treesitter/nvim-treesitter",
config = function()
local markdown = require("render-markdown")
markdown.setup({
checkbox = {
custom = {
inprogress = { raw = '[>]', rendered = '󰦕 ', highlight = 'RenderedMarkdownInProgress'},
onhold = { raw = '[=]', rendered = '', highlight = 'RenderedMarkdownOnhold'},
cancelled = { raw = '[_]', rendered = '', highlight = 'RenderedMarkdownCancelled'},
important = { raw = '[!]', rendered = '', highlight = 'RenderedMarkdownImportant'},
recurring = { raw = '[+]', rendered = '', highlight = 'RenderedMarkdownRecurring'},
uncertain = { raw = '[?]', rendered = '', highlight = 'RenderedMarkdownUncertain'},
},
},
})
end,
}

View File

@@ -1,4 +0,0 @@
return {
"kylechui/nvim-surround",
config = true,
}

View File

@@ -40,12 +40,10 @@ return {
ignore = false,
},
})
wk.register({
e = {
name = "explorer",
e = { "<cmd>NvimTreeToggle<CR>", "Toggle File Explorer" },
r = { "<cmd>NvimTreeRefresh<CR>", "Refresh File Explorer" },
},
}, { prefix = "<leader>" })
wk.add({
{ "<leader>e", group = "explorer", icon = "" },
{ "<leader>ee", "<cmd>NvimTreeToggle<CR>", desc = "Toggle File Explorer", icon = "" },
{ "<leader>er", "<cmd>NvimTreeRefresh<CR>", desc = "Refresh File Explorer", icon = "󰑓" },
})
end,
}

View File

@@ -12,15 +12,21 @@ return {
local wk = require("which-key")
telescope.load_extension("fzf")
telescope.load_extension("find_template")
wk.register({
f = {
name = "file",
f = { "<cmd>Telescope find_files<CR>", "Find Files in Current Working Directory" },
r = { "<cmd>Telescope oldfiles<CR>", "Recent Files" },
s = { "<cmd>Telescope grep_string<CR>", "Find String in File" },
g = { "<cmd>Telescope git_files<CR>", "Find git files" },
wk.add({
{ "<leader>f", group = "telescope", icon = "" },
{
"<leader>ff",
"<cmd>Telescope find_files<CR>",
desc = "Find Files in Current Working Directory",
icon = "",
},
}, { prefix = "<leader>" })
{ "<leader>fr", "<cmd>Telescope oldfiles<CR>", desc = "Recent Files", icon = "󰙰" },
{ "<leader>fs", "<cmd>Telescope live_grep<CR>", desc = "Find String in CWD", icon = "" },
{ "<leader>fc", "<cmd>Telescope grep_string<CR>", desc = "Find String in File", icon = "" },
{ "<leader>fg", "<cmd>Telescope git_files<CR>", desc = "Find git files", icon = "" },
{ "<leader>ft", "<cmd>TodoTelescope<CR>", desc = "Find todos", icon = "" },
})
end,
}

View File

@@ -0,0 +1,23 @@
return {
"nvimdev/template.nvim",
cmd = { "Template", "TemProject" },
config = function()
local template = require("template")
local wk = require("which-key")
template.setup({
temp_dir = "~/.config/nvim/templates/",
})
wk.add({
{ "<leader>t", group = "template", icon = "" },
{
"<leader>ti",
"<cmd>Telescope find_template type=insert filter_ft=false<CR>",
desc = "Insert template",
icon = "",
},
{ "<leader>tl", "<cmd>!theory<CR>", desc = "Insert latex notebook template", icon = "" },
})
end,
}

View File

@@ -0,0 +1,8 @@
return {
"folke/todo-comments.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"nvim-lua/plenary.nvim",
},
opts = {}
}

View File

@@ -4,6 +4,7 @@ return {
event = { "BufReadPre", "BufNewFile" },
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
"windwp/nvim-ts-autotag",
},
config = function()
local treesitter = require("nvim-treesitter.configs")
@@ -16,6 +17,9 @@ return {
indent = {
enable = true,
},
autotag = {
enable = true,
},
ensure_installed = {
"python",
"cpp",

View File

@@ -1,9 +1,9 @@
return {
"lervag/vimtex",
config = function()
lazy = false,
init = function()
local wk = require("which-key")
vim.g.tex_flavor = "latex"
vim.g.vimtex_view_method = "zathura"
vim.g.vimtex_quickfix_mode = 0
vim.g.vimtex_compiler_latexmk = {
@@ -11,13 +11,17 @@ return {
"-pdf",
},
}
vim.g.vimtex_fold_enabled = true
vim.g.vimtex_format_enabled = true
wk.register({
v = {
name = "vimtex",
c = { ":VimtexCompile", "Compile LaTex File" },
v = { ":!zathura main.pdf &>/dev/null &", "Open compiled PDF in Zathura" },
},
}, { prefix = "<leader>" })
wk.add({
{ "<leader>v", group = "vimtex", icon = "" },
{ "<leader>vc", "<cmd>VimtexCompile>CR>", desc = "Compile LaTex File", icon = "" },
{ "<leader>vo", "<cmd>VimtexView<CR>", desc = "Open compiled PDF in Zathura", icon = "" },
{ "<leader>vd", group = "delete", icon = "" },
{ "<leader>vde", "<Plug>(vimtex-env-delete)", desc = "Delete surrounding environment" },
{ "<leader>vc", group = "change", icon = "" },
{ "<leader>vt", group = "toggle", icon = "" },
})
end,
}

View File

@@ -1,9 +0,0 @@
return {
"vimwiki/vimwiki",
init = function()
vim.g.vimwiki_list = {
{ path = "/Users/jirayu/Projects/Private/vimwiki_code/", syntax = "markdown", ext = ".md" },
{ path = "/Users/jirayu/Projects/Private/vimwiki_edu/", syntax = "markdown", ext = ".md" },
}
end,
}

View File

@@ -8,38 +8,19 @@ return {
config = function()
local wk = require("which-key")
wk.register({
n = {
name = "vim",
h = { "<cmd>nohl<CR>", "Close Search Highlights" },
},
s = {
name = "splits",
v = { "<C-w>v", "Split vertical" },
s = { "<C-w>s", "Split horizontal" },
e = { "<C-w>=", "Make Splits equal" },
x = { "<cmd>close<CR>", "Close Split" },
},
m = {
name = "menu",
l = { "<cmd>Lazy<CR>", "Open Lazy Menu" },
m = { "<cmd>Mason<CR>", "Open Mason Menu" },
},
g = {
name = "git",
t = { "<cmd>Gitsigns toggle_signs<CR>", "Toggle Gitsigns" },
h = { "<cmd>Gitsigns toggle_linehl<CR>", "Toggle Line Highlights" },
s = { "<cmd>Telescope git_status<CR>", "git status" },
d = { "<cmd>Gvdiff<CR>", "Differences" },
w = { "<cmd>Gwrite<CR>", "Add File" },
N = { "<cmd>Gitsigns next_hunk<CR>", "Go to next hunk" },
P = { "<cmd>Gitsigns prev_hunk<CR>", "Go to previous hunk" },
c = { "<cmd>Git commit<CR>", "Commit" },
H = { "<cmd>Gitsigns stage_hunk", "Stage hunk" },
p = { "<cmd>Git push<CR>", "Push" },
C = { "<cmd>Telescope git_commits<CR>", "View commits" },
b = { "<cmd>Telescope git_branches<CR>", "View branches" },
},
}, { prefix = "<leader>" })
wk.add({
{ "<leader>n", group = "vim", icon = "" },
{ "<leader>nh", "<cmd>nohl<CR>", desc = "Close Search Highlights", icon = "" },
{ "<leader>no", "<cmd>foldopen<CR>", desc = "Open Fold", icon = "" },
{ "<leader>nc", "<cmd>foldclose<CR>", desc = "Close Fold", icon = "" },
{ "<leader>s", group = "splits", icon = "󱓡" },
{ "<leader>sv", "<C-w>v", desc = "Split vertical", icon = "" },
{ "<leader>sh", "<C-w>s", desc = "Split horizontal", icon = "" },
{ "<leader>se", "<C-w>=", desc = "Make Splits equal", icon = "󰤼" },
{ "<leader>sx", "<cmd>close<CR>", desc = "Close Split", icon = "󰅚" },
{ "<leader>i", group = "interface", icon = "󰮫" },
{ "<leader>il", "<cmd>Lazy<CR>", desc = "Open Lazy Menu" },
{ "<leader>im", "<cmd>Mason<CR>", desc = "Open Mason Menu" },
})
end,
}