summaryrefslogtreecommitdiff
path: root/.config/nvim
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/after/ftplugin/python.lua5
-rw-r--r--.config/nvim/init.lua407
-rw-r--r--.config/nvim/nvim-macos.tar.gz1
-rw-r--r--.config/nvim/nvim-pack-lock.json20
4 files changed, 252 insertions, 181 deletions
diff --git a/.config/nvim/after/ftplugin/python.lua b/.config/nvim/after/ftplugin/python.lua
new file mode 100644
index 0000000..d5f5000
--- /dev/null
+++ b/.config/nvim/after/ftplugin/python.lua
@@ -0,0 +1,5 @@
+vim.api.nvim_create_autocmd("LspAttach", {
+ callback = function()
+ vim.lsp.handlers["$/progress"] = function() end
+ end,
+})
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
index fb59850..0de20c8 100644
--- a/.config/nvim/init.lua
+++ b/.config/nvim/init.lua
@@ -1,4 +1,4 @@
-_G._startup_time = vim.loop.hrtime()
+_G._startup_time = vim.uv.hrtime()
-- ============================================================================
-- OPTIONS
-- ============================================================================
@@ -7,8 +7,8 @@ vim.opt.number = true -- line number
vim.opt.relativenumber = true -- relative line numbers
vim.opt.cursorline = true -- highlight current line
vim.opt.wrap = false -- do not wrap lines by default
-vim.opt.scrolloff = 8 -- keep 8 lines above/below cursor
-vim.opt.sidescrolloff = 8 -- keep 8 lines to left/right of cursor
+vim.opt.scrolloff = 12 -- keep 8 lines above/below cursor
+vim.opt.sidescrolloff = 12 -- keep 8 lines to left/right of cursor
vim.opt.tabstop = 4 -- tabwidth
vim.opt.shiftwidth = 4 -- indent width
@@ -67,9 +67,6 @@ vim.opt.modifiable = true -- allow buffer modifications
vim.opt.encoding = "utf-8" -- set encoding
vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
--- vim.opt.guicursor =
--- "n-v-c:block,i-ci-ve:block,r-cr:hor20,o:hor50,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,sm:block-blinkwait175-blinkoff150-blinkon175" -- cursor blinking and settings
-
-- Folding: requires treesitter available at runtime; safe fallback if not
vim.opt.foldmethod = "expr" -- use expression for folding
vim.opt.foldexpr = "v:lua.vim.treesitter.foldexpr()" -- use treesitter for folding
@@ -83,152 +80,6 @@ vim.opt.wildmode = "longest:full,full" -- complete longest common match, full co
vim.opt.diffopt:append("linematch:60") -- improve diff display
vim.opt.redrawtime = 10000 -- increase neovim redraw tolerance
vim.opt.maxmempattern = 20000 -- increase max memory
--- ============================================================================
--- STATUSLINE
--- ============================================================================
-
--- Git branch function with caching and Nerd Font icon
-local cached_branch = ""
-local last_check = 0
-local function git_branch()
- local now = vim.loop.now()
- if now - last_check > 5000 then -- Check every 5 seconds
- cached_branch = vim.fn.system("git branch --show-current 2>/dev/null | tr -d '\n'")
- last_check = now
- end
- if cached_branch ~= "" then
- return "\u{e725} " .. cached_branch .. " " -- nf-dev-git_branch
- end
- return ""
-end
-
--- File type with Nerd Font icon
-local function file_type()
- local ft = vim.bo.filetype
- local icons = {
- lua = "\u{e620} ", -- nf-dev-lua
- python = "\u{e73c} ", -- nf-dev-python
- javascript = "\u{e74e} ", -- nf-dev-javascript
- typescript = "\u{e628} ", -- nf-dev-typescript
- javascriptreact = "\u{e7ba} ",
- typescriptreact = "\u{e7ba} ",
- html = "\u{e736} ", -- nf-dev-html5
- css = "\u{e749} ", -- nf-dev-css3
- scss = "\u{e749} ",
- json = "\u{e60b} ", -- nf-dev-json
- markdown = "\u{e73e} ", -- nf-dev-markdown
- vim = "\u{e62b} ", -- nf-dev-vim
- sh = "\u{f489} ", -- nf-oct-terminal
- bash = "\u{f489} ",
- zsh = "\u{f489} ",
- rust = "\u{e7a8} ", -- nf-dev-rust
- go = "\u{e724} ", -- nf-dev-go
- c = "\u{e61e} ", -- nf-dev-c
- cpp = "\u{e61d} ", -- nf-dev-cplusplus
- java = "\u{e738} ", -- nf-dev-java
- php = "\u{e73d} ", -- nf-dev-php
- ruby = "\u{e739} ", -- nf-dev-ruby
- swift = "\u{e755} ", -- nf-dev-swift
- kotlin = "\u{e634} ",
- dart = "\u{e798} ",
- elixir = "\u{e62d} ",
- haskell = "\u{e777} ",
- sql = "\u{e706} ",
- yaml = "\u{f481} ",
- toml = "\u{e615} ",
- xml = "\u{f05c} ",
- dockerfile = "\u{f308} ", -- nf-linux-docker
- gitcommit = "\u{f418} ", -- nf-oct-git_commit
- gitconfig = "\u{f1d3} ", -- nf-fa-git
- vue = "\u{fd42} ", -- nf-md-vuejs
- svelte = "\u{e697} ",
- astro = "\u{e628} ",
- }
-
- if ft == "" then
- return " \u{f15b} " -- nf-fa-file_o
- end
-
- return ((icons[ft] or " \u{f15b} ") .. ft)
-end
-
--- File size with Nerd Font icon
-local function file_size()
- local size = vim.fn.getfsize(vim.fn.expand("%"))
- if size < 0 then
- return ""
- end
- local size_str
- if size < 1024 then
- size_str = size .. "B"
- elseif size < 1024 * 1024 then
- size_str = string.format("%.1fK", size / 1024)
- else
- size_str = string.format("%.1fM", size / 1024 / 1024)
- end
- return " \u{f016} " .. size_str .. " " -- nf-fa-file_o
-end
-
--- Mode indicators with Nerd Font icons
-local function mode_icon()
- local mode = vim.fn.mode()
- local modes = {
- n = " \u{f121} NORMAL",
- i = " \u{f11c} INSERT",
- v = " \u{f0168} VISUAL",
- V = " \u{f0168} V-LINE",
- ["\22"] = " \u{f0168} V-BLOCK",
- c = " \u{f120} COMMAND",
- s = " \u{f0c5} SELECT",
- S = " \u{f0c5} S-LINE",
- ["\19"] = " \u{f0c5} S-BLOCK",
- R = " \u{f044} REPLACE",
- r = " \u{f044} REPLACE",
- ["!"] = " \u{f489} SHELL",
- t = " \u{f120} TERMINAL",
- }
- return modes[mode] or (" \u{f059} " .. mode)
-end
-
-_G.mode_icon = mode_icon
-_G.git_branch = git_branch
-_G.file_type = file_type
-_G.file_size = file_size
-
-vim.cmd([[
- highlight StatusLineBold gui=bold cterm=bold
-]])
-
--- Function to change statusline based on window focus
-local function setup_dynamic_statusline()
- vim.api.nvim_create_autocmd({ "WinEnter", "BufEnter" }, {
- callback = function()
- vim.opt_local.statusline = table.concat({
- " ",
- "%#StatusLineBold#",
- "%{v:lua.mode_icon()}",
- "%#StatusLine#",
- " | %f %h%m%r", -- nf-pl-left_hard_divider
- " %{v:lua.git_branch()}",
- " | ", -- nf-pl-left_hard_divider
- "%{v:lua.file_type()}",
- " | ", -- nf-pl-left_hard_divider
- "%{v:lua.file_size()}",
- "%=", -- Right-align everything after this
- "%l:%c %P ", -- nf-fa-clock_o for line/col
- })
- end,
- })
- vim.api.nvim_set_hl(0, "StatusLineBold", { bold = true })
-
- vim.api.nvim_create_autocmd({ "WinLeave", "BufLeave" }, {
- callback = function()
- vim.opt_local.statusline = " %f %h%m%r | %{v:lua.file_type()} %= %l:%c %P "
- end,
- })
-end
-
-setup_dynamic_statusline()
-- ============================================================================
-- KEYMAPS
@@ -251,10 +102,14 @@ vim.keymap.set("n", "N", "Nzzzv", { desc = "Previous search result (centered)" }
vim.keymap.set("n", "<C-d>", "<C-d>zz", { desc = "Half page down (centered)" })
vim.keymap.set("n", "<C-u>", "<C-u>zz", { desc = "Half page up (centered)" })
-vim.keymap.set("n", "<C-h>", "<C-w>h", { desc = "Move to left window" })
-vim.keymap.set("n", "<C-j>", "<C-w>j", { desc = "Move to bottom window" })
-vim.keymap.set("n", "<C-k>", "<C-w>k", { desc = "Move to top window" })
-vim.keymap.set("n", "<C-l>", "<C-w>l", { desc = "Move to right window" })
+vim.keymap.set("n", "dih", function()
+ require("gitsigns").reset_hunk()
+end, { desc = "Delete in hunk" })
+
+vim.keymap.set("n", "<c-h>", "<cmd>TmuxNavigateLeft<cr>")
+vim.keymap.set("n", "<c-j>", "<cmd>TmuxNavigateDown<cr>")
+vim.keymap.set("n", "<c-k>", "<cmd>TmuxNavigateUp<cr>")
+vim.keymap.set("n", "<c-l>", "<cmd>TmuxNavigateRight<cr>")
-- vim.keymap.set("n", "<leader>sv", ":vsplit<CR>", { desc = "Split window vertically" })
-- vim.keymap.set("n", "<leader>sh", ":split<CR>", { desc = "Split window horizontally" })
@@ -291,7 +146,6 @@ vim.keymap.set("n", "<leader>td", function()
vim.diagnostic.enable(not vim.diagnostic.is_enabled())
end, { desc = "Toggle diagnostics" })
vim.keymap.set("n", "<leader>tw", function()
- vim.diagnostic.enable(not vim.diagnostic.is_enabled())
vim.wo.wrap = not vim.wo.wrap
end, { desc = "Toggle wrap" })
@@ -387,7 +241,6 @@ vim.api.nvim_create_autocmd("FileType", {
callback = function()
vim.opt_local.wrap = true
vim.opt_local.linebreak = true
- vim.opt_local.spell = true
end,
})
-- ============================================================================
@@ -422,6 +275,11 @@ vim.pack.add({
"https://github.com/stevearc/oil.nvim",
"https://github.com/folke/flash.nvim",
"https://github.com/goolord/alpha-nvim",
+ "https://github.com/christoomey/vim-tmux-navigator",
+ "https://github.com/nvim-lualine/lualine.nvim",
+ "https://github.com/MeanderingProgrammer/render-markdown.nvim",
+ "https://github.com/iamcco/markdown-preview.nvim",
+ "https://github.com/bullets-vim/bullets.vim",
})
local function packadd(name)
@@ -441,6 +299,9 @@ packadd("LuaSnip")
packadd("plenary.nvim")
packadd("nui.nvim")
packadd("rustaceanvim")
+packadd("render-markdown.nvim")
+packadd("markdown-preview.nvim")
+packadd("bullets.vim")
-- ============================================================================
-- TRANSPARENCY
@@ -481,6 +342,150 @@ vim.cmd("hi CursorLine guibg=NONE")
-- PLUGIN CONFIGS
-- ============================================================================
+local setup_lualine = function()
+ local lualine = require("lualine")
+
+ -- Color table for highlights
+ -- stylua: ignore
+ local colors = {
+ bg = '#434c5e',
+ fg = '#d8dee9',
+ yellow = '#ebcb8b',
+ cyan = '#88c0d0',
+ darkblue = '#5e81ac',
+ green = '#a3be8c',
+ orange = '#d08770',
+ violet = '#b48ead',
+ blue = '#81a1c1',
+ red = '#bf616a',
+ }
+
+ local conditions = {
+ buffer_not_empty = function()
+ return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
+ end,
+ hide_in_width = function()
+ return vim.fn.winwidth(0) > 80
+ end,
+ check_git_workspace = function()
+ local filepath = vim.fn.expand("%:p:h")
+ local gitdir = vim.fn.finddir(".git", filepath .. ";")
+ return gitdir and #gitdir > 0 and #gitdir < #filepath
+ end,
+ }
+
+ local config = {
+ options = {
+ component_separators = "",
+ section_separators = "",
+ theme = {
+ normal = { c = { fg = colors.fg, bg = colors.bg } },
+ inactive = { c = { fg = colors.fg, bg = colors.bg } },
+ },
+ },
+ sections = {
+ lualine_a = {},
+ lualine_b = {},
+ lualine_y = {},
+ lualine_z = {},
+ lualine_c = {},
+ lualine_x = {},
+ },
+ inactive_sections = {
+ lualine_a = {},
+ lualine_b = {},
+ lualine_y = {},
+ lualine_z = {},
+ lualine_c = {},
+ lualine_x = {},
+ },
+ }
+
+ local function ins_left(component)
+ table.insert(config.sections.lualine_c, component)
+ end
+
+ local function ins_right(component)
+ table.insert(config.sections.lualine_x, component)
+ end
+
+ ins_left({
+ function()
+ return "  " .. string.upper(vim.fn.mode())
+ end,
+ color = function()
+ local mode_color = {
+ n = colors.red,
+ i = colors.green,
+ v = colors.blue,
+ [""] = colors.blue,
+ V = colors.blue,
+ c = colors.violet,
+ no = colors.red,
+ s = colors.orange,
+ S = colors.orange,
+ [""] = colors.orange,
+ ic = colors.yellow,
+ R = colors.violet,
+ Rv = colors.violet,
+ cv = colors.red,
+ ce = colors.red,
+ r = colors.cyan,
+ rm = colors.cyan,
+ ["r?"] = colors.cyan,
+ ["!"] = colors.red,
+ t = colors.red,
+ }
+ return { fg = mode_color[vim.fn.mode()] }
+ end,
+ padding = { right = 1 },
+ })
+
+ ins_left({
+ "filename",
+ cond = conditions.buffer_not_empty,
+ color = { fg = colors.green, gui = "bold" },
+ })
+ ins_left({
+ "filesize",
+ cond = conditions.buffer_not_empty,
+ })
+
+ ins_left({ "progress", color = { fg = colors.fg, gui = "bold" } })
+
+ ins_left({
+ "diagnostics",
+ sources = { "nvim_diagnostic" },
+ symbols = { error = " ", warn = " ", info = " " },
+ diagnostics_color = {
+ error = { fg = colors.red },
+ warn = { fg = colors.yellow },
+ info = { fg = colors.cyan },
+ },
+ })
+
+ ins_right({
+ "branch",
+ icon = "",
+ color = { fg = colors.violet, gui = "bold" },
+ })
+
+ ins_right({
+ "diff",
+ symbols = { added = " ", modified = " ", removed = " " },
+ diff_color = {
+ added = { fg = colors.green },
+ modified = { fg = colors.orange },
+ removed = { fg = colors.red },
+ },
+ cond = conditions.hide_in_width,
+ })
+
+ lualine.setup(config)
+end
+
+setup_lualine()
+
-- ALPHA
local setup_alpha = function()
local alpha = require("alpha")
@@ -576,6 +581,63 @@ vim.api.nvim_create_autocmd("FileType", {
-- OUTLINE
require("outline").setup({})
+-- MARKDOWN BULLETS
+vim.g.bullets_delete_last_bullet_if_empty = 1
+
+-- RENDER MARKDOWN
+require("render-markdown").setup({
+ win_options = {
+ conceallevel = { default = 0, rendered = 3 },
+ },
+ bullet = { enabled = true },
+ latex = { enabled = false },
+ checkbox = {
+ enabled = true,
+ position = "inline",
+ unchecked = { icon = " 󰄱 ", highlight = "RenderMarkdownUnchecked" },
+ checked = { icon = " 󰱒 ", highlight = "RenderMarkdownChecked" },
+ },
+ html = { enabled = true, comment = { conceal = false } },
+ heading = {
+ sign = false,
+ icons = { " 󰎤 ", " 󰎧 ", " 󰎪 ", " 󰎭 ", " 󰎱 ", " 󰎳 " },
+ backgrounds = { "Headline1Bg", "Headline2Bg", "Headline3Bg", "Headline4Bg", "Headline5Bg", "Headline6Bg" },
+ foregrounds = { "Headline1Fg", "Headline2Fg", "Headline3Fg", "Headline4Fg", "Headline5Fg", "Headline6Fg" },
+ },
+ ft = { "markdown" },
+})
+
+local c = {
+ fg = "#2e3440",
+ red = "#bf616a",
+ orange = "#d08770",
+ yellow = "#ebcb8b",
+ green = "#a3be8c",
+ blue = "#5e81ac",
+ violet = "#b48ead",
+}
+local hl = vim.cmd
+hl(("highlight @markup.strong guifg=%s"):format(c.orange))
+hl(("highlight @markup.italic guifg=%s"):format(c.orange))
+hl(("highlight RenderMarkdownCodeInline guifg=%s"):format(c.green))
+for i, col in ipairs({ c.red, c.orange, c.yellow, c.green, c.blue, c.violet }) do
+ local n = tostring(i)
+ hl(("highlight Headline%sBg guifg=%s guibg=%s"):format(n, c.fg, col))
+ hl(("highlight Headline%sFg cterm=bold gui=bold guifg=%s"):format(n, col))
+ hl(("highlight RenderMarkdownH%sBg guifg=%s guibg=%s"):format(n, c.fg, col))
+ hl(("highlight RenderMarkdownH%s guifg=%s guibg=%s cterm=bold gui=bold"):format(n, col, c.fg))
+end
+
+-- toggle render markdown
+vim.keymap.set("n", "<leader>or", function()
+ local m = require("render-markdown")
+ if require("render-markdown.state").enabled then
+ m.disable()
+ else
+ m.enable()
+ end
+end, { desc = "Toggle Render Markdown" })
+
-- TREESITTER
local setup_treesitter = function()
local treesitter = require("nvim-treesitter")
@@ -805,9 +867,6 @@ end, { desc = "Previous git hunk" })
vim.keymap.set("n", "<leader>hs", function()
require("gitsigns").stage_hunk()
end, { desc = "Stage hunk" })
-vim.keymap.set("n", "<leader>hr", function()
- require("gitsigns").reset_hunk()
-end, { desc = "Reset hunk" })
vim.keymap.set("n", "<leader>hp", function()
require("gitsigns").preview_hunk()
end, { desc = "Preview hunk" })
@@ -930,19 +989,6 @@ local function lsp_on_attach(ev)
vim.keymap.set("n", "<leader>fi", function()
require("fzf-lua").lsp_implementations()
end, opts)
-
- if client:supports_method("textDocument/codeAction", bufnr) then
- vim.keymap.set("n", "<leader>oi", function()
- vim.lsp.buf.code_action({
- context = { only = { "source.organizeImports" }, diagnostics = {} },
- apply = true,
- bufnr = bufnr,
- })
- vim.defer_fn(function()
- vim.lsp.buf.format({ bufnr = bufnr })
- end, 50)
- end, opts)
- end
end
vim.api.nvim_create_autocmd("LspAttach", { group = augroup, callback = lsp_on_attach })
@@ -986,6 +1032,9 @@ vim.lsp.config("lua_ls", {
})
vim.lsp.config("pyright", {
settings = {
+ pyright = {
+ disableTaggedHints = true,
+ },
python = {
pythonPath = vim.fn.getcwd() .. "/.venv/bin/python",
@@ -1013,16 +1062,11 @@ vim.g.rustaceanvim = {
tools = {
enable_clippy = false,
},
-
server = {
capabilities = capabilities,
-
standalone = true,
-
status_notify_level = false,
-
load_vscode_settings = false,
-
default_settings = {
["rust-analyzer"] = {
checkOnSave = false,
@@ -1079,6 +1123,8 @@ do
local rustfmt = require("efmls-configs.formatters.rustfmt")
+ local markdownlint = require("efmls-configs.linters.markdownlint")
+
vim.lsp.config("efm", {
filetypes = {
"c",
@@ -1112,7 +1158,7 @@ do
json = { eslint_d, fixjson },
jsonc = { eslint_d, fixjson },
lua = { luacheck, stylua },
- markdown = { prettier_d },
+ markdown = { markdownlint, prettier_d },
python = { flake8, black },
sh = { shellcheck, shfmt },
typescript = { eslint_d, prettier_d },
@@ -1133,4 +1179,5 @@ vim.lsp.enable({
"gopls",
"clangd",
"efm",
+ "marksman",
})
diff --git a/.config/nvim/nvim-macos.tar.gz b/.config/nvim/nvim-macos.tar.gz
deleted file mode 100644
index 8537307..0000000
--- a/.config/nvim/nvim-macos.tar.gz
+++ /dev/null
@@ -1 +0,0 @@
-Not Found \ No newline at end of file
diff --git a/.config/nvim/nvim-pack-lock.json b/.config/nvim/nvim-pack-lock.json
index 9da8e87..dbac915 100644
--- a/.config/nvim/nvim-pack-lock.json
+++ b/.config/nvim/nvim-pack-lock.json
@@ -13,6 +13,10 @@
"src": "https://github.com/saghen/blink.cmp",
"version": "1.0.0 - 2.0.0"
},
+ "bullets.vim": {
+ "rev": "89294b8930e660936374fb763ac48a1ac51dd29c",
+ "src": "https://github.com/bullets-vim/bullets.vim"
+ },
"efmls-configs-nvim": {
"rev": "2dd907fe0043b95a901a9aee814f17804aa4426d",
"src": "https://github.com/creativenull/efmls-configs-nvim"
@@ -33,6 +37,14 @@
"rev": "fdd3f91800b3983e27bc9fcfb99cfa7293d7f11a",
"src": "https://github.com/kawre/leetcode.nvim"
},
+ "lualine.nvim": {
+ "rev": "47f91c416daef12db467145e16bed5bbfe00add8",
+ "src": "https://github.com/nvim-lualine/lualine.nvim"
+ },
+ "markdown-preview.nvim": {
+ "rev": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee",
+ "src": "https://github.com/iamcco/markdown-preview.nvim"
+ },
"mason.nvim": {
"rev": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65",
"src": "https://github.com/mason-org/mason.nvim"
@@ -73,10 +85,18 @@
"rev": "b9fd5226c2f76c951fc8ed5923d85e4de065e509",
"src": "https://github.com/nvim-lua/plenary.nvim"
},
+ "render-markdown.nvim": {
+ "rev": "e3c18ddd27a853f85a6f513a864cf4f2982b9f26",
+ "src": "https://github.com/MeanderingProgrammer/render-markdown.nvim"
+ },
"rustaceanvim": {
"rev": "d50597d482a6f44ddfc54d1af2f69f052053b4de",
"src": "https://github.com/mrcjkb/rustaceanvim"
},
+ "vim-tmux-navigator": {
+ "rev": "e41c431a0c7b7388ae7ba341f01a0d217eb3a432",
+ "src": "https://github.com/christoomey/vim-tmux-navigator"
+ },
"which-key.nvim": {
"rev": "3aab2147e74890957785941f0c1ad87d0a44c15a",
"src": "https://github.com/folke/which-key.nvim"