summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSquibid <me@zacharyscheiman.com>2023-10-22 18:17:21 -0400
committerSquibid <me@zacharyscheiman.com>2023-10-22 18:17:21 -0400
commit01729e261340a4462a57bf80f6e591c1371ae996 (patch)
tree67b6488d097ac04cb5d27d794b530ee15ce65593
parente522d7d3faa895c2722113b316d4fc8203158996 (diff)
downloadnvim-01729e261340a4462a57bf80f6e591c1371ae996.tar.gz
nvim-01729e261340a4462a57bf80f6e591c1371ae996.tar.bz2
nvim-01729e261340a4462a57bf80f6e591c1371ae996.zip
kitchen sink:
- add code action previews - change indent blankline style - more luasnip snippets - change default mason stuff - customize neorg more - change notify style - change startpage completely - add line info to statusline - change telescope style - change how todo comments look - make indentation work via treesitter
Diffstat (limited to '')
-rw-r--r--after/plugin/actionpreview.lua17
-rw-r--r--after/plugin/cleanfold.lua6
-rw-r--r--after/plugin/dapui.lua6
-rw-r--r--after/plugin/foldsign.lua13
-rw-r--r--after/plugin/iconpicker.lua6
-rw-r--r--after/plugin/indent-blankline.lua15
-rw-r--r--after/plugin/killersheep.lua14
-rw-r--r--after/plugin/luasnip.lua3
-rw-r--r--after/plugin/masontool.lua9
-rw-r--r--after/plugin/neodev.lua6
-rw-r--r--after/plugin/neorg.lua11
-rw-r--r--after/plugin/notify.lua20
-rw-r--r--after/plugin/presence.lua19
-rw-r--r--after/plugin/project.lua10
-rw-r--r--after/plugin/scrollbar.lua33
-rw-r--r--after/plugin/sfm.lua5
-rw-r--r--after/plugin/startpage.lua399
-rw-r--r--after/plugin/statusline.lua118
-rw-r--r--after/plugin/telescope.lua65
-rw-r--r--after/plugin/term-edit.lua8
-rw-r--r--after/plugin/todo-comments.lua34
-rw-r--r--after/plugin/trouble.lua16
-rw-r--r--after/plugin/truezen.lua18
-rw-r--r--after/plugin/ts.lua3
-rw-r--r--lua/components.lua219
-rw-r--r--lua/core/auto.lua39
-rw-r--r--lua/core/binds.lua88
-rw-r--r--lua/core/cmds.lua4
-rw-r--r--lua/core/opts.lua13
-rw-r--r--lua/core/plugins.lua80
30 files changed, 486 insertions, 811 deletions
diff --git a/after/plugin/actionpreview.lua b/after/plugin/actionpreview.lua
new file mode 100644
index 0000000..21d4ea4
--- /dev/null
+++ b/after/plugin/actionpreview.lua
@@ -0,0 +1,17 @@
+local status_ok, actions = pcall(require, "actions-preview")
+if not status_ok then
+ return
+end
+
+actions.setup {
+ backend = { "telescope" },
+ telescope = require("telescope.themes").get_dropdown {
+ borderchars = {
+ prompt = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
+ results = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
+ preview = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
+ },
+ layout_strategy = 'cursor',
+ winblend = 10,
+ }
+}
diff --git a/after/plugin/cleanfold.lua b/after/plugin/cleanfold.lua
deleted file mode 100644
index 3ae4183..0000000
--- a/after/plugin/cleanfold.lua
+++ /dev/null
@@ -1,6 +0,0 @@
-local status_ok, fold = pcall(require, "cleanfold")
-if not status_ok then
- return
-end
-
-fold.setup {}
diff --git a/after/plugin/dapui.lua b/after/plugin/dapui.lua
deleted file mode 100644
index 56cfb1b..0000000
--- a/after/plugin/dapui.lua
+++ /dev/null
@@ -1,6 +0,0 @@
-local status_ok, dapui = pcall(require, "dapui")
-if not status_ok then
- return
-end
-
-dapui.setup {}
diff --git a/after/plugin/foldsign.lua b/after/plugin/foldsign.lua
deleted file mode 100644
index 1ca7d2c..0000000
--- a/after/plugin/foldsign.lua
+++ /dev/null
@@ -1,13 +0,0 @@
-local status_ok, foldsign = pcall(require, "nvim-foldsign")
-if not status_ok then
- return
-end
-
-foldsign.setup {
- offset = -2,
- foldsigns = {
- open = 'V',
- close = '>',
- seps = { '│', '┃' },
- }
-}
diff --git a/after/plugin/iconpicker.lua b/after/plugin/iconpicker.lua
deleted file mode 100644
index e616a67..0000000
--- a/after/plugin/iconpicker.lua
+++ /dev/null
@@ -1,6 +0,0 @@
-local status_ok, iconpicker = pcall(require, "icon-picker")
-if not status_ok then
- return
-end
-
-iconpicker.setup {}
diff --git a/after/plugin/indent-blankline.lua b/after/plugin/indent-blankline.lua
index 830ad99..02f2428 100644
--- a/after/plugin/indent-blankline.lua
+++ b/after/plugin/indent-blankline.lua
@@ -1,17 +1,10 @@
-local status_ok, indent_blankline = pcall(require, "indent_blankline")
+local status_ok, ibl = pcall(require, "ibl")
if not status_ok then
return
end
-indent_blankline.setup {
- char = "",
- char_highlight_list = {
- "IndentBlanklineIndent1",
- "IndentBlanklineIndent2",
+ibl.setup {
+ scope = {
+ enabled = false,
},
- space_char_highlight_list = {
- "IndentBlanklineIndent1",
- "IndentBlanklineIndent2",
- },
- show_trailing_blankline_indent = false,
}
diff --git a/after/plugin/killersheep.lua b/after/plugin/killersheep.lua
deleted file mode 100644
index b447010..0000000
--- a/after/plugin/killersheep.lua
+++ /dev/null
@@ -1,14 +0,0 @@
-local status_ok, killersheep = pcall(require, "killersheep")
-if not status_ok then
- return
-end
-
-killersheep.setup {
- gore = true,
- border = 'shadow',
- keymaps = {
- move_left = "h",
- move_right = "l",
- shoot = "<Space>",
- },
-}
diff --git a/after/plugin/luasnip.lua b/after/plugin/luasnip.lua
index 1374bc3..e0540ea 100644
--- a/after/plugin/luasnip.lua
+++ b/after/plugin/luasnip.lua
@@ -10,3 +10,6 @@ luasnip.config.set_config {
-- update on text insert
updateevents = "TextChanged,TextChangedI"
}
+
+require("luasnip.loaders.from_vscode").lazy_load()
+require("luasnip.loaders.from_snipmate").lazy_load()
diff --git a/after/plugin/masontool.lua b/after/plugin/masontool.lua
index ee9d012..440b64d 100644
--- a/after/plugin/masontool.lua
+++ b/after/plugin/masontool.lua
@@ -4,15 +4,14 @@ if not status_ok then
end
masontool.setup {
- -- a list of all tools you want to ensure are installed upon
- -- start; they should be the names Mason uses for each tool
ensure_installed = {
'lua-language-server',
+ 'bash-language-server',
+ 'editorconfig-checker',
'stylua',
'shellcheck',
- 'editorconfig-checker',
- 'shfmt',
'clangd',
- 'clang-format',
+ 'html-lsp',
+ 'css-lsp',
},
}
diff --git a/after/plugin/neodev.lua b/after/plugin/neodev.lua
deleted file mode 100644
index ec52684..0000000
--- a/after/plugin/neodev.lua
+++ /dev/null
@@ -1,6 +0,0 @@
-local status_ok, neodev = pcall(require, "neodev")
-if not status_ok then
- return
-end
-
-neodev.setup {}
diff --git a/after/plugin/neorg.lua b/after/plugin/neorg.lua
index 52adb3e..583f429 100644
--- a/after/plugin/neorg.lua
+++ b/after/plugin/neorg.lua
@@ -3,7 +3,7 @@ if not status_ok then
return
end
-local wsphome = "~/documents/notes/"
+local wsphome = os.getenv("HOME").."/documents/notes/"
neorg.setup {
load = {
["core.defaults"] = {},
@@ -16,8 +16,8 @@ neorg.setup {
["core.dirman"] = {
config = {
workspaces = {
- home = wsphome .. "home",
- robotics = wsphome .. "robotics"
+ home = wsphome.."home",
+ robotics = wsphome.."robotics"
},
index = "index.norg",
}
@@ -31,13 +31,14 @@ neorg.setup {
width = "content",
},
folds = false,
- icon_preset = "varied",
+ icon_preset = "basic",
}
},
["core.export"] = {},
["core.completion"] = {
config = {
engine = "nvim-cmp",
+ name = "[Neorg]",
}
},
["core.presenter"] = {
@@ -48,5 +49,3 @@ neorg.setup {
["core.integrations.telescope"] = {},
}
}
-
--- vim.cmd('Neorg sync-parsers')
diff --git a/after/plugin/notify.lua b/after/plugin/notify.lua
index 1a3d1e9..36d7885 100644
--- a/after/plugin/notify.lua
+++ b/after/plugin/notify.lua
@@ -4,6 +4,8 @@ if not status_ok then
end
notify.setup {
+ timeout = 3000,
+ minimum_width = 35,
icons = {
DEBUG = "B",
ERROR = "x",
@@ -11,6 +13,20 @@ notify.setup {
TRACE = "t",
WARN = "!"
},
- minimum_width = 35,
- max_width = 80,
+
+ max_height = function() return math.floor(vim.o.lines * 0.75) end,
+ max_width = function() return math.floor(vim.o.columns * 0.5) end,
+ on_open = function(win, record)
+ vim.api.nvim_win_set_config(win, {
+ title = {
+ { " "..record.title[1].." ", "Notify"..record.level.."Title" },
+ },
+ title_pos = "center",
+ border = "single",
+ })
+ end,
+ render = function(bufnr, notif)
+ notif.message[1] = string.format("%s", notif.message[1])
+ vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, notif.message)
+ end,
}
diff --git a/after/plugin/presence.lua b/after/plugin/presence.lua
deleted file mode 100644
index b86dc77..0000000
--- a/after/plugin/presence.lua
+++ /dev/null
@@ -1,19 +0,0 @@
-local status_ok, presence = pcall(require, "presence")
-if not status_ok then
- return
-end
-
-presence.setup {
- neovim_image_text = "Have you heard of our lord a savior Neovim?",
- main_image = "file",
- show_time = false,
-
- -- Rich Presence text options
- editing_text = "Editing %s",
- file_explorer_text = "Browsing %s",
- git_commit_text = "Committing changes",
- plugin_manager_text = "Managing plugins",
- reading_text = "Reading %s",
- workspace_text = "Working on %s",
- line_number_text = "Line %s out of %s",
-}
diff --git a/after/plugin/project.lua b/after/plugin/project.lua
index fd44e4c..0b5ae3b 100644
--- a/after/plugin/project.lua
+++ b/after/plugin/project.lua
@@ -5,6 +5,14 @@ end
project.setup {
detection_methods = { "pattern" },
- patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" },
+ patterns = {
+ ".git",
+ "Makefile",
+ "_darcs",
+ ".hg",
+ ".bzr",
+ ".svn",
+ "package.json",
+ },
show_hidden = false,
}
diff --git a/after/plugin/scrollbar.lua b/after/plugin/scrollbar.lua
deleted file mode 100644
index 5125f7c..0000000
--- a/after/plugin/scrollbar.lua
+++ /dev/null
@@ -1,33 +0,0 @@
-local status_ok, scrollbar = pcall(require, "scrollbar")
-if not status_ok then
- return
-end
-
-scrollbar.setup({
- hide_if_all_visible = true,
- handle = {
- hide_if_all_visible = true,
- },
- marks = {
- Cursor = {
- text = "*",
- },
- GitAdd = { text = "|" },
- GitChange = { text = "|" },
- GitDelete = { text = "-" },
- },
- handlers = {
- cursor = true,
- diagnostic = true,
- gitsigns = true, -- Requires gitsigns
- handle = true,
- },
-})
-
---[[ scrollbar.setup {
- current_only = true,
- winblend = 50,
- zindex = 40,
- excluded_filetypes = {},
- width = 2,
-} ]]
diff --git a/after/plugin/sfm.lua b/after/plugin/sfm.lua
index dcbbe95..5b2e776 100644
--- a/after/plugin/sfm.lua
+++ b/after/plugin/sfm.lua
@@ -11,7 +11,7 @@ sfm.setup {
mappings = {
custom_only = false,
list = {
- -- user mappings go here
+ { key = 's', action = 'toggle_selection' }
}
},
renderer = {
@@ -30,7 +30,8 @@ sfm.setup {
folder_closed = "",
folder_open = "",
file = "",
- }
+ },
+ selection = "*"
}
}
}:load_extension('sfm-git', {
diff --git a/after/plugin/startpage.lua b/after/plugin/startpage.lua
index 68c0aec..6261b3f 100644
--- a/after/plugin/startpage.lua
+++ b/after/plugin/startpage.lua
@@ -3,334 +3,113 @@ if not status_ok then
return
end
-math.randomseed(os.time())
-
-local C = {}
-local R = {}
-
--- buttons
-local function button(sc, txt, keybind)
- local opts = {
+local function button(sc, txt, cmd, kopts, opts)
+ opts = opts or {
position = "center",
- shortcut = sc,
- cursor = -1,
- width = string.len(C.header[1]),
+ shortcut = sc:gsub("<leader>", "LDR"),
+ cursor = 0,
+ width = 49,
align_shortcut = "right",
- hl_shortcut = "Keyword",
- redraw_on_resize = false,
+ hl_shortcut = "AlphaShortcut",
+ hl = "AlphaText",
}
+ if cmd then
+ kopts = kopts or { noremap = true, silent = true, nowait = true }
+ opts.keymap = { "n", sc, cmd, kopts }
+ end
+
local function on_press()
- local key = vim.api.nvim_replace_termcodes(keybind .. "<Ignore>", true, false, true)
+ local key = vim.api.nvim_replace_termcodes(cmd, true, false, true)
vim.api.nvim_feedkeys(key, "t", false)
end
return {
type = "button",
val = txt,
- on_press = on_press,
opts = opts,
+ on_press = on_press,
}
end
--- actual config
-C.bigheader = {
- {
- [[ |\ ]],
- [[ ||. ]],
- [[ ||;` ]],
- [[ ,'|; : ]],
- [[ ,': |; ` ]],
- [[ ,' | ; `-` ]],
- [[ ,' | ; : ]],
- [[ ,' `-|; ` ]],
- [[ ; ; ` ]],
- [[ ,' `--\`-. `--: ]],
- [[ ,-._,'`. |\||`-. ` ]],
- [[ `;-.`-._`. | |\ \ `-. ` ]],
- [[ :`--`-.`-\ `--.| /`\;\ `-: ]],
- [[ ; ``-`. |/ ; \ `. ]],
- [[ ; `.`-/ ; \ ` ]],
- [[ ; : `/ ; \ ` ]],
- [[ ,-._ | / ; -`\ : ]],
- [[ `;-.`-._| : / | \ ` ]],
- [[ ; `-.| : / | \ ` ]],
- [[ ; | : : / | \ : ]],
- [[ ; | : / ; | \ ` ]],
- [[ ; | / ; | --`\ ` ]],
- [[ | | : / ; | \ : ]],
- [[ | : | : / ; \ ` ]],
- [[ | : ; ;:'-.._ -`\ ` ]],
- [[ | : ;___ ;'---....___;__:__| `-._ \ : ]],
- [[ | : `;``-------'';|| : \ `-._ \` ]],
- [[ -=======:===;===========;=|| : \ `-.\: ]],
- [[ ___ ; _;_|| ; ||___,:-.\___,....__\_ ]],
- [[ |`--:.|;_o||-______;,..-----""""" __|__...-'' ]],
- [[----....|___ """" jrei__||-------........________]],
- [[ """"----....____ __..--'' || ~~~~~ ]],
- [[ ~~~ ~~~ """"----....____|/ ~~~~~~~ ~~~~~~~]],
- [[~~~ ~~~~ ~~~~~~ ~ ~~~ ~~~~ ]],
- [[ ~~~~~ ~~~ ~ ~~~~~~~~~ ~~~ ~~~~~~~~~~ ]],
- },
- {
- [[ J\ ]],
- [[ | \ ]],
- [[ | `. ]],
- [[ F `. ]],
- [[ F \ ]],
- [[ F \ ]],
- [[ J `. ]],
- [[ J `. _ ]],
- [[ J \ |\ ]],
- [[ |. `.J|\ ]],
- [[ | `. `.L \ ]],
- [[ | `. \L `. ]],
- [[ J ` F `. ]],
- [[ J F \ ]],
- [[ J J \ ]],
- [[ F | \ ]],
- [[ F | `. ]],
- [[ F F `. ]],
- [[ | F \ ]],
- [[ | J \ ]],
- [[ | | \ ]],
- [[ | | \ ]],
- [[ J F \ ]],
- [[----------J J \-------------]],
- [[ L | \ ]],
- [[~ O ======F \ ~ ]],
- [[ ~ (\`-. / J \-. ~ ]],
- [[ \_\/ )"L_ _\_) ]],
- [[ >|`-.||[_][""""---------.'_.-\\ ~ ]],
- [[~~ ~~~ \`-. J_ Veronica"""""\/"_.--'\\ ]],
- [[ ~ `. "--._ _..--""" |\` ]],
- [[ ~~ ~~ ~""-. """"""""""" | ]],
- [[ ~~ ~ ~~ ~"----._--.-._--""""\|'\| ]],
- [[ ~ ~~~ ~~ ~~~ ~~~~ `- `--.` ` ]],
- [[~~~ ~~ ~~ ~~~~ ~~ ~ ]],
- },
- {
- [[ . . ]],
- [[ _..-''"""\ _.--'"""\ ]],
- [[ | L | \ ]],
- [[ _ / _.-.---.\. / .-.----.\ ]],
- [[ _/-|--- _/<"---'"""""\\`. /-'--''"""""\ ]],
- [[ | \ | L`.`-. | L ]],
- [[ /_.-.---.L | \ \ `| J`. ]],
- [[ _/--'"""" \ F \L \ | L ]],
- [[ L `. L J _.---.-"""-.\`. L_/ _.--|"""""--.\ `. ]],
- [[ | \+. /-"__.--'"""" \ `./'"---'"""""" \`. `. ]],
- [[ F _____ \ `F" `. \ \ L `. ]],
- [[ /.-'"_|---'"\ | ` JL | L `.`. ]],
- [[ <-'"" \| _.-.------._ A J _.-.-----`.--| ``.`. ]],
- [[ L `. |/.-'"_.-`---'""\."| /-'"---'""""" \`.\. \ `.`. ]],
- [[ | _.------\.<'""" L\ L\ `.`\`. \ `. ]],
- [[ _.-'//'"--'""" L\| ________\ `.F ___.-------._L \ `-\ \`. ]],
- [[ /___| F F _.--'"_|-------L /_.-'"_.-|-'"""""""\ L L `.`. ]],
- [[ | F _.-'|"""""/'"-'""" J <'""" L J | `.`. ]],
- [[ |/-'-''/|""\ )-|\ F \ | L .'"""`\""-\\_ ]],
- [[ F`-'-'-(`-') | \ F \ |___`"""`.""`.-'" ]],
- [[------------/ `-'---| F L L __ |"""""`-'"__________]],
- [[ .'_ | |__L __ J__ | _.--'"""" `".----'".' ]],
- [[ '""""""""""""|--._+--F _.-'""||" """___/.-'" ||-'"/""""" \_. .' ]],
- [[ J------------(___\__/'_____.--------'-------'"""""""" / ]],
- [[ `-. _.__.__.__.____ J_.-._ ]],
- [[ .'`-._ (-`--`---.'--._`---._.-'`-._.-'_.-'``-._' `-''-' ]],
- },
- {
- [[ _____|\ ]],
- [[ _.--| SSt |: ]],
- [[ <____|.----|| ]],
- [[ .---''---, ]],
- [[ ;..__..' _... ]],
- [[ ,'/ ;|/..--'' \ ]],
- [[ ,'_/.-/': : ]],
- [[ _..-'''/ / | \ \ _|/| ]],
- [[ \ /-./_ \; \ \,;' \ ]],
- [[ ,\ / \: `:\ \ // `:`. ]],
- [[ ,' \ /-._; | : : :: ,. . ]],
- [[ ,' :: /`-._| | | || ' : `.`.)]],
- [[ _,' |;._:: | | | | `| : `' ]],
- [[ ,' `. / |`-:_ ; | | | : \ ]],
- [[ `--. ) /|-._: : | \ \ ]],
- [[ / / :_| ;`-._; __..--'; : : ]],
- [[ / ( ;|;-./_ _/.-:'o | / ' | ]],
- [[ / , \._/_/_./--''/_|:|___|_,' | ]],
- [[ : / `'-'--'----'---------' | ]],
- [[ | : O ._O O_. O ._O O_. ; ; ]],
- [[ : `. // // // // ,' / ]],
- [[ ~~~`.______//____//____//____//_______,'~ ]],
- [[ // //~ // // ]],
- [[ ~~ _// _// _// ~ _// ~ ]],
- [[ ~ / / / / / / / / ~ ~~ ]],
- [[ ~~~ ~~~ ~~~ ~~~ ]],
- },
- {
- [[ P___----.... ]],
- [[ ! __ ]],
- [[ ' ~~ ---.#..__ ` ~ ~ - - . .: ]],
- [[ ` ~~--. .F~~___-__. ]],
- [[ ; , .- . _! ]],
- [[ , ' ; ~ . ]],
- [[ , ____ ; ' _ ._ ; ]],
- [[ ,_ . - '___#, ~~~ ---. _, . ' .#' ~ .; ]],
- [[ =---==~~~ ~~~==--__ ; '~ -. ,#_ .' ]],
- [[ ' `~=.; ` / ]],
- [[ ' ' '. ]],
- [[ ' ' ]],
- [[ \ ' ' ' ]],
- [[ `.`\ ' . ; , ]],
- [[ \ ` ' ' ; ]],
- [[ ; ' ' ' ]],
- [[ /_ ., / __...---./ ' ]],
- [[ ',_, __.--- ~~;#~ --..__ _'.-~;# // `.' ]],
- [[ / / ~~ .' . #; ~~ /// #; // / ]],
- [[ / ' . __ . ' ;#;_ . ////.;#;./ ; / ]],
- [[ \ . / ,##' / _ /. '(/ ~||~\' ]],
- [[ \ ` - . /_ . -==- ~ ' / (/ ' . ;;. ', ]],
- [[ /' . ' -^^^...--- ``(/' _ ' '' `,; ]],
- [[##,. .#...( ' .c c .c c c. '.. ;; ../ ]],
- [[%%#%;,..##.\_ ,;###;,. ;;.:##;,. raf ]],
- [[%%%%########%%%%;,.....,;%%%%%%;,.....,;%%%%%%%%%%%%%%%%%%%%............]],
- },
- {
- [[ .. ]],
- [[ .( )`-._ ]],
- [[ .' || `._ ]],
- [[ .' || `. ]],
- [[ .' || `._ ]],
- [[ .' _||_ `-. ]],
- [[ .' |====| `.. ]],
- [[ .' \__/ ( ) ]],
- [[ ( ) || _ || ]],
- [[ /|\ || .-` \ || ]],
- [[ .' | ' || _.-' | || ]],
- [[ / |\ \ || .' `.__.' || _.-.. ]],
- [[ .' /| `. _.-' _.-' _.-.`-'`._`.` ]],
- [[ \ .' | | .-.` `./ _.-`. `._.-' ]],
- [[ |. | `. _.-' `. .' .' `._.`---` ]],
- [[ .' | | : `._..-'.' `._..' || ]],
- [[ / | \ `-._.' || || ]],
- [[ | .'|`. | ||_.--.-._ || ]],
- [[ ' / | \ \ __.--'\ `. : || ]],
- [[ \ .' | \| ..-' \ `._-._.' || ]],
- [[`.._ |/ | `. \ \ `._.- || ]],
- [[ `-.._ / | \ `-.'_.--' || ]],
- [[ `-.._.' | | | | _ _ _ _'_ _ _ _ _ ]],
- [[ `-.._ | \ | | |_|_|_'|_|_|_|_|_|_| ]],
- [[ [`--^-..._.' | | /....../| __ __ | ]],
- [[ \`---.._|`--.._ | | /....../ | |__| |__| | ]],
- [[ \__ _ `-.._| `-._|_|_ _ _/_ _ _ / | |__| |__| | ]],
- [[ \ _o_ _`-._|_|_|_|_|_|_|_|_/ '-----------/ ]],
- [[ \_`.|.' _ - .--.--.--.--.--.`--------------' ]],
- [[ .```-._ ``-.._ \__ _ _ '--'--'--'--'--' - _ - _ __/ ]],
- [[ .`-.```-._ ``-..__``.- `. _ - _ _ _ - _- _ __/(.``-._]],
- [[ _.-` ``--.. .. _.-` ``--.. .. .._ _. __ __ _ __ ..--.._ / .( _..``]],
- [[`.-._ `._ `- `-._ .`-.```-._ ``-..__``.- -._--.__---._--..-._`...```]],
- [[ _.-` ``--.. .. `.-._ `._ `- `-._ .-_. ._.- -._ --.._`` _.-`LGB`-.]],
- },
+local header = {
+ '█▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀▀▀█ █▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀▀▀█ ',
+ '█ ░█████▀▀▀▀▀█████▓▄ ▀▀▀▀ ░ ░█ ░█ ░█ █ ',
+ '█ ▒███████ ▓███████ ▒██ ▓███ ▓███ ▓███ █ ',
+ '█ ▓███████ ▓███████ ▓█████████████████ █ ',
+ '█ ▓███████ ▓███████ ███ ██████████████ █ ',
+ '█ ▓███████ ▓███████ ███ ██████████████ █ ',
+ '█ ▓███████ ▓███████ ███ ██████████████ █ ',
+ '█ ▓███████ ▓███████ ███▄██████████████ █ ',
+ '█ ▓███████ ▓███████ ██████▀▀██████████ █ ',
+ '▀ ▓███████ ▓███████▄ ▄▄███████████ █ ',
+ '█ ▓███████ ██████████████████ █▄▄▄',
+ '█ ▓███████▀▀ ▀ ▀ ▀████████████████▄ ▄ █',
+ '█▄▄▄▄▄▄▄ ▀ █▀▀▀▀▀▀▀▀▀▀▀▀█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█',
+ ' █ ▀ █ ',
+ ' ▀▀▀▀▀ ',
}
-C.mediumheader = {
- {
- [[ |._ ]],
- [[ |._( ]],
- [[ <|.__..-'|. ]],
- [[ ,| .|)\ ]],
- [[ /| .|) \ ]],
- [[ /.|) .|) \ ]],
- [[ / .|) .|) \ ]],
- [[ / .|) .|) \ ]],
- [[ / .|) .|) \ ]],
- [[ / ,--+---_ | \ , ]],
- [[ '\==-,,;,,;,,;,,,,,,,-==;7 ]],
- [[ _ \__...____...__ __/ _ seal _]],
- [[ ~ ~~~~ ~~ ]],
- },
- {
- [[ , ]],
- [[ |"-,_ ]],
- [[ I--(_ ]],
- [[ ,I?8, ]],
- [[ d|`888. ]],
- [[ d8| 8888b ]],
- [[ ,88| ?8888b ]],
- [[ ,888| `88888b ]],
- [[ ,8888| 8888g8b ]],
- [[ ,88888| 888PX?8b ]],
- [[ ,888888| 8888bd88, ]],
- [[ o8888888| ,888888888 ]],
- [[ d8888888P| d888888888b ]],
- [[ _.d888gggg8'| 8gg88888888, ]],
- [[ '\==-,,,,,,,,|/;,,,,,-==;7 ]],
- [[ _ \__...____...__ __/ _ seal _]],
- [[ ~ ~~~~ ~~ ]],
- },
-}
-C.smallheader = {
- {
- [[ _~ ]],
- [[ _~ )_)_~ ]],
- [[ )_))_))_) ]],
- [[ _!__!__!_ ]],
- [[ \______t/ ]],
- [[~~~~~~~~~~~~~]],
- },
- {
- [[ __4___ ]],
- [[ _ \ \ \ \ ]],
- [[<'\ /_/_/_/ ]],
- [[ ((____!___/)]],
- [[ \0\0\0\0\/ ]],
- },
- {
- [[ I\ ]],
- [[ I \ ]],
- [[ I \ ]],
- [[ I*--\ ]],
- [[ I \ ]],
- [[ I \ ]],
- [[ I______\ ]],
- [[ _____I__O______ ]],
- [[ \ ( ) b ^ ^]],
- [[^^^^^^^^^^^^^^^^^ ^ ]],
- },
- {
- [[ ^ +~+~~ ]],
- [[ ^ )`.). ]],
- [[ )``)``) .~~ ]],
- [[ ).-'.-')|) ]],
- [[ |-).-).-'_'-/ ]],
- [[~~~\ `o-o-o' /~~~~~~~~~~~~~~~~~]],
- [[ ~~~'---.____/~~Eric C. Liebl~~~]],
- },
- {
- [[ ,_ ]],
- [[ I~ ]],
- [[ |\ ]],
- [[ /|.\ ]],
- [[ / || \ ]],
- [[ ,' |' \ ]],
- [[.-'.-==|/_--' ]],
- [[`--'-------' _ seal _]],
- }
+local footer = {
+ '▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄',
}
-R.width = vim.api.nvim_win_get_width(0)
-R.height = vim.api.nvim_win_get_height(0)
-
-C.header = C.bigheader[math.random(#C.bigheader)]
-if #C.header >= R.height then
- C.header = C.mediumheader[math.random(#C.mediumheader)]
- if #C.header >= R.height then
- C.header = C.smallheader[math.random(#C.smallheader)]
- if #C.header >= R.height then
- C.header = ""
- end
- end
-end
-
alpha.setup {
layout = {
- { type = "padding", val = math.floor((R.height - #C.header) / 2) },
- { type = "text", val = C.header, opts = { position = 'center', hl = "AlphaHeader" } },
+ { type = 'text', val = function()
+ local padding = {}
+ for i = 1, math.floor((vim.api.nvim_win_get_height(0) - #header - 6 - #footer) / 2), 1 do
+ table.insert(padding, " ")
+ end
+ return padding
+ end },
+ { type = 'text', val = header, opts = {
+ position = 'center',
+ hl = 'AlphaHeader',
+ } },
+ { type = 'padding', val = 1 },
+ { type = 'group', val = {
+ button('f', '? Find files', '<cmd>Telescope find_files<CR>'),
+ button('r', '↺ Recent files', '<cmd>Telescope oldfiles <CR>'),
+ button('n', '▣ Neorg workspace', '<cmd>Telescope neorg switch_workspace<CR>'),
+ button('m', '≡ Menu', '<cmd>ConfigMenu<CR>'),
+ button('q', '✖ Quit', '<cmd>wqa<CR>'),
+ } },
+ { type = 'text', val = footer, opts = {
+ position = 'center',
+ hl = 'AlphaFooter',
+ } },
},
+ opts = {
+ keymap = {
+ press = '<CR>',
+ press_queue = nil
+ },
+ setup = function()
+ vim.api.nvim_create_autocmd('User', {
+ pattern = 'AlphaReady',
+ desc = 'disable stuff for alpha',
+ callback = function()
+ vim.opt.laststatus = 0
+ vim.opt.showtabline = 0
+ vim.opt.more = false
+ vim.opt.showcmd = false
+ vim.opt.ruler = false
+ vim.opt.number = false
+ vim.opt.relativenumber = false
+ end,
+ })
+ vim.api.nvim_create_autocmd('BufUnload', {
+ buffer = 0,
+ desc = 'enable stuff after alpha closes',
+ callback = function()
+ vim.opt.laststatus = 3
+ vim.opt.showtabline = 2
+ vim.opt.more = true
+ vim.opt.showcmd = true
+ vim.opt.ruler = true
+ vim.opt.number = false
+ vim.opt.relativenumber = false
+ end,
+ })
+ end,
+ }
}
diff --git a/after/plugin/statusline.lua b/after/plugin/statusline.lua
index 1da1163..9e578a7 100644
--- a/after/plugin/statusline.lua
+++ b/after/plugin/statusline.lua
@@ -5,63 +5,19 @@ end
el.reset_windows()
-local builtin = require "el.builtin"
-local sections = require "el.sections"
+local builtin = require("el.builtin")
+local sections = require("el.sections")
local c = require "components"
--- color setup
-local hl_statusline = "StatusLine"
---diagnostic colors
-local hl_hint = "DiagnosticHint"
-local hl_info = "DiagnosticInfo"
-local hl_warn = "DiagnosticWarn"
-local hl_err = "DiagnosticError"
--- git colors
-local hl_red = "ErrorMsg"
-local hl_green = "diffAdded"
-local hl_yellow = "WarningMsg"
-local highlights = {
- -- diagnostic colors
- diag_err = c.extract_hl({
- bg = { [hl_statusline] = "bg" },
- fg = { [hl_err] = "fg" },
- bold = true,
- }),
- diag_warn = c.extract_hl({
- bg = { [hl_statusline] = "bg" },
- fg = { [hl_warn] = "fg" },
- bold = true,
- }),
- diag_info = c.extract_hl({
- bg = { [hl_statusline] = "bg" },
- fg = { [hl_info] = "fg" },
- bold = true,
- }),
- diag_hint = c.extract_hl({
- bg = { [hl_statusline] = "bg" },
- fg = { [hl_hint] = "fg" },
- bold = true,
- }),
-
- -- git colors
- red_fg = c.extract_hl({
- bg = { [hl_statusline] = "bg" },
- fg = { [hl_red] = "fg" },
- bold = true,
- }),
- green_fg = c.extract_hl({
- bg = { [hl_statusline] = "bg" },
- fg = { [hl_green] = "fg" },
- bold = true,
- }),
- yellow_fg = c.extract_hl({
- bg = { [hl_statusline] = "bg" },
- fg = { [hl_yellow] = "fg" },
- bold = true,
- }),
-}
+local function hl(fg, b)
+ b = b or false
+ return c.extract_hl({
+ bg = {["StatusLine"] = "bg"},
+ fg = {[fg] = "fg"},
+ bold = b,
+ })
+end
--- modes
local modes = {
-- display name, mode, highlight group
n = { "Normal", "N" },
@@ -79,56 +35,44 @@ local modes = {
ic = { "ICompl", "Ic" },
R = { "Replace", "R" },
Rv = { "VReplace", "Rv" },
- c = { "Command", "C" },
+ c = { "Command", "C", hl("DiagnosticHint")},
cv = { "Vim Ex", "E" },
ce = { "Ex (r)", "E" },
r = { "Prompt", "P" },
- rm = { "More ", "M" },
+ rm = { "More", "M" },
["r?"] = { "Confirm", "Cn" },
- ["!"] = { "Shell ", "S" },
- nt = { "Term ", "T" },
- t = { "Term ", "T" },
+ ["!"] = { "Shell", "S" },
+ nt = { "Term", "T" },
+ t = { "Term", "T" },
}
el.setup {
generator = function()
- local items = {
- { c.mode { modes = modes, fmt = " %s %s ", icon = "", hl_icon_only = false } },
+ return {
+ { { " " }, c.mode { modes = modes, hl_icon_only = false } },
{ sections.split, required = true },
{ sections.collapse_builtin { { builtin.filetype }, { " " } } },
{ sections.maximum_width(builtin.tail_file, 0.50), required = true },
{ sections.collapse_builtin { { " " }, { builtin.modified_flag } } },
{ sections.split, required = true },
+ { c.lsp_srvname },
{ c.diagnostics {
- fmt = "[%s]", lsp = true,
- hl_err = highlights.diag_err,
- hl_warn = highlights.diag_warn,
- hl_info = highlights.diag_info,
- hl_hint = highlights.diag_hint,
- icon_err = 'x', icon_warn = '!', icon_info = 'i', icon_hint = 'h'
- }
- },
- { c.git_branch { fmt = "%s *%s", icon = "" } },
+ fmt = "[%s]",
+ hl_err = hl("DiagnosticError", true),
+ hl_warn = hl("DiagnosticWarn", true),
+ hl_info = hl("DiagnosticInfo", true),
+ hl_hint = hl("DiagnosticHint", true)
+ }},
+ { c.git_branch { icon = "*", fmt = " %s%s" } },
{ c.git_changes_buf {
fmt = "[%s]",
- icon_insert = "+",
- icon_change = "~",
- icon_delete = "-",
- hl_insert = highlights.green_fg,
- hl_change = highlights.yellow_fg,
- hl_delete = highlights.red_fg,
+ hl_insert = hl("GitSignsAdd", true),
+ hl_change = hl("GitSignsChange", true),
+ hl_delete = hl("GitSignsDelete", true),
}},
+ { { " " }, c.line {
+ fmt = "ʟ[%s]",
+ }, required = true },
}
-
- local add_item = function(result, item)
- table.insert(result, item)
- end
-
- local result = {}
- for _, item in ipairs(items) do
- add_item(result, item)
- end
-
- return result
end
}
diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua
index 9411e61..519ecbd 100644
--- a/after/plugin/telescope.lua
+++ b/after/plugin/telescope.lua
@@ -5,18 +5,71 @@ end
local actions = require('telescope.actions')
local action_layout = require("telescope.actions.layout")
+local function telescopew()
+ if vim.o.columns <= 80 then
+ return vim.o.columns
+ else
+ return 80
+ end
+end
+
telescope.setup {
defaults = {
borderchars = {
- prompt = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
+ prompt = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
results = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
preview = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
},
- sorting_strategy = 'ascending',
+ preview = {
+ -- add image previews via chafa
+ mime_hook = function(filepath, bufnr, opts)
+ local is_image = function(filepath)
+ local image_extensions = { -- supported image formats
+ 'png',
+ 'jpg',
+ 'jpe',
+ 'jpeg',
+ 'webp',
+ 'gif',
+ }
+ local split_path = vim.split(filepath:lower(), '.', { plain=true })
+ local extension = split_path[#split_path]
+ return vim.tbl_contains(image_extensions, extension)
+ end
+ if is_image(filepath) then
+ local term = vim.api.nvim_open_term(bufnr, {})
+ local function send_output(_, data, _ )
+ for _, d in ipairs(data) do
+ vim.api.nvim_chan_send(term, d..'\r\n')
+ end
+ end
+ vim.fn.jobstart({
+ 'chafa',
+ '-C',
+ 'on',
+ '--animate',
+ 'off',
+ '-s',
+ (telescopew() - 10)..'x25',
+ '--clear',
+ filepath
+ }, { on_stdout = send_output, stdout_buffered = true, pty = true })
+ a.nvim_set_option_value("number", false, {buf = bufnr})
+ else
+ require("telescope.previewers.utils").set_preview_message(bufnr, opts.winid, "File cannot be previewed")
+ end
+ end
+ },
+
+ winblend = 0,
-- 'horizontal', 'vertical', 'bottom_pane', or 'cursor'
- layout_strategy = 'bottom_pane',
+ layout_strategy = 'vertical',
+ sorting_strategy = 'ascending',
layout_config = {
- bottom_pane = { height = 0.4, },
+ vertical = {
+ width = telescopew(),
+ prompt_position = "top",
+ }
},
mappings = {
i = {
@@ -42,5 +95,7 @@ telescope.load_extension('projects')
a.nvim_create_autocmd('User', {
pattern = 'TelescopePreviewerLoaded',
- command = 'setlocal number',
+ callback = function()
+ vim.opt.winblend = 0
+ end,
})
diff --git a/after/plugin/term-edit.lua b/after/plugin/term-edit.lua
deleted file mode 100644
index 77f7470..0000000
--- a/after/plugin/term-edit.lua
+++ /dev/null
@@ -1,8 +0,0 @@
-local status_ok, termedit = pcall(require, "term-edit")
-if not status_ok then
- return
-end
-
-termedit.setup {
- prompt_end = '$ ',
-}
diff --git a/after/plugin/todo-comments.lua b/after/plugin/todo-comments.lua
index 2a65cda..cf1c0a0 100644
--- a/after/plugin/todo-comments.lua
+++ b/after/plugin/todo-comments.lua
@@ -5,12 +5,32 @@ end
todocomments.setup {
keywords = {
- FIX = { icon = " ", alt = { "FIXME", "BUG" } },
- TODO = { icon = "i ", color = "info" },
- HACK = { icon = "* ", color = "warning" },
- WARN = { icon = "! ", color = "warning", alt = { "WARNING", "XXX" } },
- PERF = { icon = " ", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
- NOTE = { icon = "i ", color = "hint", alt = { "INFO" } },
- TEST = { icon = "⏲ ", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
+ FIX = {
+ icon = "# ",
+ alt = { "FIXME", "BUG" },
+ },
+ HACK = {
+ icon = "* ",
+ color = "warning",
+ },
+ WARN = {
+ icon = "! ",
+ color = "warning",
+ alt = { "WARNING", "XXX" },
+ },
+ NOTE = {
+ icon = "i ",
+ color = "hint",
+ alt = { "INFO", "TODO" },
+ },
+ PERF = {
+ icon = "@ ",
+ alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" },
+ },
+ TEST = {
+ icon = "@ ",
+ color = "test",
+ alt = { "TESTING", "PASSED", "FAILED" },
+ },
},
}
diff --git a/after/plugin/trouble.lua b/after/plugin/trouble.lua
deleted file mode 100644
index bdf9f37..0000000
--- a/after/plugin/trouble.lua
+++ /dev/null
@@ -1,16 +0,0 @@
-local status_ok, trouble = pcall(require, "trouble")
-if not status_ok then
- return
-end
-
-trouble.setup {
- icons = false,
- fold_open = "v",
- fold_closed = ">",
- signs = {
- error = "[x]",
- warning = "[!]",
- hint = "[?]",
- information = "[i]"
- },
-}
diff --git a/after/plugin/truezen.lua b/after/plugin/truezen.lua
deleted file mode 100644
index 9eecc4f..0000000
--- a/after/plugin/truezen.lua
+++ /dev/null
@@ -1,18 +0,0 @@
-local status_ok, truezen = pcall(require, "true-zen")
-if not status_ok then
- return
-end
-
-truezen.setup {
- modes = {
- ataraxis = {
- minimum_writing_area = {
- width = 90,
- height = 44,
- },
- },
- narrow = {
- folds_style = "invisible",
- },
- }
-}
diff --git a/after/plugin/ts.lua b/after/plugin/ts.lua
index 7e5a490..96bebb6 100644
--- a/after/plugin/ts.lua
+++ b/after/plugin/ts.lua
@@ -24,4 +24,7 @@ treesitter.setup {
enable = true,
additional_vim_regex_highlighting = false,
},
+ indent = {
+ enable = true
+ },
}
diff --git a/lua/components.lua b/lua/components.lua
index 6298d35..cce3127 100644
--- a/lua/components.lua
+++ b/lua/components.lua
@@ -1,8 +1,6 @@
-if not pcall(require, "el") then
- return
-end
+if not pcall(require, "el") then return end
-local Job = require "plenary.job"
+local job = require "plenary.job"
local el_sub = require "el.subscribe"
local M = {}
@@ -71,14 +69,14 @@ local function wrap_fnc(opts, fn)
window = { win_id = vim.fn.bufwinid(buffer.bufnr) }
end
if opts.hide_inactive and window and
- window.win_id ~= vim.api.nvim_get_current_win() then
+ window.win_id ~= vim.api.nvim_get_current_win() then
return ""
end
return fn(window, buffer)
end
end
-M.mode = function(opts)
+function M.mode(opts)
opts = opts or {}
return wrap_fnc(opts, function(_, _)
local fmt = opts.fmt or "%s%s"
@@ -92,79 +90,49 @@ M.mode = function(opts)
end)
end
-M.try_devicons = function()
- if not M._has_devicons then
- M._has_devicons, M._devicons = pcall(require, "nvim-web-devicons")
- end
- return M._devicons
-end
-
-M.file_icon = function(opts)
- opts = opts or {}
- return el_sub.buf_autocmd("el_file_icon", "BufRead",
- wrap_fnc(opts, function(_, buffer)
- if not M.try_devicons() then return "" end
- local fmt = opts.fmt or "%s"
- local ext = vim.fn.fnamemodify(buffer.name, ":p:e")
- local icon, hl = M._devicons.get_icon(buffer.name, ext:lower(), { default = true })
- -- local icon = extensions.file_icon(_, bufnr)
- if icon then
- if opts.hl_icon then
- local hlgroup = M.extract_hl({
- bg = { StatusLine = "bg" },
- fg = { [hl] = "fg" },
- })
- icon = set_hl(hlgroup, icon)
- end
- return (fmt):format(icon)
- end
- return ""
- end))
-end
-
-M.git_branch = function(opts)
+function M.git_branch(opts)
opts = opts or {}
return el_sub.buf_autocmd("el_git_branch", "BufEnter",
- wrap_fnc(opts, function(_, buffer)
- -- Try fugitive first as it's most reliable
- local branch = vim.g.loaded_fugitive == 1 and
- vim.fn.FugitiveHead() or nil
- -- buffer can be null and code will crash with:
- -- E5108: Error executing lua ... 'attempt to index a nil value'
- if not buffer or not (buffer.bufnr > 0) then
- return
- end
- -- fugitive is empty or not loaded, try gitsigns
- if not branch or #branch == 0 then
- local ok, res = pcall(vim.api.nvim_buf_get_var,
- buffer.bufnr, "gitsigns_head")
- if ok then branch = res end
- end
- -- last resort run git command
- if not branch then
- local j = Job:new {
- command = "git",
- args = { "branch", "--show-current" },
- cwd = vim.fn.fnamemodify(buffer.name, ":h"),
- }
+ wrap_fnc(opts, function(_, buffer)
+ -- Try fugitive first as it's most reliable
+ local branch = vim.g.loaded_fugitive == 1 and
+ vim.fn.FugitiveHead() or nil
+ -- buffer can be null and code will crash with:
+ -- E5108: Error executing lua ... 'attempt to index a nil value'
+ if not buffer or not (buffer.bufnr > 0) then
+ return
+ end
+ -- fugitive is empty or not loaded, try gitsigns
+ if not branch or #branch == 0 then
+ local ok, res = pcall(vim.api.nvim_buf_get_var,
+ buffer.bufnr, "gitsigns_head")
+ if ok then branch = res end
+ end
+ -- last resort run git command
+ if not branch then
+ local j = job:new {
+ command = "git",
+ args = { "branch", "--show-current" },
+ cwd = vim.fn.fnamemodify(buffer.name, ":h"),
+ }
- local ok, result = pcall(function()
- return vim.trim(j:sync()[1])
- end)
- if ok then
- branch = result
- end
+ local ok, result = pcall(function()
+ return vim.trim(j:sync()[1])
+ end)
+ if ok then
+ branch = result
end
+ end
- if branch and #branch > 0 then
- local fmt = opts.fmt or "%s %s"
- local icon = opts.icon or ""
- return set_hl(opts.hl, (fmt):format(icon, branch))
- end
- end))
+ if branch and #branch > 0 then
+ local fmt = opts.fmt or "%s %s"
+ local icon = opts.icon or ""
+ return set_hl(opts.hl, (fmt):format(icon, branch))
+ end
+ end))
end
-local git_changes_formatter = function(opts)
+local function git_changes_formatter(opts)
local specs = {
insert = {
regex = "(%d+) insertions?",
@@ -198,24 +166,24 @@ local git_changes_formatter = function(opts)
table.insert(result, set_hl(v.hl, ("%s%d"):format(v.icon, count)))
end
end
- return table.concat(result, ", ")
+ return table.concat(result, " ")
end
end
-- requires gitsigns
-M.git_changes_buf = function(opts)
+function M.git_changes_buf(opts)
opts = opts or {}
local formatter = opts.formatter or git_changes_formatter(opts)
return wrap_fnc(opts, function(window, buffer)
local stats = {}
if buffer and buffer.bufnr > 0 then
local ok, res = pcall(vim.api.nvim_buf_get_var,
- buffer.bufnr, "vgit_status")
+ buffer.bufnr, "vgit_status")
if ok then stats = res end
end
if buffer and buffer.bufnr > 0 then
local ok, res = pcall(vim.api.nvim_buf_get_var,
- buffer.bufnr, "gitsigns_status_dict")
+ buffer.bufnr, "gitsigns_status_dict")
if ok then stats = res end
end
local counts = {
@@ -235,82 +203,79 @@ M.git_changes_buf = function(opts)
end)
end
-M.git_changes_all = function(opts)
+function M.git_changes_all(opts)
opts = opts or {}
local formatter = opts.formatter or git_changes_formatter(opts)
return el_sub.buf_autocmd("el_git_changes", "BufWritePost",
- wrap_fnc(opts, function(window, buffer)
- if not buffer or
- not (buffer.bufnr > 0) or
- vim.bo[buffer.bufnr].bufhidden ~= "" or
- vim.bo[buffer.bufnr].buftype == "nofile" or
- vim.fn.filereadable(buffer.name) ~= 1 then
- return
- end
+ wrap_fnc(opts, function(window, buffer)
+ if not buffer or
+ not (buffer.bufnr > 0) or
+ vim.bo[buffer.bufnr].bufhidden ~= "" or
+ vim.bo[buffer.bufnr].buftype == "nofile" or
+ vim.fn.filereadable(buffer.name) ~= 1 then
+ return
+ end
- local j = Job:new {
- command = "git",
- args = { "diff", "--shortstat" },
- -- makes no sense to run for one file as
- -- 'file(s) changed' will always be 1
- -- args = { "diff", "--shortstat", buffer.name },
- cwd = vim.fn.fnamemodify(buffer.name, ":h"),
- }
+ local j = job:new {
+ command = "git",
+ args = { "diff", "--shortstat" },
+ -- makes no sense to run for one file as
+ -- 'file(s) changed' will always be 1
+ -- args = { "diff", "--shortstat", buffer.name },
+ cwd = vim.fn.fnamemodify(buffer.name, ":h"),
+ }
- local ok, git_changes = pcall(function()
- return formatter(window, buffer, vim.trim(j:sync()[1]))
- end)
+ local ok, git_changes = pcall(function()
+ return formatter(window, buffer, vim.trim(j:sync()[1]))
+ end)
- if ok then
- local fmt = opts.fmt or "%s"
- return git_changes and fmt:format(git_changes) or nil
- end
- end))
+ if ok then
+ local fmt = opts.fmt or "%s"
+ return git_changes and fmt:format(git_changes) or nil
+ end
+ end))
end
-local function lsp_srvname(bufnr)
- local buf_clients = vim.lsp.buf_get_clients(bufnr)
+function M.lsp_srvname(opts)
+ local fmt = opts.fmt or "%s"
+ local icon = opts.icon or ""
+ local buf_clients = vim.lsp.buf_get_clients(0)
if not buf_clients or #buf_clients == 0 then
- return nil
+ return ""
end
local names = ""
for i, c in ipairs(buf_clients) do
if i > 1 then names = names .. ", " end
names = names .. c.name
end
- return names
+ return icon..fmt:format(names)
end
local function diag_formatter(opts)
return function(_, buffer, counts)
local items = {}
local icons = {
- ["errors"] = { opts.icon_err or "E", opts.hl_err },
- ["warnings"] = { opts.icon_warn or "W", opts.hl_warn },
- ["infos"] = { opts.icon_info or "I", opts.hl_info },
- ["hints"] = { opts.icon_hint or "H", opts.hl_hint },
+ ["errors"] = { opts.icon_err or "x", opts.hl_err or "DiagnosticError"},
+ ["warnings"] = { opts.icon_warn or "!", opts.hl_warn or "DiagnosticWarn"},
+ ["infos"] = { opts.icon_info or "i", opts.hl_info or "DiagnosticInfo"},
+ ["hints"] = { opts.icon_hint or "h", opts.hl_hint or "DiagnosticHint"},
}
for _, k in ipairs({ "errors", "warnings", "infos", "hints" }) do
if counts[k] > 0 then
table.insert(items,
- set_hl(icons[k][2], ("%s:%s"):format(icons[k][1], counts[k])))
+ set_hl(icons[k][2], ("%s:%s"):format(icons[k][1], counts[k])))
end
end
local fmt = opts.fmt or "%s"
- local lsp_name = opts.lsp and lsp_srvname(buffer.bufnr)
- if not lsp_name and vim.tbl_isempty(items) then
+ if vim.tbl_isempty(items) then
return ""
else
- local contents = lsp_name
- if not vim.tbl_isempty(items) then
- contents = ("%s %s"):format(lsp_name, table.concat(items, " "))
- end
- return fmt:format(contents)
+ return fmt:format(table.concat(items, " "))
end
end
end
-local get_buffer_counts = function(diagnostic, _, buffer)
+local function get_buffer_counts(diagnostic, _, buffer)
local counts = { 0, 0, 0, 0 }
local diags = diagnostic.get(buffer.bufnr)
if diags and not vim.tbl_isempty(diags) then
@@ -328,13 +293,23 @@ local get_buffer_counts = function(diagnostic, _, buffer)
}
end
-M.diagnostics = function(opts)
+function M.diagnostics(opts)
opts = opts or {}
local formatter = opts.formatter or diag_formatter(opts)
return el_sub.buf_autocmd("el_buf_diagnostic", "LspAttach,DiagnosticChanged",
- wrap_fnc(opts, function(window, buffer)
- return formatter(window, buffer, get_buffer_counts(vim.diagnostic, window, buffer))
- end))
+ wrap_fnc(opts, function(window, buffer)
+ return formatter(window, buffer, get_buffer_counts(vim.diagnostic, window, buffer))
+ end))
+end
+
+function M.line(opts)
+ opts = opts or {}
+ local fmt = opts.fmt or "%s"
+ return wrap_fnc(opts, function(_, _)
+ local al = vim.api.nvim_buf_line_count(0)
+ local cl = vim.api.nvim_win_get_cursor(0)[1]
+ return (fmt):format(cl.."/"..al.." "..math.floor((cl / al) * 100).."%%")
+ end)
end
return M
diff --git a/lua/core/auto.lua b/lua/core/auto.lua
index 5a6c3a3..4c50357 100644
--- a/lua/core/auto.lua
+++ b/lua/core/auto.lua
@@ -2,7 +2,7 @@ local function auto(event, opts)
a.nvim_create_autocmd(event, opts)
end
-a.nvim_create_augroup('bufcheck', {clear = true})
+a.nvim_create_augroup('bufcheck', { clear = true })
auto('TextYankPost', { -- highlight yanks
group = 'bufcheck',
@@ -26,43 +26,6 @@ auto('BufRead', { -- return to last place
desc = 'Return to the last place the buffer was closed in.',
})
-auto('TermOpen', { -- start terminal in insert mode
- group = 'bufcheck',
- pattern = '*',
- desc = 'Start terminal in insert mode.',
- callback = function()
- vim.cmd('startinsert | set winfixheight')
- o.winfixheight = true
- o.cmdheight = 0
- end
-})
-
-auto('TermClose', { -- close terminal buffers after shell dies
- group = 'bufcheck',
- pattern = 'term://*',
- desc = 'Close terminal after shell dies.',
- callback = function()
- vim.cmd('call nvim_input("<CR>")')
- o.cmdheight = 1
- end
-})
-
-auto('InsertEnter', { -- toggle things when entering insert mode
- group = 'bufcheck',
- desc = 'Turn things on insert mode.',
- callback = function()
- o.colorcolumn = { 80 }
- end
-})
-
-auto('InsertLeave', { -- toggle things when exiting insert mode
- group = 'bufcheck',
- desc = 'Turn things off insert mode.',
- callback = function()
- o.colorcolumn = { 0 }
- end
-})
-
auto('BufWritePre', { -- make dirs when they don't exist
pattern = '*',
group = vim.api.nvim_create_augroup('auto_create_dir', { clear = true }),
diff --git a/lua/core/binds.lua b/lua/core/binds.lua
index f27c87d..02216ae 100644
--- a/lua/core/binds.lua
+++ b/lua/core/binds.lua
@@ -9,17 +9,6 @@ local function map(mode, bind, cmd, opts)
end
elseif type(bind) == 'string' then
vim.keymap.set(mode, bind, cmd, opts)
- else
- vim.notify('-- Invalid bind for keymap:\nvim.keymap.set(\''
- .. mode .. '\', ' .. bind .. ', \'' .. cmd .. '\')',
- vim.log.levels.WARN, {
- title = 'Neovim Config',
- on_open = function(win)
- local buf = vim.api.nvim_win_get_buf(win)
- vim.api.nvim_buf_set_option(buf, "filetype", "lua")
- end
- }
- )
end
end
@@ -40,7 +29,7 @@ map('n', 'N', 'Nzzzv')
map('n', '<C-d>', '<C-d>zz') -- half page jumping
map('n', '<C-u>', '<C-u>zz')
-map('n', '<leader>x', '<cmd>!chmod +x %<CR>') -- execute order 111
+map('n', '<leader>x', '<cmd>!chmod +x "%"<CR>') -- execute order 111
-- add some keybinds to the file view (netrw)
a.nvim_create_autocmd('FileType', {
@@ -51,17 +40,17 @@ a.nvim_create_autocmd('FileType', {
end
bind('h', '-^') -- Go up a directory
bind('l', '<CR>') -- Go down a directory / open a file
- bind('.', 'gh') -- Toggle dotfiles
+ bind('.', 'gh') -- Toggle hidden files
bind('P', '<C-w>z') -- Close preview window
bind('<esc>', '<cmd>q<CR>') -- Close netrw
end
})
-- tabs
-map('n', '<C-q>n', '<cmd>tabnew<CR>')
-map('n', '<C-q>w', '<cmd>tabclose<CR>')
-map('n', '<C-q>h', '<cmd>tabprev<CR>')
-map('n', '<C-q>l', '<cmd>tabnext<CR>')
+map('n', '[]', '<cmd>tabnew<CR>')
+map('n', '][', '<cmd>tabc<CR>')
+map('n', '[[', '<cmd>tabp<CR>')
+map('n', ']]', '<cmd>tabN<CR>')
-- plugin binds ---------------------------------------------------------------
@@ -78,22 +67,41 @@ end
if pcall(require, "telescope") then
local telebuilt = require('telescope.builtin') -- telescope
+ -- local telexten = require('telescope').extensions
map('n', '<leader>sf', telebuilt.find_files, { desc = 'Find files.' })
+ map('n', '<leader>so', telebuilt.oldfiles, { desc = 'Find old files.' })
map('n', '<leader>sg', telebuilt.git_files, { desc = 'Find git files.' })
+ -- search urls in buffer
+ map('n', '<leader>su', '<Cmd>UrlView<CR>', { desc = 'Find urls in buffer.' })
+ -- search lsp symbols
+ map('n', '<leader>ss', telebuilt.lsp_document_symbols,
+ { desc = 'Find LSP Symbols.' })
+ -- search for keybinds
+ map('n', '<leader>sk', telebuilt.keymaps,
+ { desc = 'Find nvim Highlights.' })
+ -- search for highlights
+ map('n', '<leader>sh', telebuilt.highlights,
+ { desc = 'Find nvim Highlights.' })
+ -- search for autocommands
+ map('n', '<leader>sa', telebuilt.autocommands,
+ { desc = 'Find nvim Autocommands.' })
+ -- search for vim options
+ map('n', '<leader>sv', telebuilt.vim_options, { desc = 'Find vim options.' })
+ -- search for string in project
map('n', '<leader>sp', function()
- telebuilt.grep_string({ search = vim.fn.input(
- 'Find string in project > '
- ) })
+ telebuilt.grep_string({ search = vim.fn.input('Find string in project > ')})
end, { desc = 'Find string in project.' })
- map('n', '<leader>so', telebuilt.oldfiles, { desc = 'Find old files.' })
+ -- Code Actions (requires telescope)
+ if pcall(require, "actions-preview") then
+ map({ "n", "v" }, "<leader>ca", require("actions-preview").code_actions, {
+ desc = 'preview code actions'
+ })
+ end
end
map('n', '<leader>u', '<cmd>UndotreeToggle<CR>', { desc = 'Open undo tree.' })
map('n', '<leader>f', '<cmd>SFMToggle<CR>', { desc = 'Open file tree view.' })
map('n', '<leader>b', '<cmd>JABSOpen<CR>', { desc = 'Switch between buffers.' })
-map('n', '<leader>tt', '<cmd>TroubleToggle<CR>', { desc = 'Diagnostic list.' })
-map('n', '<leader>tc', '<cmd>TodoTrouble<CR>', { desc = 'Comment list.' })
-map('n', '<C-e>', '<cmd>IconPickerYank<CR>', { desc = 'Icon picker list.' })
if pcall(require, "dapui") then
local dapui = require('dapui') -- dap ui
@@ -122,14 +130,38 @@ if pcall(require, "true-zen") then
})
end
--- Git
-map('n', '<leader>gph', '<cmd>Gitsigns preview_hunk_inline<CR>')
-map('n', '<leader>gsh', '<cmd>Gitsigns stage_hunk<CR>')
+-- git
+map('n', '<leader>gp', '<cmd>Gitsigns preview_hunk_inline<CR>')
+map('n', '<leader>gs', '<cmd>Gitsigns stage_hunk<CR>')
map('n', '<leader>gb', '<cmd>Gitsigns blame_line<CR>')
+map('n', '<leader>g]', '<cmd>Gitsigns next_hunk<CR>')
+map('n', '<leader>g[', '<cmd>Gitsigns prev_hunk<CR>')
-- neogen
if pcall(require, "neogen") then
map('n', '<leader>df', require("neogen").generate, {
- desc = 'Generate anootations',
+ desc = 'Generate anotations',
})
end
+
+-- venn
+function _G.Toggle_venn()
+ local venn_enabled = vim.inspect(vim.b.venn_enabled)
+ if venn_enabled == "nil" then
+ vim.b.venn_enabled = true
+ vim.cmd([[setlocal ve=all]])
+ -- draw a line on HJKL keystokes
+ vim.api.nvim_buf_set_keymap(0, "n", "J", "<C-v>j:VBox<CR>", {noremap = true})
+ vim.api.nvim_buf_set_keymap(0, "n", "K", "<C-v>k:VBox<CR>", {noremap = true})
+ vim.api.nvim_buf_set_keymap(0, "n", "L", "<C-v>l:VBox<CR>", {noremap = true})
+ vim.api.nvim_buf_set_keymap(0, "n", "H", "<C-v>h:VBox<CR>", {noremap = true})
+ -- draw a box by pressing "f" with visual selection
+ vim.api.nvim_buf_set_keymap(0, "v", "f", ":VBox<CR>", {noremap = true})
+ else
+ vim.cmd[[setlocal ve=]]
+ vim.cmd[[mapclear <buffer>]]
+ vim.b.venn_enabled = nil
+ end
+end
+-- toggle keymappings for venn using <leader>v
+vim.api.nvim_set_keymap('n', '<leader>v', ":lua Toggle_venn()<CR>", { noremap = true})
diff --git a/lua/core/cmds.lua b/lua/core/cmds.lua
index 03ff87f..3cc78e1 100644
--- a/lua/core/cmds.lua
+++ b/lua/core/cmds.lua
@@ -3,4 +3,6 @@ local function cmd(name, exec, opts)
vim.api.nvim_create_user_command(name, exec, opts)
end
-cmd('Colorscheme', 'Telescope colorscheme')
+cmd('Colorscheme', function()
+ require('telescope.builtin').colorscheme()
+end)
diff --git a/lua/core/opts.lua b/lua/core/opts.lua
index 62386dc..82d88bd 100644
--- a/lua/core/opts.lua
+++ b/lua/core/opts.lua
@@ -1,6 +1,6 @@
-- better ui ------------------------------------------------------------------
if pcall(require, "notify") then vim.notify = require("notify") end
--- o.colorcolumn = { 80 }
+o.colorcolumn = { 80 }
-- buffer
o.scrolloff = 5
@@ -11,16 +11,13 @@ o.cursorline = true
-- statusbar
o.laststatus = 3
o.cmdheight = 1
-if o.cmdheight == 0 then
- o.showcmdloc = 'statusline'
-end
o.showmode = false -- stop vim from showing mode (we have a statusbar)
+-- tabline
+o.showtabline = 2
+
-- status column
o.signcolumn = 'yes:1' -- show gutter
-o.relativenumber = true
-o.number = true
-o.numberwidth = 2
-- indents + tabs
local tabwidth = 2
@@ -38,7 +35,7 @@ vim.cmd('colorscheme mellow') -- mellow
vim.cmd('colorscheme mellow+') -- some changes
-- better editing -------------------------------------------------------------
-o.clipboard = 'unnamedplus' -- system clipboard (on unix like)
+o.clipboard = 'unnamedplus' -- system clipboard
-- file saving ----------------------------------------------------------------
o.swapfile = false
diff --git a/lua/core/plugins.lua b/lua/core/plugins.lua
index a22bed4..106e73d 100644
--- a/lua/core/plugins.lua
+++ b/lua/core/plugins.lua
@@ -16,8 +16,9 @@ require 'dep' {
-- { 'andweeb/presence.nvim' },
-- colorschemes -------------------------------------------------------------
- { 'kvrohit/mellow.nvim' },
- { 'rockerBOO/boo-colorscheme-nvim' },
+ { 'kvrohit/mellow.nvim',
+ requires = 'nvim-treesitter/nvim-treesitter'
+ },
-- ui -----------------------------------------------------------------------
{ 'lukas-reineke/indent-blankline.nvim' }, -- indentation indicators
@@ -28,35 +29,41 @@ require 'dep' {
},
{ 'goolord/alpha-nvim' }, -- start page
{ 'dinhhuy258/sfm.nvim', -- tree view
- requires = 'dinhhuy258/sfm-git.nvim',
+ deps = 'dinhhuy258/sfm-git.nvim',
},
- { 'mrjones2014/smart-splits.nvim'}, -- buffer resizing
- { 'axieax/urlview.nvim' }, -- view urls in current buffer
{ 'matbme/JABS.nvim' }, -- buffer switcher
- { 'ziontee113/icon-picker.nvim' }, -- icons
- { 'petertriho/nvim-scrollbar' }, -- scrollbar
- -- { 'lewis6991/satellite.nvim' }, -- new scrollbar for nvim 0.10
- { 'pocco81/true-zen.nvim' }, -- focus on the current thing
{ 'tomiis4/Hypersonic.nvim' }, -- regex helper/displayer
- { 'lewis6991/cleanfold.nvim' }, -- nice fold line
- { 'yaocccc/nvim-foldsign' }, -- fold sign in gutter
-
-- functional plugins -------------------------------------------------------
- { 'lewis6991/gitsigns.nvim' },
- { 'chentoast/marks.nvim' },
- { 'pta2002/intellitab.nvim' },
+ { 'lewis6991/gitsigns.nvim' }, -- very helpful git things
+ { 'squibid/git-yodel', -- git cache diff preview when in commit buffer
+ url = 'https://git.squi.bid/git-yodel'
+ },
+ { 'chentoast/marks.nvim' }, -- marks in gutter
+ { 'pta2002/intellitab.nvim' }, -- better tabbing into indents
{ 'mbbill/undotree' }, -- careful this one is written in vimscript
+ { 'dhruvasagar/vim-table-mode' }, -- same with this one
{ 'windwp/nvim-autopairs' },
{ 'numToStr/Comment.nvim' },
- { 'numtostr/BufOnly.nvim' }, -- kill the other buffers with :BufOnly
{ 'ahmedkhalf/project.nvim' }, -- cd into root of project
- { 'akinsho/toggleterm.nvim' },
- { 'chomosuke/term-edit.nvim' }, -- full vim keybinds in terminals
+ { 'akinsho/toggleterm.nvim' }, -- TODO: switch to tmux based popup terminal
+ { 'mrjones2014/smart-splits.nvim'}, -- buffer resizing
-- note taking --------------------------------------------------------------
- { 'nvim-neorg/neorg' },
- { 'nvim-neorg/neorg-telescope' },
+ { 'nvim-neorg/neorg',
+ config = function()
+ if package.loaded['nvim-treesitter'] then
+ vim.cmd(':Neorg sync-parsers<CR>')
+ end
+ end,
+ requires = {
+ 'nvim-lua/plenary.nvim',
+ 'nvim-treesitter/nvim-treesitter'
+ },
+ deps = 'nvim-neorg/neorg-telescope'
+ },
+
+ { 'jbyuki/venn.nvim' },
-- fzf ----------------------------------------------------------------------
{ 'nvim-telescope/telescope.nvim',
@@ -64,19 +71,23 @@ require 'dep' {
deps = {
'nvim-telescope/telescope-file-browser.nvim',
'nvim-telescope/telescope-ui-select.nvim',
- 'AckslD/nvim-neoclip.lua',
+ 'nvim-telescope/telescope-symbols.nvim',
+ 'axieax/urlview.nvim',
}
},
-- treesitter + colorizing --------------------------------------------------
{ 'nvim-treesitter/nvim-treesitter',
deps = {
- { 'm-demare/hlargs.nvim' },
- { 'Wansmer/treesj' },
- { 'nvim-treesitter/nvim-treesitter-context' },
+ 'm-demare/hlargs.nvim',
+ 'Wansmer/treesj',
+ 'nvim-treesitter/nvim-treesitter-context',
}
},
{ 'NvChad/nvim-colorizer.lua' },
+ { 'folke/todo-comments.nvim',
+ requires = 'nvim-lua/plenary.nvim',
+ },
-- cmp ----------------------------------------------------------------------
{ 'hrsh7th/nvim-cmp',
@@ -103,15 +114,16 @@ require 'dep' {
{ 'j-hui/fidget.nvim', -- shows lsp progress
branch = 'legacy',
},
- { 'folke/neodev.nvim' }, -- configure lua lsp for neovim
{ 'ray-x/lsp_signature.nvim' }, -- see information about the current function
{ 'dnlhc/glance.nvim' }, -- diagnostic info at a glance
+ { 'aznhe21/actions-preview.nvim', -- codeactions
+ requires = 'nvim-telescope/telescope.nvim'
+ },
- { 'folke/trouble.nvim' },
- { 'folke/todo-comments.nvim' },
-
- { 'danymat/neogen' }, -- generate lsp annotations
+ { 'danymat/neogen', -- generate lsp annotations
+ requires = 'nvim-treesitter/nvim-treesitter'
+ },
{ 'whynothugo/lsp_lines.nvim',
url = 'https://git.sr.ht/~whynothugo/lsp_lines.nvim',
@@ -120,9 +132,11 @@ require 'dep' {
-- dap + lsp + linter + formatter installer ---------------------------------
{ 'williamboman/mason.nvim',
deps = {
- { 'WhoIsSethDaniel/mason-tool-installer.nvim' },
- { 'williamboman/mason-lspconfig.nvim' },
- { 'jay-babu/mason-nvim-dap.nvim' },
- },
+ 'WhoIsSethDaniel/mason-tool-installer.nvim',
+ 'williamboman/mason-lspconfig.nvim',
+ }
+ },
+ { 'mfussenegger/nvim-dap',
+ deps = 'rcarriga/nvim-dap-ui'
},
}