114 Commits
v1.0 ... v2.0

Author SHA1 Message Date
1c3b9135d4 make sure we are safely setting termguicolors 2024-04-25 22:59:43 -04:00
30edbcbb6b make lsp related popups all look the same 2024-04-25 22:59:22 -04:00
e39c8ef5d6 remove signcolumn option, auto is good enough for me 2024-04-25 22:58:27 -04:00
b254e912f6 remove ` mark so lsp hover doesn't get messed up 2024-04-25 22:49:38 -04:00
bef886371f make norg files more fancy 2024-04-22 19:57:31 -04:00
058379b907 make replaceword safer 2024-04-19 22:32:17 -04:00
c11d42a1cb make sfm (file tree) have a darker bg 2024-04-08 18:37:02 -04:00
3e853f072a fix neorg so it works on v8.0.0 and make headlines stop overriding the
neorg header bullet points
2024-04-08 18:33:13 -04:00
2584f681c8 add tabbar plugin 2024-03-31 17:11:40 -04:00
57dfdb074c enable experimental ghost text for cmp 2024-03-31 13:07:29 -04:00
1d202e0690 switch from dotnix's cmp-luasnip-choice to L3MON4D3's 2024-03-31 13:06:53 -04:00
f85fd2b36c replace lsp_signature with better alternative 2024-03-31 12:31:20 -04:00
0c25dcf748 add todo list bind 2024-03-29 23:30:14 -04:00
d070d601d1 make <leader>x toggle executable status 2024-03-29 23:28:36 -04:00
5d7470b682 show executable status in the statusbar 2024-03-29 23:28:14 -04:00
f8dc6ffdb9 stop limiting width in cmp that was stupid 2024-03-29 21:25:11 -04:00
dfa0d349be add notification to toggling venn mode 2024-03-29 21:24:26 -04:00
ec28dc0364 modify keybinds a bit 2024-03-29 21:24:00 -04:00
a2b6c1d828 make the right click menu much more useful 2024-03-23 17:11:30 -04:00
9da714b621 remove items from harpoon using dropdown menu 2024-03-23 17:11:00 -04:00
dad7fc2b43 stop highlighting the whole line for diagnostics 2024-03-09 00:25:41 -05:00
fbe0ba5c4b improve completion config
- show what we are completing from with symbol on left
- improving results ordering
2024-03-09 00:24:27 -05:00
649918dc24 get lsp server name more consistently for the statusbar 2024-03-09 00:21:19 -05:00
40fea1a44d add another lsp rename mapping 2024-03-09 00:20:31 -05:00
bfa0910cba call mason in a safer way, and initalize servers better 2024-03-09 00:19:34 -05:00
6c2d90ee5a add ignored chars to autopairs 2024-03-09 00:17:59 -05:00
01ca7368c6 make toc close after selection neorg 2024-03-09 00:10:04 -05:00
6867a9f24e add fallback project detection, and change scope to tab instead of
global
2024-03-09 00:09:03 -05:00
a80bb9a592 make treesitter disable on massive files, and diff files
also remove auto installing
2024-03-09 00:08:19 -05:00
1af19150f9 allow previous edit position mark in gutter 2024-03-09 00:06:33 -05:00
c102431a36 make gitsigns binds get defined when git attaches 2024-03-09 00:05:08 -05:00
b161ce2482 remove comment options (they we're just the defaults) 2024-03-09 00:04:04 -05:00
adf399633b update harpoon to harpoon 2 2024-03-09 00:02:02 -05:00
7aea21724a make color swapper change colorscheme in config 2024-02-08 19:50:24 -05:00
8e3bec906d un-object orient some functions 2024-02-05 22:30:55 -05:00
b62340de6f way too lazy to sort this out, adding kitchen sink 2024-01-30 21:52:24 -05:00
6b7b94ad33 remove toggle term 2024-01-02 20:35:26 -05:00
441e8f019b add highlights to statusline mode 2023-12-05 16:01:57 -05:00
6f72d76da2 add index.norg to project plugin 2023-12-05 16:01:06 -05:00
35105f286d wasn't concatenating file path right 2023-11-27 19:34:14 -05:00
4d529e2783 fix: wrong env var 2023-11-27 19:32:31 -05:00
5681645d2d remove useless option (it already the default) 2023-11-27 18:51:51 -05:00
b8bc3573d6 fix indents and remove useless keybinds 2023-11-27 18:50:47 -05:00
9492f6b479 add new workspace, and set default one 2023-11-27 18:22:44 -05:00
e39f85e06c add required plugin for neorg presenter, and make wsphome more adaptaive 2023-11-27 17:52:11 -05:00
393b34915e add colored headlines for markdown 2023-11-26 14:25:39 -05:00
0188d9ab2e update readme to reflect path change of plugin file 2023-11-26 14:24:55 -05:00
ee2b844a8c make "Edit Config" option work for any path 2023-11-26 14:21:36 -05:00
36cf6a4f89 only show cursorline on current window 2023-11-26 14:20:54 -05:00
550cac1035 more stuff too lazy to seperate 2023-11-24 21:38:31 -05:00
ed205a9545 replace intellitab with auto-indent 2023-11-07 23:29:02 -05:00
82cae35f18 change readme to match versioning style 2023-10-22 19:55:35 -04:00
eda5a33da9 remove dap cause idk how to auto configure it 2023-10-22 19:41:12 -04:00
ec66072a5f set spell when entering commit, and use ftplugin instead of autocmds 2023-10-22 18:49:49 -04:00
b4ab8d3505 remove games and discord presence, and make sure dep update everytime we open neovim 2023-10-22 18:20:46 -04:00
339be88db2 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
2023-10-22 18:17:21 -04:00
033f38e500 add undotree config 2023-10-22 18:09:32 -04:00
4a91fa2d65 move config menu 2023-10-22 18:08:38 -04:00
25931d94ef move highlights to colorscheme, and change cmp style 2023-10-22 18:07:36 -04:00
735cf5c7e0 remove floating diagnostics, and add line diagnostics 2023-10-22 18:05:10 -04:00
ea6fcd370f kitchen sink cause I'm too lazy to sort through this junk 2023-08-11 20:43:58 -04:00
a8a1bef56a add git-yodel 2023-08-02 20:47:28 -04:00
152f3eb569 improve git integration 2023-08-02 02:22:04 -04:00
394b577d3b add annotation generator: neogen 2023-08-02 02:16:29 -04:00
f05dc87c0d create floating window with commit diff when editing git commit message 2023-07-16 21:28:36 -04:00
15caf69220 add comment to ftplugin/java.lua, and fix some typos 2023-07-16 21:28:06 -04:00
dd872e8545 change the look of telescope a bit and remove unneeded stuff 2023-07-06 12:35:56 -04:00
a870c77e31 highlights for cmp and label cmp plugins 2023-07-06 12:30:40 -04:00
0f838d6251 better movement while using cmp 2023-07-06 12:29:38 -04:00
713bba997a make jdtls work without the seperate plugin :) 2023-07-06 12:28:31 -04:00
8abf7b1c68 fidget is going to have breaking changes soon
switch to legacy branch
2023-06-26 11:52:32 -04:00
173907498a regex helper :) 2023-06-26 11:51:46 -04:00
426d72ecad more c snippets and adjust commenting 2023-06-26 11:42:29 -04:00
3b9b2e63c0 disable update checker by default 2023-06-26 11:42:06 -04:00
ba09631876 we weren't checking some of the conditions
whoops...
2023-06-26 11:41:37 -04:00
b4aebd0776 flex on the discord users
disabled by default for privacy reasons
2023-06-26 11:41:02 -04:00
e66cd2685f comment position in binds.lua 2023-06-26 11:40:45 -04:00
40281d4f66 new autocmds and change comment position in auto.lua 2023-06-26 11:40:06 -04:00
db7a1f40b1 80 columns in init.lua 2023-06-26 11:39:44 -04:00
e194be0f15 more truezen and whichkey formatting 2023-06-26 11:39:20 -04:00
47af80ae02 reformatting in toggleterm.lua 2023-06-26 11:38:52 -04:00
4b49645b4b better formatting in statusline.lua 2023-06-26 11:38:08 -04:00
eb5830f5f0 add startpage resizing
prob doesn't work, but I'm too lazy to check
2023-06-26 11:36:34 -04:00
fdf2f8616e add plugin configs & mess with the binds 2023-06-26 11:35:24 -04:00
10786c2910 remove unused function from lsp.lua and add more lsp plugins! 2023-06-26 11:31:04 -04:00
66d9af30a9 replace gd and the likes with glance 2023-06-26 11:28:27 -04:00
a7524580f0 remove killersheep custom sprite (was in a custom version and didn't work) 2023-06-26 11:20:34 -04:00
43ec1b0a3a change cmp source path to async_path 2023-06-26 11:20:03 -04:00
b9a2b3e8db (re)enable auto completion 2023-06-26 11:17:11 -04:00
2d2cd2104e modify cmp icons 2023-06-26 11:16:26 -04:00
8d44e94fd8 remove mkdir plugin and replace with autocmd 2023-06-26 11:14:21 -04:00
6fe8d8d818 spacing 2023-06-09 15:45:46 -04:00
7b724b8c29 added term edit config 2023-05-23 14:39:41 -04:00
8527f7fb60 check if we are up to date with remote repo 2023-05-23 14:39:20 -04:00
d55cca5062 make embedded terminal better 2023-05-23 14:38:44 -04:00
a783564b8e formatting in plugins 2023-05-23 14:36:46 -04:00
7ebc19e4f9 added presenter module and truezen 2023-05-23 14:36:19 -04:00
d848039c88 more neorg modules 2023-05-23 14:35:49 -04:00
a374719e3e change keybind for config menu 2023-05-14 15:37:02 -04:00
bd2b6f6b10 add keybind lookup to config menu 2023-05-14 15:36:32 -04:00
aa8d65cde1 remove config menu from binds.lua 2023-05-14 15:31:04 +00:00
3ca2e63539 add config managment scripts 2023-05-14 15:30:29 +00:00
05ad5a35e2 killer sheep game :) 2023-05-10 17:20:20 -04:00
c20f64644d comment out colorcolumn 2023-05-10 17:19:36 -04:00
b814975a38 remove tab binds
they were already unused (commented out)
2023-05-10 17:18:43 -04:00
01d89bae44 change highlight colors to reference colorscheme plugin directly 2023-05-10 17:17:35 -04:00
c4e1e5a648 lsp spacing 2023-05-10 17:17:12 -04:00
c713985bdd set lsp signs 2023-05-10 17:16:39 -04:00
bd20fdb3dd clean up unneeded files and update .gitignore 2023-04-30 22:23:15 -04:00
e8ab1ed0de add more instructions on how to install the jdtls lsp client 2023-04-30 22:19:05 -04:00
f36bc1d1de shouldn't be on development version by default 2023-04-30 19:45:22 -04:00
5868da276e make heading bigger in README.md 2023-04-30 19:44:55 -04:00
0430aa7be0 add README.md 2023-04-30 19:43:05 -04:00
5da0e3dc7c new config old version is now on v1 branch 2023-04-30 18:41:13 -04:00
96 changed files with 2761 additions and 1518 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
lazy-lock.json spell/

View File

@ -1,78 +1,11 @@
# muh neovim config <h1 style="text-align: center;">Welcome To My Neovim Config</h1>
<hr>
#### some goals for my config: ## Versioning
- reduce the use of nerdfonts The master branch contains my current config, major revisions are tagged: v#.#
- keep as simple as possible without losing functionality
## screenshots ## Use Case
<img src="pics/alpha.png" style="width:90vw;"> My config is built around what I work on; this mainly includes: c, lua, java, and shell scripting. I also try to keep my config relatively portable which is why I to not use any nerd fonts
<img src="pics/editing-c.png" style="width:90vw;">
## plugins ## Plugins
<details><summary>click me to view the plugins that are currently in muh config</summary> For plugin management I use my own [fork](https://git.squi.bid/dep/) of [Dep](https://github.com/chiyadev/dep) To find the current list of plugins go to the [plugin.lua](https://git.squi.bid/nvim/tree/lua/conf/plugins.lua) file.
- [essentials](https://github.com/tamton-aquib/essentials.nvim)
- [alpha-nvim](https://github.com/goolord/alpha-nvim)
- [nvim-scrollbar](https://github.com/petertriho/nvim-scrollbar)
- [nvim-tetris](https://github.com/alec-gibson/nvim-tetris)
- [duckytype](https://github.com/kwakzalver/duckytype.nvim)
- [modicator](https://github.com/melkster/modicator.nvim)
- [murmur](https://github.com/nyngwang/murmur.lua)
- [pantran](https://github.com/potamides/pantran.nvim)
- [jellybeans-nvim](https://github.com/metalelf0/jellybeans-nvim)
- [lush.nvim](https://github.com/rktjmp/lush.nvim)
- [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim)
- [barbacue.nvim](https://github.com/utilyre/barbecue.nvim)
- [nvim-navic](https://github.com/SmiteshP/nvim-navic)
- [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim)
- [gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim)
- [marks.nvim](https://github.com/chentoast/marks.nvim)
- [which-key.nvim](https://github.com/folke/which-key.nvim)
- [smart-splits](https://github.com/mrjones2014/smart-splits.nvim)
- [bufresize](https://github.com/kwkarlwang/bufresize.nvim)
- [nvim-notify](https://github.com/rcarriga/nvim-notify)
- [cosmic-ui](https://github.com/CosmicNvim/cosmic-ui)
- [nui.nvim](https://github.com/MunifTanjim/nui.nvim)
- [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim)
- [telescope-file-browser.nvim](https://github.com/nvim-telescope/telescope-file-browser.nvim)
- [telescope-ui-select.nvim](https://github.com/nvim-telescope/telescope-ui-select.nvim)
- [plenary.nvim](https://github.com/nvim-lua/plenary.nvim)
- [telescope-undo.nvim](https://github.com/debugloop/telescope-undo.nvim)
- [nvim-neoclip.lua](https://github.com/AckslD/nvim-neoclip.lua)
- [intellitab.nvim](https://github.com/pta2002/intellitab.nvim)
- [comment.nvim](https://github.com/numToStr/Comment.nvim)
- [trouble.nvim](https://github.com/folke/trouble.nvim)
- [todo-comments.nvim](https://github.com/folke/todo-comments.nvim)
- [toggleterm.nvim](https://github.com/akinsho/toggleterm.nvim)
- [diffview.nvim](https://github.com/sindrets/diffview.nvim)
- [nvim-rooter.lua](https://github.com/notjedi/nvim-rooter.lua)
- [venn.nvim](https://github.com/jbyuki/venn.nvim)
- [neorg](https://github.com/nvim-neorg/neorg)
- [true-zen.nvim](https://github.com/loqusion/true-zen.nvim)
- [high-str.nvim](https://github.com/Pocco81/high-str.nvim)
- [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
- [hlargs](https://github.com/m-demare/hlargs.nvim)
- [treesj](https://github.com/Wansmer/treesj)
- [hover.nvim](https://github.com/lewis6991/hover.nvim)
- [nvim-colorizer.lua](https://github.com/nvchad/nvim-colorizer.lua)
- [lsp-zero.nvim](https://github.com/VonHeikemen/lsp-zero.nvim)
- [nvim-cmp](https://github.com/hrsh7th/nvim-cmp)
- [cmp-buffer](https://github.com/hrsh7th/cmp-buffer)
- [cmp-path](https://github.com/hrsh7th/cmp-path)
- [cmp-calc](https://github.com/hrsh7th/cmp-calc)
- [cmp_luasnip](https://github.com/saadparwaiz1/cmp_luasnip)
- [cmp-nvim-lua](https://github.com/hrsh7th/cmp-nvim-lua)
- [cmp-nvim-lsp](https://github.com/hrsh7th/cmp-nvim-lsp)
- [cmp-under-comparator](https://github.com/lukas-reineke/cmp-under-comparator)
- [lspkind.nvim](https://github.com/onsails/lspkind.nvim)
- [LuaSnip](https://github.com/L3MON4D3/LuaSnip)
- [friendly-snippets](https://github.com/rafamadriz/friendly-snippets)
- [cmp-luasnip-choice](https://github.com/doxnit/cmp-luasnip-choice)
- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig)
- [mason.nvim](https://github.com/williamboman/mason.nvim)
- [mason-lspconfig.nvim](https://github.com/williamboman/mason-lspconfig.nvim)
- [nvim-autopairs](https://github.com/windwp/nvim-autopairs)
</details>
<sub>PS: sry about the kitchen sink commits, I just learned about `git add --patch`</sub>

View File

@ -0,0 +1 @@
vim.cmd('startinsert | 1')

View File

@ -0,0 +1 @@
gitcommit.lua

1
after/ftplugin/help.lua Normal file
View File

@ -0,0 +1 @@
vim.treesitter.start()

255
after/ftplugin/java.lua Normal file
View File

@ -0,0 +1,255 @@
-- NOTE: Make sure you're $JAVA_HOME is correct (prob should be 17 or higher)
local java_cmds = vim.api.nvim_create_augroup('java_cmds', {clear = true})
local cache_vars = {}
local root_files = {
'.git',
'mvnw',
'gradlew',
'pom.xml',
'build.gradle',
}
local features = {
-- change this to `true` to enable codelens
codelens = true,
-- change this to `true` if you have `nvim-dap`,
-- `java-test` and `java-debug-adapter` installed
debugger = true,
}
local function get_jdtls_paths()
if cache_vars.paths then
return cache_vars.paths
end
local path = {}
path.data_dir = vim.fn.stdpath('cache') .. '/nvim-jdtls'
local jdtls_install = require('mason-registry').get_package('jdtls'):get_install_path()
path.java_agent = jdtls_install .. '/lombok.jar'
path.launcher_jar = vim.fn.glob(jdtls_install .. '/plugins/org.eclipse.equinox.launcher_*.jar')
path.platform_config = jdtls_install .. '/config_linux'
path.bundles = {}
-- Include java-test bundle if present
local java_test_path = require('mason-registry')
.get_package('java-test')
:get_install_path()
local java_test_bundle = vim.split(
vim.fn.glob(java_test_path .. '/extension/server/*.jar'),
'\n'
)
if java_test_bundle[1] ~= '' then
vim.list_extend(path.bundles, java_test_bundle)
end
-- Include java-debug-adapter bundle if present
local java_debug_path = require('mason-registry')
.get_package('java-debug-adapter')
:get_install_path()
local java_debug_bundle = vim.split(
vim.fn.glob(java_debug_path .. '/extension/server/com.microsoft.java.debug.plugin-*.jar'),
'\n'
)
if java_debug_bundle[1] ~= '' then
vim.list_extend(path.bundles, java_debug_bundle)
end
-- Useful if you're starting jdtls with a Java version that's
-- different from the one the project uses.
path.runtimes = {
-- Note: the field `name` must be a valid `ExecutionEnvironment`,
-- you can find the list here:
-- https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request
--
-- This example assume you are using sdkman: https://sdkman.io
-- {
-- name = 'JavaSE-17',
-- path = vim.fn.expand('~/.sdkman/candidates/java/17.0.6-tem'),
-- },
-- {
-- name = 'JavaSE-18',
-- path = vim.fn.expand('~/.sdkman/candidates/java/18.0.2-amzn'),
-- },
}
cache_vars.paths = path
return path
end
local function enable_codelens(bufnr)
pcall(vim.lsp.codelens.refresh)
vim.api.nvim_create_autocmd('BufWritePost', {
buffer = bufnr,
group = java_cmds,
desc = 'refresh codelens',
callback = function()
pcall(vim.lsp.codelens.refresh)
end,
})
end
local function enable_debugger(bufnr)
require('jdtls').setup_dap({hotcodereplace = 'auto'})
require('jdtls.dap').setup_dap_main_class_configs()
local opts = {buffer = bufnr}
vim.keymap.set('n', '<leader>df', "<cmd>lua require('jdtls').test_class()<cr>", opts)
vim.keymap.set('n', '<leader>dn', "<cmd>lua require('jdtls').test_nearest_method()<cr>", opts)
end
local function jdtls_on_attach(client, bufnr)
if features.debugger then
enable_debugger(bufnr)
end
if features.codelens then
enable_codelens(bufnr)
end
-- The following mappings are based on the suggested usage of nvim-jdtls
-- https://github.com/mfussenegger/nvim-jdtls#usage
local opts = {buffer = bufnr}
vim.keymap.set('n', 'cri', "<cmd>lua require('jdtls').organize_imports()<cr>", opts)
vim.keymap.set('n', 'crv', "<cmd>lua require('jdtls').extract_variable()<cr>", opts)
vim.keymap.set('x', 'crv', "<esc><cmd>lua require('jdtls').extract_variable(true)<cr>", opts)
vim.keymap.set('n', 'crc', "<cmd>lua require('jdtls').extract_constant()<cr>", opts)
vim.keymap.set('x', 'crc', "<esc><cmd>lua require('jdtls').extract_constant(true)<cr>", opts)
vim.keymap.set('x', 'crm', "<esc><Cmd>lua require('jdtls').extract_method(true)<cr>", opts)
end
local function jdtls_setup(event)
local jdtls = require('jdtls')
local path = get_jdtls_paths()
local data_dir = path.data_dir .. '/' .. vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t')
if cache_vars.capabilities == nil then
jdtls.extendedClientCapabilities.resolveAdditionalTextEditsSupport = true
local ok_cmp, cmp_lsp = pcall(require, 'cmp_nvim_lsp')
cache_vars.capabilities = vim.tbl_deep_extend(
'force',
vim.lsp.protocol.make_client_capabilities(),
ok_cmp and cmp_lsp.default_capabilities() or {}
)
end
-- The command that starts the language server
-- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line
local cmd = {
'java',
'-Declipse.application=org.eclipse.jdt.ls.core.id1',
'-Dosgi.bundles.defaultStartLevel=4',
'-Declipse.product=org.eclipse.jdt.ls.core.product',
'-Dlog.protocol=true',
'-Dlog.level=ALL',
'-javaagent:' .. path.java_agent,
'-Xms1G',
'--add-modules=ALL-SYSTEM',
'--add-opens',
'java.base/java.util=ALL-UNNAMED',
'--add-opens',
'java.base/java.lang=ALL-UNNAMED',
'-jar', path.launcher_jar,
'-configuration', path.platform_config,
'-data', data_dir,
}
local lsp_settings = {
java = {
-- jdt = {
-- ls = {
-- vmargs = "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m"
-- }
-- },
eclipse = {
downloadSources = true,
},
configuration = {
updateBuildConfiguration = 'interactive',
runtimes = path.runtimes,
},
maven = {
downloadSources = true,
},
implementationsCodeLens = {
enabled = true,
},
referencesCodeLens = {
enabled = true,
},
-- inlayHints = {
-- parameterNames = {
-- enabled = 'all' -- literals, all, none
-- }
-- },
format = {
enabled = true,
-- settings = {
-- profile = 'asdf'
-- },
}
},
signatureHelp = {
enabled = true,
},
completion = {
favoriteStaticMembers = {
'org.hamcrest.MatcherAssert.assertThat',
'org.hamcrest.Matchers.*',
'org.hamcrest.CoreMatchers.*',
'org.junit.jupiter.api.Assertions.*',
'java.util.Objects.requireNonNull',
'java.util.Objects.requireNonNullElse',
'org.mockito.Mockito.*',
},
},
contentProvider = {
preferred = 'fernflower',
},
extendedClientCapabilities = jdtls.extendedClientCapabilities,
sources = {
organizeImports = {
starThreshold = 9999,
staticStarThreshold = 9999,
}
},
codeGeneration = {
toString = {
template = '${object.className}{${member.name()}=${member.value}, ${otherMembers}}',
},
useBlocks = true,
},
}
-- This starts a new client & server,
-- or attaches to an existing client & server depending on the `root_dir`.
jdtls.start_or_attach({
cmd = cmd,
settings = lsp_settings,
on_attach = jdtls_on_attach,
capabilities = cache_vars.capabilities,
root_dir = jdtls.setup.find_root(root_files),
flags = {
allow_incremental_sync = true,
},
init_options = {
bundles = path.bundles,
},
})
end
vim.api.nvim_create_autocmd('FileType', {
group = java_cmds,
pattern = {'java'},
desc = 'Setup jdtls',
callback = jdtls_setup,
})

3
after/ftplugin/norg.lua Normal file
View File

@ -0,0 +1,3 @@
vim.api.nvim_set_option_value("textwidth",
tonumber(vim.api.nvim_get_option_value("colorcolumn", {})), { buf = 0 })
vim.api.nvim_win_set_option(0, 'colorcolumn', '0')

View File

@ -0,0 +1,16 @@
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',
}
}

View File

@ -0,0 +1,10 @@
local status_ok, indent = pcall(require, "auto-indent")
if not status_ok then
return
end
indent.setup {
indentexpr = function(lnum)
return require("nvim-treesitter.indent").get_indent(lnum)
end
}

View File

@ -0,0 +1,8 @@
local status_ok, autopairs = pcall(require, "ultimate-autopair")
if not status_ok then
return
end
autopairs.setup {
ignored_next_char = string.gsub("!@#$%^&*()_+", "%s+", "")
}

143
after/plugin/cmp.lua Normal file
View File

@ -0,0 +1,143 @@
local status_ok, cmp = pcall(require, "cmp")
if not status_ok then
return
end
local function has_words_before()
unpack = unpack or table.unpack
local line, col = unpack(a.nvim_win_get_cursor(0))
return col ~= 0 and a.nvim_buf_get_lines(0, line - 1, line, true)
[1]:sub(col, col):match("%s") == nil
end
local luasnip = require('luasnip')
local neogen = require('neogen')
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup {
sources = cmp.config.sources({
{ name = 'nvim_lsp', priority = 999 },
{ name = 'luasnip_choice', priority = 750 },
{ name = 'buffer', max_item_count = 3 },
{ name = 'async_path', max_item_count = 5 },
{ name = 'nvim_lua' },
{ name = 'neorg' },
{ name = 'calc' },
{ name = 'cmdline' },
{ name = 'nvim_lsp_signature_help' }
}),
window = {
completion = {
scrollbar = false,
border = 'solid',
winhighlight = "Normal:WinBarNC,FloatBorder:WinBarNC,Search:WinBarNC",
},
documentation = {
border = 'solid',
winhighlight = "Normal:WinBarNC,FloatBorder:WinBarNC,Search:WinBarNC",
}
},
view = {
entries = { name = 'custom', selection_order = 'near_cursor' },
},
experimental = {
ghost_text = true
},
formatting = {
fields = {'menu', 'abbr', 'kind'},
format = function(entry, item)
local menu_icon = {
nvim_lsp = 'λ',
nvim_lua = 'v',
calc = '+',
luasnip = '%',
buffer = '@',
path = '#',
}
item.menu = menu_icon[entry.source.name]
return item
end,
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
-- mappings -----------------------------------------------------------------
mapping = cmp.mapping.preset.insert({
["<Tab>"] = cmp.mapping(function(fallback)
if #cmp.get_entries() == 1 then
cmp.confirm({ select = true })
elseif cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
if #cmp.get_entries() == 1 then
cmp.confirm({ select = true })
end
elseif neogen.jumpable() then
neogen.jump_next()
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)
elseif neogen.jumpable(true) then
neogen.jump_prev()
else
fallback()
end
end, { "i", "s" }),
['<CR>'] = cmp.mapping {
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
else
fallback()
end
end,
s = cmp.mapping.confirm({ select = true }),
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace,
select = true }),
},
["<C-u>"] = cmp.mapping.scroll_docs(-4),
["<C-d>"] = cmp.mapping.scroll_docs(4),
['<ESC>'] = cmp.mapping.close(),
["<C-e>"] = cmp.mapping.abort(),
}),
sorting = {
comparators = {
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
require("cmp-under-comparator").under,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
}
},
enabled = function()
local context = require 'cmp.config.context'
if a.nvim_get_mode().mode == 'c' then
return true
else
return not context.in_treesitter_capture("comment")
and not context.in_syntax_group("Comment")
end
end
}

View File

@ -1,4 +1,9 @@
require('colorizer').setup { local status_ok, colorizer = pcall(require, "colorizer")
if not status_ok then
return
end
colorizer.setup {
filetypes = { '*' }, filetypes = { '*' },
user_default_options = { user_default_options = {
names = false, names = false,

6
after/plugin/comment.lua Normal file
View File

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

16
after/plugin/dressing.lua Normal file
View File

@ -0,0 +1,16 @@
local status_ok, dressing = pcall(require, "dressing")
if not status_ok then
return
end
dressing.setup {
input = {
enabled = true,
title_pos = "center",
border = 'single',
relative = "win"
},
select = {
enabled = true,
}
}

14
after/plugin/fidget.lua Normal file
View File

@ -0,0 +1,14 @@
local status_ok, fidget = pcall(require, "fidget")
if not status_ok then
return
end
fidget.setup {
text = {
spinner = "line",
done = ":)",
},
window = {
zindex = 1,
}
}

View File

@ -0,0 +1,9 @@
local status_ok, yodel = pcall(require, "git-yodel")
if not status_ok then
return
end
yodel.setup {
border = 'shadow',
position = 'auto'
}

69
after/plugin/gitsigns.lua Normal file
View File

@ -0,0 +1,69 @@
local status_ok, gitsigns = pcall(require, "gitsigns")
if not status_ok then
return
end
gitsigns.setup {
signs = {
add = { text = '' },
change = { text = '' },
delete = { text = '-' },
topdelete = { text = '' },
changedelete = { text = '~' },
untracked = { text = '' },
},
signcolumn = true,
numhl = false,
linehl = false,
word_diff = false,
watch_gitdir = {
interval = 1000,
follow_files = true
},
attach_to_untracked = true,
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
preview_config = {
border = 'shadow',
},
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map('n', ']c', function()
if vim.wo.diff then return ']c' end
vim.schedule(function() gs.next_hunk() end)
return '<Ignore>'
end, {expr=true})
map('n', '[c', function()
if vim.wo.diff then return '[c' end
vim.schedule(function() gs.prev_hunk() end)
return '<Ignore>'
end, {expr=true})
-- Actions
map('n', '<leader>hs', gs.stage_hunk)
map('n', '<leader>hr', gs.reset_hunk)
map('v', '<leader>hs', function() gs.stage_hunk {vim.fn.line('.'), vim.fn.line('v')} end)
map('v', '<leader>hr', function() gs.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end)
map('n', '<leader>hS', gs.stage_buffer)
map('n', '<leader>hu', gs.undo_stage_hunk)
map('n', '<leader>hR', gs.reset_buffer)
map('n', '<leader>hp', gs.preview_hunk)
map('n', '<leader>hb', function() gs.blame_line{full=true} end)
map('n', '<leader>tb', gs.toggle_current_line_blame)
map('n', '<leader>hd', gs.diffthis)
map('n', '<leader>hD', function() gs.diffthis('~') end)
map('n', '<leader>td', gs.toggle_deleted)
-- Text object
map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
end
}

29
after/plugin/glance.lua Normal file
View File

@ -0,0 +1,29 @@
local status_ok, glance = pcall(require, "glance")
if not status_ok then
return
end
glance.setup {
detached = function(winid)
return vim.api.nvim_win_get_width(winid) < 100
end,
border = {
enable = true,
top_char = '',
},
theme = {
enable = false,
},
folds = {
fold_closed = '>',
fold_open = 'V',
folded = true,
},
indent_lines = {
enable = false,
},
winbar = {
enable = true,
},
}

6
after/plugin/harpoon.lua Normal file
View File

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

View File

@ -0,0 +1,28 @@
local status_ok, headlines = pcall(require, "headlines")
if not status_ok then
return
end
headlines.setup {
norg = {
headline_highlights = {
"@neorg.headings.1.title",
"@neorg.headings.2.title",
"@neorg.headings.3.title",
"@neorg.headings.4.title",
"@neorg.headings.5.title",
"@neorg.headings.6.title"
},
bullets = { "", "", "", "" },
},
markdown = {
headline_highlights = {
"@neorg.headings.1.title",
"@neorg.headings.2.title",
"@neorg.headings.3.title",
"@neorg.headings.4.title",
"@neorg.headings.5.title",
"@neorg.headings.6.title"
}
},
}

View File

@ -0,0 +1,15 @@
local status_ok, ibl = pcall(require, "ibl")
if not status_ok then
return
end
ibl.setup {
indent = {
char = '',
},
scope = {
enabled = true,
show_start = false,
show_end = false
},
}

23
after/plugin/jabs.lua Normal file
View File

@ -0,0 +1,23 @@
local status_ok, jabs = pcall(require, "jabs")
if not status_ok then
return
end
jabs.setup {
offset = { bottom = 2, right = 2 },
symbols = {
current = "@",
split = "|",
alternate = "*",
hidden = "\\",
locked = "=",
ro = "=",
edited = "+",
terminal = ">_",
default_file = "~",
terminal_symbol = ">_",
},
use_devicons = false,
}

92
after/plugin/lsp.lua Normal file
View File

@ -0,0 +1,92 @@
local status_ok, lspconfig = pcall(require, "lspconfig")
if not status_ok then
return
end
-- configure lsp when attached
local function lsp_attach(client, bufnr)
-- helper functions
local function set_lsp_sign(name, text)
vim.fn.sign_define(name, { text = text, texthl = name })
end
local function map(m, lhs, rhs)
local opts = { remap = false, silent = true, buffer = bufnr }
vim.keymap.set(m, lhs, rhs, opts)
end
set_lsp_sign("DiagnosticSignError", "x")
set_lsp_sign("DiagnosticSignWarn" , "!")
set_lsp_sign("DiagnosticSignInfo" , "i")
set_lsp_sign("DiagnosticSignHint" , "h")
-- LSP actions
map('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>')
map('n', 'gD', '<cmd>lua vim.lsp.buf.definition()<cr>')
-- map('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>')
map('n', 'gI', '<cmd>lua vim.lsp.buf.implementation()<cr>')
map('n', 'gY', '<cmd>lua vim.lsp.buf.type_definition()<cr>')
map('n', 'gR', '<cmd>lua vim.lsp.buf.references()<cr>')
map('n', '<S-Tab>', '<cmd>lua vim.lsp.buf.signature_help()<cr>')
map('n', '<leader>lr', '<cmd>lua vim.lsp.buf.rename()<cr>')
map('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>')
map('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>')
-- Diagnostics
map('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<cr>')
map('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<cr>')
vim.api.nvim_buf_create_user_command(bufnr, 'LspFormat', function()
vim.lsp.buf.format()
end, {desc = 'Format buffer with language server'})
vim.api.nvim_buf_create_user_command('LspWorkspaceAdd', function()
vim.lsp.buf.add_workspace_folder()
end, { desc = 'Add folder to workspace' })
vim.api.nvim_buf_create_user_command('LspWorkspaceList', function()
vim.notify(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, { desc = 'List workspace folders' })
vim.api.nvim_buf_create_user_command('LspWorkspaceRemove', function()
vim.lsp.buf.remove_workspace_folder()
end, { desc = 'Remove folder from workspace' })
end
vim.diagnostic.config({
virtual_text = false,
signs = true,
update_in_insert = false,
underline = true,
severity_sort = true,
})
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
vim.lsp.handlers.hover, {
border = 'solid',
})
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
vim.lsp.handlers.signature_help, {
border = 'solid',
})
-- get servers and attach to them
local status_ok1, mason = pcall(require, "mason")
if not status_ok1 then
return
end
mason.setup {}
local status_ok2, masonlspconfig = pcall(require, "mason-lspconfig")
if not status_ok2 then
return
end
masonlspconfig.setup {}
masonlspconfig.setup_handlers {
function (server_name)
lspconfig[server_name].setup { on_attach = lsp_attach }
end,
-- specific servers can be setup as follows:
-- ["rust_analyzer"] = function ()
-- require("rust-tools").setup {}
-- end
-- check out :help mason-lspconfig for more info
}

13
after/plugin/lsplines.lua Normal file
View File

@ -0,0 +1,13 @@
local status_ok, lines = pcall(require, "lsp_lines")
if not status_ok then
return
end
lines.setup()
vim.diagnostic.config {
virtual_lines = {
highlight_whole_line = false,
only_current_line = true
}
}

View File

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

15
after/plugin/luasnip.lua Normal file
View File

@ -0,0 +1,15 @@
local status_ok, luasnip = pcall(require, "luasnip")
if not status_ok then
return
end
luasnip.config.set_config {
-- return back into snippet
history = true,
-- update on text insert
updateevents = "TextChanged,TextChangedI"
}
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_snipmate").lazy_load()

8
after/plugin/marks.lua Normal file
View File

@ -0,0 +1,8 @@
local status_ok, marks = pcall(require, "marks")
if not status_ok then
return
end
marks.setup {
default_mappings = true,
}

29
after/plugin/mason.lua Normal file
View File

@ -0,0 +1,29 @@
local status_ok, mason = pcall(require, "mason")
if not status_ok then
return
end
mason.setup {
ui = {
border = "shadow",
width = 0.6,
height = 0.9,
icons = {
package_installed = "+",
package_pending = "?",
package_uninstalled = "x"
}
},
keymaps = {
toggle_package_expand = "<CR>",
install_package = "i", -- Keymap to install the package under the current cursor position
update_package = "u", -- Keymap to reinstall/update the package under the current cursor position
check_package_version = "c", -- Keymap to check for new version for the package under the current cursor position
update_all_packages = "U", -- Keymap to update all installed packages
check_outdated_packages = "C", -- Keymap to check which installed packages are outdated
uninstall_package = "r", -- Keymap to uninstall a package
cancel_installation = "<C-c>", -- Keymap to cancel a package installation
apply_language_filter = "<C-f>", -- Keymap to apply language filter
},
}

View File

@ -0,0 +1,17 @@
local status_ok, masontool = pcall(require, "mason-tool-installer")
if not status_ok then
return
end
masontool.setup {
ensure_installed = {
'lua-language-server',
'bash-language-server',
'editorconfig-checker',
'stylua',
'shellcheck',
'clangd',
'html-lsp',
'css-lsp',
},
}

10
after/plugin/neogen.lua Normal file
View File

@ -0,0 +1,10 @@
local status_ok, neogen = pcall(require, "neogen")
if not status_ok then
return
end
neogen.setup {
enabled = true,
input_after_comment = true,
snippet_engine = "luasnip",
}

65
after/plugin/neorg.lua Normal file
View File

@ -0,0 +1,65 @@
local status_ok, neorg = pcall(require, "neorg")
if not status_ok then
return
end
local status_ok2, luarocks = pcall(require, "luarocks-nvim")
if not status_ok2 then
return
end
luarocks.setup {}
local wsphome = (os.getenv("XDG_DOCUMENTS_DIR") or
(os.getenv("HOME").."/Documents")).."/notes/"
neorg.setup {
load = {
["core.defaults"] = {},
["core.esupports.metagen"] = {
config = {
type = "auto",
update_date = true,
}
},
["core.dirman"] = {
config = {
workspaces = {
home = wsphome.."home",
robotics = wsphome.."robotics",
school = wsphome.."school"
},
index = "index.norg",
default_workspace = "home"
}
},
["core.summary"] = {},
["core.concealer"] = {
config = {
dim_code_blocks = {
padding = { right = 2, },
content_only = false,
width = "content",
},
folds = false,
icon_preset = "basic",
}
},
["core.export"] = {},
["core.completion"] = {
config = {
engine = "nvim-cmp",
}
},
["core.qol.toc"] = {
config = {
close_after_use = true
}
},
["core.presenter"] = {
config = {
zen_mode = "zen-mode",
}
},
["core.integrations.telescope"] = {},
}
}

32
after/plugin/notify.lua Normal file
View File

@ -0,0 +1,32 @@
local status_ok, notify = pcall(require, "notify")
if not status_ok then
return
end
notify.setup {
timeout = 3000,
minimum_width = 35,
icons = {
DEBUG = "B",
ERROR = "x",
INFO = "i",
TRACE = "t",
WARN = "!"
},
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)
if record.title[1] == '' then record.title[1] = 'Unkown' end
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)
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, notif.message)
end,
}

20
after/plugin/project.lua Normal file
View File

@ -0,0 +1,20 @@
local status_ok, project = pcall(require, "project_nvim")
if not status_ok then
return
end
project.setup {
detection_methods = { "pattern", "lsp" },
patterns = {
".git",
"Makefile",
"_darcs",
".hg",
".bzr",
".svn",
"package.json",
"index.norg"
},
show_hidden = false,
scope = "tab"
}

View File

@ -1,12 +1,18 @@
local sfm = require('sfm') local status_ok, sfm = pcall(require, "sfm")
if not status_ok then
return
end
sfm.setup { sfm.setup {
view = { view = {
side = "left", -- side of the tree, can be `left`, `right` side = 'right',
width = 30 width = 35,
}, },
mappings = { mappings = {
custom_only = false, custom_only = false,
list = {
{ key = 's', action = 'toggle_selection' }
}
}, },
renderer = { renderer = {
icons = { icons = {
@ -25,16 +31,17 @@ sfm.setup {
folder_open = "", folder_open = "",
file = "", file = "",
}, },
selection = "*"
} }
}, }
}:load_extension('sfm-git', { }:load_extension('sfm-git', {
icons = { icons = {
staged = "^",
unstaged = "+", unstaged = "+",
unmerged = "", staged = "S",
renamed = ">", unmerged = "U",
renamed = "r",
untracked = "?", untracked = "?",
deleted = "x", deleted = "-",
ignored = "#" ignored = "?",
} }
}) })

View File

@ -0,0 +1,28 @@
local status_ok, smartsplits = pcall(require, "smart-splits")
if not status_ok then
return
end
smartsplits.setup {
default_amount = 3,
resize_mode = {
quit_key = '<leader>r',
resize_keys = {
'<C-h>',
'<C-j>',
'<C-k>',
'<C-l>',
},
silent = true,
hooks = {
on_enter = function()
vim.notify("Resize mode on", vim.log.levels.INFO, { title = "Smart Splits" })
vim.cmd('unmap <leader>r')
end,
on_leave = function()
vim.notify("Resize Mode off", vim.log.levels.INFO, { title = "Smart Splits" })
vim.keymap.set('n', '<leader>r', smartsplits.start_resize_mode, {})
end,
},
},
}

115
after/plugin/startpage.lua Normal file
View File

@ -0,0 +1,115 @@
local status_ok, alpha = pcall(require, "alpha")
if not status_ok then
return
end
local function button(sc, txt, cmd, kopts, opts)
opts = opts or {
position = "center",
shortcut = sc:gsub("<leader>", "LDR"),
cursor = 0,
width = 49,
align_shortcut = "right",
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(cmd, true, false, true)
vim.api.nvim_feedkeys(key, "t", false)
end
return {
type = "button",
val = txt,
opts = opts,
on_press = on_press,
}
end
local header = {
'█▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀▀▀█ █▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀▀▀█ ',
'█ ░█████▀▀▀▀▀█████▓▄ ▀▀▀▀ ░ ░█ ░█ ░█ █ ',
'█ ▒███████ ▓███████ ▒██ ▓███ ▓███ ▓███ █ ',
'█ ▓███████ ▓███████ ▓█████████████████ █ ',
'█ ▓███████ ▓███████ ███ ██████████████ █ ',
'█ ▓███████ ▓███████ ███ ██████████████ █ ',
'█ ▓███████ ▓███████ ███ ██████████████ █ ',
'█ ▓███████ ▓███████ ███▄██████████████ █ ',
'█ ▓███████ ▓███████ ██████▀▀██████████ █ ',
'▀ ▓███████ ▓███████▄ ▄▄███████████ █ ',
'█ ▓███████ ██████████████████ █▄▄▄',
'█ ▓███████▀▀ ▀ ▀ ▀████████████████▄ ▄ █',
'█▄▄▄▄▄▄▄ ▀ █▀▀▀▀▀▀▀▀▀▀▀▀█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█',
' █ ▀ █ ',
' ▀▀▀▀▀ ',
}
local footer = {
'▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄',
}
alpha.setup {
layout = {
{ 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>lua require("core.conf").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,
}
}

View File

@ -0,0 +1,78 @@
local status_ok, el = pcall(require, "el")
if not status_ok then
return
end
el.reset_windows()
local builtin = require("el.builtin")
local sections = require("el.sections")
local c = require("core.statusbar.components")
local function hl(fg, b)
b = b or false
return c.extract_hl({
bg = { ["StatusLine"] = "bg" },
fg = { [fg] = "fg" },
bold = b,
})
end
local modes = {
-- display name, mode, highlight group
n = { "Normal", "N", hl("@neorg.headings.1.title") },
niI = { "Normal", "N", hl("@neorg.headings.1.title") },
niR = { "Normal", "N", hl("@neorg.headings.1.title") },
niV = { "Normal", "N", hl("@neorg.headings.1.title") },
no = { "N·OpPd", "?" },
v = { "Visual", "V", hl("@neorg.headings.2.title") },
V = { "V·Line", "Vl", hl("@neorg.headings.2.title") },
[""] = { "V·Block", "Vb", hl("@neorg.headings.2.title") },
s = { "Select", "S" },
S = { "S·Line", "Sl" },
[""] = { "S·Block", "Sb" },
i = { "Insert", "I", hl("@neorg.headings.4.title") },
ic = { "ICompl", "Ic" },
R = { "Replace", "R", hl("@neorg.headings.5.title") },
Rv = { "VReplace", "Rv", hl("@neorg.headings.5.title") },
c = { "Command", "C", hl("@neorg.headings.3.title") },
cv = { "Vim Ex", "E" },
ce = { "Ex (r)", "E" },
r = { "Prompt", "P" },
rm = { "More", "M" },
["r?"] = { "Confirm", "Cn" },
["!"] = { "Shell", "S" },
nt = { "Term", "T" },
t = { "Term", "T" },
}
el.setup {
generator = function()
return {
{ { " " }, c.mode { modes = modes, hl_icon_only = false } },
{ sections.split, required = true },
{ sections.collapse_builtin { { builtin.filetype }, { " " } } },
{ sections.maximum_width(c.fn_tail, 0.50), required = true },
{ sections.collapse_builtin { { " " }, { builtin.modified_flag } } },
{ sections.split, required = true },
{ c.lsp_srvname },
{ c.diagnostics {
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]",
hl_insert = hl("GitSignsAdd", true),
hl_change = hl("GitSignsChange", true),
hl_delete = hl("GitSignsDelete", true),
}},
{ { " " }, c.line {
fmt = "[%s]",
}, required = true },
}
end
}

8
after/plugin/tabline.lua Normal file
View File

@ -0,0 +1,8 @@
local status_ok, tabline = pcall(require, "tar")
if not status_ok then
return
end
tabline.setup {
closeicon = "%#Constant#[x]"
}

View File

@ -0,0 +1,97 @@
local status_ok, telescope = pcall(require, "telescope")
if not status_ok then
return
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 0.8
end
end
telescope.setup {
defaults = {
borderchars = {
prompt = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
results = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
preview = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
},
winblend = 0,
layout_strategy = 'horizontal',
sorting_strategy = 'descending',
scroll_strategy = 'limit',
layout_config = {
horizontal = {
width = telescopew(),
height = 20,
prompt_position = 'bottom',
anchor = 'N',
}
},
preview = {
-- add image previews via chafa
mime_hook = function(filepath, bufnr, opts)
local function is_image(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) and vim.fn.executable('chafa') == 1 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',
'23x18', '--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
},
mappings = {
i = {
["<esc>"] = actions.close,
['<C-h>'] = 'which_key',
['<C-j>'] = actions.move_selection_next,
['<C-k>'] = actions.move_selection_previous,
['<C-l>'] = actions.select_default,
['<C-u>'] = actions.preview_scrolling_up,
['<C-d>'] = actions.preview_scrolling_down,
["<C-p>"] = action_layout.toggle_preview
},
n = {
["gg"] = actions.move_to_top,
["G"] = actions.move_to_bottom,
},
},
}
}
telescope.load_extension('file_browser')
telescope.load_extension('projects')
telescope.load_extension('fzf')
telescope.load_extension('harpoon')
a.nvim_create_autocmd('User', {
pattern = 'TelescopePreviewerLoaded',
callback = function()
vim.opt.winblend = 0
end,
})

View File

@ -0,0 +1,36 @@
local status_ok, todocomments = pcall(require, "todo-comments")
if not status_ok then
return
end
todocomments.setup {
keywords = {
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" },
},
},
}

36
after/plugin/ts.lua Normal file
View File

@ -0,0 +1,36 @@
local status_ok, treesitter = pcall(require, "nvim-treesitter.configs")
if not status_ok then
return
end
treesitter.setup {
ensure_installed = {
"c",
"lua",
"bash",
"vim",
"vimdoc",
"query",
"git_rebase",
"gitattributes",
"gitcommit",
"gitignore",
"git_config",
},
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
disable = function(lang, buf)
if lang == "diff" then return true end
local max_filesize = 1024 * 100 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end
},
indent = {
enable = true
}
}

10
after/plugin/tsc.lua Normal file
View File

@ -0,0 +1,10 @@
local status_ok, tc = pcall(require, "treesitter-context")
if not status_ok then
return
end
tc.setup{
enable = true,
line_numbers = true,
separator = '-',
}

9
after/plugin/tsj.lua Normal file
View File

@ -0,0 +1,9 @@
local status_ok, treesj = pcall(require, "treesj")
if not status_ok then
return
end
treesj.setup {
use_default_keymaps = false,
max_join_length = 120,
}

View File

@ -0,0 +1,3 @@
if (g.loaded_undotree) then
g.undotree_DiffAutoOpen = 0
end

8
after/plugin/urlview.lua Normal file
View File

@ -0,0 +1,8 @@
local status_ok, urlview = pcall(require, "urlview")
if not status_ok then
return
end
urlview.setup {
default_picker = 'telescope',
}

21
after/plugin/whichkey.lua Normal file
View File

@ -0,0 +1,21 @@
local status_ok, whichkey = pcall(require, "which-key")
if not status_ok then
return
end
whichkey.setup {
icons = {
breadcrumb = '>>',
separator = '->',
},
winblend = 0,
window = {
border = 'shadow',
margin = { 1, .1, 2, .1 },
},
layout = {
width = { min = 20, max = 50 },
align = 'center',
}
}

89
colors/mellow.ext.lua Normal file
View File

@ -0,0 +1,89 @@
vim.cmd('runtime mellow')
local function highlight(group, opts, space)
space = space or 0
if type(group) == 'table' then
for i in pairs(group) do
a.nvim_set_hl(space, group[i], opts)
end
elseif type(group) == 'string' then
a.nvim_set_hl(space, group, opts)
end
end
local function cpyhl(hlgroup)
local ok, hl = pcall(vim.api.nvim_get_hl_by_name, hlgroup, true)
if not ok then return end
for _, key in pairs({"foreground", "background", "special"}) do
if hl[key] then
hl[key] = string.format("#%06x", hl[key])
end
end
return hl
end
local function getcolor(index, fallback)
return vim.g['terminal_color_' .. index] or fallback
end
local colors = {
black = getcolor(0, 'Black'),
red = getcolor(1, 'Red'),
green = getcolor(2, 'Green'),
yellow = getcolor(3, 'Yellow'),
blue = getcolor(4, 'Blue'),
magenta = getcolor(5, 'Magenta'),
cyan = getcolor(6, 'Cyan'),
white = getcolor(7, 'White'),
bright_black = getcolor(8, 'DarkGrey'),
bright_red = getcolor(9, 'LightRed'),
bright_green = getcolor(10, 'LightGreen'),
bright_yellow = getcolor(11, 'LightYellow'),
bright_blue = getcolor(12, 'LightBlue'),
bright_magenta = getcolor(13, 'LightMagenta'),
bright_cyan = getcolor(14, 'LightCyan'),
bright_white = getcolor(15, 'LightGray'),
}
if pcall(require, "mellow") then c = require('mellow.colors').dark end
-- remove tildas
highlight('EndOfBuffer', { fg = vim.g.terminal_color_background })
-- make all backgrounds the same color
highlight('NormalNC', cpyhl('Normal'))
highlight('NormalFloat', { bg = c.bg_dark })
highlight('FloatBorder', cpyhl('NormalFloat'))
-- plugin highlights ----------------------------------------------------------
-- telescope
highlight('TelescopeMatching', { fg = c.yellow })
-- alpha
highlight('AlphaHeader', { fg = colors.blue })
highlight('AlphaText', { fg = colors.blue })
highlight('AlphaShortcut', { bold = true })
highlight('AlphaFooter', { fg = colors.blue })
-- fidget
highlight('FidgetTask', { fg = vim.g.terminal_color_foreground })
-- sfm
highlight("SFMNormal", { bg = c.bg_dark })
highlight("SFMNormalNC", cpyhl("SFMNormal"))
highlight("SFMSignColumn", cpyhl("SFMNormal"))
-- norg + headings
highlight({ "@neorg.headings.1.title", "@neorg.headings.1.icon" },
{ fg = colors.yellow, bg = '#2a211c' })
highlight({ "@neorg.headings.2.title", "@neorg.headings.2.icon" },
{ fg = colors.blue, bg = '#201e25' })
highlight({ "@neorg.headings.3.title", "@neorg.headings.3.icon" },
{ fg = colors.cyan, bg = '#2b1b20' })
highlight({ "@neorg.headings.4.title", "@neorg.headings.4.icon" },
{ fg = colors.green, bg = '#1d201e' })
highlight({ "@neorg.headings.5.title", "@neorg.headings.5.icon" },
{ fg = colors.magenta, bg = '#251a21' })
highlight({ "@neorg.headings.6.title", "@neorg.headings.6.icon" },
{ fg = colors.white, bg = '#212126' })

View File

@ -1,9 +1,25 @@
-- global shorthands -- shorthands -----------------------------------------------------------------
o = vim.opt o = vim.opt
g = vim.g
a = vim.api a = vim.api
cmd = vim.cmd g = vim.g
g.mapleader = " " c = vim.cmd
-- load config -- performance ----------------------------------------------------------------
require('core.init') vim.loader.enable()
-- main lua files -------------------------------------------------------------
misc = require('core.misc')
misc.include('bootstrap')
misc.include('conf')
-- core lua files -------------------------------------------------------------
misc.include('core.conf')
misc.include('core.context')
-- call all snippets in the lua/snippets directory ----------------------------
if pcall(require, "luasnip") then
misc.include('snippet.shorthands')
for _, file in ipairs(vim.fn.readdir(vim.fn.stdpath('config')..'/lua/snippet',
[[v:val =~ '\.lua$']])) do
require('snippet.'..file:gsub('%.lua$', ''))
end
end

9
lua/.luarc.json Normal file
View File

@ -0,0 +1,9 @@
{
"diagnostics.globals": [
"g",
"o",
"a",
"vim",
],
"workspace.checkThirdParty": false
}

5
lua/bootstrap.lua Normal file
View File

@ -0,0 +1,5 @@
local path = vim.fn.stdpath("data").."/site/pack/deps/opt/dep"
if vim.fn.empty(vim.fn.glob(path)) > 0 then
vim.fn.system({ "git", "clone", "--depth=1", "https://git.squi.bid/dep", path })
end
vim.cmd("packadd dep")

87
lua/conf/auto.lua Normal file
View File

@ -0,0 +1,87 @@
local function auto(event, opts)
a.nvim_create_autocmd(event, opts)
end
local function augroup(name, opts)
opts = opts or {}
opts['clear'] = true
a.nvim_create_augroup(name, opts)
end
local winchange = augroup('winchange')
local bufcheck = augroup('bufcheck')
local toggles = augroup('toggles')
auto({ "FocusGained", "TermClose", "TermLeave" }, {
group = bufcheck,
desc = 'Update contents of file.',
command = "checktime",
})
auto("VimResized", {
group = winchange,
desc = 'Resize splits when window is resized.',
callback = function()
local current_tab = vim.fn.tabpagenr()
vim.cmd("tabdo wincmd =")
vim.cmd("tabnext " .. current_tab)
end,
})
auto('TextYankPost', {
group = bufcheck,
pattern = '*',
desc = 'Highlight on yank.',
callback = function()
vim.highlight.on_yank{ timeout = 250 }
end
})
auto('BufRead', {
pattern = '*',
group = bufcheck,
desc = 'Return to the last place the buffer was closed in.',
callback = function() vim.cmd([[call setpos(".", getpos("'\""))]]) end
})
auto('FileType', {
pattern = { 'gitcommit', 'markdown' },
desc = 'Spell checking and wrapping in commit buffers and markdown files.',
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end
})
auto('BufWritePre', {
pattern = '*',
group = bufcheck,
desc = 'Basically mkdir -p.',
callback = function(ctx)
if ctx.match:match("^%w%w+://") then return end
local dir = vim.fn.fnamemodify(ctx.file, ':p:h')
vim.fn.mkdir(dir, 'p')
end
})
auto('WinLeave', {
desc = 'Unset cursorline',
group = toggles,
callback = function() vim.opt.cursorline = false end
})
auto('WinEnter', {
desc = 'Set cursorline',
group = toggles,
callback = function()
if vim.bo.filetype ~= 'alpha' then
vim.opt.cursorline = true
end
end
})
auto('ColorScheme', {
desc = 'Update statusline on colorscheme change',
group = winchange,
callback = function() require('el').reset_windows() end
})

185
lua/conf/binds.lua Normal file
View File

@ -0,0 +1,185 @@
local conf = require('core.conf')
local function map(mode, bind, cmd, opts)
opts = opts or {}
opts['noremap'] = true
opts['silent'] = true
if type(bind) == 'table' then
for i in pairs(bind) do
vim.keymap.set(mode, bind[i], cmd, opts)
end
elseif type(bind) == 'string' then
vim.keymap.set(mode, bind, cmd, opts)
end
end
-- vim binds ------------------------------------------------------------------
g.mapleader = ' ' -- set leader key
map('x', '<leader>p', [["_dP]], { desc = 'Greatest remap of all time.' })
map('n', '<esc>', ':nohlsearch<Bar>:echo<CR>', { desc = 'Clear search.' })
map('t', '<esc>', '<C-\\><C-n>', { desc = 'make <esc> work in terminals.' })
-- move selected text up/down
map('v', '<S-k>', ":m '<-2<CR>gv=gv", { desc = 'Move selected text up.' })
map('v', '<S-j>', ":m '>+1<CR>gv=gv", { desc = 'Move selected text down.' })
-- the cursor STAYS IN THE MIDDLE
map('n', '<S-j>', 'mzJ`z<cmd>delm z<CR>') -- when combining lines
map('n', 'n', 'nzzzv') -- when searching
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', function() -- execute order 111
local fn = vim.fn.expand("%:p")
if vim.fn.getftype(fn) == "file" then
local perm = vim.fn.getfperm(fn)
if string.match(perm, "x", 3) then
vim.notify("Removed executable flags", vim.log.levels.INFO, { title = misc.appid })
vim.fn.setfperm(fn, string.sub(fn, 1, 2).."-"..string.sub(fn, 4, 5).."-"..string.sub(fn, 7, 8).."-")
else
vim.notify("Add executable flags", vim.log.levels.INFO, { title = misc.appid })
vim.fn.setfperm(fn, string.sub(fn, 1, 2).."x"..string.sub(fn, 4, 5).."x"..string.sub(fn, 7, 8).."x")
end
else
vim.notify("File doesn't exist", vim.log.levels.INFO, { title = misc.appid })
end
end)
-- add some keybinds to the file view (netrw)
a.nvim_create_autocmd('FileType', {
pattern = 'netrw',
callback = function()
local function bind(lhs, rhs)
vim.keymap.set('n', lhs, rhs, { remap = true, buffer = true })
end
bind('h', '-^') -- Go up a directory
bind('l', '<CR>') -- Go down a directory / open a file
bind('.', 'gh') -- Toggle hidden files
bind('P', '<C-w>z') -- Close preview window
bind('<esc>', '<cmd>q<CR>') -- Close netrw
end
})
-- tabs
map('n', '[]', '<cmd>tabnew<CR>')
map('n', '][', '<cmd>tabc<CR>')
map('n', '[[', '<cmd>tabp<CR>')
map('n', ']]', '<cmd>tabn<CR>')
-- config binds ---------------------------------------------------------------
map('n', '<leader>m', conf.configmenu, { desc = 'Neovim config manager menu', })
-- plugin binds ---------------------------------------------------------------
-- pretty lsp view
map('n', 'gd', '<CMD>Glance definitions<CR>')
map('n', 'gr', '<CMD>Glance references<CR>')
map('n', 'gy', '<CMD>Glance type_definitions<CR>')
map('n', 'gi', '<CMD>Glance implementations<CR>')
if pcall(require, "treesj") then
local treesj = require('treesj') -- treesj
map('n', '<leader>j', treesj.toggle)
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 Keymaps.' })
-- 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', telebuilt.live_grep, { desc = 'Find string in project.' })
-- 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
-- todo list
if pcall(require, "todo-comments") then
map("n", "<leader>td", "<cmd>TodoQuickFix<CR>", { desc = 'open up list of TODO\'s' })
end
-- harpoon
if (pcall(require, 'harpoon')) then
local harpoon = require("harpoon")
map("n", "<leader>a", function()
harpoon:list():append()
vim.notify('added new file to quickmarks', vim.log.levels.INFO, {
title = misc.appid,
})
end)
map('n', '<C-q>', function() harpoon:list():select(1) end)
map('n', '<C-g>', function() harpoon:list():select(2) end)
map('n', '<C-h>', function() harpoon:list():select(3) end)
map('n', '<C-i>', function() harpoon:list():select(4) end)
map("n", "<C-S-P>", function() harpoon:list():prev() end)
map("n", "<C-S-N>", function() harpoon:list():next() end)
map("n", "<C-e>", function() require("core.harpoon").switcher() 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', '<C-j>', '<cmd>JABSOpen<CR>', { desc = 'Switch between buffers.' })
if pcall(require, "smart-splits") then
local smartsplits = require('smart-splits') -- resizing buffers (toggleable)
map('n', '<leader>r', smartsplits.start_resize_mode)
end
-- neogen
if pcall(require, "neogen") then
map('n', '<leader>df', require("neogen").generate, {
desc = 'Generate anotations',
})
end
-- venn
function _G.Toggle_venn()
local mapb = vim.api.nvim_buf_set_keymap
local venn_enabled = vim.inspect(vim.b.venn_enabled)
if venn_enabled == "nil" then
vim.notify("Enabled venn mode", vim.log.levels.LOW, { title = misc.appid })
vim.b.venn_enabled = true
vim.cmd([[setlocal ve=all]])
-- draw a line on HJKL keystokes
mapb(0, "n", "J", "<C-v>j:VBox<CR>", { noremap = true })
mapb(0, "n", "K", "<C-v>k:VBox<CR>", { noremap = true })
mapb(0, "n", "L", "<C-v>l:VBox<CR>", { noremap = true })
mapb(0, "n", "H", "<C-v>h:VBox<CR>", { noremap = true })
-- draw a box by pressing "f" with visual selection
mapb(0, "v", "f", ":VBox<CR>", { noremap = true })
else
vim.notify("Disabled venn mode", vim.log.levels.LOW, { title = misc.appid })
vim.cmd[[setlocal ve=]]
vim.cmd[[mapclear <buffer>]]
vim.b.venn_enabled = nil
end
end
-- toggle keymappings for venn using <leader>v
map('n', '<leader>v', ":lua Toggle_venn()<CR>")

4
lua/conf/init.lua Normal file
View File

@ -0,0 +1,4 @@
misc.include('conf.plugins') -- load plugins first to allow colorscheme to be set in opts
misc.include('conf.opts')
misc.include('conf.binds')
misc.include('conf.auto')

65
lua/conf/opts.lua Normal file
View File

@ -0,0 +1,65 @@
-- better ui ------------------------------------------------------------------
if pcall(require, "notify") then vim.notify = require("notify") end
o.colorcolumn = { 80 }
-- buffer
o.scrolloff = 5
o.wrap = true -- wraping lines
o.linebreak = true -- fix where line is wraped
o.cursorline = true
-- statusbar
o.laststatus = 3
o.cmdheight = 1
o.showmode = false -- stop vim from showing mode (we have a statusbar)
-- tabline
o.showtabline = 2
-- indents + tabs
local tabwidth = 2
o.expandtab = true
o.smarttab = true
o.cindent = true
o.autoindent = true
o.tabstop = tabwidth
o.shiftwidth = tabwidth
o.softtabstop = tabwidth
-- colorscheme
if vim.fn.has("termguicolors") then
o.termguicolors = true
end
misc.colorscheme('mellow')
-- better editing -------------------------------------------------------------
o.clipboard = 'unnamedplus' -- system clipboard
o.splitkeep = "screen" -- keep same text on screen when spliting
o.updatetime = 200
-- file saving ----------------------------------------------------------------
o.swapfile = false
o.undofile = true
o.confirm = true
-- searching ------------------------------------------------------------------
o.ignorecase = true
o.smartcase = true
o.wrapscan = true
o.showmatch = true
o.incsearch = true
-- wild menus -----------------------------------------------------------------
o.wildoptions = 'pum'
o.pumblend = 3
o.pumheight = 20
o.wildignorecase = true
o.wildignore = '*.o'
-- netrw ----------------------------------------------------------------------
g.netrw_banner = 1
g.netrw_localcopydircmd = 'cp -r'
g.netrw_winsize = 30
g.netrw_liststyle = 1
g.netrw_preview = 1

167
lua/conf/plugins.lua Normal file
View File

@ -0,0 +1,167 @@
require('dep') {
-- dep manages dep ----------------------------------------------------------
{ 'squibid/dep',
url = 'https://git.squi.bid/dep',
pin = true,
-- branch = 'dev'
},
-- colorschemes -------------------------------------------------------------
{ 'mellow-theme/mellow.nvim',
requires = 'nvim-treesitter/nvim-treesitter'
},
-- ui -----------------------------------------------------------------------
{ 'lukas-reineke/indent-blankline.nvim' }, -- indentation indicators
{ 'folke/which-key.nvim' }, -- key map help
{ 'rcarriga/nvim-notify' }, -- notifications
{ 'tjdevries/express_line.nvim', -- status bar
requires = 'nvim-lua/plenary.nvim'
},
{ 'goolord/alpha-nvim' }, -- start page
{ 'dinhhuy258/sfm.nvim', -- tree view
deps = 'dinhhuy258/sfm-git.nvim'
},
{ 'matbme/JABS.nvim' }, -- buffer switcher
{ 'stevearc/dressing.nvim', -- nice ui selectors
requires = 'nvim-telescope/telescope.nvim'
},
{ 'lukas-reineke/headlines.nvim',
requires = 'nvim-neorg/neorg'
},
{ 'squibid/tar', -- tab bar
url = 'https://git.squi.bid/tar'
},
-- functional plugins -------------------------------------------------------
{ 'lewis6991/gitsigns.nvim' }, -- very helpful git things
{ 'chentoast/marks.nvim' }, -- marks in gutter
{ 'vidocqh/auto-indent.nvim' }, -- better tabbing into indents
{ 'mbbill/undotree' }, -- careful this one is written in vimscript
{ 'dhruvasagar/vim-table-mode' }, -- same with this one
{ 'altermo/ultimate-autopair.nvim', -- autopairs
branch = 'v0.6'
},
{ 'numToStr/Comment.nvim' },
{ 'ahmedkhalf/project.nvim' }, -- cd into root of project
{ 'mrjones2014/smart-splits.nvim'}, -- buffer resizing
{ 'ThePrimeagen/harpoon', -- super duper fast navigation through files
branch = 'harpoon2',
requires = 'nvim-lua/plenary.nvim'
},
-- note taking --------------------------------------------------------------
{ 'nvim-neorg/neorg',
branch = '*',
requires = {
'nvim-lua/plenary.nvim',
'nvim-treesitter/nvim-treesitter',
'folke/zen-mode.nvim',
{ 'vhyrro/luarocks.nvim',
config = function()
-- NOTE: you need the lua.h header file for lua version 5.1 and
-- luarocks on void linux run: xbps-install luarocks lua51-devel
local output = ""
local function cbstd(_, data, _)
data = table.concat(data)
data = data:gsub("\r", "\n")
output = output..data
end
-- actually start the build here
vim.fn.jobstart({ "nvim", "-l", "build.lua" }, {
on_stdout = cbstd,
on_stderr = cbstd,
on_exit = function()
-- return build status as a notification
vim.notify(output, vim.log.levels.INFO, { title = misc.appid })
end
})
end
}
},
deps = { 'nvim-neorg/neorg-telescope',
requires = 'nvim-telescope/telescope.nvim'
}
},
{ 'jbyuki/venn.nvim' },
-- fzf ----------------------------------------------------------------------
{ 'nvim-telescope/telescope.nvim',
requires = 'nvim-lua/plenary.nvim',
deps = {
'nvim-telescope/telescope-file-browser.nvim',
'nvim-telescope/telescope-symbols.nvim',
'axieax/urlview.nvim'
}
},
{ 'nvim-telescope/telescope-fzf-native.nvim',
config = function()
vim.cmd('make')
end,
requires = 'nvim-telescope/telescope.nvim'
},
-- treesitter + colorizing --------------------------------------------------
{ 'nvim-treesitter/nvim-treesitter',
deps = {
'Wansmer/treesj',
'nvim-treesitter/nvim-treesitter-context'
}
},
{ 'NvChad/nvim-colorizer.lua' },
{ 'folke/todo-comments.nvim',
requires = 'nvim-lua/plenary.nvim'
},
-- cmp ----------------------------------------------------------------------
{ 'hrsh7th/nvim-cmp',
deps = {
'lukas-reineke/cmp-under-comparator', -- better results
'hrsh7th/cmp-buffer', -- buffers
'FelipeLema/cmp-async-path', -- path
'hrsh7th/cmp-nvim-lsp', -- lsp
'hrsh7th/cmp-nvim-lua', -- nvim lua api
'hrsh7th/cmp-nvim-lsp-signature-help', -- completion information
{ 'L3MON4D3/cmp-luasnip-choice', -- luasnip
requires = 'L3MON4D3/LuaSnip'
}
},
},
-- snippets -----------------------------------------------------------------
{ 'L3MON4D3/LuaSnip',
deps = 'rafamadriz/friendly-snippets',
config = function()
vim.cmd('make install_jsregexp')
end
},
-- lsp ----------------------------------------------------------------------
{ 'neovim/nvim-lspconfig' }, -- setup lsp
{ 'j-hui/fidget.nvim', -- shows lsp progress
branch = 'legacy'
},
{ 'dnlhc/glance.nvim' }, -- diagnostic info at a glance
{ 'aznhe21/actions-preview.nvim', -- codeactions
requires = 'nvim-telescope/telescope.nvim'
},
{ 'danymat/neogen', -- generate lsp annotations
requires = 'nvim-treesitter/nvim-treesitter'
},
{ 'whynothugo/lsp_lines.nvim',
url = 'https://git.sr.ht/~whynothugo/lsp_lines.nvim'
},
-- mason --------------------------------------------------------------------
{ 'williamboman/mason.nvim',
deps = {
'WhoIsSethDaniel/mason-tool-installer.nvim',
'williamboman/mason-lspconfig.nvim'
}
}
}

View File

@ -1,73 +0,0 @@
a.nvim_create_augroup('bufcheck', {clear = true})
-- highlight yanks
a.nvim_create_autocmd('TextYankPost', {
group = 'bufcheck',
pattern = '*',
callback = function() vim.highlight.on_yank{timeout = 250} end
})
-- start terminal in insert mode
a.nvim_create_autocmd('TermOpen', {
group = 'bufcheck',
pattern = '*',
command = 'startinsert | set winfixheight'
})
-- close terminal buffers after shell dies
a.nvim_create_autocmd('TermClose', {
group = 'bufcheck',
pattern = 'term://*',
command = 'call nvim_input("<CR>")'
})
-- start git messages in insert mode
a.nvim_create_autocmd('FileType', {
group = 'bufcheck',
pattern = { 'gitcommit', 'gitrebase', },
command = 'startinsert | 1'
})
-- return to last place
a.nvim_create_autocmd('BufRead', {
pattern = '*',
command = [[call setpos(".", getpos("'\""))]]
})
-- disable color column in certain files
a.nvim_create_autocmd('FileType', {
pattern = {
'netrw',
"help",
"term",
"gitcommit",
"packer",
"vim",
"Trouble",
"norg",
"alpha"
},
command = 'set colorcolumn=0'
})
-- disable intent markers in certain files
a.nvim_create_autocmd('FileType', {
pattern = {
'netrw',
"help",
"term",
"gitcommit",
"packer",
"vim",
"Trouble",
"norg",
"alpha"
},
command = 'IndentBlanklineDisable'
})
-- disable extra tildas in certain files
a.nvim_create_autocmd('FileType', {
pattern = '*',
command = 'hi NonText guifg=bg'
})

81
lua/core/conf.lua Normal file
View File

@ -0,0 +1,81 @@
local pickers = require("telescope.pickers")
local finders = require("telescope.finders")
local previewers = require("telescope.previewers")
local conf = require("telescope.config").values
local actions = require("telescope.actions")
local action_state = require("telescope.actions.state")
local M = {}
local function genmenu()
local list = {}
local function add(name, plug)
if not plug then
table.insert(list, name)
elseif package.loaded[plug] then
table.insert(list, name)
end
end
add('Edit Config', nil)
add('Update Plugins', 'dep')
add('Keybinds', 'telescope')
add('Colorscheme', 'telescope')
return list
end
function M.configmenu()
pickers.new({
prompt_title = "Nvim Config Menu",
finder = finders.new_table { results = genmenu() },
sorter = conf.generic_sorter(),
previewer = previewers.new_buffer_previewer {
define_preview = function(self, entry)
local lines = {
'a'
}
if entry.value == "Edit Config" then
lines = misc.readf(vim.fn.stdpath('config')..'/init.lua')
local ft = vim.filetype.match({
filename = os.getenv('XDG_CONFIG_HOME')..'/nvim/init.lua' })
require("telescope.previewers.utils").highlighter(self.state.bufnr, ft)
elseif entry.value == "Colorscheme" then
lines = vim.fn.getcompletion('', 'color')
for k, v in pairs(lines) do
if v.find(v, '.ext') then
table.remove(lines, k)
break
end
end
end
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, lines)
end
},
attach_mappings = function(bufnr, map)
actions.select_default:replace(function()
actions.close(bufnr)
local selection = action_state.get_selected_entry()
if selection[1] == 'Edit Config' then
vim.cmd('e '..vim.fn.stdpath('config')..'/init.lua')
elseif selection[1] == 'Update Plugins' then
require('dep').sync()
if package.loaded['nvim-treesitter'] then
vim.cmd('TSUpdate')
end
if package.loaded['mason'] then
require('mason.api.command').MasonUpdate()
end
elseif selection[1] == 'Keybinds' then
require('telescope.builtin').keymaps()
elseif selection[1] == 'Colorscheme' then
require('core.theme').switcher()
end
end)
return true
end,
}):find()
end
return M

19
lua/core/context.lua Normal file
View File

@ -0,0 +1,19 @@
-- clear menu
vim.cmd([[:aunmenu PopUp]])
-- add menu items
vim.cmd([[:amenu PopUp.Save\ Buffer <cmd>:w<CR>]])
vim.cmd([[:amenu PopUp.Save\ All\ Buffers <cmd>:wa<CR>]])
vim.cmd([[:nmenu PopUp.Select\ All ggVG]])
vim.cmd([[:nmenu PopUp.Undo u]])
vim.cmd([[:nmenu PopUp.Redo <C-r>]])
vim.cmd([[:amenu PopUp.-1- <nop>]]) -- dividers
vim.cmd([[:nmenu PopUp.Copy\ Line yy]])
vim.cmd([[:vmenu PopUp.Copy\ Selection y]])
vim.cmd([[:amenu PopUp.Paste p]])
vim.cmd([[:vmenu PopUp.Cut d]])
vim.cmd([[:nmenu PopUp.Cut dd]])
vim.cmd([[:vmenu PopUp.-2- <nop>]]) -- dividers
vim.cmd([[:nmenu PopUp.-2- <nop>]]) -- dividers
vim.cmd([[:vmenu PopUp.Format\ Selection =]])
vim.cmd([[:nmenu PopUp.Format\ Line ==]])

61
lua/core/harpoon.lua Normal file
View File

@ -0,0 +1,61 @@
local pickers = require("telescope.pickers")
local finders = require("telescope.finders")
local conf = require("telescope.config").values
local actions = require("telescope.actions")
local action_set = require("telescope.actions.set")
local action_state = require("telescope.actions.state")
local harpoon = require('harpoon')
local M = {}
function M.switcher()
local filepaths = {}
for _, item in ipairs(harpoon:list().items) do
table.insert(filepaths, item.value)
end
pickers.new({
prompt_title = "Harpoon",
finder = finders.new_table { results = filepaths },
sorter = conf.generic_sorter(),
previewer = conf.file_previewer {},
attach_mappings = function(prompt_bufnr, map)
actions.move_selection_previous:replace(function()
action_set.shift_selection(prompt_bufnr, -1)
end)
actions.move_selection_next:replace(function()
action_set.shift_selection(prompt_bufnr, 1)
end)
-- remove harpoon item
vim.keymap.set("i", "<C-a>", function()
if action_state.get_selected_entry() then
for i, v in ipairs(filepaths) do
if v == action_state.get_selected_entry()[1] then
harpoon:list():removeAt(i)
actions.close(prompt_bufnr)
M.switcher()
end
end
end
end)
-- select items, and open buffer
vim.keymap.set("i", "<C-s>", function()
if action_state.get_selected_entry() then
actions.close(prompt_bufnr)
vim.cmd("split "..action_state.get_selected_entry()[1])
end
end, { buffer = true, remap = true })
actions.select_default:replace(function()
if action_state.get_selected_entry() then
actions.close(prompt_bufnr)
vim.cmd("e "..action_state.get_selected_entry()[1])
end
end)
return true
end
}):find()
end
return M

View File

@ -1,6 +0,0 @@
require('core.plugins')
require('core.opts')
require('core.maps')
require('core.auto')
require("core.snippets.init")
require('core.overrides.init')

View File

@ -1,165 +0,0 @@
local opts = { noremap = true, silent = true }
-- greatest remap ever
a.nvim_set_keymap("n", "<leader>p", "\"_dP", opts)
-- toggle terminal buffer
a.nvim_set_keymap("n", "<C-\\>", "<cmd>ToggleTerm size=20<CR>", opts)
a.nvim_set_keymap("t", "<C-\\>", "<cmd>ToggleTerm<CR>", opts)
-- esc to go to normal mode in term bufers
a.nvim_set_keymap("t", "<ESC>", "<C-\\><C-n>", opts)
-- open file viewer
a.nvim_set_keymap("n", "<leader>fo", ":Ex<CR>", opts)
a.nvim_set_keymap("n", "<leader>fs", ":Sex<CR>", opts)
a.nvim_set_keymap("n", "<leader>fh", ":Hex<CR>", opts)
a.nvim_set_keymap("n", "<leader>fv", ":Vex<CR>", opts)
-- clear search
a.nvim_set_keymap("n", "<ESC>", ":nohlsearch<Bar>:echo<CR>", opts)
-- move selected text
a.nvim_set_keymap("v", "<S-j>", ":m '>+1<CR>gv=gv", opts)
a.nvim_set_keymap("v", "<S-k>", ":m '<-2<CR>gv=gv", opts)
-- keep cursor middle
a.nvim_set_keymap("n", "<S-j>", "mzJ`z", opts) -- when combining lines
a.nvim_set_keymap("n", "n", "nzzzv", opts) -- searching
a.nvim_set_keymap("n", "N", "Nzzzv", opts)
a.nvim_set_keymap("n", "<C-d>", "<C-d>zz", opts) -- half page jumping
a.nvim_set_keymap("n", "<C-u>", "<C-u>zz", opts)
-- execute order 111
a.nvim_set_keymap("n", "<leader>x", "<cmd>!chmod +x %<CR>", opts)
-- add some keybinds to the file view
a.nvim_create_autocmd('FileType', {
pattern = 'netrw',
callback = function()
local bind = function(lhs, rhs)
vim.keymap.set('n', lhs, rhs, { remap = true, buffer = true })
end
bind('h', '-^') -- Go up a directory
bind('l', '<CR>') -- Go down a directory / open a file
bind('.', 'gh') -- Toggle dotfiles
bind('P', '<C-w>z') -- Close preview window
bind('<ESC>', '<cmd>q<CR>') -- Close netrw
end
})
-- plugin related binds
-- better indenting
a.nvim_set_keymap('i', '<tab>', '<cmd>lua require("intellitab").indent()<CR>', opts)
-- open Trouble buffer
a.nvim_set_keymap("n", "<leader>tt", "<cmd>TroubleToggle document_diagnostics<CR>", opts)
a.nvim_set_keymap("n", "<leader>td", "<cmd>TodoTrouble<CR>", opts)
-- dismiss notifications
a.nvim_set_keymap("n", "<leader>nd", "", { callback = require('notify').dismiss })
-- resizing splits
a.nvim_set_keymap("n", '<C-h>', "<cmd>SmartResizeLeft<CR>", opts)
a.nvim_set_keymap("n", '<C-j>', "<cmd>SmartResizeDown<CR>", opts)
a.nvim_set_keymap("n", '<C-k>', "<cmd>SmartResizeUp<CR>", opts)
a.nvim_set_keymap("n", '<C-l>', "<cmd>SmartResizeRight<CR>", opts)
-- don't blame me pls
a.nvim_set_keymap("n", "<C-g>", [[<cmd>Gitsigns toggle_current_line_blame<CR>]], opts)
-- telescope
a.nvim_set_keymap('n', '<leader>sf', '<cmd>Telescope find_files<CR>', opts)
a.nvim_set_keymap('n', '<leader>sg', '<cmd>Telescope git_commits<CR>', opts)
a.nvim_set_keymap('n', '<leader>sb', '<cmd>Telescope current_buffer_fuzzy_find<CR>', opts)
a.nvim_set_keymap('n', '<leader>so', '<cmd>Telescope oldfiles<CR>', opts)
a.nvim_set_keymap('n', '<leader>sc', '<cmd>Telescope neoclip unnamed<CR>', opts)
a.nvim_set_keymap('n', '<leader>su', '<cmd>Telescope undo<CR>', opts)
a.nvim_set_keymap('n', '<leader>sd', '<cmd>Telescope diagnostics<CR>', opts)
a.nvim_set_keymap('n', '<leader>sn', '<cmd>Telescope notify<CR>', opts)
-- treesitter
a.nvim_set_keymap('n', '<leader>j', '<cmd>TSJToggle<CR>', opts)
-- re-source snippets
a.nvim_set_keymap('n', '<leader><leader>s', '<cmd>source ~/.config/nvim/lua/core/snippets/init.lua<CR>', opts)
-- hover
vim.keymap.set('n', '<S-tab>', require("hover").hover_select, opts)
-- lsp diagnostics float
a.nvim_set_keymap('n', '<tab>', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
-- essentials
a.nvim_set_keymap('n', '<leader>eu', '<cmd>lua require("essentials").go_to_url()<CR>', opts)
a.nvim_set_keymap('n', '<leader>ec', '<cmd>lua require("essentials").cheat_sh()<CR>', opts)
-- return to home screen
a.nvim_set_keymap('n', '<leader>gh', '<cmd>Alpha<CR>', opts)
-- true zen
local truezen = require('true-zen')
local keymap = vim.keymap
keymap.set('n', '<leader>zn', function()
local first = 0
local last = vim.api.nvim_buf_line_count(0)
truezen.narrow(first, last)
end, { noremap = true })
keymap.set('v', '<leader>zn', function()
local first = vim.fn.line('v')
local last = vim.fn.line('.')
truezen.narrow(first, last)
end, { noremap = true })
a.nvim_set_keymap('n', '<leader>zf', '<cmd>lua require("true-zen.focus").toggle()<CR>', opts)
a.nvim_set_keymap('n', '<leader>zm', '<cmd>lua require("true-zen.minimalist").toggle()<CR>', opts)
a.nvim_set_keymap('n', '<leader>za', '<cmd>lua require("true-zen.ataraxis").toggle()<CR>', opts)
-- highlighting
a.nvim_set_keymap("v", "<leader>ha", ":<c-u>HSHighlight 1<CR>", opts)
a.nvim_set_keymap("v", "<leader>hc", ":<c-u>HSRmHighlight<CR>", opts)
-- code actions + renaming
a.nvim_set_keymap('n', '<leader>gn', '<cmd>lua require("cosmic-ui").rename()<CR>', opts)
a.nvim_set_keymap('v', '<leader>ga', '<cmd>lua require("cosmic-ui").range_code_actions()<CR>', opts)
a.nvim_set_keymap('n', '<leader>ga', '<cmd>lua require("cosmic-ui").code_actions()<CR>', opts)
-- glow
a.nvim_set_keymap('n', '<leader>gl', '<cmd>lua _glow()<CR>', opts)
-- open file tree
a.nvim_set_keymap('n', '<leader>to', '<cmd>SFMToggle<CR>', opts)
-- vbox note taking
function _G.Toggle_venn()
local venn_enabled = vim.inspect(vim.b.venn_enabled)
vim.notify = require('notify')
if venn_enabled == "nil" then
vim.b.venn_enabled = true
cmd[[setlocal ve=all]]
-- draw a line on HJKL keystokes
a.nvim_buf_set_keymap(0, "n", "J", "<C-v>j:VBox<CR>", {noremap = true})
a.nvim_buf_set_keymap(0, "n", "K", "<C-v>k:VBox<CR>", {noremap = true})
a.nvim_buf_set_keymap(0, "n", "L", "<C-v>l:VBox<CR>", {noremap = true})
a.nvim_buf_set_keymap(0, "n", "H", "<C-v>h:VBox<CR>", {noremap = true})
-- draw a box by pressing "f" with visual selection
a.nvim_buf_set_keymap(0, "v", "f", ":VBox<CR>", {noremap = true})
-- make easier to navigate
o.cursorcolumn = true
o.colorcolumn = { 0 }
-- notify
vim.notify("venn toggled on", "info", { title = "Neovim config" })
else
cmd[[setlocal ve=]]
cmd[[mapclear <buffer>]]
vim.b.venn_enabled = nil
o.cursorcolumn = false
o.colorcolumn = { 80 }
-- notify
vim.notify("venn toggled off", "info", { title = "Neovim config" })
end
end
-- toggle keymappings for venn using <leader>v
a.nvim_set_keymap('n', '<leader>v', ":lua Toggle_venn()<CR>", { noremap = true})

43
lua/core/misc.lua Normal file
View File

@ -0,0 +1,43 @@
local M = {}
M.appid = "Nvim Config"
function M.colorscheme(name)
vim.cmd('colorscheme '..name)
for k, v in pairs(vim.fn.getcompletion('', 'color')) do
if v == name..'.ext' then
vim.cmd('colorscheme '..name..'.ext')
end
end
end
function M.replaceword(old, new)
local conf = vim.fn.stdpath("config").."/lua/conf/".."opts.lua"
local f = io.open(conf, "r")
if not f then return end
local new_content = f:read("*all"):gsub(old, new)
f:close()
f = io.open(conf, "w")
if not f then return end
f:write(new_content)
f:close()
end
function M.include(fn)
if not pcall(require, fn) then
vim.notify('Could not find "'..fn, vim.log.levels.WARN..'"', { title = M.appid })
end
end
function M.readf(fn)
local f = io.open(fn, "r")
if not f then return nil end
local tab = {}
for l in f:lines() do
table.insert(tab, l)
end
return tab
end
return M

View File

@ -1,218 +0,0 @@
---------------
-- better ui --
---------------
o.number = true
o.relativenumber = true
o.numberwidth = 2 -- width o numberline
o.signcolumn = 'yes:1' -- show gutter
o.cursorline = true -- highlights the current line
o.scrolloff = 5 -- # lines below/above cursor
o.showmode = false -- stop vim from showing mode
o.cmdheight = 2 -- vim command height
o.mouse = "" -- no mouse
o.laststatus = 3 -- global statusline
o.wrap = true -- wrap lines
o.linebreak = true -- fix where line is wraped
o.emoji = false -- something to do with the spacing of emojis
o.clipboard = 'unnamedplus' -- use system clipboard
-- intenting & tabing
o.expandtab = true
o.smarttab = true
o.cindent = true
o.autoindent = true
o.tabstop = 2
o.shiftwidth = 2
o.softtabstop = -1 -- If negative, shiftwidth value is used
-- spelling
o.spelllang = { 'en_us' }
-- colors
o.termguicolors = true
cmd('colorscheme jellybeans-nvim')
-- diagnostics w/o virtual text
vim.diagnostic.config({
underline = true,
virtual_text = false
})
colors = {
black = '#000000',
black2 = '#161616',
black3 = '#0E0E0E',
black4 = '#101010',
grey = '#1E1E1E',
grey2 = '#404040',
white = '#ffffff',
red = '#E06C75',
orange = '#EA936C',
yellow = '#E5C07B',
green = '#98C379',
blue = '#61AFEF',
purple = '#C678DD',
pink = '#704A5A',
}
lspicons = {
Text = 'Tx',
Snippet = '<>',
Method = '',
Function = '{}',
Constructor = '',
Field = '""',
Variable = 'x=',
Class = '~{',
Interface = '.h',
Module = '',
Property = '@p',
Unit = '',
Value = '',
Enum = 'E#',
Keyword = '$1',
Color = '',
File = '#`',
Reference = '',
Folder = '[/',
EnumMember = '',
Constant = '',
Struct = '',
Event = '',
Operator = '%*',
TypeParameter = '',
}
-- width line
o.colorcolumn = { 80 }
-- custom opts
copts = {
tablines = 'colored', -- false, 'colored', and 'wrap'
minimapcolor = colors.grey2,
}
------------
-- saving --
------------
o.swapfile = false
o.undofile = true
o.confirm = true
------------
-- search --
------------
o.ignorecase = true
o.smartcase = true
o.wrapscan = true
o.showmatch = true
----------------
-- wild menus --
----------------
o.wildoptions = 'pum'
o.pumblend = 3
o.pumheight = 20
o.wildignorecase = true
o.wildignore = '*.o'
-----------
-- netrw --
-----------
g.netrw_banner = 0
g.netrw_localcopydircmd = 'cp -r'
g.netrw_winsize = 30
g.netrw_liststyle = 1
-----------------------
-- language settings --
-----------------------
g.c_syntax_for_h = true -- treat c header files as c files instead of c++ files
----------------
-- highlights --
----------------
-- transparent background
-- a.nvim_set_hl(0, "Normal", { bg = "" })
--
a.nvim_set_hl(0, "ColorColumn", { bg = colors.grey }) -- color column
a.nvim_set_hl(0, "Pmenu", { bg = colors.black2 })
a.nvim_set_hl(0, "PmenuSel", { bg = colors.grey2 })
a.nvim_set_hl(0, "CursorLineNr", { fg = colors.white, bold = true })
-- indent line colors
a.nvim_set_hl(0, "IndentBlanklineIndent1", { fg = colors.red } )
a.nvim_set_hl(0, "IndentBlanklineIndent2", { fg = colors.orange } )
a.nvim_set_hl(0, "IndentBlanklineIndent3", { fg = colors.yellow } )
a.nvim_set_hl(0, "IndentBlanklineIndent4", { fg = colors.green } )
a.nvim_set_hl(0, "IndentBlanklineIndent5", { fg = colors.blue } )
a.nvim_set_hl(0, "IndentBlanklineIndent6", { fg = colors.purple } )
-- code window
a.nvim_set_hl(0, 'CodewindowBorder', {fg = copts.minimapcolor})
-- diagnostics
a.nvim_set_hl(0, "DiagnosticVirtualTextHint", { fg = "#ffffff", bg = "#1E1E1E" })
a.nvim_set_hl(0, "DiagnosticVirtualTextInfo", { fg = "#006fd8", bg = "#152f47" })
a.nvim_set_hl(0, "DiagnosticVirtualTextWarn", { fg = "#E9AD5A", bg = "#533221" })
a.nvim_set_hl(0, "DiagnosticVirtualTextError",
{ fg = "#ED3B44", bg = "#4b1313" })
-- alpha start page 4chan edition
a.nvim_set_hl(0, "AlphaHeader", {fg = "#789922" })
a.nvim_set_hl(0, "AlphaEmphasis", {fg = "#DD0000" })
-- murmur (word highlights)
a.nvim_set_hl(0, "murmur_cursor_rgb", { bg = colors.grey2 })
-- cmp/treesitter stuff
a.nvim_set_hl(0, "CmpItemMenu", { fg = colors.purple, italic = true })
a.nvim_set_hl(0, "CmpItemKindSnippet", { bg = "#A377BF", bold = true })
a.nvim_set_hl(0, "CmpItemKindText", { bg = "#63bc47", bold = true })
a.nvim_set_hl(0, "CmpItemKindField", { bg = "#db7093", bold = true })
a.nvim_set_hl(0, "CmpItemKindVariable", { bg = "#ff8c00", bold = true })
a.nvim_set_hl(0, "CmpItemKindEnum", { bg = "#FF5733", bold = true })
a.nvim_set_hl(0, "CmpItemKindFunction", { bg = "#483d8b", bold = true })
a.nvim_set_hl(0, "CmpItemKindKeyword", { bg = "#FF339C", bold = true })
a.nvim_set_hl(0, "CmpItemKindProperty", { bg = "#4FBF63", bold = true })
a.nvim_set_hl(0, "CmpItemKindInterface", { bg = "#1e90ff", bold = true })
a.nvim_set_hl(0, "CmpItemKindClass", { bg = "#4D4C5C", bold = true })
a.nvim_set_hl(0, "CmpItemKindFile", { bg = "#E8D01C", bold = true })
a.nvim_set_hl(0, "CmpItemKindFolder", { bg = "#E8D01C", bold = true })
a.nvim_set_hl(0, "CmpItemKindOperator", { bg = "#E06C75", bold = true })
-- telescope
a.nvim_set_hl(0, "TelescopeMatching", { bg = colors.black3 })
a.nvim_set_hl(0, "TelescopeNormal", { bg = colors.black3 })
a.nvim_set_hl(0, "TelescopePreviewBorder", { bg = colors.black3 })
a.nvim_set_hl(0, "TelescopePreviewNormal", { bg = colors.black3 })
a.nvim_set_hl(0, "TelescopePreviewTitle", { bg = colors.black3,
fg = colors.black3 })
a.nvim_set_hl(0, "TelescopePromptBorder", { bg = colors.black2 })
a.nvim_set_hl(0, "TelescopePromptNormal", { bg = colors.black2 })
a.nvim_set_hl(0, "TelescopePromptPrefix", { bg = colors.black2 })
a.nvim_set_hl(0, "TelescopePromptTitle", { bg = colors.black2,
fg = colors.black2 })
a.nvim_set_hl(0, "TelescopeResultsBorder", { bg = colors.black4 })
a.nvim_set_hl(0, "TelescopeResultsNormal", { bg = colors.black4 })
a.nvim_set_hl(0, "TelescopeResultsTitle", { bg = colors.black4,
fg = colors.black4 })
a.nvim_set_hl(0, "TelescopeSelection", { bg = colors.black2 })
a.nvim_set_hl(0, "TelescopeSelectionCaret", { bg = colors.black2,
fg = colors.orange, bold = true })
-- sfm (tree view stuff)
a.nvim_set_hl(0, "SFMGitStaged", { fg = colors.green })
a.nvim_set_hl(0, "SFMGitUnstaged", { fg = colors.green })
a.nvim_set_hl(0, "SFMGitRenamed", { fg = colors.purple })
a.nvim_set_hl(0, "SFMGitNew", { fg = colors.orange })
a.nvim_set_hl(0, "SFMGitDeleted", { fg = colors.red })
a.nvim_set_hl(0, "SFMGitIgnored", { fg = colors.grey })

View File

@ -1,260 +0,0 @@
local present, alpha = pcall(require, "alpha")
if not present then
return
end
local pepe = {
{
[[⠄⠄⠄⠄⠄⠄⠄⢀⣠⣶⣾⣿⣶⣦⣤⣀⠄⢀⣀⣤⣤⣤⣤⣄⠄⠄⠄⠄⠄⠄]],
[[⠄⠄⠄⠄⠄⢀⣴⣿⣿⣿⡿⠿⠿⠿⠿⢿⣷⡹⣿⣿⣿⣿⣿⣿⣷⠄⠄⠄⠄⠄]],
[[⠄⠄⠄⠄⠄⣾⣿⣿⣿⣯⣵⣾⣿⣿⡶⠦⠭⢁⠩⢭⣭⣵⣶⣶⡬⣄⣀⡀⠄⠄]],
[[⠄⠄⠄⡀⠘⠻⣿⣿⣿⣿⡿⠟⠩⠶⠚⠻⠟⠳⢶⣮⢫⣥⠶⠒⠒⠒⠒⠆⠐⠒]],
[[⠄⢠⣾⢇⣿⣿⣶⣦⢠⠰⡕⢤⠆⠄⠰⢠⢠⠄⠰⢠⠠⠄⡀⠄⢊⢯⠄⡅⠂⠄]],
[[⢠⣿⣿⣿⣿⣿⣿⣿⣏⠘⢼⠬⠆⠄⢘⠨⢐⠄⢘⠈⣼⡄⠄⠄⡢⡲⠄⠂⠠⠄]],
[[⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣥⣀⡁⠄⠘⠘⠘⢀⣠⣾⣿⢿⣦⣁⠙⠃⠄⠃⠐⣀]],
[[⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣋⣵⣾⣿⣿⣿⣿⣦⣀⣶⣾⣿⣿⡉⠉⠉]],
[[⣿⣿⣿⣿⣿⣿⣿⠟⣫⣥⣬⣭⣛⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡆⠄]],
[[⣿⣿⣿⣿⣿⣿⣿⠸⣿⣏⣙⠿⣿⣿⣶⣦⣍⣙⠿⠿⠿⠿⠿⠿⠿⠿⣛⣩⣶⠄]],
[[⣛⣛⣛⠿⠿⣿⣿⣿⣮⣙⠿⢿⣶⣶⣭⣭⣛⣛⣛⣛⠛⠛⠻⣛⣛⣛⣛⣋⠁⢀]],
[[⣿⣿⣿⣿⣿⣶⣬⢙⡻⠿⠿⣷⣤⣝⣛⣛⣛⣛⣛⣛⣛⣛⠛⠛⣛⣛⠛⣡⣴⣿]],
[[⣛⣛⠛⠛⠛⣛⡑⡿⢻⢻⠲⢆⢹⣿⣿⣿⣿⣿⣿⠿⠿⠟⡴⢻⢋⠻⣟⠈⠿⠿]],
[[⣿⡿⡿⣿⢷⢤⠄⡔⡘⣃⢃⢰⡦⡤⡤⢤⢤⢤⠒⠞⠳⢸⠃⡆⢸⠄⠟⠸⠛⢿]],
[[⡟⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢸]],
},
{
[[⠄⠄⠄⠄⠄⠄⠄⠄⠄⣾⣿⣿⣿⣿⡄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄]],
[[⠄⠄⠄⠄⠄⠄⠄⠄⣼⣿⣿⣿⣿⣿⣿⣧⠄⠄⠄⠄⠄⣀⣀⠄⠄⠄⠄⠄⠄⠄]],
[[⠄⠄⠄⠄⠄⠄⢀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣧⠄⠄⠄⣾⠛⠛⣷⢀⣾⠟⠻⣦⠄]],
[[⠄⠄⠄⠄⠄⠄⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡀⠄⠄⢰⡿⠋⠄⠄⣠⡾⠋⠄]],
[[⠄⠄⠄⠄⠄⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡄⠄⣬⡄⠄⠄⠄⣭⡅⠄⠄]],
[[⠄⠄⠄⠄⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡆⠄⠄⠄⠄⠄⠄⠄⠄⠄]],
[[⠄⠄⠄⠄⢛⣛⣛⣛⣛⣛⣛⣛⣛⡛⢋⣉⣭⣭⣥⣬⣤⣤⣀⠄⠄⠄⠄⠄⠄⠄]],
[[⠄⠄⣴⣵⣿⣟⡉⣥⣶⣶⠶⠶⠬⣉⡂⠹⣟⡫⠽⠟⢒⣒⠒⠆⠄⠄⠄⠄⠄⠄]],
[[⠄⣼⣿⣿⣿⣿⣿⣶⣭⣃⡈⠄⠄⠘⠃⡰⢶⣶⣿⠏⠄⠄⠙⡛⠄⠄⠄⠄⠄⠄]],
[[⢰⣿⣿⣿⣿⣿⣿⣿⣯⣉⣉⣩⣭⣶⣿⡿⠶⠶⠶⠶⠶⠾⣋⠄⠄⠄⠄⠄⠄⠄]],
[[⢾⣿⣿⣿⣿⣿⣿⣿⢩⣶⣒⠒⠶⢖⣒⣚⡛⠭⠭⠭⠍⠉⠁⠄⠄⠄⣀⣀⡀⠄]],
[[⠘⢿⣿⣿⣿⣿⣿⣿⣧⣬⣭⣭⣭⣤⡤⠤⠶⠟⣋⣀⣀⡀⢀⣤⣾⠟⠋⠈⢳⠄]],
[[⣴⣦⡒⠬⠭⣭⣭⣭⣙⣛⠋⠭⡍⠁⠈⠙⠛⠛⠛⠛⢻⠛⠉⢻⠁⠄⠄⠄⢸⡀]],
[[⣿⣿⣿⣿⣷⣦⣤⠤⢬⢍⣼⣦⡾⠛⠄⠄⠄⠄⠄⠄⠈⡇⠄⢸⠄⠄⠄⢦⣄⣇]],
[[⣿⣿⡿⣋⣭⣭⣶⣿⣶⣿⣿⣿⠟⠛⠃⠄⠄⠄⠄⠄⢠⠃⠄⡜⠄⠄⠄⠔⣿⣿]],
},
{
[[⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠔⠊⠉⠉⠉⠉⠉⠐⢦⡄⠄⠄⠄⠄⠄⠄⠄⠄]],
[[⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⡐⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠘⣆⠄⠄⠄⠄⠄⠄⠄]],
[[⠄⠄⠄⠄⠄⠄⠄⠄⢀⠖⠁⢀⣾⣆⡰⠶⡷⠶⣀⣾⣄⠄⠈⣆⠄⠄⠄⠄⠄⠄]],
[[⠄⠄⡄⠄⠠⢤⣤⠔⠃⠄⠄⠄⠄⠘⢧⣤⢣⣤⠋⠄⠄⠄⠄⠈⠣⢤⡠⠄⠄⠄]],
[[⠄⠄⠘⠦⡀⠄⠄⠄⠄⠄⠄⠄⢻⡟⠻⣿⣿⡿⠻⡟⠃⠄⠄⠄⠄⠄⠄⠄⡀⠞]],
[[⠄⠄⠄⠄⠉⢢⡀⠄⠄⠄⠄⠄⠄⠄⠄⠄⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⡠⠊⠄⠄]],
[[⠄⠄⠄⠄⠄⠄⠈⠢⣤⣤⣴⣶⡶⢶⣶⣶⣶⣆⢒⣤⣤⠄⢠⠤⠤⠚⠄⠄⠄⠄]],
[[⠄⠄⠄⠄⠄⢀⣠⣾⣿⣿⣿⣿⣎⢻⣿⠁⡀⣿⡎⣿⣿⣀⣃⠧⡀⠄⠄⠄⠄⠄]],
[[⠄⠄⣠⣶⣾⣿⣿⣿⣿⣿⣿⣿⡹⡼⢿⣠⠵⠿⣑⢿⣟⣛⠤⣩⡁⠄⠄⠄⠄⠄]],
[[⢠⣿⣿⣿⢏⡜⡻⣷⡽⣿⣷⣭⣿⣮⣽⣯⣽⣿⣿⣷⣤⣾⡿⠟⠃⠄⠄⠄⠄⠄]],
[[⠻⣿⣿⣿⣌⢷⣙⠾⠯⣒⡿⠭⣝⣛⣛⣛⣛⠛⠭⠭⠟⢣⠌⠄⠄⠄⠄⠄⠄⠄]],
[[⠄⠻⣿⣿⣿⣮⣟⠷⣦⣤⣝⣛⠲⠶⠶⠒⢂⣀⠠⠄⠐⠁⠄⠄⠄⠄⠄⠄⠄⠄]],
[[⠄⠄⠄⠙⠿⠿⢿⣿⡷⠶⠭⠭⠭⠵⠶⠒⠋⠉⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄]],
},
{
[[⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿]],
[[⣿⣿⣿⣿⣿⣿⣿⠛⢩⣴⣶⣶⣶⣌⠙⠫⠛⢋⣭⣤⣤⣤⣤⡙⣿⣿⣿⣿⣿⣿]],
[[⣿⣿⣿⣿⣿⡟⢡⣾⣿⠿⣛⣛⣛⣛⣛⡳⠆⢻⣿⣿⣿⠿⠿⠷⡌⠻⣿⣿⣿⣿]],
[[⣿⣿⣿⣿⠏⣰⣿⣿⣴⣿⣿⣿⡿⠟⠛⠛⠒⠄⢶⣶⣶⣾⡿⠶⠒⠲⠌⢻⣿⣿]],
[[⣿⣿⠏⣡⢨⣝⡻⠿⣿⢛⣩⡵⠞⡫⠭⠭⣭⠭⠤⠈⠭⠒⣒⠩⠭⠭⣍⠒⠈⠛]],
[[⡿⢁⣾⣿⣸⣿⣿⣷⣬⡉⠁⠄⠁⠄⠄⠄⠄⠄⠄⠄⣶⠄⠄⠄⠄⠄⠄⠄⠄⢀]],
[[⢡⣾⣿⣿⣿⣿⣿⣿⣿⣧⡀⠄⠄⠄⠄⠄⠄⠄⢀⣠⣿⣦⣤⣀⣀⣀⣀⠄⣤⣾]],
[[⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣶⡶⢇⣰⣿⣿⣟⠿⠿⠿⠿⠟⠁⣾⣿⣿]],
[[⣿⣿⣿⣿⣿⣿⣿⡟⢛⡛⠿⠿⣿⣧⣶⣶⣿⣿⣿⣿⣿⣷⣼⣿⣿⣿⣧⠸⣿⣿]],
[[⠘⢿⣿⣿⣿⣿⣿⡇⢿⡿⠿⠦⣤⣈⣙⡛⠿⠿⠿⣿⣿⣿⣿⠿⠿⠟⠛⡀⢻⣿]],
[[⠄⠄⠉⠻⢿⣿⣿⣷⣬⣙⠳⠶⢶⣤⣍⣙⡛⠓⠒⠶⠶⠶⠶⠖⢒⣛⣛⠁⣾⣿]],
[[⠄⠄⠄⠄⠄⠈⠛⠛⠿⠿⣿⣷⣤⣤⣈⣉⣛⣛⣛⡛⠛⠛⠿⠿⠿⠟⢋⣼⣿⣿]],
[[⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠈⠉⠉⣻⣿⣿⣿⣿⡿⠿⠛⠃⠄⠙⠛⠿⢿⣿]],
[[⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢬⣭⣭⡶⠖⣢⣦⣀⠄⠄⠄⠄⢀⣤⣾⣿]],
[[⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢰⣶⣶⣶⣾⣿⣿⣿⣿⣷⡄⠄⢠⣾⣿⣿⣿]],
},
}
-- dynamic header padding
local fn = vim.fn
local marginTopPercent = 0.2
local Padding = fn.max { 2, fn.floor(fn.winheight(0) * marginTopPercent) }
local header = {
type = "text",
val = pepe[math.random(#pepe)],
opts = {
position = "center",
hl = "AlphaAscii",
},
}
local plugins = require('lazy').stats().count
local date = os.date("%d/%m/%y(%a)%X")
math.randomseed(os.time())
local id = math.random(10000000, 99999999)
local id1 = math.random(10000000, 99999999)
local id2 = math.random(10000000, 99999999)
local chan = {
[[based!!!]],
[[in other words, 4chan is better because
everyone gets to be an idiot.]],
[[NOOOOOOO YOU CANT PUBLISH BENCHMARKS FOR
OUR ANCIENT OS]],
[[This is the beginning of the end. AI has
finally won. Tech is no longer a viable job.]],
[[And Wikipedia is bloat because of html,
mathml, rich text, etc. Using modern codecs
and a simpler form of wiki we could store
the entire "human knowledge-base" and plain
text references (books, papers, articles,
websites) inside a single μSD card]],
[[My arch install broke again]],
[[Why are stdout, stderr and stdin already
opened when I start my program? Who opened
them and what is he doing in my computer?]],
[[YES BOYCOTT!
SPREAD THIS MESSAGE
EVERYONE QUIT USING THE SITE, THEY CANNOT
IGNORE US ANYMORE. FROM THIS DAY ONWARDS
THEIR PRODUCT WILL NOT BE ABLE TO HOLD UP
WITHOUT US]],
[[COMPANY A BETTER THAN COMPANY B]],
[[Nah, ignore this anon. If you want to
REALLY learn programming, you need to
learn with punch cards. Once you've
got that under your belt, move on
up to assembly.]],
}
local phrase = chan[math.random(#chan)]
local heading = {
type = "text",
val = "  Anonymous " .. date .. " No." .. id .. "",
opts = {
position = "center",
hl = "AlphaButtons",
},
}
local post_buttons = {
type = "text",
val = "They don't get it. For me, it's nvim. ",
opts = {
position = "center",
hl = "AlphaFooter",
},
}
local pre_foot = {
type = "text",
val = ">>" .. id2 .. "(OP) ",
opts = {
position = "center",
hl = "AlphaEmphasis",
},
}
local footer = {
type = "text",
val = " I've " .. plugins .. " plugins, it launches instantly kek.",
opts = {
position = "center",
hl = "AlphaFooter",
},
}
local pre_foot_2 = {
type = "text",
val = ">>" .. id1 .. " ",
opts = {
position = "center",
hl = "AlphaEmphasis",
},
}
local footer_2 = {
type = "text",
val = " " .. phrase,
opts = {
position = "left",
hl = "AlphaFooter",
},
}
local function button(sc, txt, keybind)
local sc_ = sc:gsub("%s", ""):gsub("SPC", "<leader>")
local opts = {
position = "center",
text = txt,
shortcut = sc,
cursor = 0,
width = 44,
align_shortcut = "right",
hl_shortcut = "AlphaShortcuts",
hl = "AlphaHeader",
}
if keybind then
opts.keymap = { "n", sc_, keybind, { noremap = true, silent = true } }
end
return {
type = "button",
val = txt,
on_press = function()
local key = vim.api.nvim_replace_termcodes(sc_, true, false, true)
vim.api.nvim_feedkeys(key, "normal", false)
end,
opts = opts,
}
end
local buttons = {
type = "group",
val = {
button("LDR e", " >open new file", ":ene<CR>"),
button("LDR h", " >open oldfiles", ":Telescope oldfiles<CR>"),
button("LDR f", " >fuzzy search", ":Telescope find_files<CR>"),
button("LDR y", " >browse folders" , ":Telescope file_browser path=%:p:h<CR>"),
button("LDR /", " >regex search", ":Telescope live_grep<CR>"),
button("LDR u", " >update plugins", ":lua require('lazy').update()<CR>"),
},
opts = {
spacing = 0,
},
}
local section = {
header = header,
buttons = buttons,
heading = heading,
post_buttons = post_buttons,
pre_foot = pre_foot,
footer = footer,
pre_foot_2 = pre_foot_2,
footer_2 = footer_2,
}
local opts = {
layout = {
{ type = "padding", val = Padding},
{ type = "padding", val = 1 },
section.header,
{ type = "padding", val = 1 },
section.heading,
{ type = "padding", val = 1 },
section.buttons,
section.post_buttons,
{ type = "padding", val = 1 },
section.pre_foot,
section.footer,
{ type = "padding", val = 1 },
section.pre_foot_2,
section.footer_2,
{ type = "padding", val = Padding },
},
opts = {
margin = 50,
},
}
alpha.setup(opts)

View File

@ -1,97 +0,0 @@
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(a.nvim_win_get_cursor(0))
return col ~= 0 and a.nvim_buf_get_lines(0, line - 1, line, true)
[1]:sub(col, col):match("%s") == nil
end
local cmp = require('cmp')
local luasnip = require('luasnip')
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup {
completion = { autocomplete = false, },
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
sources = cmp.config.sources({
{ name = 'nvim_lsp', keyword_length = 3 },
{ name = 'luasnip', keyword_length = 3 },
{ name = 'path' },
{ name = 'buffer', keyword_length = 3, max_item_count = 7 },
{ name = 'calc' },
{ name = 'neorg' },
}),
window = {
completion = {
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
col_offset = -3,
side_padding = 0,
}
},
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
local kind_icons = lspicons
local menu_items = {
buffer = "buffer",
nvim_lsp = "LSP",
luasnip = "luasnip",
nvim_lua = "lua",
calc = "calc",
}
vim_item.kind = string.format(' %s ', kind_icons[vim_item.kind])
vim_item.menu = string.format(' (%s)', menu_items[entry.source.name])
return vim_item
end
},
mapping = cmp.mapping.preset.insert({
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
['<CR>'] = cmp.mapping.confirm({ select = true }),
['<ESC>'] = cmp.mapping.close(),
}),
sorting = {
comparators = {
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
require "cmp-under-comparator".under,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
},
enabled = function()
local context = require 'cmp.config.context'
if a.nvim_get_mode().mode == 'c' then
return true
else
return not context.in_treesitter_capture("comment")
and not context.in_syntax_group("Comment")
end
end
}

View File

@ -1,3 +0,0 @@
require('cmp_luasnip_choice').setup {
auto_open = true,
}

View File

@ -1,18 +0,0 @@
require("hover").setup {
init = function()
-- Require providers
require("hover.providers.lsp")
-- require('hover.providers.gh')
-- require('hover.providers.gh_user')
-- require('hover.providers.jira')
require('hover.providers.man')
require('hover.providers.dictionary')
end,
preview_opts = {
border = 'single'
},
-- Whether the contents of a currently open hover window should be moved
-- to a :h preview-window when pressing the hover keymap.
preview_window = true,
title = true
}

View File

@ -1,22 +0,0 @@
if copts.tablines == 'colored' then
require("indent_blankline").setup {
space_char_blankline = ' ',
char_highlight_list = {
'IndentBlanklineIndent1',
'IndentBlanklineIndent2',
'IndentBlanklineIndent3',
'IndentBlanklineIndent4',
'IndentBlanklineIndent5',
'IndentBlanklineIndent6',
},
}
elseif copts.tablines == 'wrap' then
o.list = true
require('indent_blankline').setup {
space_char_blankline = ' ',
show_current_context = true,
show_current_context_start = true,
}
else
g.indent_blankline_char = ' '
end

View File

@ -1,24 +0,0 @@
require('core.overrides.indentblankline')
require('core.overrides.lualine')
require('core.overrides.telescope')
require('core.overrides.modicator')
require('core.overrides.neorg')
require('core.overrides.whichkey')
require('core.overrides.neoclip')
require('core.overrides.smartsplits')
require('core.overrides.treesitter')
require('core.overrides.treesj')
require('core.overrides.colorizer')
require('core.overrides.trouble')
require('core.overrides.lspzero')
require('core.overrides.cmp')
require('core.overrides.snip')
require('core.overrides.lspkind')
require('core.overrides.cmpluasnipchoice')
require('core.overrides.truezen')
require('core.overrides.alpha')
require('core.overrides.notify')
require('core.overrides.hover')
require('core.overrides.scrollbar')
require('core.overrides.toggleterm')
require('core.overrides.sfm')

View File

@ -1 +0,0 @@
require('lspkind').init()

View File

@ -1,17 +0,0 @@
local lsp = require('lsp-zero')
lsp.set_preferences {
suggest_lsp_servers = true,
setup_servers_on_start = true,
set_lsp_keymaps = true,
configure_diagnostics = true,
cmp_capabilities = true,
manage_nvim_cmp = false,
call_servers = 'local',
sign_icons = {
error = 'x',
warn = '!',
hint = '?',
info = 'i'
}
}
lsp.setup()

View File

@ -1,145 +0,0 @@
local custom = require'lualine.themes.auto'
custom.normal = {
a = { fg = colors.black, bg = colors.blue, gui = 'bold' },
b = { fg = colors.black, bg = colors.grey, gui = 'bold' },
c = { fg = colors.white, bg = colors.grey },
x = {},
y = { fg = colors.blue, bg = colors.black2 },
z = { fg = colors.black2, bg = colors.blue, gui = 'bold' },
}
custom.insert = {
a = { fg = colors.black, bg = colors.green, gui = 'bold' },
b = { fg = colors.black, bg = colors.grey, gui = 'bold' },
c = { fg = colors.white, bg = colors.grey },
x = {},
y = { fg = colors.green, bg = colors.black2 },
z = { fg = colors.black2, bg = colors.green, gui = 'bold' },
}
custom.replace = {
a = { fg = colors.black, bg = colors.orange, gui = 'bold' },
b = { fg = colors.black, bg = colors.grey, gui = 'bold' },
c = { fg = colors.white, bg = colors.grey },
x = {},
y = { fg = colors.orange, bg = colors.black2 },
z = { fg = colors.black2, bg = colors.orange, gui = 'bold' },
}
custom.visual = {
a = { fg = colors.black, bg = colors.purple, gui = 'bold' },
b = { fg = colors.black, bg = colors.grey, gui = 'bold' },
c = { fg = colors.white, bg = colors.grey },
x = {},
y = { fg = colors.purple, bg = colors.black2 },
z = { fg = colors.black2, bg = colors.purple, gui = 'bold' },
}
custom.command = {
a = { fg = colors.black, bg = colors.red, gui = 'bold' },
b = { fg = colors.black, bg = colors.grey, gui = 'bold' },
c = { fg = colors.white, bg = colors.grey },
x = {},
y = { fg = colors.red, bg = colors.black2 },
z = { fg = colors.black2, bg = colors.red, gui = 'bold' },
}
custom.terminal = {
a = { fg = colors.black, bg = colors.yellow, gui = 'bold' },
b = { fg = colors.black, bg = colors.grey, gui = 'bold' },
c = { fg = colors.white, bg = colors.grey },
x = {},
y = { fg = colors.yellow, bg = colors.black2 },
z = { fg = colors.black2, bg = colors.yellow, gui = 'bold' },
}
custom.inactive = {
a = { bg = colors.black2 },
b = { bg = colors.black2 },
c = { bg = colors.black2 },
x = { bg = colors.black2 },
y = { bg = colors.black2 },
z = { bg = colors.black2 },
}
local function diff_source()
local gitsigns = vim.b.gitsigns_status_dict
if gitsigns then
return {
added = gitsigns.added,
modified = gitsigns.changed,
removed = gitsigns.removed
}
end
end
local function maximize_status()
return require("true-zen.focus").running and '[M]' or '[]='
end
require('lualine').setup {
options = {
icons_enabled = false,
component_separators = { left = '', right = '' },
section_separators = { left = '', right = '' },
disabled_filetypes = {
statusline = {
'no-neck-pain',
'alpha',
'TelescopePrompt',
},
winbar = {},
},
theme = custom,
always_divide_middle = false,
globalstatus = true,
refresh = {
statusline = 500,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {
{ 'mode' },
{ 'filetype',
color = { fg = colors.white, bg = colors.grey },
},
{ 'filename',
filestatus = true,
path = 0,
symbols = {
modified = '[+]',
readonly = '[=]',
unnamed = 'No Name',
newfile = '[New]',
}
}
},
lualine_b = {
{ 'diff',
source = diff_source,
},
{ 'diagnostics',
sources = {'nvim_diagnostic', 'nvim_lsp'},
sections = {'error', 'warn', 'info', 'hint'},
diagnostics_color = {
error = 'DiagnosticError',
warn = 'DiagnosticWarn',
info = 'DiagnosticInfo',
hint = 'DiagnosticHint',
},
symbols = {error = '[x]', warn = '[!]', info = '[i]', hint = '[?]'},
}
},
lualine_c = {},
lualine_x = {
{ 'fileformat',
color = { gui = 'bold' }
}
},
lualine_y = {
{ maximize_status },
},
lualine_z = { 'progress' }
},
inactive_sections = {
lualine_x = {'location'},
},
}

View File

@ -1,18 +0,0 @@
require('modicator').setup({
show_warnings = true,
highlights = {
defaults = {
bold = true,
},
modes = {
['i'] = { foreground = colors.green, },
['v'] = { foreground = colors.purple, },
['V'] = { foreground = colors.purple, },
[''] = { foreground = colors.purple, },
['s'] = { foreground = colors.purple, },
['S'] = { foreground = colors.yellow, },
['R'] = { foreground = colors.orange, },
['c'] = { foreground = colors.red, },
},
},
})

View File

@ -1,9 +0,0 @@
require('neoclip').setup {
keys = {
telescope = {
i = {
paste_behind = ' '
},
},
},
}

View File

@ -1,18 +0,0 @@
require('neorg').setup {
load = {
['core.defaults'] = {},
['core.norg.concealer'] = {
config = {
dim_code_blocks = {
width = 'content',
padding = { right = 2, },
},
folds = false,
}
},
['core.norg.completion'] = {
config = { engine = 'nvim-cmp', }
},
['core.integrations.nvim-cmp'] = {},
}
}

View File

@ -1,14 +0,0 @@
require('notify').setup(
{
icons = {
DEBUG = "B",
ERROR = "x",
INFO = "i",
TRACE = "t",
WARN = "!"
},
minimum_width = 35,
max_width = 80,
render = "compact",
}
)

View File

@ -1,29 +0,0 @@
require("scrollbar").setup({
show = true,
show_in_active_only = true,
handle = {
color = colors.bg_highlight,
},
marks = {
Search = { color = colors.pink },
Error = { color = colors.red },
Warn = { color = colors.orange },
Info = { color = colors.blue },
Hint = { color = colors.grey2 },
Misc = { color = colors.purple },
},
excluded_buftypes = {
"terminal",
},
excluded_filetypes = {
"prompt",
"TelescopePrompt",
"noice",
"alpha",
"sfm",
},
handlers = {
diagnostic = true,
gitsigns = true,
}
})

View File

@ -1,7 +0,0 @@
require('smart-splits').setup {
resize_mode = {
hooks = {
on_leave = require('bufresize').register
},
},
}

View File

@ -1,9 +0,0 @@
local ls = require('luasnip')
ls.config.set_config {
-- return back into snippet
history = true,
-- update on text insert
updateevents = "TextChanged,TextChangedI"
}

View File

@ -1,42 +0,0 @@
local telescope = require('telescope')
local actions = require('telescope.actions')
telescope.setup {
defaults = {
borderchars = { " ", " ", " ", " ", " ", " ", " ", " " },
sorting_strategy = 'ascending',
layout_config = {
height = 0.9,
prompt_position = 'top',
},
mappings = {
i = {
['<C-h>'] = 'which_key',
['<C-j>'] = actions.move_selection_next,
['<C-k>'] = actions.move_selection_previous,
['<C-l>'] = actions.select_default,
['<C-u>'] = actions.preview_scrolling_up,
['<C-d>'] = actions.preview_scrolling_down,
},
n = {
["gg"] = actions.move_to_top,
["G"] = actions.move_to_bottom,
},
},
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown {
-- even more opts
}
}
},
}
}
telescope.load_extension('undo')
telescope.load_extension('file_browser')
telescope.load_extension('ui-select')
a.nvim_create_autocmd('User', {
pattern = 'TelescopePreviewerLoaded',
command = 'setlocal number',
})

View File

@ -1,19 +0,0 @@
require('toggleterm').setup {
shade_terminals = true,
}
local Terminal = require('toggleterm.terminal').Terminal
local glow = Terminal:new({
cmd = "glow",
hidden = true,
direction = "float",
float_opts = {
border = "shadow",
width = 120,
height = 50,
}
})
function _glow()
glow:toggle()
end

View File

@ -1,15 +0,0 @@
require('nvim-treesitter.configs').setup {
ensure_installed = {
'help',
'c',
'lua',
'norg',
'bash',
'html',
'make',
},
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
}

View File

@ -1,3 +0,0 @@
require('treesj').setup({
use_default_keymaps = false,
})

View File

@ -1,11 +0,0 @@
require("trouble").setup {
icons = false,
fold_open = "v",
fold_closed = ">",
signs = {
error = "[x]",
warning = "[!]",
hint = "[?]",
information = "[i]"
},
}

View File

@ -1,13 +0,0 @@
require('true-zen').setup {
modes = {
ataraxis = { -- normal zen
minimum_writing_area = { -- minimum size of main window
width = 120,
height = 44,
},
},
narrow = {
folds_style = "invisible",
},
},
}

View File

@ -1,8 +0,0 @@
require("which-key").setup {
icons = {
breadcrumb = '>>',
separator = '->',
},
window = { winblend = 3, },
layout = { align = 'center', },
}

View File

@ -1,129 +0,0 @@
-- make sure lazy is installed
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git", lazypath })
vim.fn.system({ "git", "-C", lazypath, "checkout", "tags/stable" })
end
end
vim.opt.rtp:prepend(lazypath)
require('lazy').setup{
{ 'tamton-aquib/essentials.nvim' },
-- only the most useless plugins (some of these are also ui related)
{ 'goolord/alpha-nvim' },
{ 'petertriho/nvim-scrollbar' },
{ 'alec-gibson/nvim-tetris' },
{ 'kwakzalver/duckytype.nvim', config = true }, -- like monkey type
{ 'melkster/modicator.nvim' },
{ 'nyngwang/murmur.lua', config = true },
{ 'potamides/pantran.nvim' },
--
-- colorscheme / ui
{ 'metalelf0/jellybeans-nvim',
dependencies = 'rktjmp/lush.nvim',
lazy = false,
priority = 1000,
},
{ 'nvim-lualine/lualine.nvim' },
{ 'utilyre/barbecue.nvim',
version = '*',
dependencies = {
'SmiteshP/nvim-navic',
},
config = true,
},
{ 'lukas-reineke/indent-blankline.nvim' },
{ 'lewis6991/gitsigns.nvim', config = true, },
{ 'chentoast/marks.nvim', config = true, },
{ 'folke/which-key.nvim' },
{ 'mrjones2014/smart-splits.nvim',
dependencies = { 'kwkarlwang/bufresize.nvim', config = true, },
},
{ 'rcarriga/nvim-notify' },
{ 'CosmicNvim/cosmic-ui',
dependencies = { 'MunifTanjim/nui.nvim' },
config = true,
},
{ 'dinhhuy258/sfm.nvim',
dependencies = { 'dinhhuy258/sfm-git.nvim' }
},
--
-- careful the following plugins might be considered useful proceed with caution
-- muh fzf
{ 'nvim-telescope/telescope.nvim',
version = '0.1.*',
dependencies = {
'nvim-telescope/telescope-file-browser.nvim',
'nvim-telescope/telescope-ui-select.nvim',
'nvim-lua/plenary.nvim',
'debugloop/telescope-undo.nvim',
'AckslD/nvim-neoclip.lua',
}
},
--
-- movement
{ 'pta2002/intellitab.nvim' },
--
-- debugging
{ 'numToStr/Comment.nvim', config = true, },
{ 'folke/trouble.nvim' },
{ 'folke/todo-comments.nvim', config = true, },
{ 'akinsho/toggleterm.nvim', version = '*' },
--
-- project stuff
{ 'sindrets/diffview.nvim', config = true, },
{ 'notjedi/nvim-rooter.lua', config = true, },
--
-- notes
{ 'jbyuki/venn.nvim' },
{ 'nvim-neorg/neorg',
version = '*',
ft = 'norg',
build = ':Neorg sync-parsers',
},
{ 'loqusion/true-zen.nvim' },
{ 'Pocco81/high-str.nvim' },
--
-- cmp, lsp and syntax
{ 'nvim-treesitter/nvim-treesitter',
dependencies = {
{ 'm-demare/hlargs.nvim', config = true },
'Wansmer/treesj',
}
},
{ 'lewis6991/hover.nvim' },
{ 'nvchad/nvim-colorizer.lua' },
{ 'VonHeikemen/lsp-zero.nvim' },
{ 'hrsh7th/nvim-cmp',
dependencies = {
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'hrsh7th/cmp-calc',
'saadparwaiz1/cmp_luasnip',
'hrsh7th/cmp-nvim-lua',
'hrsh7th/cmp-nvim-lsp',
'lukas-reineke/cmp-under-comparator',
'onsails/lspkind.nvim',
},
},
{ 'L3MON4D3/LuaSnip',
version = 'v1.*',
dependencies = 'rafamadriz/friendly-snippets',
},
{ 'doxnit/cmp-luasnip-choice' },
{ 'neovim/nvim-lspconfig' },
{ 'williamboman/mason.nvim' },
{ 'williamboman/mason-lspconfig.nvim' },
{ 'windwp/nvim-autopairs', config = true, },
--
}

View File

@ -1,29 +0,0 @@
ls.add_snippets('c', {
s('trip', {
-- cond ? then : else statment
i(1, 'cond'), t(' ? '), i(2, 'then'), t(' : '), i(3, 'else')
}),
s('stdlibs', {
-- cond ? then : else statment
t('#include <stdio.h>'),
t({'', '#include <stdlib.h>'})
}),
s('die', {
t({
'void die(const char *fmt, ...) {', '',
'va_list ap;',
'',
'va_start(ap, fmt);',
'vfprintf(stderr, fmt, ap);',
'va_end(ap);',
'',
[[if (fmt[0] && fmt[strlen(fmt)-1] == ':') {]],
[[ fputc(' ', stderr);]],
' perror(NULL);',
'} else',
[[ fputc('\n', stderr);]],
' exit(1);',
'}',
})
})
})

View File

@ -0,0 +1,325 @@
if not pcall(require, "el") then return end
local job = require "plenary.job"
local el_sub = require "el.subscribe"
local M = {}
function M.extract_hl(spec)
if not spec or vim.tbl_isempty(spec) then return end
local hl_name, hl_opts = { "El" }, {}
for attr, val in pairs(spec) do
if type(val) == "table" then
table.insert(hl_name, attr)
assert(vim.tbl_count(val) == 1)
local hl, what = next(val)
local hlID = vim.fn.hlID(hl)
if hlID > 0 then
table.insert(hl_name, hl)
local col = vim.fn.synIDattr(hlID, what)
if col and #col > 0 then
table.insert(hl_name, what)
hl_opts[attr] = col
end
end
else
-- bold, underline, etc
hl_opts[attr] = val
end
end
hl_name = table.concat(hl_name, "_")
-- if highlight exists, verify it has
-- the correct colorscheme highlights
local newID = vim.fn.hlID(hl_name)
if newID > 0 then
for what, expected in pairs(hl_opts) do
local res = vim.fn.synIDattr(newID, what)
if type(expected) == "boolean" then
-- synIDattr returns '1' for boolean
res = res and res == "1" and true
end
if res ~= expected then
-- need to regen the highlight
-- print("color mismatch", hl_name, what, "e:", expected, "c:", res)
newID = 0
end
end
end
if newID == 0 then
vim.api.nvim_set_hl(0, hl_name, hl_opts)
end
return hl_name
end
local function set_hl(hls, s)
if not hls or not s then return s end
hls = type(hls) == "string" and { hls } or hls
for _, hl in ipairs(hls) do
if vim.fn.hlID(hl) > 0 then
return ("%%#%s#%s%%0*"):format(hl, s)
end
end
return s
end
local function wrap_fnc(opts, fn)
return function(window, buffer)
-- buf_autocmd doesn't send win
if not window and buffer then
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
return ""
end
return fn(window, buffer)
end
end
function M.mode(opts)
opts = opts or {}
return wrap_fnc(opts, function(_, _)
local fmt = opts.fmt or "%s%s"
local mode = vim.api.nvim_get_mode().mode
local mode_data = opts.modes and opts.modes[mode]
local hls = mode_data and mode_data[3]
local icon = opts.hl_icon_only and set_hl(hls, opts.icon) or opts.icon
mode = mode_data and mode_data[1]:upper() or mode
mode = (fmt):format(icon or "", mode)
return not opts.hl_icon_only and set_hl(hls, mode) or mode
end)
end
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"),
}
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))
end
local function git_changes_formatter(opts)
local specs = {
insert = {
regex = "(%d+) insertions?",
icon = opts.icon_insert or "+",
hl = opts.hl_insert,
},
change = {
regex = "(%d+) files? changed",
icon = opts.icon_change or "~",
hl = opts.hl_change,
},
delete = {
regex = "(%d+) deletions?",
icon = opts.icon_delete or "-",
hl = opts.hl_delete,
},
}
return function(_, _, s)
local result = {}
for k, v in pairs(specs) do
local count = nil
if type(s) == "string" then
-- 'git diff --shortstat' output
-- from 'git_changes_all'
count = tonumber(string.match(s, v.regex))
else
-- map from 'git_changes_buf'
count = s[k]
end
if count and count > 0 then
table.insert(result, set_hl(v.hl, ("%s%d"):format(v.icon, count)))
end
end
return table.concat(result, " ")
end
end
-- requires gitsigns
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")
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")
if ok then stats = res end
end
local counts = {
insert = stats.added > 0 and stats.added or nil,
change = stats.changed > 0 and stats.changed or nil,
delete = stats.removed > 0 and stats.removed or nil,
}
if not vim.tbl_isempty(counts) then
local fmt = opts.fmt or "%s"
local out = formatter(window, buffer, counts)
return out and fmt:format(out) or nil
else
-- el functions that return a
-- string must not return nil
return ""
end
end)
end
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
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)
if ok then
local fmt = opts.fmt or "%s"
return git_changes and fmt:format(git_changes) or nil
end
end))
end
function M.lsp_srvname(opts)
local fmt = opts.fmt or "%s"
local icon = opts.icon or ""
local names = ""
vim.lsp.for_each_buffer_client(0, function(client)
if names ~= "" then names = names..", " end
names = names..client.name
end)
return icon..fmt:format(names)
end
local function diag_formatter(opts)
return function(_, buffer, counts)
local items = {}
local icons = {
["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])))
end
end
local fmt = opts.fmt or "%s"
if vim.tbl_isempty(items) then
return ""
else
return fmt:format(table.concat(items, " "))
end
end
end
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
for _, d in ipairs(diags) do
if tonumber(d.severity) then
counts[d.severity] = counts[d.severity] + 1
end
end
end
return {
errors = counts[1],
warnings = counts[2],
infos = counts[3],
hints = counts[4],
}
end
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))
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
function M.fn_tail(opts)
opts = opts or {}
local fmt = opts.fmt or "%s"
local hl_exec = opts.hl_exec or "Character"
local fn = vim.fn.expand("%:t")
if vim.fn.getftype(fn) == "file" then
if string.match(vim.fn.getfperm(fn), 'x', 3) then
return (fmt):format(set_hl(hl_exec, fn))
end
end
return (fmt):format(fn)
end
return M

80
lua/core/theme.lua Normal file
View File

@ -0,0 +1,80 @@
local pickers = require("telescope.pickers")
local finders = require("telescope.finders")
local previewers = require("telescope.previewers")
local conf = require("telescope.config").values
local actions = require("telescope.actions")
local action_set = require("telescope.actions.set")
local action_state = require("telescope.actions.state")
local misc = require('core.misc')
local M = {}
function M.switcher()
local bufnr = vim.api.nvim_get_current_buf()
-- show current buffer content in previewer
local colors = vim.fn.getcompletion('', 'color')
for k, v in pairs(colors) do
if v.find(v, '.ext') then
table.remove(colors, k)
break
end
end
-- our picker function: colors
pickers.new({
prompt_title = "Set Nvim Colorscheme",
finder = finders.new_table { results = colors },
sorter = conf.generic_sorter(),
previewer = previewers.new_buffer_previewer {
define_preview = function(self, entry)
-- add content
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
vim.api.nvim_buf_set_lines(self.state.bufnr, 0, -1, false, lines)
-- add syntax highlighting in previewer
local ft = (vim.filetype.match { buf = bufnr } or "diff"):match "%w+"
require("telescope.previewers.utils").highlighter(self.state.bufnr, ft)
end
},
attach_mappings = function(prompt_bufnr, map)
-- reload theme while typing
vim.schedule(function()
vim.api.nvim_create_autocmd("TextChangedI", {
buffer = prompt_bufnr,
callback = function()
if action_state.get_selected_entry() then
misc.colorscheme(action_state.get_selected_entry()[1])
end
end,
})
end)
-- reload theme on cycling
actions.move_selection_previous:replace(function()
action_set.shift_selection(prompt_bufnr, -1)
misc.colorscheme(action_state.get_selected_entry()[1])
end)
actions.move_selection_next:replace(function()
action_set.shift_selection(prompt_bufnr, 1)
misc.colorscheme(action_state.get_selected_entry()[1])
end)
-- reload theme on selection
actions.select_default:replace(function()
if action_state.get_selected_entry() then
actions.close(prompt_bufnr)
misc.colorscheme(action_state.get_selected_entry()[1])
-- make the colorscheme swap persistant
misc.replaceword("misc.colorscheme%(.+%)",
"misc.colorscheme('"..action_state.get_selected_entry()[1].."')")
end
end)
return true
end,
}):find()
end
return M

79
lua/snippet/c.lua Normal file
View File

@ -0,0 +1,79 @@
ls.add_snippets('c', {
s('trip', {
-- cond ? then : else statment
i(1, 'cond'), t(' ? '), i(2, 'then'), t(' : '), i(3, 'else')
}),
s('stdlibs', {
-- the normal stuff
t('#include <stdio.h>'),
t({'', '#include <stdlib.h>'})
}),
s('die', {
-- message provieder when program is exiting
t({
'void die(const char *fmt, ...) {', '',
'va_list ap;',
'',
'va_start(ap, fmt);',
'vfprintf(stderr, fmt, ap);',
'va_end(ap);',
'',
[[if (fmt[0] && fmt[strlen(fmt)-1] == ':') {]],
[[ fputc(' ', stderr);]],
' perror(NULL);',
'} else',
[[ fputc('\n', stderr);]],
' exit(1);',
'}',
})
}),
s({
name = 'get them opts!',
trig = 'getopt',
dscr = 'standard argument parser',
},
fmta(
[[
int c;
while ((c = getopt(argc, argv, "<OPTS>")) != -1) {
switch (c) {
case '<OPT1>': <OPT1RUN> break;
default: <DEFRUN> break;
}
}
]],
{
OPTS = i(1, 'h'),
OPT1 = i(2, 'h'),
OPT1RUN = i(3, 'printf("help text\\n");'),
DEFRUN = i(4, 'printf("run %s -h for help\\n", argv[0]); return 1;'),
}
)
),
s({
name = 'Variadic function parser',
trig = 'infinite vars',
dscr = 'Parse an infinite number of arguments passed to a function',
},
{
t({
"/*",
" * NOTE: the function must have a int before the ... argument",
" * and you need to include <stdarg.h> for this to work",
" */",
"va_list ptr;",
"va_start(ptr, ", i(1, "n"),
");",
"for (int i = 0; i < ", ri(1),
"; i++) {",
i(2),
"}",
"va_end(ptr);",
}),
}
)
})

View File

@ -29,7 +29,3 @@ parse = require("luasnip.util.parser").parse_snippet
ri = function (insert_node_id) ri = function (insert_node_id)
return f(function (args) return args[1][1] end, insert_node_id) return f(function (args) return args[1][1] end, insert_node_id)
end end
require('core.snippets.c')
require('core.snippets.makefile')
require('core.snippets.lua')

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB