summaryrefslogtreecommitdiff
path: root/.config/nvim/lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua')
-rw-r--r--.config/nvim/lua/cfg/colorizer/init.lua14
-rw-r--r--.config/nvim/lua/cfg/dashboard/init.lua70
-rw-r--r--.config/nvim/lua/cfg/hop/init.lua2
-rw-r--r--.config/nvim/lua/cfg/lsp/init.lua174
-rw-r--r--.config/nvim/lua/cfg/lsp/ts-fmt-lint.lua37
-rw-r--r--.config/nvim/lua/cfg/lspinstall/init.lua1
-rw-r--r--.config/nvim/lua/cfg/neoformat/init.lua23
-rw-r--r--.config/nvim/lua/cfg/nvimtree/init.lua87
-rw-r--r--.config/nvim/lua/cfg/symbols-outline/init.lua15
-rw-r--r--.config/nvim/lua/cfg/telescope/init.lua89
-rw-r--r--.config/nvim/lua/cfg/themes/dark.lua367
-rw-r--r--.config/nvim/lua/cfg/treesitter/init.lua123
-rw-r--r--.config/nvim/lua/cfg/utils/init.lua112
-rw-r--r--.config/nvim/lua/cfg/vim-rooter/init.lua2
-rw-r--r--.config/nvim/lua/cfg/vimtex/init.lua25
-rw-r--r--.config/nvim/lua/cfg/which-key/init.lua225
-rw-r--r--.config/nvim/lua/core/autopairs.lua (renamed from .config/nvim/lua/cfg/autopairs/init.lua)2
-rw-r--r--.config/nvim/lua/core/bufferline.lua (renamed from .config/nvim/lua/cfg/barbar/init.lua)7
-rw-r--r--.config/nvim/lua/core/colorizer.lua17
-rw-r--r--.config/nvim/lua/core/compe.lua (renamed from .config/nvim/lua/cfg/compe/init.lua)27
-rw-r--r--.config/nvim/lua/core/dap.lua41
-rw-r--r--.config/nvim/lua/core/dashboard.lua98
-rw-r--r--.config/nvim/lua/core/formatter.lua60
-rw-r--r--.config/nvim/lua/core/galaxyline.lua (renamed from .config/nvim/lua/cfg/galaxyline/init.lua)110
-rw-r--r--.config/nvim/lua/core/gitsigns.lua (renamed from .config/nvim/lua/cfg/gitsigns/init.lua)16
-rw-r--r--.config/nvim/lua/core/hop.lua20
-rw-r--r--.config/nvim/lua/core/linter.lua33
-rw-r--r--.config/nvim/lua/core/nvimtree.lua88
-rw-r--r--.config/nvim/lua/core/status_colors.lua19
-rw-r--r--.config/nvim/lua/core/telescope.lua97
-rw-r--r--.config/nvim/lua/core/terminal.lua68
-rw-r--r--.config/nvim/lua/core/treesitter.lua187
-rw-r--r--.config/nvim/lua/core/which-key.lua201
-rw-r--r--.config/nvim/lua/core/zen.lua (renamed from .config/nvim/lua/cfg/zen/init.lua)16
-rw-r--r--.config/nvim/lua/dark/Git.lua10
-rw-r--r--.config/nvim/lua/dark/LSP.lua92
-rw-r--r--.config/nvim/lua/dark/Treesitter.lua56
-rw-r--r--.config/nvim/lua/dark/Whichkey.lua9
-rw-r--r--.config/nvim/lua/dark/config.lua23
-rw-r--r--.config/nvim/lua/dark/highlights.lua99
-rw-r--r--.config/nvim/lua/dark/init.lua30
-rw-r--r--.config/nvim/lua/dark/markdown.lua27
-rw-r--r--.config/nvim/lua/dark/palette.lua33
-rw-r--r--.config/nvim/lua/dark/util.lua25
-rw-r--r--.config/nvim/lua/default-config.lua349
-rw-r--r--.config/nvim/lua/keymappings.lua166
-rw-r--r--.config/nvim/lua/lang/clang.lua156
-rw-r--r--.config/nvim/lua/lang/dart.lua59
-rw-r--r--.config/nvim/lua/lang/dockerfile.lua35
-rw-r--r--.config/nvim/lua/lang/elixir.lua61
-rw-r--r--.config/nvim/lua/lang/go.lua57
-rw-r--r--.config/nvim/lua/lang/graphql.lua31
-rw-r--r--.config/nvim/lua/lang/html.lua47
-rw-r--r--.config/nvim/lua/lang/javascript.lua25
-rw-r--r--.config/nvim/lua/lang/javascriptreact.lua25
-rw-r--r--.config/nvim/lua/lang/json.lua69
-rw-r--r--.config/nvim/lua/lang/kotlin.lua63
-rw-r--r--.config/nvim/lua/lang/lua.lua88
-rw-r--r--.config/nvim/lua/lang/python.lua92
-rw-r--r--.config/nvim/lua/lang/rust.lua152
-rw-r--r--.config/nvim/lua/lang/sh.lua62
-rw-r--r--.config/nvim/lua/lang/swift.lua55
-rw-r--r--.config/nvim/lua/lang/tex.lua159
-rw-r--r--.config/nvim/lua/lang/typescript.lua25
-rw-r--r--.config/nvim/lua/lang/typescriptreact.lua25
-rw-r--r--.config/nvim/lua/lang/vim.lua40
-rw-r--r--.config/nvim/lua/lang/yaml.lua54
-rw-r--r--.config/nvim/lua/lang/zig.lua58
-rw-r--r--.config/nvim/lua/lang/zsh.lua53
-rw-r--r--.config/nvim/lua/lsp/emmet-ls.lua (renamed from .config/nvim/lua/cfg/lsp/emmet-ls.lua)16
-rw-r--r--.config/nvim/lua/lsp/init.lua264
-rw-r--r--.config/nvim/lua/lsp/tailwindcss-ls.lua13
-rw-r--r--.config/nvim/lua/lsp/ts-fmt-lint.lua72
-rw-r--r--.config/nvim/lua/lsp/tsserver-ls.lua83
-rw-r--r--.config/nvim/lua/plugin-loader.lua49
-rw-r--r--.config/nvim/lua/plugins.lua429
-rw-r--r--.config/nvim/lua/settings.lua60
-rw-r--r--.config/nvim/lua/utils/init.lua232
78 files changed, 4109 insertions, 1992 deletions
diff --git a/.config/nvim/lua/cfg/colorizer/init.lua b/.config/nvim/lua/cfg/colorizer/init.lua
deleted file mode 100644
index abe2f72..0000000
--- a/.config/nvim/lua/cfg/colorizer/init.lua
+++ /dev/null
@@ -1,14 +0,0 @@
-local status_ok, colorizer = pcall(require, "colorizer")
-if not status_ok then
- return
-end
-colorizer.setup({ "*" }, {
- RGB = true, -- #RGB hex codes
- RRGGBB = true, -- #RRGGBB hex codes
- RRGGBBAA = true, -- #RRGGBBAA hex codes
- rgb_fn = true, -- CSS rgb() and rgba() functions
- hsl_fn = true, -- CSS hsl() and hsla() functions
- css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
- css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn
-})
--- names = true; -- "Name" codes like Blue
diff --git a/.config/nvim/lua/cfg/dashboard/init.lua b/.config/nvim/lua/cfg/dashboard/init.lua
deleted file mode 100644
index 770bb5a..0000000
--- a/.config/nvim/lua/cfg/dashboard/init.lua
+++ /dev/null
@@ -1,70 +0,0 @@
-local M = {}
-
-M.config = function()
- vim.g.dashboard_disable_at_vimenter = 0
-
- vim.g.dashboard_custom_header = O.dashboard.custom_header
-
- vim.g.dashboard_default_executive = "telescope"
-
- vim.g.dashboard_custom_section = {
- a = {
- description = { " Find File " },
- command = "Telescope find_files",
- },
- b = {
- description = { " Recently Used Files" },
- command = "Telescope oldfiles",
- },
- -- c = {
- -- description = { " Load Last Session " },
- -- command = "SessionLoad",
- -- },
- c = {
- description = { " Find Word " },
- command = "Telescope live_grep",
- },
- d = {
- description = { " Settings " },
- command = ":e " .. CONFIG_PATH .. "/config.lua",
- },
- -- f = {
- -- description = { " Neovim Config Files" },
- -- command = "Telescope find_files cwd=" .. CONFIG_PATH,
- -- },
- -- e = {description = {' Marks '}, command = 'Telescope marks'}
- }
- vim.cmd "let g:dashboard_session_directory = $HOME..'/.config/nvim/.sessions'"
- vim.cmd "let packages = len(globpath('~/.local/share/nvim/site/pack/packer/start', '*', 0, 1))"
-
- vim.api.nvim_exec(
- [[
- let g:dashboard_custom_footer = ['LuaJIT loaded '..packages..' plugins']
-]],
- false
- )
-
- -- file_browser = {description = {' File Browser'}, command = 'Telescope find_files'},
-
- -- vim.g.dashboard_session_directory = CACHE_PATH..'/session'
- -- vim.g.dashboard_custom_footer = O.dashboard.footer
-end
-
-require("cfg.utils").define_augroups {
- _dashboard = {
- -- seems to be nobuflisted that makes my stuff disapear will do more testing
- {
- "FileType",
- "dashboard",
- "setlocal nocursorline noswapfile synmaxcol& signcolumn=no norelativenumber nocursorcolumn nospell nolist nonumber bufhidden=wipe colorcolumn= foldcolumn=0 matchpairs= ",
- },
- {
- "FileType",
- "dashboard",
- "set showtabline=0 | autocmd BufLeave <buffer> set showtabline=2",
- },
- { "FileType", "dashboard", "nnoremap <silent> <buffer> q :q<CR>" },
- },
-}
-
-return M
diff --git a/.config/nvim/lua/cfg/hop/init.lua b/.config/nvim/lua/cfg/hop/init.lua
deleted file mode 100644
index acd4cd7..0000000
--- a/.config/nvim/lua/cfg/hop/init.lua
+++ /dev/null
@@ -1,2 +0,0 @@
-vim.api.nvim_set_keymap('n', 's', ":HopChar2<cr>", {silent = true})
-vim.api.nvim_set_keymap('n', 'S', ":HopWord<cr>", {silent = true})
diff --git a/.config/nvim/lua/cfg/lsp/init.lua b/.config/nvim/lua/cfg/lsp/init.lua
deleted file mode 100644
index 547f9e7..0000000
--- a/.config/nvim/lua/cfg/lsp/init.lua
+++ /dev/null
@@ -1,174 +0,0 @@
--- TODO figure out why this don't work
-vim.fn.sign_define(
- "LspDiagnosticsSignError",
- {texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError"}
-)
-vim.fn.sign_define(
- "LspDiagnosticsSignWarning",
- {texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning"}
-)
-vim.fn.sign_define(
- "LspDiagnosticsSignHint",
- {texthl = "LspDiagnosticsSignHint", text = "", numhl = "LspDiagnosticsSignHint"}
-)
-vim.fn.sign_define(
- "LspDiagnosticsSignInformation",
- {texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation"}
-)
-
-vim.cmd("nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>")
-vim.cmd("nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>")
-vim.cmd("nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>")
-vim.cmd("nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>")
-vim.cmd("nnoremap <silent> K :lua vim.lsp.buf.hover()<CR>")
--- vim.cmd('nnoremap <silent> <C-k> <cmd>lua vim.lsp.buf.signature_help()<CR>')
-vim.cmd("nnoremap <silent> <C-p> :lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = O.lsp.popup_border}})<CR>")
-vim.cmd("nnoremap <silent> <C-n> :lua vim.lsp.diagnostic.goto_next({popup_opts = {border = O.lsp.popup_border}})<CR>")
--- scroll down hover doc or scroll in definition preview
--- scroll up hover doc
-vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()')
-
--- Set Default Prefix.
--- Note: You can set a prefix per lsp server in the lv-globals.lua file
-vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
- vim.lsp.diagnostic.on_publish_diagnostics, {
- virtual_text = {
- prefix = "",
- spacing = 0,
- },
- signs = true,
- underline = true,
- }
-)
-
-vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
- vim.lsp.handlers.hover, {
- border = O.lsp.popup_border
- }
-)
-
-vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
- vim.lsp.handlers.signature_help, {
- border = O.lsp.popup_border
- }
-)
-
--- symbols for autocomplete
-vim.lsp.protocol.CompletionItemKind = {
- "  (Text) ",
- "  (Method)",
- "  (Function)",
- "  (Constructor)",
- " ﴲ (Field)",
- "[] (Variable)",
- "  (Class)",
- " ﰮ (Interface)",
- "  (Module)",
- " 襁 (Property)",
- "  (Unit)",
- "  (Value)",
- " 練 (Enum)",
- "  (Keyword)",
- "  (Snippet)",
- "  (Color)",
- "  (File)",
- "  (Reference)",
- "  (Folder)",
- "  (EnumMember)",
- " ﲀ (Constant)",
- " ﳤ (Struct)",
- "  (Event)",
- "  (Operator)",
- "  (TypeParameter)"
-}
-
---[[ " autoformat
-autocmd BufWritePre *.js lua vim.lsp.buf.formatting_sync(nil, 100)
-autocmd BufWritePre *.jsx lua vim.lsp.buf.formatting_sync(nil, 100)
-autocmd BufWritePre *.lua lua vim.lsp.buf.formatting_sync(nil, 100) ]]
--- Java
--- autocmd FileType java nnoremap ca <Cmd>lua require('jdtls').code_action()<CR>
-
-local function documentHighlight(client, bufnr)
- -- Set autocommands conditional on server_capabilities
- if client.resolved_capabilities.document_highlight then
- vim.api.nvim_exec(
- [[
- hi LspReferenceRead cterm=bold ctermbg=red guibg=#464646
- hi LspReferenceText cterm=bold ctermbg=red guibg=#464646
- hi LspReferenceWrite cterm=bold ctermbg=red guibg=#464646
- augroup lsp_document_highlight
- autocmd! * <buffer>
- autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
- autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
- augroup END
- ]],
- false
- )
- end
-end
-local lsp_config = {}
-
-if O.document_highlight then
- function lsp_config.common_on_attach(client, bufnr)
- documentHighlight(client, bufnr)
- end
-end
-
-function lsp_config.tsserver_on_attach(client, bufnr)
- -- lsp_config.common_on_attach(client, bufnr)
- client.resolved_capabilities.document_formatting = false
-
- local ts_utils = require("nvim-lsp-ts-utils")
-
- -- defaults
- ts_utils.setup {
- debug = false,
- disable_commands = false,
- enable_import_on_completion = false,
- import_all_timeout = 5000, -- ms
-
- -- eslint
- eslint_enable_code_actions = true,
- eslint_enable_disable_comments = true,
- eslint_bin = O.lang.tsserver.linter,
- eslint_config_fallback = nil,
- eslint_enable_diagnostics = true,
-
- -- formatting
- enable_formatting = O.lang.tsserver.autoformat,
- formatter = O.lang.tsserver.formatter,
- formatter_config_fallback = nil,
-
- -- parentheses completion
- complete_parens = false,
- signature_help_in_parens = false,
-
- -- update imports on file move
- update_imports_on_move = false,
- require_confirmation_on_move = false,
- watch_dir = nil,
- }
-
- -- required to fix code action ranges
- ts_utils.setup_client(client)
-
- -- TODO: keymap these?
- -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gs", ":TSLspOrganize<CR>", {silent = true})
- -- vim.api.nvim_buf_set_keymap(bufnr, "n", "qq", ":TSLspFixCurrent<CR>", {silent = true})
- -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", ":TSLspRenameFile<CR>", {silent = true})
- -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", ":TSLspImportAll<CR>", {silent = true})
-end
-
-
-require('cfg.utils').define_augroups({
- _general_lsp = {
- {'FileType', 'lspinfo', 'nnoremap <silent> <buffer> q :q<CR>'},
- }
-})
-
--- Use a loop to conveniently both setup defined servers
--- and map buffer local keybindings when the language server attaches
--- local servers = {"pyright", "tsserver"}
--- for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup {on_attach = on_attach} end
-return lsp_config
diff --git a/.config/nvim/lua/cfg/lsp/ts-fmt-lint.lua b/.config/nvim/lua/cfg/lsp/ts-fmt-lint.lua
deleted file mode 100644
index 36d4ca8..0000000
--- a/.config/nvim/lua/cfg/lsp/ts-fmt-lint.lua
+++ /dev/null
@@ -1,37 +0,0 @@
--- Example configuations here: https://github.com/mattn/efm-langserver
--- You can look for project scope Prettier and Eslint with e.g. vim.fn.glob("node_modules/.bin/prettier") etc. If it is not found revert to global Prettier where needed.
-local M = {}
-
-M.setup = function()
- local tsserver_args = {}
-
- local prettier = {
- formatCommand = "prettier --stdin-filepath ${INPUT}",
- formatStdin = true
- }
-
- if vim.fn.glob("node_modules/.bin/prettier") ~= "" then
- prettier = {
- formatCommand = "./node_modules/.bin/prettier --stdin-filepath ${INPUT}",
- formatStdin = true
- }
- end
-
- require"lspconfig".efm.setup {
- -- init_options = {initializationOptions},
- cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"},
- init_options = {documentFormatting = true, codeAction = false},
- filetypes = {"html", "css", "yaml", "vue", "javascript", "javascriptreact", "typescript", "typescriptreact"},
- settings = {
- rootMarkers = {".git/", "package.json"},
- languages = {
- html = {prettier},
- css = {prettier},
- json = {prettier},
- yaml = {prettier}
- }
- }
- }
-end
-
-return M
diff --git a/.config/nvim/lua/cfg/lspinstall/init.lua b/.config/nvim/lua/cfg/lspinstall/init.lua
deleted file mode 100644
index af5e175..0000000
--- a/.config/nvim/lua/cfg/lspinstall/init.lua
+++ /dev/null
@@ -1 +0,0 @@
-require("lspinstall").setup()
diff --git a/.config/nvim/lua/cfg/neoformat/init.lua b/.config/nvim/lua/cfg/neoformat/init.lua
deleted file mode 100644
index 9a5ac76..0000000
--- a/.config/nvim/lua/cfg/neoformat/init.lua
+++ /dev/null
@@ -1,23 +0,0 @@
--- autoformat
-if O.format_on_save then
- require("cfg.utils").define_augroups({
- autoformat = {
- {
- "BufWritePre",
- "*",
- [[try | undojoin | Neoformat | catch /^Vim\%((\a\+)\)\=:E790/ | finally | silent Neoformat | endtry]],
- },
- },
- })
-end
-
-vim.g.neoformat_run_all_formatters = 0
-
-vim.g.neoformat_enabled_python = { "flake8", "black", "docformatter" }
-vim.g.neoformat_enabled_javascript = { "prettier" }
-
-if not O.format_on_save then
- vim.cmd([[if exists('#autoformat#BufWritePre')
- :autocmd! autoformat
- endif]])
-end
diff --git a/.config/nvim/lua/cfg/nvimtree/init.lua b/.config/nvim/lua/cfg/nvimtree/init.lua
deleted file mode 100644
index 97cfe03..0000000
--- a/.config/nvim/lua/cfg/nvimtree/init.lua
+++ /dev/null
@@ -1,87 +0,0 @@
--- --if not package.loaded['nvim-tree.view'] then
--- -- return
--- --end
---
-local M = {}
-local status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
-if not status_ok then
- return
-end
---
-M.config = function()
- local g = vim.g
-
- vim.o.termguicolors = true
-
- g.nvim_tree_side = "left"
- g.nvim_tree_width = 30
- g.nvim_tree_ignore = { ".git", "node_modules", ".cache" }
- g.nvim_tree_auto_open = 1
- g.nvim_tree_auto_close = 0
- g.nvim_tree_quit_on_open = 0
- g.nvim_tree_follow = 1
- g.nvim_tree_indent_markers = 1
- g.nvim_tree_hide_dotfiles = 1
- g.nvim_tree_git_hl = 1
- g.nvim_tree_root_folder_modifier = ":t"
- g.nvim_tree_tab_open = 0
- g.nvim_tree_allow_resize = 1
- g.nvim_tree_lsp_diagnostics = 1
- g.nvim_tree_auto_ignore_ft = { "startify", "dashboard" }
-
- g.nvim_tree_show_icons = {
- git = 1,
- folders = 1,
- files = 1,
- folder_arrows = 1,
- }
-
- vim.g.nvim_tree_icons = {
- default = "",
- symlink = "",
- git = {
- unstaged = "",
- staged = "S",
- unmerged = "",
- renamed = "➜",
- deleted = "",
- untracked = "U",
- ignored = "◌",
- },
- folder = {
- default = "",
- open = "",
- empty = "",
- empty_open = "",
- symlink = "",
- },
- }
- local tree_cb = nvim_tree_config.nvim_tree_callback
-
- vim.g.nvim_tree_bindings = {
- { key = { "l", "<CR>", "o" }, cb = tree_cb "edit" },
- { key = "h", cb = tree_cb "close_node" },
- { key = "v", cb = tree_cb "vsplit" },
- }
-end
-
-local view_status_ok, view = pcall(require, "nvim-tree.view")
-if not view_status_ok then
- return
-end
-M.toggle_tree = function()
- if view.win_open() then
- require("nvim-tree").close()
- if package.loaded["bufferline.state"] then
- require("bufferline.state").set_offset(0)
- end
- else
- if package.loaded["bufferline.state"] then
- -- require'bufferline.state'.set_offset(31, 'File Explorer')
- require("bufferline.state").set_offset(31, "")
- end
- require("nvim-tree").find_file(true)
- end
-end
---
-return M
diff --git a/.config/nvim/lua/cfg/symbols-outline/init.lua b/.config/nvim/lua/cfg/symbols-outline/init.lua
deleted file mode 100644
index f15b5df..0000000
--- a/.config/nvim/lua/cfg/symbols-outline/init.lua
+++ /dev/null
@@ -1,15 +0,0 @@
-vim.g.symbols_outline = {
- highlight_hovered_item = true,
- show_guides = true,
- auto_preview = true,
- position = "right",
- keymaps = {
- close = "<Esc>",
- goto_location = "<Cr>",
- focus_location = "o",
- hover_symbol = "<C-space>",
- rename_symbol = "r",
- code_actions = "a",
- },
- lsp_blacklist = {},
-}
diff --git a/.config/nvim/lua/cfg/telescope/init.lua b/.config/nvim/lua/cfg/telescope/init.lua
deleted file mode 100644
index 9e0c45f..0000000
--- a/.config/nvim/lua/cfg/telescope/init.lua
+++ /dev/null
@@ -1,89 +0,0 @@
-local status_ok, telescope = pcall(require, "telescope")
-if not status_ok then
- return
-end
-local actions = require "telescope.actions"
--- if O.plugin.trouble.active then
--- local trouble = require("trouble.providers.telescope")
--- end
--- Global remapping
-------------------------------
--- '--color=never',
-telescope.setup {
- defaults = {
- find_command = {
- "rg",
- "--no-heading",
- "--with-filename",
- "--line-number",
- "--column",
- "--smart-case",
- },
- prompt_prefix = " ",
- selection_caret = " ",
- entry_prefix = " ",
- initial_mode = "insert",
- selection_strategy = "reset",
- sorting_strategy = "ascending",
- layout_strategy = "horizontal",
- layout_config = {
- width = 0.75,
- prompt_position = "top",
- preview_cutoff = 120,
- horizontal = { mirror = false },
- vertical = { mirror = false },
- },
- file_sorter = require("telescope.sorters").get_fzy_sorter,
- file_ignore_patterns = {},
- generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
- path_display = {"shorten"},
- winblend = 0,
- border = {},
- borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
- color_devicons = true,
- use_less = true,
- set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
- file_previewer = require("telescope.previewers").vim_buffer_cat.new,
- grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
- qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
-
- -- Developer configurations: Not meant for general override
- buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
- mappings = {
- i = {
- ["<C-c>"] = actions.close,
- ["<C-j>"] = actions.move_selection_next,
- ["<C-k>"] = actions.move_selection_previous,
- -- ["<c-t>"] = trouble.open_with_trouble,
- ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
- -- To disable a keymap, put [map] = false
- -- So, to not map "<C-n>", just put
- -- ["<c-x>"] = false,
- -- ["<esc>"] = actions.close,
-
- -- Otherwise, just set the mapping to the function that you want it to be.
- -- ["<C-i>"] = actions.select_horizontal,
-
- -- Add up multiple actions
- ["<CR>"] = actions.select_default + actions.center,
-
- -- You can perform as many actions in a row as you like
- -- ["<CR>"] = actions.select_default + actions.center + my_cool_custom_action,
- },
- n = {
- ["<C-j>"] = actions.move_selection_next,
- ["<C-k>"] = actions.move_selection_previous,
- -- ["<c-t>"] = trouble.open_with_trouble,
- ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
- -- ["<C-i>"] = my_cool_custom_action,
- },
- },
- },
- extensions = {
- fzy_native = {
- override_generic_sorter = false,
- override_file_sorter = true,
- },
- },
-}
-
diff --git a/.config/nvim/lua/cfg/themes/dark.lua b/.config/nvim/lua/cfg/themes/dark.lua
deleted file mode 100644
index 935b2be..0000000
--- a/.config/nvim/lua/cfg/themes/dark.lua
+++ /dev/null
@@ -1,367 +0,0 @@
-local lush = require "lush"
-local hsl = lush.hsl
-
-local theme = lush(function()
- local c = {
- bg = hsl "#0A0A0A",
- bg1 = hsl "#0D0D0D",
- bg2 = hsl "#202020",
-
- white = hsl "#f5f5f5",
-
- gray = hsl "#505050",
- light_gray = hsl "#D0D0D0",
-
- error_red = hsl "#AC4142",
- warning_orange = hsl "#F4BF75",
- info_yellow = hsl "#F4BF75",
- hint_blue = hsl "#A5D6FF",
-
- red = hsl "#AC4142",
-
- blue = hsl "#A5D6FF",
- gray_blue = hsl "#A5D6FF",
-
- yellow = hsl "#F4BF75",
-
- orange = hsl "#FFA657",
-
- green = hsl "#A1B56C",
- light_green = hsl "#A1B56C",
-
- aqua = hsl "#A5D6FF",
-
- purple = hsl "#AA759F",
- pale_purple = hsl "#A5D6FF",
-
- sign_add = hsl "#A1B56C",
- sign_change = hsl "#A5D6FF",
- sign_delete = hsl "#AC4142",
- }
- return {
- Normal { bg = c.bg, fg = c.white, gui = "NONE" }, -- used for the columns set with 'colorcolumn'
- SignColumn { Normal },
- ModeMsg { Normal },
- MsgArea { Normal },
- MsgSeparator { Normal },
- SpellBad { bg = "NONE", fg = c.white, gui = "underline", sp = c.red },
- SpellCap { bg = "NONE", fg = c.white, gui = "underline", sp = c.yellow },
- SpellLocal { bg = "NONE", fg = c.white, gui = "underline", sp = c.green },
- SpellRare { bg = "NONE", fg = c.white, gui = "underline", sp = c.blue },
- NormalNC { Normal },
- Pmenu { bg = c.bg2, fg = c.white, gui = "NONE" },
- PmenuSel { bg = c.gray_blue, fg = c.bg1.da(5), gui = "NONE" },
- WildMenu { PmenuSel }, -- Non Defaults
- CursorLineNr { bg = "NONE", fg = c.light_gray, gui = "bold" },
- Comment { bg = "NONE", fg = c.gray, gui = "italic" }, -- any comment
- Folded { bg = c.bg1, fg = c.gray, gui = "NONE" },
- FoldColumn { Normal, fg = c.gray, gui = "NONE" },
- LineNr { bg = "NONE", fg = c.gray, gui = "NONE" },
- FloatBorder { bg = c.bg1, fg = c.gray, gui = "NONE" },
- Whitespace { bg = "NONE", fg = c.gray.da(35), gui = "NONE" },
- VertSplit { bg = "NONE", fg = c.bg2, gui = "NONE" },
- CursorLine { bg = c.bg1, fg = "NONE", gui = "NONE" },
- CursorColumn { CursorLine },
- ColorColumn { CursorLine },
- NormalFloat { bg = c.bg2.da(30), fg = "NONE", gui = "NONE" },
- Visual { bg = c.bg2.da(25), fg = "NONE", gui = "NONE" },
- VisualNOS { Visual },
- WarningMsg { bg = "NONE", fg = c.red, gui = "NONE" },
- DiffText { bg = "NONE", fg = "NONE", gui = "NONE" },
- DiffAdd { bg = c.sign_add, fg = "NONE", gui = "NONE" },
- DiffChange { bg = c.sign_change, fg = "NONE", gui = "NONE" },
- DiffDelete { bg = c.sign_delete, fg = "NONE", gui = "NONE" },
- QuickFixLine { CursorLine },
- PmenuSbar { bg = c.bg2.li(15), fg = "NONE", gui = "NONE" },
- PmenuThumb { bg = c.white, fg = "NONE", gui = "NONE" },
- MatchParen { CursorLine, fg = "NONE", gui = "NONE" },
- Cursor { fg = "NONE", bg = "NONE", gui = "reverse" },
- lCursor { Cursor },
- CursorIM { Cursor },
- TermCursor { Cursor },
- TermCursorNC { Cursor },
- Conceal { bg = "NONE", fg = c.blue, gui = "NONE" },
- Directory { bg = "NONE", fg = c.blue, gui = "NONE" },
- SpecialKey { bg = "NONE", fg = c.blue, gui = "bold" },
- Title { bg = "NONE", fg = c.blue, gui = "bold" },
- ErrorMsg { bg = "NONE", fg = c.error_red, gui = "NONE" },
- Search { bg = c.gray_blue, fg = c.white },
- IncSearch { Search },
- Substitute { Search },
- MoreMsg { bg = "NONE", fg = c.aqua, gui = "NONE" },
- Question { MoreMsg },
- EndOfBuffer { bg = "NONE", fg = c.bg, gui = "NONE" },
- NonText { EndOfBuffer },
-
- String { fg = c.blue },
- Character { fg = c.light_green },
- Constant { fg = c.orange },
- Number { fg = c.red },
- Boolean { fg = c.red },
- Float { fg = c.red },
-
- Identifier { fg = c.white },
- Function { fg = c.purple },
- Operator { fg = c.orange },
-
- Type { fg = c.white },
- StorageClass { fg = c.yellow },
- Structure { fg = c.orange },
- Typedef { fg = c.purple },
-
- Keyword { fg = c.orange },
- Statement { Keyword },
- Conditional { Keyword },
- Repeat { Keyword },
- Label { Keyword },
- Exception { Keyword },
-
- Include { Keyword },
- PreProc { fg = c.orange },
- Define { PreProc },
- Macro { PreProc },
- PreCondit { PreProc },
-
- Special { fg = c.orange },
- SpecialChar { Character },
- Tag { fg = c.pale_purple },
- Debug { fg = c.red },
- Delimiter { fg = c.white.da(25) },
- SpecialComment { fg = c.gray },
- Underlined { fg = "NONE", gui = "underline" },
- Bold { fg = "NONE", gui = "bold" },
- Italic { fg = "NONE", gui = "italic" },
-
- -- Todo
- -- ("Ignore", below, may be invisible...)
- Ignore { fg = c.white },
- Todo { bg = "NONE", fg = c.red, gui = "bold" },
- Error { fg = c.error_red },
-
- -- Treesitter
- TSComment { Comment }, -- comment blocks.
- luaTSConstructor { bg = "NONE", fg = c.white.da(25) }, -- override Lua curly braces
- TSAnnotation { bg = "NONE", fg = c.aqua }, -- For C++/Dart attributes, annotations that can be attached to the code to denote some kind of meta information.
- TSAttribute { bg = "NONE", fg = c.aqua }, -- (unstable) TODO: docs
- TSConstructor { Type }, -- For constructor calls and definitions: `{ }` in Lua, and Java constructors.
- TSType { Type }, -- types.
- TSTypeBuiltin { Type }, -- builtin types.
- TSConditional { Conditional }, -- keywords related to conditionnals.
- TSException { Exception }, -- exception related keywords.
- TSInclude { Include }, -- includes: `#include` in C, `use` or `extern crate` in Rust, or `require` in Lua.
- TSKeyword { Keyword }, -- keywords that don't fall in previous categories.
- TSKeywordFunction { Keyword }, -- keywords used to define a fuction.
- TSLabel { Label }, -- labels: `label:` in C and `:label:` in Lua.
- TSNamespace { bg = "NONE", fg = c.blue }, -- For identifiers referring to modules and namespaces.
- TSRepeat { Repeat }, -- keywords related to loops.
- TSConstant { Constant }, -- constants
- TSConstBuiltin { Constant }, -- constant that are built in the language: `nil` in Lua.
- TSFloat { Float }, -- floats.
- TSNumber { Number }, -- all numbers
- TSBoolean { Boolean }, -- booleans.
- TSCharacter { Character }, -- characters.
- TSError { bg = "NONE", fg = "NONE" }, -- For syntax/parser errors.
- TSFunction { Function }, -- function (calls and definitions).
- TSFuncBuiltin { Function }, -- builtin functions: `table.insert` in Lua.
- TSMethod { Function }, -- method calls and definitions.
- TSConstMacro { Macro }, -- constants that are defined by macros: `NULL` in C.
- TSFuncMacro { Macro }, -- macro defined fuctions (calls and definitions): each `macro_rules` in Rust.
- TSVariableBuiltin { bg = "NONE", fg = c.aqua }, -- Variable names that are defined by the languages, like `this` or `self`.
- TSProperty { fg = c.aqua },
- TSOperator { Operator }, -- any operator: `+`, but also `->` and `*` in C.
- TSVariable { bg = "NONE", fg = c.white }, -- Any variable name that does not have another highlight.
- TSField { bg = "NONE", fg = c.white }, -- For fields.
- TSParameter { TSField }, -- parameters of a function.
- TSParameterReference { TSParameter }, -- references to parameters of a function.
- TSSymbol { Identifier }, -- identifiers referring to symbols or atoms.
- TSText { fg = c.white }, -- strings considered text in a markup language.
- TSPunctDelimiter { Delimiter }, -- delimiters ie: `.`
- TSTagDelimiter { Delimiter }, -- Tag delimiter like `<` `>` `/`
- TSPunctBracket { Delimiter }, -- brackets and parens.
- TSPunctSpecial { Delimiter }, -- special punctutation that does not fall in the catagories before.
- TSString { String }, -- strings.
- TSStringRegex { TSString }, -- regexes.
- TSStringEscape { Character }, -- escape characters within a string.
- TSWarning { Todo }, -- Variable names that are defined by the languages, like `this` or `self`.
- TSTag { Tag }, -- Tags like html tag names.
- TSEmphasis { gui = "italic" }, -- text to be represented with emphasis.
- TSUnderline { gui = "underline" }, -- text to be represented with an underline.
- TSStrike { gui = "strikethrough" }, -- strikethrough text.
- TSTitle { Title }, -- Text that is part of a title.
- TSLiteral { String }, -- Literal text.
- TSURI { fg = c.aqua }, -- Any URI like a link or email.
- -- TSNone { }, -- TODO: docs
-
- -- These groups are for the native LSP client. Some other LSP clients may
- -- use these groups, or use their own. Consult your LSP client's
- -- documentation.
-
- LspDiagnosticsDefaultError { bg = "NONE", fg = c.error_red, gui = "NONE" },
- LspDiagnosticsDefaultWarning { bg = "NONE", fg = c.warning_orange, gui = "NONE" },
- LspDiagnosticsDefaultInformation { bg = "NONE", fg = c.info_yellow, gui = "NONE" },
- LspDiagnosticsDefaultHint { bg = "NONE", fg = c.hint_blue, gui = "NONE" },
-
- LspDiagnosticsVirtualTextError { LspDiagnosticsDefaultError },
- LspDiagnosticsVirtualTextWarning { LspDiagnosticsDefaultWarning },
- LspDiagnosticsVirtualTextInformation { LspDiagnosticsDefaultInformation },
- LspDiagnosticsVirtualTextHint { LspDiagnosticsDefaultHint },
-
- LspDiagnosticsFloatingError { fg = c.error_red, gui = "NONE" },
- LspDiagnosticsFloatingWarning { fg = c.warning_orange, gui = "NONE" },
- LspDiagnosticsFloatingInformation { fg = c.info_yellow, gui = "NONE" },
- LspDiagnosticsFloatingHint { fg = c.hint_blue, gui = "NONE" },
-
- LspDiagnosticsSignError { fg = c.error_red, gui = "NONE" },
- LspDiagnosticsSignWarning { fg = c.warning_orange, gui = "NONE" },
- LspDiagnosticsSignInformation { fg = c.info_yellow, gui = "NONE" },
- LspDiagnosticsSignHint { fg = c.hint_blue, gui = "NONE" }, -- Tree-Sitter
-
- LspDiagnosticsError { LspDiagnosticsSignError },
- LspDiagnosticsWarning { LspDiagnosticsSignWarning },
- LspDiagnosticsInformation { LspDiagnosticsSignInformation },
- LspDiagnosticsHint { LspDiagnosticsSignHint },
-
- -- LspReferenceText {bg = c.bg1, fg = "NONE", gui = "underline"},
- -- LspReferenceRead {bg = c.bg1, fg = "NONE", gui = "underline"},
- -- LspReferenceWrite {bg = c.bg1, fg = "NONE", gui = "underline"},
-
- LspDiagnosticsUnderlineError { fg = "NONE", gui = "underline", sp = c.red },
- LspDiagnosticsUnderlineWarning { fg = "NONE", gui = "underline", sp = c.yellow },
- LspDiagnosticsUnderlineInformation { fg = "NONE", gui = "underline", sp = c.blue },
- LspDiagnosticsUnderlineHint { fg = "NONE", gui = "underline", sp = c.green },
-
- -- gitsigns.nvim
- SignAdd { fg = c.sign_add },
- SignChange { fg = c.sign_change },
- SignDelete { fg = c.sign_delete }, -- Any URI like a link or email.
- GitSignsAdd { fg = c.sign_add },
- GitSignsChange { fg = c.sign_change },
- GitSignsDelete { fg = c.sign_delete },
-
- -- telescope.nvim
- TelescopeSelection { bg = "NONE", fg = c.aqua },
- TelescopeMatching { bg = "NONE", fg = c.red, gui = "bold" },
- TelescopeBorder { bg = c.bg1, fg = c.gray }, -- nvim-tree.lua
-
- -- Nvimtree
- NvimTreeFolderIcon { fg = c.blue },
- NvimTreeIndentMarker { fg = c.gray },
- NvimTreeNormal { fg = c.white.da(10), bg = c.bg1 },
- NvimTreeFolderName { fg = c.blue },
- NvimTreeOpenedFolderName { fg = c.aqua.da(10), gui = "italic" },
- NvimTreeOpenedFile { NvimTreeOpenedFolderName },
- NvimTreeRootFolder { fg = c.blue.da(20) },
- NvimTreeExecFile { fg = c.green },
- NvimTreeImageFile { fg = c.purple },
- NvimTreeSpecialFile { fg = c.aqua },
-
- NvimTreeGitStaged { fg = c.sign_add },
- NvimTreeGitNew { fg = c.sign_add },
- NvimTreeGitDirty { fg = c.sign_add },
- NvimTreeGitRenamed { fg = c.sign_change },
- NvimTreeGitMerge { fg = c.sign_change },
- NvimTreeGitDelete { fg = c.sign_delete },
- NvimTreeVertSplit { fg = c.bg1, bg = c.bg1 },
-
- -- BarBar
- TabLine { bg = c.bg1, fg = c.white, gui = "NONE" },
- TabLineFill { bg = c.bg1, fg = c.gray, gui = "NONE" },
- TabLineSel { bg = c.white, fg = c.bg1, gui = "NONE" },
-
- BufferCurrent { fg = c.fg, bg = c.bg },
- BufferCurrentIndex { fg = c.aqua, bg = c.bg },
- BufferCurrentMod { fg = c.info_yellow, bg = c.bg },
- BufferCurrentSign { fg = c.aqua, bg = c.bg },
- BufferCurrentTarget { fg = c.red, bg = c.bg, gui = "bold" },
-
- BufferVisible { fg = c.fg, bg = c.bg },
- BufferVisibleIndex { fg = c.fg, bg = c.bg },
- BufferVisibleMod { fg = c.info_yellow, bg = c.bg },
- BufferVisibleSign { fg = c.info_yellow, bg = c.bg },
- BufferVisibleTarget { fg = c.red, bg = c.bg, gui = "bold" },
-
- BufferInactive { fg = c.gray, bg = c.bg1 },
- BufferInactiveIndex { fg = c.gray, bg = c.bg1 },
- BufferInactiveMod { fg = c.info_yellow, bg = c.bg1 },
- BufferInactiveSign { fg = c.gray, bg = c.bg1 },
- BufferInactiveTarget { fg = c.red, bg = c.bg1 },
-
- -- some fix for html related stuff
- htmlH1 { Title }, -- markdown stuff
- mkdLink { fg = c.aqua, gui = "underline" },
- mkdLineBreak { bg = "NONE", fg = "NONE", gui = "NONE" },
- mkdHeading { fg = c.white },
- mkdInlineURL { mkdLink },
- mkdUnderline { fg = c.gray },
- markdownUrl { mkdLink },
- markdownCode { fg = c.orange, bg = "NONE" },
- markdownLinkTextDelimiter { Delimiter },
- markdownLinkDelimiter { Delimiter },
- markdownIdDelimiter { Delimiter },
- markdownLinkText { fg = c.aqua },
- markdownItalic { fg = "NONE", gui = "italic" }, -- flutter-tools.nvim
- FlutterWidgetGuides { fg = c.gray.li(10) }, -- statusline
-
- StatusLine { bg = c.bg1, fg = c.white }, -- status line of current window
- StatusLineNC { bg = c.bg1, fg = c.light_gray }, -- status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window.
- StatusLineSeparator { bg = c.bg1, fg = "NONE" },
- StatusLineGit { bg = c.bg1, fg = c.orange },
- StatusLineGitAdd { bg = c.bg1, fg = c.green },
- StatusLineGitChange { bg = c.bg1, fg = c.blue },
- StatusLineGitDelete { bg = c.bg1, fg = c.red },
- StatusLineLspDiagnosticsError { bg = c.bg1, fg = c.error_red, gui = "NONE" },
- StatusLineLspDiagnosticsWarning { bg = c.bg1, fg = c.warning_orange, gui = "NONE" },
- StatusLineLspDiagnosticsInformation { bg = c.bg1, fg = c.info_yellow, gui = "NONE" },
- StatusLineLspDiagnosticsHint { bg = c.bg1, fg = c.hint_blue, gui = "NONE" },
- StatusLineTreeSitter { bg = c.bg1, fg = c.green },
-
- -- StatusLineMode {bg = c.gray, fg = c.bg, gui = "bold"},
- -- StatusLineDeco {bg = c.bg2, fg = c.yellow},
- -- StatusLineLCol {bg = c.bg2, fg = c.white},
- -- StatusLineLColAlt {bg = c.bg1, fg = c.white},
- -- StatusLineFT {bg = c.bg2, fg = c.white},
- -- StatusLineFTAlt {bg = c.bg2, fg = c.white},
- -- StatusLineGitAlt {bg = c.gray, fg = c.bg},
- -- StatusLineLSP {bg = c.bg1, fg = c.gray.li(25)},
- -- StatusLineFileName {bg = c.bg1, fg = c.white, gui = "bold"},
-
- -- lsp-trouble.nvim
- LspTroubleIndent { fg = c.gray.li(10) }, -- tabline stuff
-
- -- tabline diagnostic
- TabLineError { LspDiagnosticsSignError },
- TabLineWarning { LspDiagnosticsSignWarning },
- TabLineHint { LspDiagnosticsSignHint },
- TabLineInformation { LspDiagnosticsSignInformation }, -- which-key.nvim
-
- WhichKey { fg = c.white }, -- nvim-compe
- WhichKeySeperator { fg = c.gray }, -- nvim-compe
- WhichKeyGroup { fg = c.blue }, -- nvim-compe
- WhichKeyDesc { fg = c.aqua }, -- nvim-compe
- WhichKeyFloat { bg = c.bg1 }, -- nvim-compe
-
- CompeDocumentation { Pmenu, fg = "NONE" }, -- diffview
-
- DiffviewNormal { NvimTreeNormal },
- DiffviewStatusAdded { SignAdd },
- DiffviewStatusModified { SignChange },
- DiffviewStatusRenamed { SignChange },
- DiffviewStatusDeleted { SignDelete },
- DiffviewFilePanelInsertion { SignAdd },
- DiffviewFilePanelDeletion { SignDelete },
- DiffviewVertSplit { fg = c.gray, bg = c.bg },
-
- DashboardHeader { fg = c.blue },
- DashboardCenter { fg = c.purple },
- DashboardFooter { fg = c.aqua },
-
- IndentBlanklineContextChar { fg = c.gray.da(20) },
-
- CodiVirtualText { fg = c.hint_blue },
- }
-end)
-
--- return our parsed theme for extension or use else where.
-return theme
-
--- vi:nowrap
diff --git a/.config/nvim/lua/cfg/treesitter/init.lua b/.config/nvim/lua/cfg/treesitter/init.lua
deleted file mode 100644
index deaa86e..0000000
--- a/.config/nvim/lua/cfg/treesitter/init.lua
+++ /dev/null
@@ -1,123 +0,0 @@
--- TODO refacor this whole file and treesitter in general
--- if not package.loaded['nvim-treesitter'] then return end
---
--- Custom parsers
--- local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
--- parser_config.make = {
--- install_info = {
--- url = "https://github.com/alemuller/tree-sitter-make", -- local path or git repo
--- files = {"src/parser.c"},
--- requires_generate_from_grammar = true
--- }
--- }
--- parser_config.just = {
--- install_info = {
--- url = "~/dev/tree-sitter-just", -- local path or git repo
--- files = {"src/parser.c"}
--- }
--- -- filetype = "just", -- if filetype does not agrees with parser name
--- -- used_by = {"bar", "baz"} -- additional filetypes that use this parser
--- }
--- Custom text objects
-local textobj_prefixes = O.treesitter.textobj_prefixes
-local textobj_suffixes = O.treesitter.textobj_suffixes
-local textobj_sel_keymaps = {}
-local textobj_swap_keymaps = {}
-local textobj_move_keymaps = {
- enable = O.plugin.ts_textobjects,
- set_jumps = true, -- whether to set jumps in the jumplist
- goto_next_start = {},
- goto_next_end = {},
- goto_previous_start = {},
- goto_previous_end = {},
-}
-for obj, suffix in pairs(textobj_suffixes) do
- if textobj_prefixes["goto_next"] ~= nil then
- textobj_move_keymaps["goto_next_start"][textobj_prefixes["goto_next"] .. suffix[1]] = "@" .. obj .. ".outer"
- textobj_move_keymaps["goto_next_end"][textobj_prefixes["goto_next"] .. suffix[2]] = "@" .. obj .. ".outer"
- end
- if textobj_prefixes["goto_prev"] ~= nil then
- textobj_move_keymaps["goto_previous_start"][textobj_prefixes["goto_previous"] .. suffix[2]] = "@" .. obj .. ".outer"
- textobj_move_keymaps["goto_previous_end"][textobj_prefixes["goto_previous"] .. suffix[1]] = "@" .. obj .. ".outer"
- end
-
- if textobj_prefixes["inner"] ~= nil then
- textobj_sel_keymaps[textobj_prefixes["inner"] .. suffix[1]] = "@" .. obj .. ".inner"
- end
- if textobj_prefixes["outer"] ~= nil then
- textobj_sel_keymaps[textobj_prefixes["outer"] .. suffix[1]] = "@" .. obj .. ".outer"
- end
-
- if textobj_prefixes["swap"] ~= nil then
- textobj_swap_keymaps[textobj_prefixes["swap"] .. suffix[1]] = "@" .. obj .. ".outer"
- end
-end
-vim.g.ts_hint_textobject_keys = O.treesitter.hint_labels -- Requires https://github.com/mfussenegger/nvim-ts-hint-textobject/pull/2
-
--- Add which key menu entries
-local status, wk = pcall(require, "which-key")
-if status then
- local normal = {
- mode = "n", -- Normal mode
- }
- local operators = {
- mode = "o", -- Operator mode
- }
- wk.register(textobj_sel_keymaps, operators)
- wk.register({
- ["m"] = "Hint Objects",
- ["."] = "Textsubject",
- [";"] = "Textsubject-big",
- }, operators)
- wk.register(textobj_swap_keymaps, normal)
- wk.register({
- [textobj_prefixes["swap"]] = "Swap",
- -- [textobj_prefixes["goto_next"]] = "Jump [",
- -- [textobj_prefixes["goto_previous"]] = "Jump ]"
- }, normal)
- wk.register(textobj_move_keymaps["goto_next_start"], normal)
- wk.register(textobj_move_keymaps["goto_next_end"], normal)
- wk.register(textobj_move_keymaps["goto_previous_start"], normal)
- wk.register(textobj_move_keymaps["goto_previous_end"], normal)
-end
-local status_ok, treesitter_configs = pcall(require, "nvim-treesitter.configs")
-if not status_ok then
- return
-end
-
-treesitter_configs.setup {
- ensure_installed = O.treesitter.ensure_installed, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
- ignore_install = O.treesitter.ignore_install,
- matchup = {
- enable = true, -- mandatory, false will disable the whole extension
- -- disable = { "c", "ruby" }, -- optional, list of language that will be disabled
- },
- highlight = {
- enable = O.treesitter.highlight.enabled, -- false will disable the whole extension
- additional_vim_regex_highlighting = true,
- disable = { "latex" },
- },
- context_commentstring = {
- enable = O.plugin.ts_context_commentstring.active,
- config = { css = "// %s" },
- },
- -- indent = {enable = true, disable = {"python", "html, "javascript"}},
- -- TODO seems to be broken
- indent = { enable = { "javascriptreact" } },
- autotag = { enable = O.plugin.ts_autotag.active },
- textobjects = {
- swap = {
- enable = O.plugin.ts_textobjects,
- swap_next = textobj_swap_keymaps,
- },
- move = textobj_move_keymaps,
- select = {
- enable = O.plugin.ts_textobjects,
- keymaps = textobj_sel_keymaps,
- },
- },
- textsubjects = {
- enable = O.plugin.ts_textsubjects,
- keymaps = { ["."] = "textsubjects-smart", [";"] = "textsubjects-big" },
- },
-}
diff --git a/.config/nvim/lua/cfg/utils/init.lua b/.config/nvim/lua/cfg/utils/init.lua
deleted file mode 100644
index 4c5dfd2..0000000
--- a/.config/nvim/lua/cfg/utils/init.lua
+++ /dev/null
@@ -1,112 +0,0 @@
-local utils = {}
-
-function utils.reload_config()
- vim.cmd "source ~/.config/nvim/config.lua"
- vim.cmd "source ~/.config/nvim/lua/plugins.lua"
- vim.cmd "source ~/.config/nvim/lua/cfg/neoformat/init.lua"
- vim.cmd ":PackerCompile"
- vim.cmd ":PackerInstall"
-end
-
-function utils.check_lsp_client_active(name)
- local clients = vim.lsp.get_active_clients()
- for _, client in pairs(clients) do
- if client.name == name then
- return true
- end
- end
- return false
-end
-
-function utils.define_augroups(definitions) -- {{{1
- -- Create autocommand groups based on the passed definitions
- --
- -- The key will be the name of the group, and each definition
- -- within the group should have:
- -- 1. Trigger
- -- 2. Pattern
- -- 3. Text
- -- just like how they would normally be defined from Vim itself
- for group_name, definition in pairs(definitions) do
- vim.cmd("augroup " .. group_name)
- vim.cmd "autocmd!"
-
- for _, def in pairs(definition) do
- local command = table.concat(vim.tbl_flatten { "autocmd", def }, " ")
- vim.cmd(command)
- end
-
- vim.cmd "augroup END"
- end
-end
-
-utils.define_augroups {
-
- _user_autocommands = O.user_autocommands,
- _general_settings = {
- {
- "TextYankPost",
- "*",
- "lua require('vim.highlight').on_yank({higroup = 'Search', timeout = 200})",
- },
- {
- "BufWinEnter",
- "*",
- "setlocal formatoptions-=c formatoptions-=r formatoptions-=o",
- },
- {
- "BufRead",
- "*",
- "setlocal formatoptions-=c formatoptions-=r formatoptions-=o",
- },
- {
- "BufNewFile",
- "*",
- "setlocal formatoptions-=c formatoptions-=r formatoptions-=o",
- },
- { "BufWritePost", "config.lua", "lua require('cfg.utils').reload_config()" },
- { "VimLeavePre", "*", "set title set titleold=" },
- },
- -- _solidity = {
- -- {'BufWinEnter', '.sol', 'setlocal filetype=solidity'}, {'BufRead', '*.sol', 'setlocal filetype=solidity'},
- -- {'BufNewFile', '*.sol', 'setlocal filetype=solidity'}
- -- },
- -- _gemini = {
- -- {'BufWinEnter', '.gmi', 'setlocal filetype=markdown'}, {'BufRead', '*.gmi', 'setlocal filetype=markdown'},
- -- {'BufNewFile', '*.gmi', 'setlocal filetype=markdown'}
- -- },
- _markdown = {
- { "FileType", "markdown", "setlocal wrap" },
- { "FileType", "markdown", "setlocal spell" },
- },
- _buffer_bindings = {
- { "FileType", "floaterm", "nnoremap <silent> <buffer> q :q<CR>" },
- },
- _auto_resize = {
- -- will cause split windows to be resized evenly if main window is resized
- { "VimResized", "*", "wincmd =" },
- },
- _packer_compile = {
- -- will cause split windows to be resized evenly if main window is resized
- { "BufWritePost", "plugins.lua", "PackerCompile" },
- },
- -- _mode_switching = {
- -- -- will switch between absolute and relative line numbers depending on mode
- -- {'InsertEnter', '*', 'if &relativenumber | let g:ms_relativenumberoff = 1 | setlocal number norelativenumber | endif'},
- -- {'InsertLeave', '*', 'if exists("g:ms_relativenumberoff") | setlocal relativenumber | endif'},
- -- {'InsertEnter', '*', 'if &cursorline | let g:ms_cursorlineoff = 1 | setlocal nocursorline | endif'},
- -- {'InsertLeave', '*', 'if exists("g:ms_cursorlineoff") | setlocal cursorline | endif'},
- -- },
-}
-
-vim.cmd [[
- function! QuickFixToggle()
- if empty(filter(getwininfo(), 'v:val.quickfix'))
- copen
- else
- cclose
- endif
-endfunction
-]]
-
-return utils
diff --git a/.config/nvim/lua/cfg/vim-rooter/init.lua b/.config/nvim/lua/cfg/vim-rooter/init.lua
deleted file mode 100644
index a873194..0000000
--- a/.config/nvim/lua/cfg/vim-rooter/init.lua
+++ /dev/null
@@ -1,2 +0,0 @@
--- TODO create file
-vim.g.rooter_silent_chdir = 1
diff --git a/.config/nvim/lua/cfg/vimtex/init.lua b/.config/nvim/lua/cfg/vimtex/init.lua
deleted file mode 100644
index 4d7b93b..0000000
--- a/.config/nvim/lua/cfg/vimtex/init.lua
+++ /dev/null
@@ -1,25 +0,0 @@
-vim.g.vimtex_compiler_method = "latexmk"
-vim.g.vimtex_view_method = "zathura"
-vim.g.vimtex_fold_enabled = 0
-
-O.user_which_key["L"] = {
- name = "+Latex",
- c = { "<cmd>VimtexCompile<cr>", "Toggle Compilation Mode" },
- f = { "<cmd>call vimtex#fzf#run()<cr>", "Fzf Find" },
- i = { "<cmd>VimtexInfo<cr>", "Project Information" },
- s = { "<cmd>VimtexStop<cr>", "Stop Project Compilation" },
- t = { "<cmd>VimtexTocToggle<cr>", "Toggle Table Of Content" },
- v = { "<cmd>VimtexView<cr>", "View PDF" },
-}
-
--- Compile on initialization, cleanup on quit
-vim.api.nvim_exec(
- [[
- augroup vimtex_event_1
- au!
- au User VimtexEventQuit call vimtex#compiler#clean(0)
- au User VimtexEventInitPost call vimtex#compiler#compile()
- augroup END
- ]],
- false
-)
diff --git a/.config/nvim/lua/cfg/which-key/init.lua b/.config/nvim/lua/cfg/which-key/init.lua
deleted file mode 100644
index 993018c..0000000
--- a/.config/nvim/lua/cfg/which-key/init.lua
+++ /dev/null
@@ -1,225 +0,0 @@
--- if not package.loaded['which-key'] then
--- return
--- end
-local status_ok, which_key = pcall(require, "which-key")
-if not status_ok then
- return
-end
-
-which_key.setup {
- plugins = {
- marks = true, -- shows a list of your marks on ' and `
- registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
- -- the presets plugin, adds help for a bunch of default keybindings in Neovim
- -- No actual key bindings are created
- presets = {
- operators = false, -- adds help for operators like d, y, ...
- motions = false, -- adds help for motions
- text_objects = false, -- help for text objects triggered after entering an operator
- windows = true, -- default bindings on <c-w>
- nav = true, -- misc bindings to work with windows
- z = true, -- bindings for folds, spelling and others prefixed with z
- g = true, -- bindings for prefixed with g
- },
- },
- icons = {
- breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
- separator = "➜", -- symbol used between a key and it's label
- group = "+", -- symbol prepended to a group
- },
- window = {
- border = "single", -- none, single, double, shadow
- position = "bottom", -- bottom, top
- margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
- padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
- },
- layout = {
- height = { min = 4, max = 25 }, -- min and max height of the columns
- width = { min = 20, max = 50 }, -- min and max width of the columns
- spacing = 3, -- spacing between columns
- },
- hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate
- show_help = true, -- show help message on the command line when the popup is visible
-}
-
--- Set leader
-if O.leader_key == " " or O.leader_key == "space" then
- vim.api.nvim_set_keymap("n", "<Space>", "<NOP>", { noremap = true, silent = true })
- vim.g.mapleader = " "
-else
- vim.api.nvim_set_keymap("n", O.leader_key, "<NOP>", { noremap = true, silent = true })
- vim.g.mapleader = O.leader_key
-end
-
-local opts = {
- mode = "n", -- NORMAL mode
- prefix = "<leader>",
- buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
- silent = true, -- use `silent` when creating keymaps
- noremap = true, -- use `noremap` when creating keymaps
- nowait = false, -- use `nowait` when creating keymaps
-}
-
--- no hl
-vim.api.nvim_set_keymap("n", "<Leader>n", ':let @/=""<CR>', { noremap = true, silent = true })
-
--- explorer
-
-vim.api.nvim_set_keymap(
- "n",
- "<Leader>e",
- ":lua require'cfg.nvimtree'.toggle_tree()<CR>",
- { noremap = true, silent = true }
-)
-
-vim.api.nvim_set_keymap("n", "<Leader>f", ":Telescope find_files<CR>", { noremap = true, silent = true })
-
--- dashboard
-vim.api.nvim_set_keymap("n", "<Leader>;", ":Dashboard<CR>", { noremap = true, silent = true })
-
--- Comments
-vim.api.nvim_set_keymap("n", "<leader>k", ":CommentToggle<CR>", { noremap = true, silent = true })
-vim.api.nvim_set_keymap("v", "<leader>k", ":CommentToggle<CR>", { noremap = true, silent = true })
-
--- split window
-vim.api.nvim_set_keymap("n", "<leader>v", ":vsplit<CR>", {noremap = true, silent = true})
-vim.api.nvim_set_keymap("n", "<leader>h", ":split<CR>", {noremap = true, silent = true})
-
-
--- close buffer
-vim.api.nvim_set_keymap("n", "<leader>c", ":BufferClose<CR>", { noremap = true, silent = true })
-
--- open config
-vim.api.nvim_set_keymap(
- "n",
- "<leader>.",
- ":e " .. CONFIG_PATH .. "/config.lua<CR>",
- { noremap = true, silent = true }
-)
-
-local mappings = {
-
- ["."] = "Config",
- ["k"] = "Comment",
- ["c"] = "Close Buffer",
- ["e"] = "Explorer",
- ["f"] = "Find File",
- ["n"] = "No Highlight",
- [";"] = "Dashboard",
- ["v"] = "Vertical Split",
- ["h"] = "Horizontal Split",
- p = {
- name = "Packer",
- c = { "<cmd>PackerCompile<cr>", "Compile" },
- i = { "<cmd>PackerInstall<cr>", "Install" },
- r = { "<cmd>lua require('cfg.utils').reload_config()<cr>", "Reload" },
- s = { "<cmd>PackerSync<cr>", "Sync" },
- u = { "<cmd>PackerUpdate<cr>", "Update" },
- },
- g = {
- name = "Git",
- j = { "<cmd>lua require 'gitsigns'.next_hunk()<cr>", "Next Hunk" },
- k = { "<cmd>lua require 'gitsigns'.prev_hunk()<cr>", "Prev Hunk" },
- l = { "<cmd>lua require 'gitsigns'.blame_line()<cr>", "Blame" },
- p = { "<cmd>lua require 'gitsigns'.preview_hunk()<cr>", "Preview Hunk" },
- r = { "<cmd>lua require 'gitsigns'.reset_hunk()<cr>", "Reset Hunk" },
- R = { "<cmd>lua require 'gitsigns'.reset_buffer()<cr>", "Reset Buffer" },
- s = { "<cmd>lua require 'gitsigns'.stage_hunk()<cr>", "Stage Hunk" },
- u = {
- "<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>",
- "Undo Stage Hunk",
- },
- o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
- b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
- c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" },
- C = {
- "<cmd>Telescope git_bcommits<cr>",
- "Checkout commit(for current file)",
- },
- },
- l = {
- name = "LSP",
- a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "Code Action" },
- d = {
- "<cmd>Telescope lsp_document_diagnostics<cr>",
- "Document Diagnostics",
- },
- w = {
- "<cmd>Telescope lsp_workspace_diagnostics<cr>",
- "Workspace Diagnostics",
- },
- f = { "<cmd>Neoformat<cr>", "Format" },
- i = { "<cmd>LspInfo<cr>", "Info" },
- j = { "<cmd>lua vim.lsp.diagnostic.goto_next({popup_opts = {border = O.lsp.popup_border}})<cr>", "Next Diagnostic" },
- k = { "<cmd>lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = O.lsp.popup_border}})<cr>", "Prev Diagnostic" },
- q = { "<cmd>Telescope quickfix<cr>", "Quickfix" },
- r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" },
- s = {
- O.plugin.symbol_outline.active and "<cmd>SymbolsOutline<cr>" or "<cmd> Telescope lsp_document_symbols<cr>",
- "Document Symbols",
- },
- S = {
- "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>",
- "Workspace Symbols",
- },
- },
- s = {
- name = "Search",
- b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
- c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" },
- d = { "<cmd>Telescope commands<cr>", "Commands History" },
- f = { "<cmd>Telescope find_files<cr>", "Find File" },
- h = { "<cmd>Telescope help_tags<cr>", "Find Help" },
- M = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
- r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
- R = { "<cmd>Telescope registers<cr>", "Registers" },
- t = { "<cmd>Telescope live_grep<cr>", "Text" },
- },
- T = {
- name = "Treesitter",
- i = { ":TSConfigInfo<cr>", "Info" },
- },
-}
-
-if O.plugin.symbol_outline.active then
- vim.api.nvim_set_keymap("n", "<leader>o", ":SymbolsOutline<CR>", { noremap = true, silent = true })
- mappings["o"] = "Symbols outline"
-end
-
-if O.plugin.ts_playground.active then
- vim.api.nvim_set_keymap("n", "<leader>Th", ":TSHighlightCapturesUnderCursor<CR>", { noremap = true, silent = true })
- mappings[""] = "Highlight Capture"
-end
-
-if O.plugin.zen.active then
- vim.api.nvim_set_keymap("n", "<leader>z", ":ZenMode<CR>", { noremap = true, silent = true })
- mappings["z"] = "Zen"
-end
-
-if O.plugin.telescope_project.active then
- -- open projects
- vim.api.nvim_set_keymap(
- "n",
- "<leader>P",
- ":lua require'telescope'.extensions.project.project{}<CR>",
- { noremap = true, silent = true }
- )
- mappings["P"] = "Projects"
-end
-
-if O.lushmode then
- mappings["L"] = {
- name = "+Lush",
- l = { ":Lushify<cr>", "Lushify" },
- x = { ":lua require('lush').export_to_buffer(require('lush_theme.cool_name'))", "Lush Export" },
- t = { ":LushRunTutorial<cr>", "Lush Tutorial" },
- q = { ":LushRunQuickstart<cr>", "Lush Quickstart" },
- }
-end
-
-for k, v in pairs(O.user_which_key) do
- mappings[k] = v
-end
-
-local wk = require "which-key"
-wk.register(mappings, opts)
diff --git a/.config/nvim/lua/cfg/autopairs/init.lua b/.config/nvim/lua/core/autopairs.lua
index b8dad5f..f0111db 100644
--- a/.config/nvim/lua/cfg/autopairs/init.lua
+++ b/.config/nvim/lua/core/autopairs.lua
@@ -1,7 +1,7 @@
-- if not package.loaded['nvim-autopairs'] then
-- return
-- end
-local status_ok, autopairs = pcall(require, "nvim-autopairs")
+local status_ok, _ = pcall(require, "nvim-autopairs")
if not status_ok then
return
end
diff --git a/.config/nvim/lua/cfg/barbar/init.lua b/.config/nvim/lua/core/bufferline.lua
index 5257de5..d4e4b4f 100644
--- a/.config/nvim/lua/cfg/barbar/init.lua
+++ b/.config/nvim/lua/core/bufferline.lua
@@ -1,8 +1,9 @@
-vim.api.nvim_set_keymap("n", "<TAB>", ":BufferNext<CR>", { noremap = true, silent = true })
-vim.api.nvim_set_keymap("n", "<S-TAB>", ":BufferPrevious<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<S-x>", ":BufferClose<CR>", { noremap = true, silent = true })
+vim.api.nvim_set_keymap("n", "<S-l>", ":BufferNext<CR>", { noremap = true, silent = true })
+vim.api.nvim_set_keymap("n", "<S-h>", ":BufferPrevious<CR>", { noremap = true, silent = true })
+vim.api.nvim_set_keymap("n", "<leader>c", ":BufferClose<CR>", { noremap = true, silent = true })
-O.user_which_key["b"] = {
+O.plugin.which_key.mappings["b"] = {
name = "Buffers",
j = { "<cmd>BufferPick<cr>", "jump to buffer" },
f = { "<cmd>Telescope buffers<cr>", "Find buffer" },
diff --git a/.config/nvim/lua/core/colorizer.lua b/.config/nvim/lua/core/colorizer.lua
new file mode 100644
index 0000000..c6a2a27
--- /dev/null
+++ b/.config/nvim/lua/core/colorizer.lua
@@ -0,0 +1,17 @@
+local M = {}
+
+M.config = function()
+ O.plugin.hop = {
+ active = false,
+ }
+end
+
+M.setup = function()
+ local status_ok, colorizer = pcall(require, "colorizer")
+ if not status_ok then
+ return
+ end
+ colorizer.setup(O.plugin.hop)
+end
+
+return M
diff --git a/.config/nvim/lua/cfg/compe/init.lua b/.config/nvim/lua/core/compe.lua
index f42e8ad..c8152ad 100644
--- a/.config/nvim/lua/cfg/compe/init.lua
+++ b/.config/nvim/lua/core/compe.lua
@@ -1,14 +1,7 @@
---if not package.loaded['compe'] then
--- return
--- end
-
local M = {}
-
-vim.g.vsnip_snippet_dir = O.vnsip_dir
-
M.config = function()
- local opt = {
- enabled = O.auto_complete,
+ O.completion = {
+ enabled = true,
autocomplete = true,
debug = false,
min_length = 1,
@@ -27,24 +20,28 @@ M.config = function()
calc = { kind = "  (Calc)" },
vsnip = { kind = "  (Snippet)" },
nvim_lsp = { kind = "  (LSP)" },
- -- nvim_lua = {kind = "  "},
nvim_lua = false,
spell = { kind = "  (Spell)" },
tags = false,
- -- vim_dadbod_completion = true,
- -- snippets_nvim = {kind = "  "},
- -- ultisnips = {kind = "  "},
- -- treesitter = {kind = "  "},
+ vim_dadbod_completion = false,
+ snippets_nvim = false,
+ ultisnips = false,
+ treesitter = false,
emoji = { kind = " ﲃ (Emoji)", filetypes = { "markdown", "text" } },
-- for emoji press : (idk if that in compe tho)
},
}
+end
+
+M.setup = function()
+ vim.g.vsnip_snippet_dir = O.vsnip_dir
+
local status_ok, compe = pcall(require, "compe")
if not status_ok then
return
end
- compe.setup(opt)
+ compe.setup(O.completion)
local t = function(str)
return vim.api.nvim_replace_termcodes(str, true, true, true)
diff --git a/.config/nvim/lua/core/dap.lua b/.config/nvim/lua/core/dap.lua
new file mode 100644
index 0000000..bc76e22
--- /dev/null
+++ b/.config/nvim/lua/core/dap.lua
@@ -0,0 +1,41 @@
+local M = {}
+M.config = function()
+ O.plugin.dap = {
+ active = false,
+ breakpoint = {
+ text = "",
+ texthl = "LspDiagnosticsSignError",
+ linehl = "",
+ numhl = "",
+ },
+ }
+end
+
+M.setup = function()
+ local status_ok, dap = pcall(require, "dap")
+ if not status_ok then
+ return
+ end
+
+ vim.fn.sign_define("DapBreakpoint", O.plugin.dap.breakpoint)
+ dap.defaults.fallback.terminal_win_cmd = "50vsplit new"
+
+ O.user_which_key["d"] = {
+ name = "Debug",
+ t = { "<cmd>lua require'dap'.toggle_breakpoint()<cr>", "Toggle Breakpoint" },
+ b = { "<cmd>lua require'dap'.step_back()<cr>", "Step Back" },
+ c = { "<cmd>lua require'dap'.continue()<cr>", "Continue" },
+ C = { "<cmd>lua require'dap'.run_to_cursor()<cr>", "Run To Cursor" },
+ d = { "<cmd>lua require'dap'.disconnect()<cr>", "Disconnect" },
+ g = { "<cmd>lua require'dap'.session()<cr>", "Get Session" },
+ i = { "<cmd>lua require'dap'.step_into()<cr>", "Step Into" },
+ o = { "<cmd>lua require'dap'.step_over()<cr>", "Step Over" },
+ u = { "<cmd>lua require'dap'.step_out()<cr>", "Step Out" },
+ p = { "<cmd>lua require'dap'.pause.toggle()<cr>", "Pause" },
+ r = { "<cmd>lua require'dap'.repl.toggle()<cr>", "Toggle Repl" },
+ s = { "<cmd>lua require'dap'.continue()<cr>", "Start" },
+ q = { "<cmd>lua require'dap'.stop()<cr>", "Quit" },
+ }
+end
+
+return M
diff --git a/.config/nvim/lua/core/dashboard.lua b/.config/nvim/lua/core/dashboard.lua
new file mode 100644
index 0000000..4c7ecc3
--- /dev/null
+++ b/.config/nvim/lua/core/dashboard.lua
@@ -0,0 +1,98 @@
+local M = {}
+M.config = function()
+ O.plugin.dashboard = {
+ active = false,
+ search_handler = "telescope",
+ custom_header = {
+ ' ##############..... ############## ',
+ ' ##############......############## ',
+ ' ##########..........########## ',
+ ' ##########........########## ',
+ ' ##########.......########## ',
+ ' ##########.....##########.. ',
+ ' ##########....##########..... ',
+ ' ..##########..##########......... ',
+ ' ....##########.#########............. ',
+ ' ..################JJJ............ ',
+ ' ################............. ',
+ ' ##############.JJJ.JJJJJJJJJJ ',
+ ' ############...JJ...JJ..JJ JJ ',
+ ' ##########....JJ...JJ..JJ JJ ',
+ ' ########......JJJ..JJJ JJJ JJJ ',
+ ' ###### ......... ',
+ ' ..... ',
+ ' . ',
+ },
+
+ custom_section = {
+ a = {
+ description = { " Find File " },
+ command = "Telescope find_files",
+ },
+ b = {
+ description = { " Recently Used Files" },
+ command = "Telescope oldfiles",
+ },
+ c = {
+ description = { " Find Word " },
+ command = "Telescope live_grep",
+ },
+ d = {
+ description = { " Settings " },
+ command = ":e ~/.config/nvim/config.lua",
+ },
+ },
+
+ }
+end
+
+M.setup = function()
+ vim.g.dashboard_disable_at_vimenter = 0
+
+ vim.g.dashboard_custom_header = O.plugin.dashboard.custom_header
+
+ vim.g.dashboard_default_executive = O.plugin.dashboard.search_handler
+
+ vim.g.dashboard_custom_section = O.plugin.dashboard.custom_section
+
+ O.plugin.which_key.mappings[";"] = { "<cmd>Dashboard<CR>", "Dashboard" }
+
+ -- f = {
+ -- description = { " Neovim Config Files" },
+ -- command = "Telescope find_files cwd=" .. CONFIG_PATH,
+ -- },
+ -- e = {description = {' Marks '}, command = 'Telescope marks'}
+
+ vim.cmd "let g:dashboard_session_directory = $HOME..'/.config/nvim/.sessions'"
+ vim.cmd "let packages = len(globpath('~/.local/share/nvim/site/pack/packer/start', '*', 0, 1))"
+
+ vim.api.nvim_exec(
+ [[
+ let g:dashboard_custom_footer = ['LuaJIT loaded '..packages..' plugins']
+]],
+ false
+ )
+
+ -- file_browser = {description = {' File Browser'}, command = 'Telescope find_files'},
+
+ -- vim.g.dashboard_session_directory = CACHE_PATH..'/session'
+ -- vim.g.dashboard_custom_footer = O.dashboard.footer
+ require("utils").define_augroups {
+ _dashboard = {
+ -- seems to be nobuflisted that makes my stuff disapear will do more testing
+ {
+ "FileType",
+ "dashboard",
+ "setlocal nocursorline noswapfile synmaxcol& signcolumn=no norelativenumber nocursorcolumn nospell nolist nonumber bufhidden=wipe colorcolumn= foldcolumn=0 matchpairs= ",
+ },
+ {
+ "FileType",
+ "dashboard",
+ "set showtabline=0 | autocmd BufLeave <buffer> set showtabline=" .. O.default_options.showtabline,
+ },
+ { "FileType", "dashboard", "nnoremap <silent> <buffer> q :q<CR>" },
+ },
+ }
+end
+
+return M
diff --git a/.config/nvim/lua/core/formatter.lua b/.config/nvim/lua/core/formatter.lua
new file mode 100644
index 0000000..04c078a
--- /dev/null
+++ b/.config/nvim/lua/core/formatter.lua
@@ -0,0 +1,60 @@
+-- autoformat
+if O.format_on_save then
+ require("utils").define_augroups {
+ autoformat = {
+ {
+ "BufWritePost",
+ "*",
+ ":silent FormatWrite",
+ },
+ },
+ }
+end
+
+-- -- check if formatter has been defined for the language or not
+-- local function formatter_exists(lang_formatter)
+-- if lang_formatter == nil then
+-- return false
+-- end
+-- if lang_formatter.exe == nil or lang_formatter.args == nil then
+-- return false
+-- end
+-- return true
+-- end
+
+-- returns default formatter for given language
+-- local function formatter_return(lang_formatter)
+-- return {
+-- exe = lang_formatter.exe,
+-- args = lang_formatter.args,
+-- stdin = not (lang_formatter.stdin ~= nil),
+-- }
+-- end
+
+-- fill a table like this -> {rust: {exe:"sth",args:{"a","b"},stdin=true},go: {}...}
+-- local formatter_filetypes = {}
+-- for k, v in pairs(O.lang) do
+-- if formatter_exists(v.formatter) then
+-- local keys = v.filetypes
+-- if keys == nil then
+-- keys = { k }
+-- end
+-- for _, l in pairs(keys) do
+-- formatter_filetypes[l] = {
+-- function()
+-- return formatter_return(v.formatter)
+-- end,
+-- }
+-- end
+-- end
+-- end
+local status_ok, _ = pcall(require, "formatter")
+if not status_ok then
+ return
+end
+
+if not O.format_on_save then
+ vim.cmd [[if exists('#autoformat#BufWritePost')
+ :autocmd! autoformat
+ endif]]
+end
diff --git a/.config/nvim/lua/cfg/galaxyline/init.lua b/.config/nvim/lua/core/galaxyline.lua
index c4bc5ef..1f9f781 100644
--- a/.config/nvim/lua/cfg/galaxyline/init.lua
+++ b/.config/nvim/lua/core/galaxyline.lua
@@ -5,28 +5,12 @@ local status_ok, gl = pcall(require, "galaxyline")
if not status_ok then
return
end
--- get my theme in galaxyline repo
--- local colors = require('galaxyline.theme').default
-local colors = {
- bg = "#0A0A0A",
- fg = "#D0D0D0",
- yellow = "#DCDCAA",
- dark_yellow = "#D7BA7D",
- cyan = "#4EC9B0",
- green = "#608B4E",
- light_green = "#B5CEA8",
- string_orange = "#CE9178",
- orange = "#FF8800",
- purple = "#C586C0",
- magenta = "#D16D9E",
- grey = "#858585",
- blue = "#569CD6",
- vivid_blue = "#4FC1FF",
- light_blue = "#9CDCFE",
- red = "#D16969",
- error_red = "#F44747",
- info_yellow = "#FFCC66",
-}
+
+-- NOTE: if someone defines colors but doesn't have them then this will break
+local palette_status_ok, colors = pcall(require, O.colorscheme .. ".palette")
+if not palette_status_ok then
+ colors = O.plugin.galaxyline.colors
+end
local condition = require "galaxyline.condition"
local gls = gl.section
@@ -50,8 +34,8 @@ table.insert(gls.left, {
end
return alias_mode..' '
end,
- separator_highlight = "StatusLineSeparator",
- highlight = "StatusLineNC",
+ separator_highlight = { "NONE", colors.alt_bg },
+ highlight = { colors.grey, colors.alt_bg },
},
})
@@ -64,8 +48,8 @@ table.insert(gls.left, {
end,
condition = condition.check_git_workspace,
separator = " ",
- separator_highlight = "StatusLineSeparator",
- highlight = "StatusLineGit",
+ separator_highlight = { "NONE", colors.alt_bg },
+ highlight = { colors.orange, colors.alt_bg },
},
})
@@ -74,8 +58,8 @@ table.insert(gls.left, {
provider = "GitBranch",
condition = condition.check_git_workspace,
separator = " ",
- separator_highlight = "StatusLineSeparator",
- highlight = "StatusLineNC",
+ separator_highlight = { "NONE", colors.alt_bg },
+ highlight = { colors.grey, colors.alt_bg },
},
})
@@ -84,7 +68,7 @@ table.insert(gls.left, {
provider = "DiffAdd",
condition = condition.hide_in_width,
icon = "  ",
- highlight = "StatusLineGitAdd",
+ highlight = { colors.green, colors.alt_bg },
},
})
@@ -93,7 +77,7 @@ table.insert(gls.left, {
provider = "DiffModified",
condition = condition.hide_in_width,
icon = " 柳",
- highlight = "StatusLineGitChange",
+ highlight = { colors.blue, colors.alt_bg },
},
})
@@ -102,7 +86,7 @@ table.insert(gls.left, {
provider = "DiffRemove",
condition = condition.hide_in_width,
icon = "  ",
- highlight = "StatusLineGitDelete",
+ highlight = { colors.red, colors.alt_bg },
},
})
@@ -111,7 +95,7 @@ table.insert(gls.left, {
provider = function()
return " "
end,
- highlight = "StatusLineGitDelete",
+ highlight = { colors.grey, colors.alt_bg },
},
})
-- get output from shell command
@@ -142,7 +126,7 @@ local PythonEnv = function()
if vim.bo.filetype == "python" then
local venv = os.getenv "CONDA_DEFAULT_ENV"
if venv ~= nil then
- return "🅒 (" .. env_cleanup(venv) .. ")"
+ return "  (" .. env_cleanup(venv) .. ")"
end
venv = os.getenv "VIRTUAL_ENV"
if venv ~= nil then
@@ -155,8 +139,8 @@ end
table.insert(gls.left, {
VirtualEnv = {
provider = PythonEnv,
- highlight = "StatusLineTreeSitter",
event = "BufEnter",
+ highlight = { colors.green, colors.alt_bg },
},
})
@@ -164,15 +148,14 @@ table.insert(gls.right, {
DiagnosticError = {
provider = "DiagnosticError",
icon = "  ",
- highlight = "StatusLineLspDiagnosticsError",
+ highlight = { colors.red, colors.alt_bg },
},
})
table.insert(gls.right, {
DiagnosticWarn = {
provider = "DiagnosticWarn",
icon = "  ",
-
- highlight = "StatusLineLspDiagnosticsWarning",
+ highlight = { colors.orange, colors.alt_bg },
},
})
@@ -180,8 +163,7 @@ table.insert(gls.right, {
DiagnosticInfo = {
provider = "DiagnosticInfo",
icon = "  ",
-
- highlight = "StatusLineLspDiagnosticsInformation",
+ highlight = { colors.yellow, colors.alt_bg },
},
})
@@ -189,8 +171,7 @@ table.insert(gls.right, {
DiagnosticHint = {
provider = "DiagnosticHint",
icon = "  ",
-
- highlight = "StatusLineLspDiagnosticsHint",
+ highlight = { colors.blue, colors.alt_bg },
},
})
@@ -203,8 +184,8 @@ table.insert(gls.right, {
return ""
end,
separator = " ",
- separator_highlight = "StatusLineSeparator",
- highlight = "StatusLineTreeSitter",
+ separator_highlight = { "NONE", colors.alt_bg },
+ highlight = { colors.green, colors.alt_bg },
},
})
@@ -218,13 +199,15 @@ local get_lsp_client = function(msg)
local lsps = ""
for _, client in ipairs(clients) do
local filetypes = client.config.filetypes
- if filetypes and vim.fn.index(filetypes, buf_ft) ~= 1 then
+ if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
-- print(client.name)
if lsps == "" then
-- print("first", lsps)
lsps = client.name
else
- lsps = lsps .. ", " .. client.name
+ if not string.find(lsps, client.name) then
+ lsps = lsps .. ", " .. client.name
+ end
-- print("more", lsps)
end
end
@@ -246,8 +229,8 @@ table.insert(gls.right, {
end
return true
end,
- icon = " ",
- highlight = "StatusLineNC",
+ icon = " ",
+ highlight = { colors.grey, colors.alt_bg },
},
})
@@ -255,8 +238,8 @@ table.insert(gls.right, {
LineInfo = {
provider = "LineColumn",
separator = " ",
- separator_highlight = "StatusLineSeparator",
- highlight = "StatusLineNC",
+ separator_highlight = { "NONE", colors.alt_bg },
+ highlight = { colors.grey, colors.alt_bg },
},
})
@@ -264,8 +247,8 @@ table.insert(gls.right, {
PerCent = {
provider = "LinePercent",
separator = " ",
- separator_highlight = "StatusLineSeparator",
- highlight = "StatusLineNC",
+ separator_highlight = { "NONE", colors.alt_bg },
+ highlight = { colors.grey, colors.alt_bg },
},
})
@@ -276,8 +259,8 @@ table.insert(gls.right, {
end,
condition = condition.hide_in_width,
separator = " ",
- separator_highlight = "StatusLineSeparator",
- highlight = "StatusLineNC",
+ separator_highlight = { "NONE", colors.alt_bg },
+ highlight = { colors.grey, colors.alt_bg },
},
})
@@ -286,8 +269,8 @@ table.insert(gls.right, {
provider = "FileTypeName",
condition = condition.hide_in_width,
separator = " ",
- separator_highlight = "StatusLineSeparator",
- highlight = "StatusLineNC",
+ separator_highlight = { "NONE", colors.alt_bg },
+ highlight = { colors.grey, colors.alt_bg },
},
})
@@ -296,8 +279,8 @@ table.insert(gls.right, {
provider = "FileEncode",
condition = condition.hide_in_width,
separator = " ",
- separator_highlight = "StatusLineSeparator",
- highlight = "StatusLineNC",
+ separator_highlight = { "NONE", colors.alt_bg },
+ highlight = { colors.grey, colors.alt_bg },
},
})
@@ -307,8 +290,8 @@ table.insert(gls.right, {
return " "
end,
separator = " ",
- separator_highlight = "StatusLineSeparator",
- highlight = "StatusLineNC",
+ separator_highlight = { "NONE", colors.alt_bg },
+ highlight = { colors.grey, colors.alt_bg },
},
})
@@ -316,8 +299,8 @@ table.insert(gls.short_line_left, {
BufferType = {
provider = "FileTypeName",
separator = " ",
- separator_highlight = "StatusLineSeparator",
- highlight = "StatusLineNC",
+ separator_highlight = { "NONE", colors.alt_bg },
+ highlight = { colors.alt_bg, colors.alt_bg },
},
})
@@ -325,9 +308,8 @@ table.insert(gls.short_line_left, {
SFileName = {
provider = "SFileName",
condition = condition.buffer_not_empty,
-
- highlight = "StatusLineNC",
+ highlight = { colors.alt_bg, colors.alt_bg },
},
})
---table.insert(gls.short_line_right[1] = {BufferIcon = {provider = 'BufferIcon', highlight = {colors.grey, colors.bg}}})
+--table.insert(gls.short_line_right[1] = {BufferIcon = {provider = 'BufferIcon', highlight = {colors.grey, colors.alt_bg}}})
diff --git a/.config/nvim/lua/cfg/gitsigns/init.lua b/.config/nvim/lua/core/gitsigns.lua
index 920c312..bc310ad 100644
--- a/.config/nvim/lua/cfg/gitsigns/init.lua
+++ b/.config/nvim/lua/core/gitsigns.lua
@@ -1,13 +1,7 @@
local M = {}
-
M.config = function()
- local status_ok, gitsigns = pcall(require, "gitsigns")
- if not status_ok then
- return
- end
- gitsigns.setup {
+ O.plugin.gitsigns = {
signs = {
- -- TODO add hl to colorscheme
add = {
hl = "GitSignsAdd",
text = "▎",
@@ -54,4 +48,12 @@ M.config = function()
}
end
+M.setup = function()
+ local status_ok, gitsigns = pcall(require, "gitsigns")
+ if not status_ok then
+ return
+ end
+ gitsigns.setup(O.plugin.gitsigns)
+end
+
return M
diff --git a/.config/nvim/lua/core/hop.lua b/.config/nvim/lua/core/hop.lua
new file mode 100644
index 0000000..d3dd90d
--- /dev/null
+++ b/.config/nvim/lua/core/hop.lua
@@ -0,0 +1,20 @@
+vim.api.nvim_set_keymap('n', 's', ":HopChar2<cr>", { noremap = true, silent = true })
+vim.api.nvim_set_keymap('n', 'S', ":HopWord<cr>", { noremap = true, silent = true })
+
+local M = {}
+
+M.config = function()
+ O.plugin.hop = {
+ active = false,
+ }
+end
+
+M.setup = function()
+ local status_ok, hop = pcall(require, "hop")
+ if not status_ok then
+ return
+ end
+ hop.setup(O.plugin.hop)
+end
+
+return M
diff --git a/.config/nvim/lua/core/linter.lua b/.config/nvim/lua/core/linter.lua
new file mode 100644
index 0000000..94dff93
--- /dev/null
+++ b/.config/nvim/lua/core/linter.lua
@@ -0,0 +1,33 @@
+local M = {}
+
+M.setup = function()
+ if O.lint_on_save then
+ require("utils").define_augroups {
+ autolint = {
+ {
+ "BufWritePost",
+ "<buffer>",
+ ":silent lua require('lint').try_lint()",
+ },
+ {
+ "BufEnter",
+ "<buffer>",
+ ":silent lua require('lint').try_lint()",
+ },
+ },
+ }
+ end
+end
+
+local status_ok, _ = pcall(require, "lint")
+if not status_ok then
+ return
+end
+
+if not O.lint_on_save then
+ vim.cmd [[if exists('#autolint#BufWritePost')
+ :autocmd! autolint
+ endif]]
+end
+
+return M
diff --git a/.config/nvim/lua/core/nvimtree.lua b/.config/nvim/lua/core/nvimtree.lua
new file mode 100644
index 0000000..a763c71
--- /dev/null
+++ b/.config/nvim/lua/core/nvimtree.lua
@@ -0,0 +1,88 @@
+local M = {}
+--
+M.config = function()
+ O.plugin.nvimtree = {
+ side = "left",
+ show_icons = {
+ git = 1,
+ folders = 1,
+ files = 1,
+ folder_arrows = 1,
+ tree_width = 30,
+ },
+ ignore = { ".git", "node_modules", ".cache" },
+ auto_open = 1,
+ auto_close = 1,
+ quit_on_open = 0,
+ follow = 1,
+ hide_dotfiles = 1,
+ git_hl = 1,
+ root_folder_modifier = ":t",
+ tab_open = 0,
+ allow_resize = 1,
+ lsp_diagnostics = 1,
+ auto_ignore_ft = { "startify", "dashboard" },
+ icons = {
+ default = "",
+ symlink = "",
+ git = {
+ unstaged = "",
+ staged = "S",
+ unmerged = "",
+ renamed = "➜",
+ deleted = "",
+ untracked = "U",
+ ignored = "◌",
+ },
+ folder = {
+ default = "",
+ open = "",
+ empty = "",
+ empty_open = "",
+ symlink = "",
+ },
+ },
+ }
+end
+--
+M.setup = function()
+ local status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
+ if not status_ok then
+ return
+ end
+ local g = vim.g
+
+ for opt, val in pairs(O.plugin.nvimtree) do
+ g["nvim_tree_" .. opt] = val
+ end
+
+ local tree_cb = nvim_tree_config.nvim_tree_callback
+
+ g.nvim_tree_bindings = {
+ { key = { "l", "<CR>", "o" }, cb = tree_cb "edit" },
+ { key = "h", cb = tree_cb "close_node" },
+ { key = "v", cb = tree_cb "vsplit" },
+ }
+end
+--
+--
+M.toggle_tree = function()
+ local view_status_ok, view = pcall(require, "nvim-tree.view")
+ if not view_status_ok then
+ return
+ end
+ if view.win_open() then
+ require("nvim-tree").close()
+ if package.loaded["bufferline.state"] then
+ require("bufferline.state").set_offset(0)
+ end
+ else
+ if package.loaded["bufferline.state"] then
+ -- require'bufferline.state'.set_offset(31, 'File Explorer')
+ require("bufferline.state").set_offset(31, "")
+ end
+ require("nvim-tree").toggle()
+ end
+end
+--
+return M
diff --git a/.config/nvim/lua/core/status_colors.lua b/.config/nvim/lua/core/status_colors.lua
new file mode 100644
index 0000000..9a70ddd
--- /dev/null
+++ b/.config/nvim/lua/core/status_colors.lua
@@ -0,0 +1,19 @@
+O.plugin.galaxyline = {
+ active = true,
+ colors = {
+ alt_bg = "#0A0A0A",
+ grey = "#D0D0D0",
+ blue = "#569CD6",
+ green = "#608B4E",
+ yellow = "#DCDCAA",
+ orange = "#FF8800",
+ purple = "#C586C0",
+ magenta = "#D16D9E",
+ cyan = "#4EC9B0",
+ red = "#D16969",
+ error_red = "#F44747",
+ warning_orange = "#FF8800",
+ info_yellow = "#FFCC66",
+ hint_blue = "#9CDCFE",
+ },
+}
diff --git a/.config/nvim/lua/core/telescope.lua b/.config/nvim/lua/core/telescope.lua
new file mode 100644
index 0000000..48157bc
--- /dev/null
+++ b/.config/nvim/lua/core/telescope.lua
@@ -0,0 +1,97 @@
+local M = {}
+M.config = function()
+ local status_ok, actions = pcall(require, "telescope.actions")
+ if not status_ok then
+ return
+ end
+
+ O.plugin.telescope = {
+ active = false,
+ defaults = {
+ find_command = {
+ "rg",
+ "--no-heading",
+ "--with-filename",
+ "--line-number",
+ "--column",
+ "--smart-case",
+ },
+ prompt_prefix = " ",
+ selection_caret = " ",
+ entry_prefix = " ",
+ initial_mode = "insert",
+ selection_strategy = "reset",
+ sorting_strategy = "ascending",
+ layout_strategy = "horizontal",
+ layout_config = {
+ width = 0.75,
+ prompt_position = "top",
+ preview_cutoff = 120,
+ horizontal = { mirror = false },
+ vertical = { mirror = false },
+ },
+ file_sorter = require("telescope.sorters").get_fzy_sorter,
+ file_ignore_patterns = {},
+ generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
+ path_display = {"shorten"},
+ winblend = 0,
+ border = {},
+ borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
+ color_devicons = true,
+ use_less = true,
+ set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
+ file_previewer = require("telescope.previewers").vim_buffer_cat.new,
+ grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
+ qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
+
+
+ -- Developer configurations: Not meant for general override
+ -- buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
+ mappings = {
+ i = {
+ -- ["<C-n>"] = actions.cycle_history_next,
+ -- ["<C-p>"] = actions.cycle_history_prev,
+ ["<C-c>"] = actions.close,
+ ["<C-j>"] = actions.move_selection_next,
+ ["<C-k>"] = actions.move_selection_previous,
+ ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
+ ["<CR>"] = actions.select_default + actions.center,
+ -- To disable a keymap, put [map] = false
+ -- So, to not map "<C-n>", just put
+ -- ["<c-t>"] = trouble.open_with_trouble,
+ -- ["<c-x>"] = false,
+ -- ["<esc>"] = actions.close,
+ -- Otherwise, just set the mapping to the function that you want it to be.
+ -- ["<C-i>"] = actions.select_horizontal,
+ -- Add up multiple actions
+ -- You can perform as many actions in a row as you like
+ -- ["<CR>"] = actions.select_default + actions.center + my_cool_custom_action,
+ },
+ n = {
+ ["<C-j>"] = actions.move_selection_next,
+ ["<C-k>"] = actions.move_selection_previous,
+ ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
+ -- ["<c-t>"] = trouble.open_with_trouble,
+ -- ["<C-i>"] = my_cool_custom_action,
+ },
+ },
+ },
+ extensions = {
+ fzy_native = {
+ override_generic_sorter = false,
+ override_file_sorter = true,
+ },
+ },
+ }
+end
+
+M.setup = function()
+ local status_ok, telescope = pcall(require, "telescope")
+ if not status_ok then
+ return
+ end
+ telescope.setup(O.plugin.telescope)
+ vim.api.nvim_set_keymap("n", "<Leader>f", ":Telescope find_files<CR>", { noremap = true, silent = true })
+end
+
+return M
diff --git a/.config/nvim/lua/core/terminal.lua b/.config/nvim/lua/core/terminal.lua
new file mode 100644
index 0000000..0f93045
--- /dev/null
+++ b/.config/nvim/lua/core/terminal.lua
@@ -0,0 +1,68 @@
+local M = {}
+M.config = function()
+ O.plugin["terminal"] = {
+ -- size can be a number or function which is passed the current terminal
+ size = 5,
+ -- open_mapping = [[<c-\>]],
+ open_mapping = [[<c-t>]],
+ hide_numbers = true, -- hide the number column in toggleterm buffers
+ shade_filetypes = {},
+ shade_terminals = true,
+ shading_factor = 2, -- the degree by which to darken to terminal colour, default: 1 for dark backgrounds, 3 for light
+ start_in_insert = true,
+ insert_mappings = true, -- whether or not the open mapping applies in insert mode
+ persist_size = true,
+ -- direction = 'vertical' | 'horizontal' | 'window' | 'float',
+ direction = "float",
+ close_on_exit = true, -- close the terminal window when the process exits
+ shell = vim.o.shell, -- change the default shell
+ -- This field is only relevant if direction is set to 'float'
+ float_opts = {
+ -- The border key is *almost* the same as 'nvim_win_open'
+ -- see :h nvim_win_open for details on borders however
+ -- the 'curved' border is a custom border type
+ -- not natively supported but implemented in this plugin.
+ -- border = 'single' | 'double' | 'shadow' | 'curved' | ... other options supported by win open
+ border = "curved",
+ -- width = <value>,
+ -- height = <value>,
+ winblend = 3,
+ highlights = {
+ border = "Normal",
+ background = "Normal",
+ },
+ },
+ }
+end
+
+M.setup = function()
+ local status_ok, terminal = pcall(require, "toggleterm")
+ if not status_ok then
+ print(terminal)
+ return
+ end
+ vim.api.nvim_set_keymap(
+ "n",
+ "<leader>gg",
+ "<cmd>lua require('core.terminal')._lazygit_toggle()<CR>",
+ { noremap = true, silent = true }
+ )
+ O.plugin.which_key.mappings["gg"] = "LazyGit"
+ terminal.setup(O.plugin.terminal)
+end
+
+local function is_installed(exe)
+ return vim.fn.executable(exe) == 1
+end
+
+M._lazygit_toggle = function()
+ if is_installed "lazygit" ~= true then
+ print "Please install lazygit. Check documentation for more information"
+ return
+ end
+ local Terminal = require("toggleterm.terminal").Terminal
+ local lazygit = Terminal:new { cmd = "lazygit", hidden = true }
+ lazygit:toggle()
+end
+
+return M
diff --git a/.config/nvim/lua/core/treesitter.lua b/.config/nvim/lua/core/treesitter.lua
new file mode 100644
index 0000000..2b7a2d5
--- /dev/null
+++ b/.config/nvim/lua/core/treesitter.lua
@@ -0,0 +1,187 @@
+local M = {}
+M.config = function()
+ O.treesitter = {
+ ensure_installed = {}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
+ ignore_install = {},
+ matchup = {
+ enable = false, -- mandatory, false will disable the whole extension
+ -- disable = { "c", "ruby" }, -- optional, list of language that will be disabled
+ },
+ highlight = {
+ enable = true, -- false will disable the whole extension
+ additional_vim_regex_highlighting = true,
+ disable = { "latex" },
+ },
+ context_commentstring = {
+ enable = false,
+ config = { css = "// %s" },
+ },
+ -- indent = {enable = true, disable = {"python", "html", "javascript"}},
+ -- TODO seems to be broken
+ indent = { enable = { "javascriptreact" } },
+ autotag = { enable = false },
+ textobjects = {
+ swap = {
+ enable = false,
+ -- swap_next = textobj_swap_keymaps,
+ },
+ -- move = textobj_move_keymaps,
+ select = {
+ enable = false,
+ -- keymaps = textobj_sel_keymaps,
+ },
+ },
+ textsubjects = {
+ enable = false,
+ keymaps = { ["."] = "textsubjects-smart", [";"] = "textsubjects-big" },
+ },
+ playground = {
+ enable = false,
+ disable = {},
+ updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
+ persist_queries = false, -- Whether the query persists across vim sessions
+ keybindings = {
+ toggle_query_editor = "o",
+ toggle_hl_groups = "i",
+ toggle_injected_languages = "t",
+ toggle_anonymous_nodes = "a",
+ toggle_language_display = "I",
+ focus_language = "f",
+ unfocus_language = "F",
+ update = "R",
+ goto_node = "<cr>",
+ show_help = "?",
+ },
+ },
+ rainbow = {
+ enable = false,
+ extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean
+ max_file_lines = 1000, -- Do not enable for files with more than 1000 lines, int
+ },
+ }
+
+ -- -- TODO refactor treesitter
+ -- -- @usage pass a table with your desired languages
+ -- treesitter = {
+ -- ensure_installed = "all",
+ -- ignore_install = { "haskell" },
+ -- highlight = { enabled = true },
+ -- -- The below are for treesitter-textobjects plugin
+ -- textobj_prefixes = {
+ -- goto_next = "]", -- Go to next
+ -- goto_previous = "[", -- Go to previous
+ -- inner = "i", -- Select inside
+ -- outer = "a", -- Selct around
+ -- swap = "<leader>a", -- Swap with next
+ -- },
+ -- textobj_suffixes = {
+ -- -- Start and End respectively for the goto keys
+ -- -- for other keys it only uses the first
+ -- ["function"] = { "f", "F" },
+ -- ["class"] = { "m", "M" },
+ -- ["parameter"] = { "a", "A" },
+ -- ["block"] = { "k", "K" },
+ -- ["conditional"] = { "i", "I" },
+ -- ["call"] = { "c", "C" },
+ -- ["loop"] = { "l", "L" },
+ -- ["statement"] = { "s", "S" },
+ -- ["comment"] = { "/", "?" },
+ -- },
+ -- -- The below is for treesitter hint textobjects plugin
+ -- hint_labels = { "h", "j", "f", "d", "n", "v", "s", "l", "a" },
+ -- },
+end
+
+M.setup = function()
+ -- TODO: refacor this whole file and treesitter in general
+ -- if not package.loaded['nvim-treesitter'] then return end
+ --
+ -- Custom parsers
+ -- local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
+ -- parser_config.make = {
+ -- install_info = {
+ -- url = "https://github.com/alemuller/tree-sitter-make", -- local path or git repo
+ -- files = {"src/parser.c"},
+ -- requires_generate_from_grammar = true
+ -- }
+ -- }
+ -- parser_config.just = {
+ -- install_info = {
+ -- url = "~/dev/tree-sitter-just", -- local path or git repo
+ -- files = {"src/parser.c"}
+ -- }
+ -- -- filetype = "just", -- if filetype does not agrees with parser name
+ -- -- used_by = {"bar", "baz"} -- additional filetypes that use this parser
+ -- }
+ -- Custom text objects
+ -- local textobj_prefixes = O.treesitter.textobj_prefixes
+ -- local textobj_suffixes = O.treesitter.textobj_suffixes
+ -- local textobj_sel_keymaps = {}
+ -- local textobj_swap_keymaps = {}
+ -- local textobj_move_keymaps = {
+ -- enable = O.plugin.ts_textobjects,
+ -- set_jumps = true, -- whether to set jumps in the jumplist
+ -- goto_next_start = {},
+ -- goto_next_end = {},
+ -- goto_previous_start = {},
+ -- goto_previous_end = {},
+ -- }
+ -- for obj, suffix in pairs(textobj_suffixes) do
+ -- if textobj_prefixes["goto_next"] ~= nil then
+ -- textobj_move_keymaps["goto_next_start"][textobj_prefixes["goto_next"] .. suffix[1]] = "@" .. obj .. ".outer"
+ -- textobj_move_keymaps["goto_next_end"][textobj_prefixes["goto_next"] .. suffix[2]] = "@" .. obj .. ".outer"
+ -- end
+ -- if textobj_prefixes["goto_previous"] ~= nil then
+ -- textobj_move_keymaps["goto_previous_start"][textobj_prefixes["goto_previous"] .. suffix[2]] = "@" .. obj .. ".outer"
+ -- textobj_move_keymaps["goto_previous_end"][textobj_prefixes["goto_previous"] .. suffix[1]] = "@" .. obj .. ".outer"
+ -- end
+ --
+ -- if textobj_prefixes["inner"] ~= nil then
+ -- textobj_sel_keymaps[textobj_prefixes["inner"] .. suffix[1]] = "@" .. obj .. ".inner"
+ -- end
+ -- if textobj_prefixes["outer"] ~= nil then
+ -- textobj_sel_keymaps[textobj_prefixes["outer"] .. suffix[1]] = "@" .. obj .. ".outer"
+ -- end
+ --
+ -- if textobj_prefixes["swap"] ~= nil then
+ -- textobj_swap_keymaps[textobj_prefixes["swap"] .. suffix[1]] = "@" .. obj .. ".outer"
+ -- end
+ -- end
+ -- vim.g.ts_hint_textobject_keys = O.treesitter.hint_labels -- Requires https://github.com/mfussenegger/nvim-ts-hint-textobject/pull/2
+ --
+ -- -- Add which key menu entries
+ -- local status, wk = pcall(require, "which-key")
+ -- if status then
+ -- local normal = {
+ -- mode = "n", -- Normal mode
+ -- }
+ -- local operators = {
+ -- mode = "o", -- Operator mode
+ -- }
+ -- wk.register(textobj_sel_keymaps, operators)
+ -- wk.register({
+ -- ["m"] = "Hint Objects",
+ -- ["."] = "Textsubject",
+ -- [";"] = "Textsubject-big",
+ -- }, operators)
+ -- wk.register(textobj_swap_keymaps, normal)
+ -- wk.register({
+ -- [textobj_prefixes["swap"]] = "Swap",
+ -- -- [textobj_prefixes["goto_next"]] = "Jump [",
+ -- -- [textobj_prefixes["goto_previous"]] = "Jump ]"
+ -- }, normal)
+ -- wk.register(textobj_move_keymaps["goto_next_start"], normal)
+ -- wk.register(textobj_move_keymaps["goto_next_end"], normal)
+ -- wk.register(textobj_move_keymaps["goto_previous_start"], normal)
+ -- wk.register(textobj_move_keymaps["goto_previous_end"], normal)
+ -- end
+
+ local status_ok, treesitter_configs = pcall(require, "nvim-treesitter.configs")
+ if not status_ok then
+ return
+ end
+
+ treesitter_configs.setup(O.treesitter)
+end
+
+return M
diff --git a/.config/nvim/lua/core/which-key.lua b/.config/nvim/lua/core/which-key.lua
new file mode 100644
index 0000000..dabf832
--- /dev/null
+++ b/.config/nvim/lua/core/which-key.lua
@@ -0,0 +1,201 @@
+local M = {}
+M.config = function()
+ O.plugin.which_key = {
+ active = false,
+ setup = {
+ plugins = {
+ marks = true, -- shows a list of your marks on ' and `
+ registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
+ -- the presets plugin, adds help for a bunch of default keybindings in Neovim
+ -- No actual key bindings are created
+ presets = {
+ operators = false, -- adds help for operators like d, y, ...
+ motions = false, -- adds help for motions
+ text_objects = false, -- help for text objects triggered after entering an operator
+ windows = true, -- default bindings on <c-w>
+ nav = true, -- misc bindings to work with windows
+ z = true, -- bindings for folds, spelling and others prefixed with z
+ g = true, -- bindings for prefixed with g
+ },
+ spelling = { enabled = true, suggestions = 20 }, -- use which-key for spelling hints
+ },
+ icons = {
+ breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
+ separator = "➜", -- symbol used between a key and it's label
+ group = "+", -- symbol prepended to a group
+ },
+ window = {
+ border = "single", -- none, single, double, shadow
+ position = "bottom", -- bottom, top
+ margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
+ padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
+ },
+ layout = {
+ height = { min = 4, max = 25 }, -- min and max height of the columns
+ width = { min = 20, max = 50 }, -- min and max width of the columns
+ spacing = 3, -- spacing between columns
+ },
+ hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate
+ show_help = true, -- show help message on the command line when the popup is visible
+ },
+
+ opts = {
+ mode = "n", -- NORMAL mode
+ prefix = "<leader>",
+ buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
+ silent = true, -- use `silent` when creating keymaps
+ noremap = true, -- use `noremap` when creating keymaps
+ nowait = true, -- use `nowait` when creating keymaps
+ },
+ vopts = {
+ mode = "v", -- VISUAL mode
+ prefix = "<leader>",
+ buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
+ silent = true, -- use `silent` when creating keymaps
+ noremap = true, -- use `noremap` when creating keymaps
+ nowait = true, -- use `nowait` when creating keymaps
+ },
+ -- NOTE: Prefer using : over <cmd> as the latter avoids going back in normal-mode.
+ -- see https://neovim.io/doc/user/map.html#:map-cmd
+ vmappings = {
+ ["/"] = { ":CommentToggle<CR>", "Comment" },
+ },
+ mappings = {
+ ["w"] = { "<cmd>w!<CR>", "Save" },
+ ["q"] = { "<cmd>q!<CR>", "Quit" },
+ ["k"] = { "<cmd>CommentToggle<CR>", "Comment" },
+ ["c"] = { "<cmd>BufferClose!<CR>", "Close Buffer" },
+ ["e"] = { "<cmd>lua require'core.nvimtree'.toggle_tree()<CR>", "Explorer" },
+ ["f"] = { "<cmd>Telescope find_files<CR>", "Find File" },
+ ["n"] = { '<cmd>let @/=""<CR>', "No Highlight" },
+ ["h"] = { "<cmd>vsplit<CR>", "Vertical Split" },
+ ["v"] = { '<cmd>split<CR>', "Horizontal Split" },
+ p = {
+ name = "Packer",
+ c = { "<cmd>PackerCompile<cr>", "Compile" },
+ i = { "<cmd>PackerInstall<cr>", "Install" },
+ r = { "<cmd>lua require('utils').reload_config()<cr>", "Reload" },
+ s = { "<cmd>PackerSync<cr>", "Sync" },
+ u = { "<cmd>PackerUpdate<cr>", "Update" },
+ },
+
+ -- " Available Debug Adapters:
+ -- " https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/
+ -- " Adapter configuration and installation instructions:
+ -- " https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation
+ -- " Debug Adapter protocol:
+ -- " https://microsoft.github.io/debug-adapter-protocol/
+ -- " Debugging
+ g = {
+ name = "Git",
+ j = { "<cmd>lua require 'gitsigns'.next_hunk()<cr>", "Next Hunk" },
+ k = { "<cmd>lua require 'gitsigns'.prev_hunk()<cr>", "Prev Hunk" },
+ l = { "<cmd>lua require 'gitsigns'.blame_line()<cr>", "Blame" },
+ p = { "<cmd>lua require 'gitsigns'.preview_hunk()<cr>", "Preview Hunk" },
+ r = { "<cmd>lua require 'gitsigns'.reset_hunk()<cr>", "Reset Hunk" },
+ R = { "<cmd>lua require 'gitsigns'.reset_buffer()<cr>", "Reset Buffer" },
+ s = { "<cmd>lua require 'gitsigns'.stage_hunk()<cr>", "Stage Hunk" },
+ u = {
+ "<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>",
+ "Undo Stage Hunk",
+ },
+ o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
+ b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
+ c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" },
+ C = {
+ "<cmd>Telescope git_bcommits<cr>",
+ "Checkout commit(for current file)",
+ },
+ },
+
+ l = {
+ name = "LSP",
+ a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "Code Action" },
+ d = {
+ "<cmd>Telescope lsp_document_diagnostics<cr>",
+ "Document Diagnostics",
+ },
+ w = {
+ "<cmd>Telescope lsp_workspace_diagnostics<cr>",
+ "Workspace Diagnostics",
+ },
+ f = { "<cmd>silent FormatWrite<cr>", "Format" },
+ i = { "<cmd>LspInfo<cr>", "Info" },
+ j = {
+ "<cmd>lua vim.lsp.diagnostic.goto_next({popup_opts = {border = O.lsp.popup_border}})<cr>",
+ "Next Diagnostic",
+ },
+ k = {
+ "<cmd>lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = O.lsp.popup_border}})<cr>",
+ "Prev Diagnostic",
+ },
+ l = { "<cmd>silent lua require('lint').try_lint()<cr>", "Lint" },
+ q = { "<cmd>Telescope quickfix<cr>", "Quickfix" },
+ r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" },
+ s = { "<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols" },
+ S = {
+ "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>",
+ "Workspace Symbols",
+ },
+ },
+
+ s = {
+ name = "Search",
+ b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
+ c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" },
+ f = { "<cmd>Telescope find_files<cr>", "Find File" },
+ h = { "<cmd>Telescope help_tags<cr>", "Find Help" },
+ M = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
+ r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
+ R = { "<cmd>Telescope registers<cr>", "Registers" },
+ t = { "<cmd>Telescope live_grep<cr>", "Text" },
+ k = { "<cmd>Telescope keymaps<cr>", "Keymaps" },
+ C = { "<cmd>Telescope commands<cr>", "Commands" },
+ p = {
+ "<cmd>lua require('telescope.builtin.internal').colorscheme({enable_preview = true})<cr>",
+ "Colorscheme with Preview",
+ },
+ },
+ T = {
+ name = "Treesitter",
+ i = { ":TSConfigInfo<cr>", "Info" },
+ },
+ },
+ }
+end
+
+M.setup = function()
+ -- if not package.loaded['which-key'] then
+ -- return
+ -- end
+ local status_ok, which_key = pcall(require, "which-key")
+ if not status_ok then
+ return
+ end
+
+ which_key.setup(O.plugin.which_key.setup)
+
+ local opts = O.plugin.which_key.opts
+ local vopts = O.plugin.which_key.vopts
+
+ local mappings = O.plugin.which_key.mappings
+ local vmappings = O.plugin.which_key.vmappings
+
+ -- if O.plugin.ts_playground.active then
+ -- vim.api.nvim_set_keymap("n", "<leader>Th", ":TSHighlightCapturesUnderCursor<CR>", { noremap = true, silent = true })
+ -- mappings[""] = "Highlight Capture"
+ -- end
+
+ if O.plugin.zen.active then
+ vim.api.nvim_set_keymap("n", "<leader>z", ":ZenMode<CR>", { noremap = true, silent = true })
+ mappings["z"] = "Zen"
+ end
+
+ local wk = require "which-key"
+
+ wk.register(mappings, opts)
+ wk.register(vmappings, vopts)
+ wk.register(O.user_which_key, opts)
+end
+
+return M
diff --git a/.config/nvim/lua/cfg/zen/init.lua b/.config/nvim/lua/core/zen.lua
index d4a3da5..99a5d76 100644
--- a/.config/nvim/lua/cfg/zen/init.lua
+++ b/.config/nvim/lua/core/zen.lua
@@ -1,11 +1,6 @@
local M = {}
-local status_ok, zen_mode = pcall(require, "zen-mode")
-if not status_ok then
- return
-end
-
M.config = function()
- zen_mode.setup {
+ O.plugin["zen"] = {
window = {
backdrop = 1,
height = 0.85, -- height of the Zen window
@@ -27,4 +22,13 @@ M.config = function()
},
}
end
+
+M.setup = function()
+ local status_ok, zen_mode = pcall(require, "zen-mode")
+ if not status_ok then
+ return
+ end
+ zen_mode.setup(O.plugin.zen)
+end
+
return M
diff --git a/.config/nvim/lua/dark/Git.lua b/.config/nvim/lua/dark/Git.lua
new file mode 100644
index 0000000..b47ccf2
--- /dev/null
+++ b/.config/nvim/lua/dark/Git.lua
@@ -0,0 +1,10 @@
+local Git = {
+ SignAdd = { fg = C.sign_add },
+ SignChange = { fg = C.sign_change },
+ SignDelete = { fg = C.sign_delete },
+ GitSignsAdd = { fg = C.sign_add },
+ GitSignsChange = { fg = C.sign_change },
+ GitSignsDelete = { fg = C.sign_delete },
+}
+
+return Git
diff --git a/.config/nvim/lua/dark/LSP.lua b/.config/nvim/lua/dark/LSP.lua
new file mode 100644
index 0000000..2dfa07f
--- /dev/null
+++ b/.config/nvim/lua/dark/LSP.lua
@@ -0,0 +1,92 @@
+local LSP = {
+ LspDiagnosticsDefaultError = { fg = C.error_red },
+ LspDiagnosticsDefaultWarning = { fg = C.warning_orange },
+ LspDiagnosticsDefaultInformation = { fg = C.info_yellow },
+ LspDiagnosticsDefaultHint = { fg = C.hint_blue },
+ LspDiagnosticsVirtualTextError = { fg = C.error_red },
+ LspDiagnosticsVirtualTextWarning = { fg = C.warning_orange },
+ LspDiagnosticsVirtualTextInformation = { fg = C.info_yellow },
+ LspDiagnosticsVirtualTextHint = { fg = C.hint_blue },
+ LspDiagnosticsFloatingError = { fg = C.error_red },
+ LspDiagnosticsFloatingWarning = { fg = C.warning_orange },
+ LspDiagnosticsFloatingInformation = { fg = C.info_yellow },
+ LspDiagnosticsFloatingHint = { fg = C.hint_blue },
+ LspDiagnosticsSignError = { fg = C.error_red },
+ LspDiagnosticsSignWarning = { fg = C.warning_orange },
+ LspDiagnosticsSignInformation = { fg = C.info_yellow },
+ LspDiagnosticsSignHint = { fg = C.hint_blue },
+ LspDiagnosticsError = { fg = C.error_red },
+ LspDiagnosticsWarning = { fg = C.warning_orange },
+ LspDiagnosticsInformation = { fg = C.info_yellow },
+ LspDiagnosticsHint = { fg = C.hint_blue },
+ LspDiagnosticsUnderlineError = { fg = C.error_red },
+ LspDiagnosticsUnderlineWarning = { fg = C.warning_orange },
+ LspDiagnosticsUnderlineInformation = { fg = C.info_yellow },
+ LspDiagnosticsUnderlineHint = { fg = C.hint_blue },
+ QuickScopePrimary = { fg = C.cyan_test, style = "underline" },
+ QuickScopeSecondary = { fg = C.purple_test, style = "underline" },
+ TelescopeSelection = { fg = C.hint_blue },
+ TelescopeMatching = { fg = C.info_yellow, style = "bold" },
+ TelescopeBorder = { fg = C.cyan, bg = C.bg },
+ NvimTreeFolderIcon = { fg = C.blue },
+ NvimTreeIndentMarker = { fg = C.gray },
+ NvimTreeNormal = { fg = C.light_gray, bg = C.alt_bg },
+ NvimTreeVertSplit = { fg = C.alt_bg, bg = C.alt_bg },
+ NvimTreeFolderName = { fg = C.blue },
+ NvimTreeOpenedFolderName = { fg = C.cyan, style = "italic" },
+ NvimTreeImageFile = { fg = C.purple },
+ NvimTreeSpecialFile = { fg = C.orange },
+ NvimTreeGitStaged = { fg = C.sign_add },
+ NvimTreeGitNew = { fg = C.sign_add },
+ NvimTreeGitDirty = { fg = C.sign_add },
+ NvimTreeGitDeleted = { fg = C.sign_delete },
+ NvimTreeGitMerge = { fg = C.sign_change },
+ NvimTreeGitRenamed = { fg = C.sign_change },
+ NvimTreeSymlink = { fg = C.cyan },
+ NvimTreeRootFolder = { fg = C.fg, style = "bold" },
+ NvimTreeExecFile = { fg = C.green },
+ BufferCurrent = { fg = C.fg, bg = C.bg },
+ BufferCurrentIndex = { fg = C.fg, bg = C.bg },
+ BufferCurrentMod = { fg = C.info_yellow, bg = C.bg },
+ BufferCurrentSign = { fg = C.hint_blue, bg = C.bg },
+ BufferCurrentTarget = { fg = C.red, bg = C.bg, style = "bold" },
+ BufferVisible = { fg = C.fg, bg = C.bg },
+ BufferVisibleIndex = { fg = C.fg, bg = C.bg },
+ BufferVisibleMod = { fg = C.info_yellow, bg = C.bg },
+ BufferVisibleSign = { fg = C.hint_blue, bg = C.bg },
+ BufferVisibleTarget = { fg = C.red, bg = C.bg, style = "bold" },
+ BufferInactive = { fg = C.gray, bg = C.alt_bg },
+ BufferInactiveIndex = { fg = C.gray, bg = C.alt_bg },
+ BufferInactiveMod = { fg = C.info_yellow, bg = C.alt_bg },
+ BufferInactiveSign = { fg = C.gray, bg = C.alt_bg },
+ BufferInactiveTarget = { fg = C.red, bg = C.alt_bg, style = "bold" },
+ StatusLine = { fg = C.alt_bg },
+ StatusLineNC = { fg = C.alt_bg },
+ StatusLineSeparator = { fg = C.alt_bg },
+ StatusLineTerm = { fg = C.alt_bg },
+ StatusLineTermNC = { fg = C.alt_bg },
+ CodiVirtualText = { fg = C.pale_purple },
+ IndentBlanklineContextChar = { fg = C.accent },
+ DashboardHeader = { fg = C.blue },
+ DashboardCenter = { fg = C.purple },
+ DashboardFooter = { fg = C.cyan },
+ CompeDocumentation = { bg = C.alt_bg },
+ DiffViewNormal = { fg = C.gray, bg = C.alt_bg },
+ DiffviewStatusAdded = { fg = C.sign_add },
+ DiffviewStatusModified = { fg = C.sign_change },
+ DiffviewStatusRenamed = { fg = C.sign_change },
+ DiffviewStatusDeleted = { fg = C.sign_delete },
+ DiffviewFilePanelInsertion = { fg = C.sign_add },
+ DiffviewFilePanelDeletion = { fg = C.sign_delete },
+ DiffviewVertSplit = { bg = C.bg },
+ diffAdded = { fg = C.sign_add },
+ diffRemoved = { fg = C.sign_delete },
+ diffFileId = { fg = C.blue, style = "bold,reverse" },
+ diffFile = { fg = C.alt_bg },
+ diffNewFile = { fg = C.green },
+ diffOldFile = { fg = C.red },
+ debugPc = { bg = C.cyan },
+ debugBreakpoint = { fg = C.red, style = "reverse" },
+}
+
+return LSP
diff --git a/.config/nvim/lua/dark/Treesitter.lua b/.config/nvim/lua/dark/Treesitter.lua
new file mode 100644
index 0000000..d2d965a
--- /dev/null
+++ b/.config/nvim/lua/dark/Treesitter.lua
@@ -0,0 +1,56 @@
+local Treesitter = {
+ TSComment = { fg = C.blue },
+ TSAnnotation = { fg = C.purple },
+ TSAttribute = { fg = C.cyan },
+ TSConstructor = { fg = C.white },
+ TSType = { fg = C.white },
+ TSTypeBuiltin = { fg = C.white },
+ TSConditional = { fg = C.orange },
+ TSException = { fg = C.orange },
+ TSInclude = { fg = C.orange },
+ TSKeyword = { fg = C.orange },
+ TSKeywordFunction = { fg = C.orange },
+ TSLabel = { fg = C.orange },
+ TSNamespace = { fg = C.orange },
+ TSRepeat = { fg = C.orange },
+ TSConstant = { fg = C.orange },
+ TSConstBuiltin = { fg = C.orange },
+ TSFloat = { fg = C.red },
+ TSNumber = { fg = C.red },
+ TSBoolean = { fg = C.red },
+ TSCharacter = { fg = C.light_green },
+ TSError = { fg = C.error_red },
+ TSFunction = { fg = C.purple },
+ TSFuncBuiltin = { fg = C.purple },
+ TSMethod = { fg = C.purple },
+ TSConstMacro = { fg = C.orange },
+ TSFuncMacro = { fg = C.orange },
+ TSVariable = { fg = C.white },
+ TSVariableBuiltin = { fg = C.cyan },
+ TSProperty = { fg = C.white },
+ TSOperator = { fg = C.orange },
+ TSField = { fg = C.white },
+ TSParameter = { fg = C.white },
+ TSParameterReference = { fg = C.white },
+ TSSymbol = { fg = C.white },
+ TSText = { fg = C.fg },
+ TSPunctDelimiter = { fg = C.gray },
+ TSTagDelimiter = { fg = C.gray },
+ TSPunctBracket = { fg = C.gray },
+ TSPunctSpecial = { fg = C.gray },
+ TSString = { fg = C.blue },
+ TSStringRegex = { fg = C.blue },
+ TSStringEscape = { fg = C.blue },
+ TSTag = { fg = C.pale_purple },
+ TSEmphasis = { style = "italic" },
+ TSUnderline = { style = "underline" },
+ TSTitle = { fg = C.blue, style = "bold" },
+ TSLiteral = { fg = C.blue },
+ TSURI = { fg = C.cyan, style = "underline" },
+ TSKeywordOperator = { fg = C.blue },
+ TSStructure = { fg = C.purple_test },
+ TSStrong = { fg = C.yellow },
+ TSQueryLinterError = { fg = C.warning_orange },
+}
+
+return Treesitter
diff --git a/.config/nvim/lua/dark/Whichkey.lua b/.config/nvim/lua/dark/Whichkey.lua
new file mode 100644
index 0000000..2aa3d3e
--- /dev/null
+++ b/.config/nvim/lua/dark/Whichkey.lua
@@ -0,0 +1,9 @@
+local Whichkey = {
+ WhichKey = { fg = C.light_gray },
+ WhichKeySeperator = { fg = C.gray },
+ WhichKeyGroup = { fg = C.yellow },
+ WhichKeyDesc = { fg = C.light_gray },
+ WhichKeyFloat = { bg = C.alt_bg },
+}
+
+return Whichkey
diff --git a/.config/nvim/lua/dark/config.lua b/.config/nvim/lua/dark/config.lua
new file mode 100644
index 0000000..ebac710
--- /dev/null
+++ b/.config/nvim/lua/dark/config.lua
@@ -0,0 +1,23 @@
+local config
+
+vim = vim or { g = {}, o = {} }
+
+local function opt(key, default)
+ if vim.g[key] == nil then
+ return default
+ end
+ if vim.g[key] == 0 then
+ return false
+ end
+ return vim.g[key]
+end
+
+config = {
+ transparent_background = opt("transparent_background", false),
+ italic_comments = opt("italic_keywords", true) and "italic" or "NONE",
+ italic_keywords = opt("italic_keywords", true) and "italic" or "NONE",
+ italic_functions = opt("italic_function", false) and "italic" or "NONE",
+ italic_variables = opt("italic_variables", true) and "italic" or "NONE",
+}
+
+return config
diff --git a/.config/nvim/lua/dark/highlights.lua b/.config/nvim/lua/dark/highlights.lua
new file mode 100644
index 0000000..376b341
--- /dev/null
+++ b/.config/nvim/lua/dark/highlights.lua
@@ -0,0 +1,99 @@
+local highlights = {
+ Normal = { fg = C.fg, bg = Config.transparent_background and "NONE" or C.bg },
+ SignColumn = { bg = C.bg },
+ MsgArea = { fg = C.fg, bg = C.bg },
+ ModeMsg = { fg = C.fg, bg = C.bg },
+ MsgSeparator = { fg = C.fg, bg = C.bg },
+ SpellBad = { fg = C.error_red, style = "underline" },
+ SpellCap = { fg = C.yellow, style = "underline" },
+ SpellLocal = { fg = C.green, style = "underline" },
+ SpellRare = { fg = C.purple, style = "underline" },
+ NormalNC = { fg = C.fg, bg = C.bg },
+ Pmenu = { fg = C.white, bg = C.accent },
+ PmenuSel = { fg = C.alt_bg, bg = C.blue },
+ WildMenu = { fg = C.alt_bg, bg = C.blue },
+ CursorLineNr = { fg = C.light_gray, style = "bold" },
+ Comment = { fg = C.blue, style = "italic" },
+ Folded = { fg = C.accent, bg = C.alt_bg },
+ FoldColumn = { fg = C.accent, bg = C.alt_bg },
+ LineNr = { fg = C.gray },
+ FloatBoder = { fg = C.gray, bg = C.alt_bg },
+ Whitespace = { fg = C.gray },
+ VertSplit = { fg = C.bg, bg = C.accent },
+ CursorLine = { bg = C.alt_bg },
+ CursorColumn = { bg = C.alt_bg },
+ ColorColumn = { bg = C.alt_bg },
+ NormalFloat = { bg = C.alt_bg },
+ Visual = { bg = C.alt_bg },
+ VisualNOS = { bg = C.alt_bg },
+ WarningMsg = { fg = C.error_red, bg = C.bg },
+ DiffAdd = { fg = C.alt_bg, bg = C.sign_add },
+ DiffChange = { fg = C.alt_bg, bg = C.sign_change, style = "underline" },
+ DiffDelete = { fg = C.alt_bg, bg = C.sign_delete },
+ QuickFixLine = { bg = C.accent },
+ PmenuSbar = { bg = C.alt_bg },
+ PmenuThumb = { bg = C.white },
+ MatchWord = { style = "underline" },
+ MatchParen = { fg = C.pale_purple, bg = C.bg, style = "underline" },
+ MatchWordCur = { style = "underline" },
+ MatchParenCur = { style = "underline" },
+ Cursor = { fg = C.cursor_fg, bg = C.cursor_bg },
+ lCursor = { fg = C.cursor_fg, bg = C.cursor_bg },
+ CursorIM = { fg = C.cursor_fg, bg = C.cursor_bg },
+ TermCursor = { fg = C.cursor_fg, bg = C.cursor_bg },
+ TermCursorNC = { fg = C.cursor_fg, bg = C.cursor_bg },
+ Conceal = { fg = C.accent },
+ Directory = { fg = C.blue },
+ SpecialKey = { fg = C.blue, style = "bold" },
+ Title = { fg = C.blue, style = "bold" },
+ ErrorMsg = { fg = C.error_red, bg = C.bg, style = "bold" },
+ Search = { fg = C.hint_blue, bg = C.alt_bg },
+ IncSearch = { fg = C.hint_blue, bg = C.alt_bg },
+ Substitute = { fg = C.alt_bg, bg = C.gray_blue },
+ MoreMsg = { fg = C.cyan },
+ Question = { fg = C.cyan },
+ EndOfBuffer = { fg = C.bg },
+ NonText = { fg = C.bg },
+ Variable = { fg = C.white },
+ String = { fg = C.blue },
+ Character = { fg = C.light_green },
+ Constant = { fg = C.orange },
+ Number = { fg = C.red },
+ Boolean = { fg = C.red },
+ Float = { fg = C.red },
+ Identifier = { fg = C.white },
+ Function = { fg = C.purple },
+ Operator = { fg = C.orange },
+ Type = { fg = C.white },
+ StorageClass = { fg = C.yellow },
+ Structure = { fg = C.orange },
+ Typedef = { fg = C.purple },
+ Keyword = { fg = C.orange },
+ Statement = { fg = C.orange },
+ Conditional = { fg = C.orange },
+ Repeat = { fg = C.orange },
+ Label = { fg = C.orange },
+ Exception = { fg = C.orange },
+ Include = { fg = C.orange },
+ PreProc = { fg = C.orange },
+ Define = { fg = C.orange },
+ Macro = { fg = C.orange },
+ PreCondit = { fg = C.orange },
+ Special = { fg = C.orange },
+ SpecialChar = { fg = C.orange },
+ Tag = { fg = C.pale_purple },
+ Debug = { fg = C.red },
+ Delimiter = { fg = C.gray },
+ SpecialComment = { fg = C.blue },
+ Underlined = { style = "underline" },
+ Bold = { style = "bold" },
+ Italic = { style = "italic" },
+ Ignore = { fg = C.cyan, bg = C.bg, style = "bold" },
+ Todo = { fg = C.red, bg = C.bg, style = "bold" },
+ Error = { fg = C.error_red, bg = C.bg, style = "bold" },
+ TabLine = { fg = C.white, bg = C.alt_bg },
+ TabLineSel = { fg = C.white, bg = C.alt_bg },
+ TabLineFill = { fg = C.white, bg = C.alt_bg },
+}
+
+return highlights
diff --git a/.config/nvim/lua/dark/init.lua b/.config/nvim/lua/dark/init.lua
new file mode 100644
index 0000000..dd24d95
--- /dev/null
+++ b/.config/nvim/lua/dark/init.lua
@@ -0,0 +1,30 @@
+vim.api.nvim_command "hi clear"
+if vim.fn.exists "syntax_on" then
+ vim.api.nvim_command "syntax reset"
+end
+vim.o.background = "dark"
+vim.o.termguicolors = true
+vim.g.colors_name = "dark"
+
+local util = require "dark.util"
+Config = require "dark.config"
+C = require "dark.palette"
+local highlights = require "dark.highlights"
+local Treesitter = require "dark.Treesitter"
+local markdown = require "dark.markdown"
+local Whichkey = require "dark.Whichkey"
+local Git = require "dark.Git"
+local LSP = require "dark.LSP"
+
+local skeletons = {
+ highlights,
+ Treesitter,
+ markdown,
+ Whichkey,
+ Git,
+ LSP,
+}
+
+for _, skeleton in ipairs(skeletons) do
+ util.initialise(skeleton)
+end
diff --git a/.config/nvim/lua/dark/markdown.lua b/.config/nvim/lua/dark/markdown.lua
new file mode 100644
index 0000000..2b83e05
--- /dev/null
+++ b/.config/nvim/lua/dark/markdown.lua
@@ -0,0 +1,27 @@
+local markdown = {
+ markdownBlockquote = { fg = C.accent },
+ markdownBold = { fg = C.yellow, style = "bold" },
+ markdownCode = { fg = C.green },
+ markdownCodeBlock = { fg = C.green },
+ markdownCodeDelimiter = { fg = C.green },
+ markdownH1 = { fg = C.blue },
+ markdownH2 = { fg = C.blue },
+ markdownH3 = { fg = C.blue },
+ markdownH4 = { fg = C.blue },
+ markdownH5 = { fg = C.blue },
+ markdownH6 = { fg = C.blue },
+ markdownHeadingDelimiter = { fg = C.red },
+ markdownHeadingRule = { fg = C.accent },
+ markdownId = { fg = C.purple },
+ markdownIdDeclaration = { fg = C.blue },
+ markdownIdDelimiter = { fg = C.light_gray },
+ markdownLinkDelimiter = { fg = C.light_gray },
+ markdownItalic = { style = "italic" },
+ markdownLinkText = { fg = C.blue },
+ markdownListMarker = { fg = C.red },
+ markdownOrderedListMarker = { fg = C.red },
+ markdownRule = { fg = C.accent },
+ markdownUrl = { fg = C.cyan, style = "underline" },
+}
+
+return markdown
diff --git a/.config/nvim/lua/dark/palette.lua b/.config/nvim/lua/dark/palette.lua
new file mode 100644
index 0000000..5fd955c
--- /dev/null
+++ b/.config/nvim/lua/dark/palette.lua
@@ -0,0 +1,33 @@
+local colors = {
+ fg = "#F5F5F5",
+ bg = "#0A0A0A",
+ alt_bg = "#0D0D0D",
+ accent = "#383d45",
+ white = "#F5F5F5",
+ gray = "#505050",
+ light_gray = "#D0D0D0",
+ blue = "#A5D6FF",
+ gray_blue = "#5F819D",
+ cyan = "#5E8D87",
+ red = "#AA4142 ",
+ green = "#A1B56C",
+ light_green = "#A1B56C",
+ yellow = "#F4BF75",
+ orange = "#FFA557",
+ purple = "#AA749F",
+ pale_purple = "#A5D6FF",
+ magenta = "#AA759F",
+ cursor_fg = "#D0D0D0",
+ cursor_bg = "#151515",
+ sign_add = "#A1B56C",
+ sign_change = "#A5D6FF",
+ sign_delete = "#AA4142",
+ error_red = "#AC4142",
+ warning_orange = "#F4BF75",
+ info_yellow = "#F4BF75",
+ hint_blue = "#A5D6FF",
+ purple_test = "#ff00ff",
+ cyan_test = "#00ffff",
+}
+
+return colors
diff --git a/.config/nvim/lua/dark/util.lua b/.config/nvim/lua/dark/util.lua
new file mode 100644
index 0000000..dbac18a
--- /dev/null
+++ b/.config/nvim/lua/dark/util.lua
@@ -0,0 +1,25 @@
+local M = {}
+
+local function highlight(group, properties)
+ local bg = properties.bg == nil and "" or "guibg=" .. properties.bg
+ local fg = properties.fg == nil and "" or "guifg=" .. properties.fg
+ local style = properties.style == nil and "" or "gui=" .. properties.style
+
+ local cmd = table.concat({
+ "highlight",
+ group,
+ bg,
+ fg,
+ style,
+ }, " ")
+
+ vim.api.nvim_command(cmd)
+end
+
+function M.initialise(skeleton)
+ for group, properties in pairs(skeleton) do
+ highlight(group, properties)
+ end
+end
+
+return M
diff --git a/.config/nvim/lua/default-config.lua b/.config/nvim/lua/default-config.lua
index 1121f28..941738a 100644
--- a/.config/nvim/lua/default-config.lua
+++ b/.config/nvim/lua/default-config.lua
@@ -2,199 +2,149 @@ CONFIG_PATH = vim.fn.stdpath "config"
DATA_PATH = vim.fn.stdpath "data"
CACHE_PATH = vim.fn.stdpath "cache"
TERMINAL = vim.fn.expand "$TERMINAL"
+USER = vim.fn.expand "$USER"
O = {
- format_on_save = true,
- auto_close_tree = 0,
- auto_complete = true,
- colorscheme = "lunar",
- clipboard = "unnamedplus",
- hidden_files = true,
- wrap_lines = false,
- number = true,
- relative_number = true,
- number_width = 4,
- cmdheight = 2,
- cursorline = true,
- shell = "zsh",
- timeoutlen = 100,
- nvim_tree_disable_netrw = 0,
- ignore_case = true,
- smart_case = true,
- lushmode = false,
- hl_search = false,
- document_highlight = false,
+ keys = {
+ leader_key = "space",
+ },
+ colorscheme = "dark",
+ line_wrap_cursor_movement = true,
transparent_window = false,
- leader_key = "space",
- vnsip_dir = vim.fn.stdpath "config" .. "/snippets",
+ format_on_save = true,
+ lint_on_save = true,
+ vsnip_dir = os.getenv "HOME" .. "/.config/snippets",
- -- @usage pass a table with your desired languages
- treesitter = {
- ensure_installed = "all",
- ignore_install = { "haskell" },
- highlight = { enabled = true },
- -- The below are for treesitter-textobjects plugin
- textobj_prefixes = {
- goto_next = "]", -- Go to next
- goto_previous = "[", -- Go to previous
- inner = "i", -- Select inside
- outer = "a", -- Selct around
- swap = "<leader>a", -- Swap with next
- },
- textobj_suffixes = {
- -- Start and End respectively for the goto keys
- -- for other keys it only uses the first
- ["function"] = { "f", "F" },
- ["class"] = { "m", "M" },
- ["parameter"] = { "a", "A" },
- ["block"] = { "k", "K" },
- ["conditional"] = { "i", "I" },
- ["call"] = { "c", "C" },
- ["loop"] = { "l", "L" },
- ["statement"] = { "s", "S" },
- ["comment"] = { "/", "?" },
- },
- -- The below is for treesitter hint textobjects plugin
- hint_labels = { "h", "j", "f", "d", "n", "v", "s", "l", "a" },
+ default_options = {
+ backup = false, -- creates a backup file
+ clipboard = "unnamedplus", -- allows neovim to access the system clipboard
+ cmdheight = 2, -- more space in the neovim command line for displaying messages
+ colorcolumn = "99999", -- fixes indentline for now
+ completeopt = { "menuone", "noselect" },
+ conceallevel = 0, -- so that `` is visible in markdown files
+ fileencoding = "utf-8", -- the encoding written to a file
+ foldmethod = "manual", -- folding, set to "expr" for treesitter based foloding
+ foldexpr = "", -- set to "nvim_treesitter#foldexpr()" for treesitter based folding
+ guifont = "monospace:h17", -- the font used in graphical neovim applications
+ hidden = true, -- required to keep multiple buffers and open multiple buffers
+ hlsearch = true, -- highlight all matches on previous search pattern
+ ignorecase = true, -- ignore case in search patterns
+ mouse = "a", -- allow the mouse to be used in neovim
+ pumheight = 10, -- pop up menu height
+ showmode = false, -- we don't need to see things like -- INSERT -- anymore
+ showtabline = 2, -- always show tabs
+ smartcase = true, -- smart case
+ smartindent = true, -- make indenting smarter again
+ splitbelow = true, -- force all horizontal splits to go below current window
+ splitright = true, -- force all vertical splits to go to the right of current window
+ swapfile = false, -- creates a swapfile
+ termguicolors = true, -- set term gui colors (most terminals support this)
+ timeoutlen = 100, -- time to wait for a mapped sequence to complete (in milliseconds)
+ title = true, -- set the title of window to the value of the titlestring
+ -- opt.titlestring = "%<%F%=%l/%L - nvim" -- what the title of the window will be set to
+ undodir = CACHE_PATH .. "/undo", -- set an undo directory
+ undofile = true, -- enable persisten undo
+ updatetime = 300, -- faster completion
+ writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
+ expandtab = true, -- convert tabs to spaces
+ shiftwidth = 2, -- the number of spaces inserted for each indentation
+ tabstop = 2, -- insert 2 spaces for a tab
+ cursorline = true, -- highlight the current line
+ number = true, -- set numbered lines
+ relativenumber = false, -- set relative numbered lines
+ numberwidth = 4, -- set number column width to 2 {default 4}
+ signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
+ wrap = false, -- display lines as one long line
+ spell = false,
+ spelllang = "en",
+ scrolloff = 8, -- is one of my fav
+ sidescrolloff = 8,
},
lsp = {
+ diagnostics = {
+ virtual_text = {
+ prefix = "",
+ spacing = 0,
+ },
+ signs = true,
+ underline = true,
+ },
+ document_highlight = true,
popup_border = "single",
+ default_keybinds = true,
+ on_attach_callback = nil,
},
- database = { save_location = "~/.config/nvcode_db", auto_execute = 1 },
+ disabled_built_ins = {
+ "netrw",
+ "netrwPlugin",
+ "netrwSettings",
+ "netrwFileHandlers",
+ "gzip",
+ "zip",
+ "zipPlugin",
+ "tar",
+ "tarPlugin", -- 'man',
+ "getscript",
+ "getscriptPlugin",
+ "vimball",
+ "vimballPlugin",
+ "2html_plugin",
+ "logipat",
+ "rrhelper",
+ "spellfile_plugin",
+ -- 'matchit', 'matchparen', 'shada_plugin',
+ },
plugin = {
- -- Builtins
- dashboard = { active = false },
- colorizer = { active = false },
- zen = { active = false },
- ts_context_commentstring = { active = false },
- ts_hintobjects = { active = false },
- ts_autotag = { active = false },
- ts_textobjects = { active = false },
- ts_playground = { active = false },
- ts_textsubjects = { active = false },
- telescope_fzy = { active = false },
- telescope_project = { active = false },
- indent_line = { active = false },
- symbol_outline = { active = false },
- debug = { active = false },
- lazygit = { active = false },
- lush = { active = false },
- diffview = { active = false },
- floatterm = { active = false },
- trouble = { active = false },
- sanegx = { active = false },
- vim_rooter = { active = false },
- hop = { active = false },
+ lspinstall = {},
+ telescope = {},
+ compe = {},
+ autopairs = {},
+ treesitter = {},
+ formatter = {},
+ lint = {},
+ nvimtree = {},
+ gitsigns = {},
+ which_key = {},
+ comment = {},
+ rooter = {},
+ galaxyline = {},
+ bufferline = {},
+ dap = {},
+ dashboard = {},
+ terminal = {},
+ zen = {},
+ hop = {},
+ colorizer = {},
},
+ -- TODO: refactor for tree
+ auto_clos_tree = 0,
+ nvim_tree_disable_netrw = 0,
+
+ database = { save_location = "~/.config/nvim_db", auto_execute = 1 },
+
+ -- TODO: just using mappings (leader mappings)
user_which_key = {},
user_plugins = {
- -- use config.lua for this not put here
+ -- use lv-config.lua for this not put here
},
user_autocommands = {
{ "FileType", "qf", "set nobuflisted" },
},
+ formatters = {
+ filetype = {},
+ },
+
+ -- TODO move all of this into lang specific files, only require when using
lang = {
- cmake = {},
- clang = {
- diagnostics = {
- virtual_text = { spacing = 0, prefix = "" },
- signs = true,
- underline = true,
- },
- cross_file_rename = true,
- header_insertion = "never",
- },
- css = {
- virtual_text = true,
- },
- dart = {
- sdk_path = "/usr/lib/dart/bin/snapshots/analysis_server.dart.snapshot",
- },
- docker = {},
efm = {},
- elm = {},
- emmet = { active = true },
- elixir = {},
- graphql = {},
- go = {},
- html = {},
- java = {},
- json = {
- diagnostics = {
- virtual_text = { spacing = 0, prefix = "" },
- signs = true,
- underline = true,
- },
- },
- kotlin = {},
- latex = {},
- lua = {
- diagnostics = {
- virtual_text = { spacing = 0, prefix = "" },
- signs = true,
- underline = true,
- },
- },
- php = {
- format = {
- format = {
- default = "psr12",
- },
- },
- environment = {
- php_version = "7.4",
- },
- diagnostics = {
- virtual_text = { spacing = 0, prefix = "" },
- signs = true,
- underline = true,
- },
- filetypes = { "php", "phtml" },
- },
- python = {
- linter = "",
- isort = false,
- diagnostics = {
- virtual_text = { spacing = 0, prefix = "" },
- signs = true,
- underline = true,
- },
- analysis = {
- type_checking = "basic",
- auto_search_paths = true,
- use_library_code_types = true,
- },
- },
- rust = {
- rust_tools = {
- active = false,
- parameter_hints_prefix = "<-",
- other_hints_prefix = "=>", -- prefix for all the other hints (type, chaining)
- },
- linter = "",
- diagnostics = {
- virtual_text = { spacing = 0, prefix = "" },
- signs = true,
- underline = true,
- },
- },
- sh = {
- -- @usage can be 'shellcheck'
- linter = "",
- -- @usage can be 'shfmt'
- diagnostics = {
- virtual_text = { spacing = 0, prefix = "" },
- signs = true,
- underline = true,
- },
- },
+ emmet = { active = false },
svelte = {},
tailwindcss = {
active = false,
@@ -208,41 +158,50 @@ O = {
"typescriptreact",
},
},
- terraform = {},
tsserver = {
- -- @usage can be 'eslint'
+ -- @usage can be 'eslint' or 'eslint_d'
linter = "",
diagnostics = {
virtual_text = { spacing = 0, prefix = "" },
signs = true,
underline = true,
},
+ formatter = {
+ exe = "prettier",
+ args = {},
+ },
},
- vim = {},
- yaml = {},
},
+}
- dashboard = {
+require "core.status_colors"
+require("core.gitsigns").config()
+require("core.compe").config()
+require("core.dashboard").config()
+require("core.dap").config()
+require("core.terminal").config()
+require("core.zen").config()
+require("core.telescope").config()
+require("core.treesitter").config()
+require("core.which-key").config()
+require("core.nvimtree").config()
- custom_header = {
- ' ##############..... ############## ',
- ' ##############......############## ',
- ' ##########..........########## ',
- ' ##########........########## ',
- ' ##########.......########## ',
- ' ##########.....##########.. ',
- ' ##########....##########..... ',
- ' ..##########..##########......... ',
- ' ....##########.#########............. ',
- ' ..################JJJ............ ',
- ' ################............. ',
- ' ##############.JJJ.JJJJJJJJJJ ',
- ' ############...JJ...JJ..JJ JJ ',
- ' ##########....JJ...JJ..JJ JJ ',
- ' ########......JJJ..JJJ JJJ JJJ ',
- ' ###### ......... ',
- ' ..... ',
- ' . ',
- },
- },
-}
+require("lang.clang").config()
+require("lang.dart").config()
+require("lang.dockerfile").config()
+require("lang.elixir").config()
+require("lang.go").config()
+require("lang.graphql").config()
+require("lang.html").config()
+require("lang.json").config()
+require("lang.kotlin").config()
+require("lang.lua").config()
+require("lang.python").config()
+require("lang.rust").config()
+require("lang.sh").config()
+require("lang.swift").config()
+require("lang.tex").config()
+require("lang.vim").config()
+require("lang.yaml").config()
+require("lang.zig").config()
+require("lang.zsh").config()
diff --git a/.config/nvim/lua/keymappings.lua b/.config/nvim/lua/keymappings.lua
index 4dfcbb0..e8e3f42 100644
--- a/.config/nvim/lua/keymappings.lua
+++ b/.config/nvim/lua/keymappings.lua
@@ -1,69 +1,115 @@
--- better window movement
-vim.api.nvim_set_keymap("n", "<C-h>", "<C-w>h", { silent = true })
-vim.api.nvim_set_keymap("n", "<C-j>", "<C-w>j", { silent = true })
-vim.api.nvim_set_keymap("n", "<C-k>", "<C-w>k", { silent = true })
-vim.api.nvim_set_keymap("n", "<C-l>", "<C-w>l", { silent = true })
-
--- Terminal window navigation
-vim.api.nvim_set_keymap("t", "<C-h>", "<C-\\><C-N><C-w>h", {silent = true, noremap = true})
-vim.api.nvim_set_keymap("t", "<C-j>", "<C-\\><C-N><C-w>j", {silent = true, noremap = true})
-vim.api.nvim_set_keymap("t", "<C-k>", "<C-\\><C-N><C-w>k", {silent = true, noremap = true})
-vim.api.nvim_set_keymap("t", "<C-l>", "<C-\\><C-N><C-w>l", {silent = true, noremap = true})
-vim.api.nvim_set_keymap("i", "<C-h>", "<C-\\><C-N><C-w>h", {silent = true, noremap = true})
-vim.api.nvim_set_keymap("i", "<C-j>", "<C-\\><C-N><C-w>j", {silent = true, noremap = true})
-vim.api.nvim_set_keymap("i", "<C-k>", "<C-\\><C-N><C-w>k", {silent = true, noremap = true})
-vim.api.nvim_set_keymap("i", "<C-l>", "<C-\\><C-N><C-w>l", {silent = true, noremap = true})
-vim.api.nvim_set_keymap("t", "<Esc>", "<C-\\><C-n>", {silent = true, noremap = true})
-
--- TODO fix this
--- resize with arrows
-if vim.fn.has("mac") == 1 then
- vim.api.nvim_set_keymap("n", "<A-Up>", ":resize -2<CR>", { silent = true })
- vim.api.nvim_set_keymap("n", "<A-Down>", ":resize +2<CR>", { silent = true })
- vim.api.nvim_set_keymap("n", "<A-Left>", ":vertical resize -2<CR>", { silent = true })
- vim.api.nvim_set_keymap("n", "<A-Right>", ":vertical resize +2<CR>", { silent = true })
-else
- vim.api.nvim_set_keymap("n", "<C-Up>", ":resize -2<CR>", { silent = true })
- vim.api.nvim_set_keymap("n", "<C-Down>", ":resize +2<CR>", { silent = true })
- vim.api.nvim_set_keymap("n", "<C-Left>", ":vertical resize -2<CR>", { silent = true })
- vim.api.nvim_set_keymap("n", "<C-Right>", ":vertical resize +2<CR>", { silent = true })
-end
+local utils = require "utils"
+
+local opts = {
+ nnoremap = { noremap = true, silent = true },
+ inoremap = { noremap = true, silent = true },
+ vnoremap = { noremap = true, silent = true },
+ xnoremap = { noremap = true, silent = true },
+ generic = { silent = true },
+}
+
+local default_keys = {
+ insert_mode = {
+ -- I hate escape
+ { "jk", "<ESC>" },
+ { "kj", "<ESC>" },
+ { "jj", "<ESC>" },
+ -- Move current line / block with Alt-j/k ala vscode.
+ { "<A-j>", "<Esc>:m .+1<CR>==gi" },
+ { "<A-k>", "<Esc>:m .-2<CR>==gi" },
+ -- navigation
+ { "<A-Up>", "<C-\\><C-N><C-w>h" },
+ { "<A-Down>", "<C-\\><C-N><C-w>j" },
+ { "<A-Left>", "<C-\\><C-N><C-w>k" },
+ { "<A-Right>", "<C-\\><C-N><C-w>l" },
+ },
+
+ normal_mode = {
+ -- Better window movement
+ { "<C-h>", "<C-w>h" },
+ { "<C-j>", "<C-w>j" },
+ { "<C-k>", "<C-w>k" },
+ { "<C-l>", "<C-w>l" },
+
+ -- Resize with arrows
+ { "<C-Up>", ":resize -2<CR>" },
+ { "<C-Down>", ":resize +2<CR>" },
+ { "<C-Left>", ":vertical resize -2<CR>" },
+ { "<C-Right>", ":vertical resize +2<CR>" },
+
+ -- Tab switch buffer
+ -- { "<TAB>", ":bnext<CR>" },
+ -- { "<S-TAB>", ":bprevious<CR>" },
+
+ -- Move current line / block with Alt-j/k a la vscode.
+ { "<A-j>", ":m .+1<CR>==" },
+ { "<A-k>", ":m .-2<CR>==" },
--- better indenting
-vim.api.nvim_set_keymap("v", "<", "<gv", { noremap = true, silent = true })
-vim.api.nvim_set_keymap("v", ">", ">gv", { noremap = true, silent = true })
+ -- QuickFix
+ { "]q", ":cnext<CR>" },
+ { "[q", ":cprev<CR>" },
+ { "<C-q>", ":call QuickFixToggle()<CR>" },
--- I hate escape
-vim.api.nvim_set_keymap("i", "jk", "<ESC>", { noremap = true, silent = true })
-vim.api.nvim_set_keymap("i", "kj", "<ESC>", { noremap = true, silent = true })
-vim.api.nvim_set_keymap("i", "jj", "<ESC>", { noremap = true, silent = true })
+ -- {'<C-TAB>', 'compe#complete()', {noremap = true, silent = true, expr = true}},
+ },
--- Tab switch buffer
-vim.api.nvim_set_keymap("n", "<TAB>", ":bnext<CR>", { noremap = true, silent = true })
-vim.api.nvim_set_keymap("n", "<S-TAB>", ":bprevious<CR>", { noremap = true, silent = true })
+ term_mode = {
+ -- Terminal window navigation
+ { "<C-h>", "<C-\\><C-N><C-w>h" },
+ { "<C-j>", "<C-\\><C-N><C-w>j" },
+ { "<C-k>", "<C-\\><C-N><C-w>k" },
+ { "<C-l>", "<C-\\><C-N><C-w>l" },
+ },
--- Move selected line / block of text in visual mode
-vim.api.nvim_set_keymap("x", "K", ":move '<-2<CR>gv-gv", { noremap = true, silent = true })
-vim.api.nvim_set_keymap("x", "J", ":move '>+1<CR>gv-gv", { noremap = true, silent = true })
+ visual_mode = {
+ -- Better indenting
+ { "<", "<gv" },
+ { ">", ">gv" },
--- Move current line / block with Alt-j/k ala vscode.
-vim.api.nvim_set_keymap("n", "<A-j>", ":m .+1<CR>==", { noremap = true, silent = true })
-vim.api.nvim_set_keymap("n", "<A-k>", ":m .-2<CR>==", { noremap = true, silent = true })
-vim.api.nvim_set_keymap("i", "<A-j>", "<Esc>:m .+1<CR>==gi", { noremap = true, silent = true })
-vim.api.nvim_set_keymap("i", "<A-k>", "<Esc>:m .-2<CR>==gi", { noremap = true, silent = true })
-vim.api.nvim_set_keymap("x", "<A-j>", ":m '>+1<CR>gv-gv", { noremap = true, silent = true })
-vim.api.nvim_set_keymap("x", "<A-k>", ":m '<-2<CR>gv-gv", { noremap = true, silent = true })
+ -- { "p", '"0p', { silent = true } },
+ -- { "P", '"0P', { silent = true } },
+ },
--- QuickFix
-vim.api.nvim_set_keymap("n", "]q", ":cnext<CR>", { noremap = true, silent = true })
-vim.api.nvim_set_keymap("n", "[q", ":cprev<CR>", { noremap = true, silent = true })
+ visual_block_mode = {
+ -- Move selected line / block of text in visual mode
+ { "K", ":move '<-2<CR>gv-gv" },
+ { "J", ":move '>+1<CR>gv-gv" },
--- Better nav for omnicomplete
-vim.cmd 'inoremap <expr> <c-j> ("\\<C-n>")'
-vim.cmd 'inoremap <expr> <c-k> ("\\<C-p>")'
+ -- Move current line / block with Alt-j/k ala vscode.
+ { "<A-j>", ":m '>+1<CR>gv-gv" },
+ { "<A-k>", ":m '<-2<CR>gv-gv" },
+ },
+}
+
+if vim.fn.has "mac" == 1 then
+ -- TODO: fix this
+ default_keys.normal_mode[5][1] = "<A-Up>"
+ default_keys.normal_mode[6][1] = "<A-Down>"
+ default_keys.normal_mode[7][1] = "<A-Left>"
+ default_keys.normal_mode[8][1] = "<A-Right>"
+end
+
+if O.keys.leader_key == " " or O.keys.leader_key == "space" then
+ vim.g.mapleader = " "
+else
+ vim.g.mapleader = O.keys.leader_key
+end
+
+local function get_user_keys(mode)
+ if O.keys[mode] == nil then
+ return default_keys[mode]
+ else
+ return O.keys[mode]
+ end
+end
-vim.cmd 'vnoremap p "0p'
-vim.cmd 'vnoremap P "0P'
+utils.add_keymap_normal_mode(opts.nnoremap, get_user_keys "normal_mode")
+utils.add_keymap_insert_mode(opts.inoremap, get_user_keys "insert_mode")
+utils.add_keymap_visual_mode(opts.vnoremap, get_user_keys "visual_mode")
+utils.add_keymap_visual_block_mode(opts.xnoremap, get_user_keys "visual_block_mode")
+utils.add_keymap_term_mode(opts.generic, get_user_keys "term_mode")
--- Toggle the QuickFix window
-vim.api.nvim_set_keymap("", "<C-q>", ":call QuickFixToggle()<CR>", { noremap = true, silent = true })
+-- navigate tab completion with <c-j> and <c-k>
+-- runs conditionally
+vim.cmd 'inoremap <expr> <C-j> pumvisible() ? "\\<C-n>" : "\\<C-j>"'
+vim.cmd 'inoremap <expr> <C-k> pumvisible() ? "\\<C-p>" : "\\<C-k>"'
diff --git a/.config/nvim/lua/lang/clang.lua b/.config/nvim/lua/lang/clang.lua
new file mode 100644
index 0000000..702d6f4
--- /dev/null
+++ b/.config/nvim/lua/lang/clang.lua
@@ -0,0 +1,156 @@
+local M = {}
+
+M.config = function()
+ O.lang.clang = {
+ diagnostics = {
+ virtual_text = { spacing = 0, prefix = "" },
+ signs = true,
+ underline = true,
+ },
+ cross_file_rename = true,
+ header_insertion = "never",
+ filetypes = { "c", "cpp", "objc" },
+ formatter = {
+ exe = "clang-format",
+ args = {},
+ stdin = true,
+ },
+ linters = {
+ "cppcheck",
+ "clangtidy",
+ },
+ debug = {
+ adapter = {
+ command = "/usr/bin/lldb-vscode",
+ },
+ stop_on_entry = false,
+ },
+ }
+end
+
+M.format = function()
+ local shared_config = {
+ function()
+ return {
+ exe = O.lang.clang.formatter.exe,
+ args = O.lang.clang.formatter.args,
+ stdin = O.lang.clang.formatter.stdin,
+ cwd = vim.fn.expand "%:h:p",
+ }
+ end,
+ }
+ O.formatters.filetype["c"] = shared_config
+ O.formatters.filetype["cpp"] = shared_config
+ O.formatters.filetype["objc"] = shared_config
+
+ require("formatter.config").set_defaults {
+ logging = false,
+ filetype = O.formatters.filetype,
+ }
+end
+
+M.lint = function()
+ require("lint").linters_by_ft = {
+ c = O.lang.clang.linters,
+ cpp = O.lang.clang.linters,
+ }
+end
+
+M.lsp = function()
+ if require("utils").check_lsp_client_active "clangd" then
+ return
+ end
+ local clangd_flags = { "--background-index" }
+
+ if O.lang.clang.cross_file_rename then
+ table.insert(clangd_flags, "--cross-file-rename")
+ end
+
+ table.insert(clangd_flags, "--header-insertion=" .. O.lang.clang.header_insertion)
+
+ require("lspconfig").clangd.setup {
+ cmd = { DATA_PATH .. "/lspinstall/cpp/clangd/bin/clangd", unpack(clangd_flags) },
+ on_attach = require("lsp").common_on_attach,
+ handlers = {
+ ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
+ virtual_text = O.lang.clang.diagnostics.virtual_text,
+ signs = O.lang.clang.diagnostics.signs,
+ underline = O.lang.clang.diagnostics.underline,
+ update_in_insert = true,
+ }),
+ },
+ }
+end
+
+M.dap = function()
+ if O.plugin.dap.active then
+ local dap_install = require "dap-install"
+ local dap = require "dap"
+ dap_install.config("ccppr_vsc_dbg", {})
+ dap.adapters.lldb = {
+ type = "executable",
+ command = O.lang.clang.debug.adapter.command,
+ name = "lldb",
+ }
+ local shared_dap_config = {
+ {
+ name = "Launch",
+ type = "lldb",
+ request = "launch",
+ program = function()
+ return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
+ end,
+ cwd = "${workspaceFolder}",
+ stopOnEntry = O.lang.clang.debug.stop_on_entry,
+ args = {},
+ env = function()
+ local variables = {}
+ for k, v in pairs(vim.fn.environ()) do
+ table.insert(variables, string.format("%s=%s", k, v))
+ end
+ return variables
+ end,
+ runInTerminal = false,
+ },
+ {
+ -- If you get an "Operation not permitted" error using this, try disabling YAMA:
+ -- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
+ name = "Attach to process",
+ type = "lldb", -- Adjust this to match your adapter name (`dap.adapters.<name>`)
+ request = "attach",
+ pid = function()
+ local output = vim.fn.system { "ps", "a" }
+ local lines = vim.split(output, "\n")
+ local procs = {}
+ for _, line in pairs(lines) do
+ -- output format
+ -- " 107021 pts/4 Ss 0:00 /bin/zsh <args>"
+ local parts = vim.fn.split(vim.fn.trim(line), " \\+")
+ local pid = parts[1]
+ local name = table.concat({ unpack(parts, 5) }, " ")
+ if pid and pid ~= "PID" then
+ pid = tonumber(pid)
+ if pid ~= vim.fn.getpid() then
+ table.insert(procs, { pid = tonumber(pid), name = name })
+ end
+ end
+ end
+ local choices = { "Select process" }
+ for i, proc in ipairs(procs) do
+ table.insert(choices, string.format("%d: pid=%d name=%s", i, proc.pid, proc.name))
+ end
+ local choice = vim.fn.inputlist(choices)
+ if choice < 1 or choice > #procs then
+ return nil
+ end
+ return procs[choice].pid
+ end,
+ args = {},
+ },
+ }
+ dap.configurations.c = shared_dap_config
+ dap.configurations.cpp = shared_dap_config
+ end
+end
+
+return M
diff --git a/.config/nvim/lua/lang/dart.lua b/.config/nvim/lua/lang/dart.lua
new file mode 100644
index 0000000..2ed5c33
--- /dev/null
+++ b/.config/nvim/lua/lang/dart.lua
@@ -0,0 +1,59 @@
+local M = {}
+
+M.config = function()
+ O.lang.dart = {
+ sdk_path = "/usr/lib/dart/bin/snapshots/analysis_server.dart.snapshot",
+ formatter = {
+ exe = "dart",
+ args = { "format" },
+ stdin = true,
+ },
+ }
+end
+
+M.format = function()
+ O.formatters.filetype["dart"] = {
+ function()
+ return {
+ exe = O.lang.dart.formatter.exe,
+ args = O.lang.dart.formatter.args,
+ stdin = O.lang.dart.formatter.stdin,
+ }
+ end,
+ }
+
+ require("formatter.config").set_defaults {
+ logging = false,
+ filetype = O.formatters.filetype,
+ }
+end
+
+M.lint = function()
+ -- TODO: implement linters (if applicable)
+ return "No linters configured!"
+end
+
+M.lsp = function()
+ if require("utils").check_lsp_client_active "dartls" then
+ return
+ end
+
+ require("lspconfig").dartls.setup {
+ cmd = { "dart", O.lang.dart.sdk_path, "--lsp" },
+ on_attach = require("lsp").common_on_attach,
+ init_options = {
+ closingLabels = false,
+ flutterOutline = false,
+ onlyAnalyzeProjectsWithOpenFiles = false,
+ outline = false,
+ suggestFromUnimportedLibraries = true,
+ },
+ }
+end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M
diff --git a/.config/nvim/lua/lang/dockerfile.lua b/.config/nvim/lua/lang/dockerfile.lua
new file mode 100644
index 0000000..0009c30
--- /dev/null
+++ b/.config/nvim/lua/lang/dockerfile.lua
@@ -0,0 +1,35 @@
+local M = {}
+
+M.config = function()
+ O.lang.docker = {}
+end
+
+M.format = function()
+ -- TODO: implement formatter for language
+ return "No formatter available!"
+end
+
+M.lint = function()
+ -- TODO: implement linters (if applicable)
+ return "No linters configured!"
+end
+
+M.lsp = function()
+ if require("utils").check_lsp_client_active "dockerls" then
+ return
+ end
+
+ -- npm install -g dockerfile-language-server-nodejs
+ require("lspconfig").dockerls.setup {
+ cmd = { DATA_PATH .. "/lspinstall/dockerfile/node_modules/.bin/docker-langserver", "--stdio" },
+ on_attach = require("lsp").common_on_attach,
+ root_dir = vim.loop.cwd,
+ }
+end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M
diff --git a/.config/nvim/lua/lang/elixir.lua b/.config/nvim/lua/lang/elixir.lua
new file mode 100644
index 0000000..0959809
--- /dev/null
+++ b/.config/nvim/lua/lang/elixir.lua
@@ -0,0 +1,61 @@
+local M = {}
+
+M.config = function()
+ O.lang.elixir = {
+ formatter = {
+ exe = "mix",
+ args = { "format" },
+ stdin = true,
+ },
+ lsp = {
+ path = DATA_PATH .. "/lspinstall/elixir/elixir-ls/language_server.sh",
+ },
+ }
+end
+
+M.format = function()
+ O.formatters.filetype["elixir"] = {
+ function()
+ return {
+ exe = O.lang.elixir.formatter.exe,
+ args = O.lang.elixir.formatter.args,
+ stdin = O.lang.elixir.formatter.stdin,
+ }
+ end,
+ }
+
+ require("formatter.config").set_defaults {
+ logging = false,
+ filetype = O.formatters.filetype,
+ }
+end
+
+M.lint = function()
+ -- TODO: implement linters (if applicable)
+ return "No linters configured!"
+end
+
+M.lsp = function()
+ if require("utils").check_lsp_client_active "elixirls" then
+ return
+ end
+
+ require("lspconfig").elixirls.setup {
+ cmd = { O.lang.elixir.lsp.path },
+ on_attach = require("lsp").common_on_attach,
+ }
+end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+-- needed for the LSP to recognize elixir files (alternativly just use elixir-editors/vim-elixir)
+-- vim.cmd [[
+-- au BufRead,BufNewFile *.ex,*.exs set filetype=elixir
+-- au BufRead,BufNewFile *.eex,*.leex,*.sface set filetype=eelixir
+-- au BufRead,BufNewFile mix.lock set filetype=elixir
+-- ]]
+
+return M
diff --git a/.config/nvim/lua/lang/go.lua b/.config/nvim/lua/lang/go.lua
new file mode 100644
index 0000000..880e56d
--- /dev/null
+++ b/.config/nvim/lua/lang/go.lua
@@ -0,0 +1,57 @@
+local M = {}
+
+M.config = function()
+ O.lang.go = {
+ formatter = {
+ exe = "gofmt",
+ args = {},
+ stdin = true,
+ },
+ linters = {
+ "golangcilint",
+ "revive",
+ },
+ }
+end
+
+M.format = function()
+ O.formatters.filetype["go"] = {
+ function()
+ return {
+ exe = O.lang.go.formatter.exe,
+ args = O.lang.go.formatter.args,
+ stdin = O.lang.go.formatter.stdin,
+ }
+ end,
+ }
+
+ require("formatter.config").set_defaults {
+ logging = false,
+ filetype = O.formatters.filetype,
+ }
+end
+
+M.lint = function()
+ require("lint").linters_by_ft = {
+ go = O.lang.go.linters,
+ }
+end
+
+M.lsp = function()
+ if not require("utils").check_lsp_client_active "gopls" then
+ require("lspconfig").gopls.setup {
+ cmd = { DATA_PATH .. "/lspinstall/go/gopls" },
+ settings = { gopls = { analyses = { unusedparams = true }, staticcheck = true } },
+ root_dir = require("lspconfig").util.root_pattern(".git", "go.mod"),
+ init_options = { usePlaceholders = true, completeUnimported = true },
+ on_attach = require("lsp").common_on_attach,
+ }
+ end
+end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M
diff --git a/.config/nvim/lua/lang/graphql.lua b/.config/nvim/lua/lang/graphql.lua
new file mode 100644
index 0000000..a3425a0
--- /dev/null
+++ b/.config/nvim/lua/lang/graphql.lua
@@ -0,0 +1,31 @@
+local M = {}
+
+M.config = function()
+ O.lang.graphql = {}
+end
+
+M.format = function()
+ -- TODO: implement formatter for language
+ return "No formatter available!"
+end
+
+M.lint = function()
+ -- TODO: implement linters (if applicable)
+ return "No linters configured!"
+end
+
+M.lsp = function()
+ if require("utils").check_lsp_client_active "graphql" then
+ return
+ end
+
+ -- npm install -g graphql-language-service-cli
+ require("lspconfig").graphql.setup { on_attach = require("lsp").common_on_attach }
+end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M
diff --git a/.config/nvim/lua/lang/html.lua b/.config/nvim/lua/lang/html.lua
new file mode 100644
index 0000000..d5a02b6
--- /dev/null
+++ b/.config/nvim/lua/lang/html.lua
@@ -0,0 +1,47 @@
+local M = {}
+
+M.config = function()
+ O.lang.html = {
+ linters = {
+ "tidy",
+ -- https://docs.errata.ai/vale/scoping#html
+ "vale",
+ },
+ }
+end
+
+M.format = function()
+ -- TODO: implement formatters (if applicable)
+ return "No formatters configured!"
+end
+
+M.lint = function()
+ require("lint").linters_by_ft = {
+ html = O.lang.html.linters,
+ }
+end
+
+M.lsp = function()
+ if not require("utils").check_lsp_client_active "html" then
+ -- npm install -g vscode-html-languageserver-bin
+ local capabilities = vim.lsp.protocol.make_client_capabilities()
+ capabilities.textDocument.completion.completionItem.snippetSupport = true
+
+ require("lspconfig").html.setup {
+ cmd = {
+ "node",
+ DATA_PATH .. "/lspinstall/html/vscode-html/html-language-features/server/dist/node/htmlServerMain.js",
+ "--stdio",
+ },
+ on_attach = require("lsp").common_on_attach,
+ capabilities = capabilities,
+ }
+ end
+end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M
diff --git a/.config/nvim/lua/lang/javascript.lua b/.config/nvim/lua/lang/javascript.lua
new file mode 100644
index 0000000..178c6f5
--- /dev/null
+++ b/.config/nvim/lua/lang/javascript.lua
@@ -0,0 +1,25 @@
+local M = {}
+
+M.config = function()
+ -- TODO: implement config for language
+ return "No config available!"
+end
+
+M.format = function()
+ -- TODO: implement formatter for language
+ return "No formatter available!"
+end
+
+M.lint = function()
+ -- TODO: implement linters (if applicable)
+ return "No linters configured!"
+end
+
+M.lsp = function() end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M
diff --git a/.config/nvim/lua/lang/javascriptreact.lua b/.config/nvim/lua/lang/javascriptreact.lua
new file mode 100644
index 0000000..178c6f5
--- /dev/null
+++ b/.config/nvim/lua/lang/javascriptreact.lua
@@ -0,0 +1,25 @@
+local M = {}
+
+M.config = function()
+ -- TODO: implement config for language
+ return "No config available!"
+end
+
+M.format = function()
+ -- TODO: implement formatter for language
+ return "No formatter available!"
+end
+
+M.lint = function()
+ -- TODO: implement linters (if applicable)
+ return "No linters configured!"
+end
+
+M.lsp = function() end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M
diff --git a/.config/nvim/lua/lang/json.lua b/.config/nvim/lua/lang/json.lua
new file mode 100644
index 0000000..78bf669
--- /dev/null
+++ b/.config/nvim/lua/lang/json.lua
@@ -0,0 +1,69 @@
+local M = {}
+
+M.config = function()
+ O.lang.json = {
+ diagnostics = {
+ virtual_text = { spacing = 0, prefix = "" },
+ signs = true,
+ underline = true,
+ },
+ formatter = {
+ exe = "python",
+ args = { "-m", "json.tool" },
+ stdin = true,
+ },
+ }
+end
+
+M.format = function()
+ O.formatters.filetype["json"] = {
+ function()
+ return {
+ exe = O.lang.json.formatter.exe,
+ args = O.lang.json.formatter.args,
+ stdin = O.lang.json.formatter.stdin,
+ }
+ end,
+ }
+
+ require("formatter.config").set_defaults {
+ logging = false,
+ filetype = O.formatters.filetype,
+ }
+end
+
+M.lint = function()
+ -- TODO: implement linters (if applicable)
+ return "No linters configured!"
+end
+
+M.lsp = function()
+ if require("utils").check_lsp_client_active "jsonls" then
+ return
+ end
+
+ -- npm install -g vscode-json-languageserver
+ require("lspconfig").jsonls.setup {
+ cmd = {
+ "node",
+ DATA_PATH .. "/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js",
+ "--stdio",
+ },
+ on_attach = require("lsp").common_on_attach,
+
+ commands = {
+ Format = {
+ function()
+ vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 })
+ end,
+ },
+ },
+ }
+end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M
diff --git a/.config/nvim/lua/lang/kotlin.lua b/.config/nvim/lua/lang/kotlin.lua
new file mode 100644
index 0000000..3fe1dc9
--- /dev/null
+++ b/.config/nvim/lua/lang/kotlin.lua
@@ -0,0 +1,63 @@
+local M = {}
+
+M.config = function()
+ O.lang.kotlin = {}
+end
+
+M.format = function()
+ -- TODO: implement formatter for language
+ return "No formatter available!"
+end
+
+M.lint = function()
+ -- TODO: implement linters (if applicable)
+ return "No linters configured!"
+end
+
+M.lsp = function()
+ if require("utils").check_lsp_client_active "kotlin_language_server" then
+ return
+ end
+
+ --- default config for gradle-projects of the
+ --- kotlin-language-server: https://github.com/fwcd/kotlin-language-server
+ ---
+ --- This server requires vim to be aware of the kotlin-filetype.
+ --- You could refer for this capability to:
+ --- https://github.com/udalov/kotlin-vim (recommended)
+ --- Note that there is no LICENSE specified yet.
+
+ local util = require "lspconfig/util"
+
+ local bin_name = DATA_PATH .. "/lspinstall/kotlin/server/bin/kotlin-language-server"
+ if vim.fn.has "win32" == 1 then
+ bin_name = bin_name .. ".bat"
+ end
+
+ local root_files = {
+ "settings.gradle", -- Gradle (multi-project)
+ "settings.gradle.kts", -- Gradle (multi-project)
+ "build.xml", -- Ant
+ "pom.xml", -- Maven
+ }
+
+ local fallback_root_files = {
+ "build.gradle", -- Gradle
+ "build.gradle.kts", -- Gradle
+ }
+
+ require("lspconfig").kotlin_language_server.setup {
+ cmd = { bin_name },
+ on_attach = require("lsp").common_on_attach,
+ root_dir = function(fname)
+ return util.root_pattern(unpack(root_files))(fname) or util.root_pattern(unpack(fallback_root_files))(fname)
+ end,
+ }
+end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M
diff --git a/.config/nvim/lua/lang/lua.lua b/.config/nvim/lua/lang/lua.lua
new file mode 100644
index 0000000..c7305d0
--- /dev/null
+++ b/.config/nvim/lua/lang/lua.lua
@@ -0,0 +1,88 @@
+
+local M = {}
+
+M.config = function()
+ O.lang.lua = {
+ diagnostics = {
+ virtual_text = { spacing = 0, prefix = "" },
+ signs = true,
+ underline = true,
+ },
+ formatter = {
+ exe = "stylua",
+ args = {},
+ stdin = false,
+ },
+ linters = { "luacheck" },
+ lsp = {
+ path = DATA_PATH .. "/lspinstall/lua/sumneko-lua-language-server",
+ },
+ }
+end
+
+M.format = function()
+ O.formatters.filetype["lua"] = {
+ function()
+ return {
+ exe = O.lang.lua.formatter.exe,
+ args = O.lang.lua.formatter.args,
+ stdin = O.lang.lua.formatter.stdin,
+ tempfile_prefix = ".formatter",
+ }
+ end,
+ }
+
+ require("formatter.config").set_defaults {
+ logging = false,
+ filetype = O.formatters.filetype,
+ }
+end
+
+M.lint = function()
+ require("lint").linters_by_ft = {
+ lua = O.lang.lua.linters,
+ }
+end
+
+M.lsp = function()
+ if not require("utils").check_lsp_client_active "sumneko_lua" then
+ -- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)
+ local sumneko_root_path = DATA_PATH .. "/lspinstall/lua"
+ local sumneko_binary = sumneko_root_path .. "/sumneko-lua-language-server"
+
+ require("lspconfig").sumneko_lua.setup {
+ cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" },
+ on_attach = require("lsp").common_on_attach,
+ settings = {
+ Lua = {
+ runtime = {
+ -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
+ version = "LuaJIT",
+ -- Setup your lua path
+ path = vim.split(package.path, ";"),
+ },
+ diagnostics = {
+ -- Get the language server to recognize the `vim` global
+ globals = { "vim", "O" },
+ },
+ workspace = {
+ -- Make the server aware of Neovim runtime files
+ library = {
+ [vim.fn.expand "$VIMRUNTIME/lua"] = true,
+ [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
+ },
+ maxPreload = 100000,
+ preloadFileSize = 1000,
+ },
+ },
+ },
+ }
+ end
+end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M
diff --git a/.config/nvim/lua/lang/python.lua b/.config/nvim/lua/lang/python.lua
new file mode 100644
index 0000000..b421e82
--- /dev/null
+++ b/.config/nvim/lua/lang/python.lua
@@ -0,0 +1,92 @@
+local M = {}
+
+M.config = function()
+ O.lang.python = {
+ -- @usage can be flake8 or yapf
+ linter = "",
+ isort = false,
+ diagnostics = {
+ virtual_text = { spacing = 0, prefix = "" },
+ signs = true,
+ underline = true,
+ },
+ analysis = {
+ type_checking = "basic",
+ auto_search_paths = true,
+ use_library_code_types = true,
+ },
+ formatter = {
+ exe = "yapf",
+ args = {},
+ stdin = true,
+ },
+ linters = {
+ "flake8",
+ "pylint",
+ "mypy",
+ },
+ }
+end
+
+M.format = function()
+ O.formatters.filetype["python"] = {
+ function()
+ return {
+ exe = O.lang.python.formatter.exe,
+ args = O.lang.python.formatter.args,
+ stdin = O.lang.python.formatter.stdin,
+ }
+ end,
+ }
+
+ require("formatter.config").set_defaults {
+ logging = false,
+ filetype = O.formatters.filetype,
+ }
+end
+
+M.lint = function()
+ require("lint").linters_by_ft = {
+ python = O.lang.python.linters,
+ }
+end
+
+M.lsp = function()
+ if require("utils").check_lsp_client_active "pyright" then
+ return
+ end
+ -- npm i -g pyright
+ require("lspconfig").pyright.setup {
+ cmd = {
+ DATA_PATH .. "/lspinstall/python/node_modules/.bin/pyright-langserver",
+ "--stdio",
+ },
+ on_attach = require("lsp").common_on_attach,
+ handlers = {
+ ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
+ virtual_text = O.lang.python.diagnostics.virtual_text,
+ signs = O.lang.python.diagnostics.signs,
+ underline = O.lang.python.diagnostics.underline,
+ update_in_insert = true,
+ }),
+ },
+ settings = {
+ python = {
+ analysis = {
+ typeCheckingMode = O.lang.python.analysis.type_checking,
+ autoSearchPaths = O.lang.python.analysis.auto_search_paths,
+ useLibraryCodeForTypes = O.lang.python.analysis.use_library_code_types,
+ },
+ },
+ },
+ }
+end
+
+M.dap = function()
+ if O.plugin.dap.active then
+ local dap_install = require "dap-install"
+ dap_install.config("python_dbg", {})
+ end
+end
+
+return M
diff --git a/.config/nvim/lua/lang/rust.lua b/.config/nvim/lua/lang/rust.lua
new file mode 100644
index 0000000..8726059
--- /dev/null
+++ b/.config/nvim/lua/lang/rust.lua
@@ -0,0 +1,152 @@
+local M = {}
+
+M.config = function()
+ O.lang.rust = {
+ rust_tools = {
+ active = false,
+ parameter_hints_prefix = "<-",
+ other_hints_prefix = "=>", -- prefix for all the other hints (type, chaining)
+ },
+ -- @usage can be clippy
+ formatter = {
+ exe = "rustfmt",
+ args = { "--emit=stdout", "--edition=2018" },
+ stdin = true,
+ },
+ linter = "",
+ diagnostics = {
+ virtual_text = { spacing = 0, prefix = "" },
+ signs = true,
+ underline = true,
+ },
+ }
+end
+
+M.format = function()
+ O.formatters.filetype["rust"] = {
+ function()
+ return {
+ exe = O.lang.rust.formatter.exe,
+ args = O.lang.rust.formatter.args,
+ stdin = O.lang.rust.formatter.stdin,
+ }
+ end,
+ }
+
+ require("formatter.config").set_defaults {
+ logging = false,
+ filetype = O.formatters.filetype,
+ }
+end
+
+M.lint = function()
+ -- TODO: implement linters (if applicable)
+ return "No linters configured!"
+end
+
+M.lsp = function()
+ if require("utils").check_lsp_client_active "rust_analyzer" then
+ return
+ end
+
+ if O.lang.rust.rust_tools.active then
+ local opts = {
+ tools = { -- rust-tools options
+ -- automatically set inlay hints (type hints)
+ -- There is an issue due to which the hints are not applied on the first
+ -- opened file. For now, write to the file to trigger a reapplication of
+ -- the hints or just run :RustSetInlayHints.
+ -- default: true
+ autoSetHints = true,
+
+ -- whether to show hover actions inside the hover window
+ -- this overrides the default hover handler
+ -- default: true
+ hover_with_actions = true,
+
+ runnables = {
+ -- whether to use telescope for selection menu or not
+ -- default: true
+ use_telescope = true,
+
+ -- rest of the opts are forwarded to telescope
+ },
+
+ inlay_hints = {
+ -- wheter to show parameter hints with the inlay hints or not
+ -- default: true
+ show_parameter_hints = true,
+
+ -- prefix for parameter hints
+ -- default: "<-"
+ parameter_hints_prefix = O.lang.rust.rust_tools.parameter_hints_prefix,
+
+ -- prefix for all the other hints (type, chaining)
+ -- default: "=>"
+ other_hints_prefix = O.lang.rust.rust_tools.other_hints_prefix,
+
+ -- whether to align to the lenght of the longest line in the file
+ max_len_align = false,
+
+ -- padding from the left if max_len_align is true
+ max_len_align_padding = 1,
+
+ -- whether to align to the extreme right or not
+ right_align = false,
+
+ -- padding from the right if right_align is true
+ right_align_padding = 7,
+ },
+
+ hover_actions = {
+ -- the border that is used for the hover window
+ -- see vim.api.nvim_open_win()
+ border = {
+ { "╭", "FloatBorder" },
+ { "─", "FloatBorder" },
+ { "╮", "FloatBorder" },
+ { "│", "FloatBorder" },
+ { "╯", "FloatBorder" },
+ { "─", "FloatBorder" },
+ { "╰", "FloatBorder" },
+ { "│", "FloatBorder" },
+ },
+ },
+ },
+
+ -- all the opts to send to nvim-lspconfig
+ -- these override the defaults set by rust-tools.nvim
+ -- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer
+ server = {
+ cmd = { DATA_PATH .. "/lspinstall/rust/rust-analyzer" },
+ on_attach = require("lsp").common_on_attach,
+ }, -- rust-analyser options
+ }
+ require("rust-tools").setup(opts)
+ else
+ require("lspconfig").rust_analyzer.setup {
+ cmd = { DATA_PATH .. "/lspinstall/rust/rust-analyzer" },
+ on_attach = require("lsp").common_on_attach,
+ filetypes = { "rust" },
+ root_dir = require("lspconfig.util").root_pattern("Cargo.toml", "rust-project.json"),
+ }
+ end
+
+ -- TODO: fix these mappings
+ vim.api.nvim_exec(
+ [[
+ autocmd Filetype rust nnoremap <leader>lm <Cmd>RustExpandMacro<CR>
+ autocmd Filetype rust nnoremap <leader>lH <Cmd>RustToggleInlayHints<CR>
+ autocmd Filetype rust nnoremap <leader>le <Cmd>RustRunnables<CR>
+ autocmd Filetype rust nnoremap <leader>lh <Cmd>RustHoverActions<CR>
+ ]],
+ true
+ )
+end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M
diff --git a/.config/nvim/lua/lang/sh.lua b/.config/nvim/lua/lang/sh.lua
new file mode 100644
index 0000000..2301e44
--- /dev/null
+++ b/.config/nvim/lua/lang/sh.lua
@@ -0,0 +1,62 @@
+local M = {}
+
+M.config = function()
+ O.lang.sh = {
+ -- @usage can be 'shellcheck'
+ linter = "",
+ -- @usage can be 'shfmt'
+ diagnostics = {
+ virtual_text = { spacing = 0, prefix = "" },
+ signs = true,
+ underline = true,
+ },
+ formatter = {
+ exe = "shfmt",
+ args = { "-w" },
+ stdin = false,
+ },
+ linters = { "shellcheck" },
+ }
+end
+
+M.format = function()
+ O.formatters.filetype["sh"] = {
+ function()
+ return {
+ exe = O.lang.sh.formatter.exe,
+ args = O.lang.sh.formatter.args,
+ stdin = O.lang.sh.formatter.stdin,
+ tempfile_prefix = ".formatter",
+ }
+ end,
+ }
+
+ require("formatter.config").set_defaults {
+ logging = false,
+ filetype = O.formatters.filetype,
+ }
+end
+
+M.lint = function()
+ require("lint").linters_by_ft = {
+ sh = O.lang.sh.linters,
+ }
+end
+
+M.lsp = function()
+ if not require("utils").check_lsp_client_active "bashls" then
+ -- npm i -g bash-language-server
+ require("lspconfig").bashls.setup {
+ cmd = { DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start" },
+ on_attach = require("lsp").common_on_attach,
+ filetypes = { "sh", "zsh" },
+ }
+ end
+end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M
diff --git a/.config/nvim/lua/lang/swift.lua b/.config/nvim/lua/lang/swift.lua
new file mode 100644
index 0000000..25c13f9
--- /dev/null
+++ b/.config/nvim/lua/lang/swift.lua
@@ -0,0 +1,55 @@
+local M = {}
+
+M.config = function()
+ O.lang.swift = {
+ formatter = {
+ exe = "swiftformat",
+ args = {},
+ stdin = true,
+ },
+ lsp = {
+ path = "sourcekit-lsp",
+ },
+ }
+end
+
+M.format = function()
+ -- TODO: implement formatter (if applicable)
+ return "No formatter configured!"
+end
+
+M.lint = function()
+ O.formatters.filetype["swift"] = {
+ function()
+ return {
+ exe = O.lang.swift.formatter.exe,
+ args = O.lang.swift.formatter.args,
+ stdin = O.lang.swift.formatter.stdin,
+ }
+ end,
+ }
+
+ require("formatter.config").set_defaults {
+ logging = false,
+ filetype = O.formatters.filetype,
+ }
+end
+
+M.lsp = function()
+ if require("utils").check_lsp_client_active "sourcekit" then
+ return
+ end
+
+ require("lspconfig").sourcekit.setup {
+ cmd = { "xcrun", O.lang.swift.lsp.path },
+ on_attach = require("lsp").common_on_attach,
+ filetypes = { "swift" },
+ }
+end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M
diff --git a/.config/nvim/lua/lang/tex.lua b/.config/nvim/lua/lang/tex.lua
new file mode 100644
index 0000000..9ebf05f
--- /dev/null
+++ b/.config/nvim/lua/lang/tex.lua
@@ -0,0 +1,159 @@
+local M = {}
+
+M.config = function()
+ O.lang.latex = {
+ filetypes = { "tex", "bib" },
+ aux_directory = nil,
+ bibtex_formatter = "texlab",
+ diagnostics_delay = 300,
+ formatter_line_length = 80,
+ latex_formatter = "latexindent",
+ lsp = {
+ path = DATA_PATH .. "/lspinstall/latex/texlab",
+ },
+ build = {
+ executable = "latexmk",
+ args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" },
+ on_save = false,
+ forward_search_after = false,
+ },
+ chktex = {
+ on_open_and_save = false,
+ on_edit = false,
+ },
+ forward_search = {
+ executable = nil,
+ args = {},
+ },
+ latexindent = {
+ ["local"] = nil,
+ modify_line_breaks = false,
+ },
+ diagnostics = {
+ virtual_text = { spacing = 0, prefix = "" },
+ signs = true,
+ underline = true,
+ },
+ linters = { "chktex" },
+ auto_save = false,
+ ignore_errors = {},
+ }
+end
+
+M.format = function()
+ -- TODO: implement formatter for language
+ return "No formatter available!"
+end
+
+M.lint = function()
+ require("lint").linters_by_ft = {
+ tex = O.lang.latex.linters,
+ }
+end
+
+M.lsp = function()
+ if require("utils").check_lsp_client_active "texlab" then
+ return
+ end
+
+ local preview_settings = {}
+
+ local sumatrapdf_args = { "-reuse-instance", "%p", "-forward-search", "%f", "%l" }
+ local evince_args = { "-f", "%l", "%p", '"code -g %f:%l"' }
+ local okular_args = { "--unique", "file:%p#src:%l%f" }
+ local zathura_args = { "--synctex-forward", "%l:1:%f", "%p" }
+ local qpdfview_args = { "--unique", "%p#src:%f:%l:1" }
+ local skim_args = { "%l", "%p", "%f" }
+
+ if O.lang.latex.forward_search.executable == "C:/Users/{User}/AppData/Local/SumatraPDF/SumatraPDF.exe" then
+ preview_settings = sumatrapdf_args
+ elseif O.lang.latex.forward_search.executable == "evince-synctex" then
+ preview_settings = evince_args
+ elseif O.lang.latex.forward_search.executable == "okular" then
+ preview_settings = okular_args
+ elseif O.lang.latex.forward_search.executable == "zathura" then
+ preview_settings = zathura_args
+ elseif O.lang.latex.forward_search.executable == "qpdfview" then
+ preview_settings = qpdfview_args
+ elseif O.lang.latex.forward_search.executable == "/Applications/Skim.app/Contents/SharedSupport/displayline" then
+ preview_settings = skim_args
+ end
+
+ require("lspconfig").texlab.setup {
+ cmd = { O.lang.latex.lsp.path },
+ on_attach = require("lsp").common_on_attach,
+ handlers = {
+ ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
+ virtual_text = O.lang.latex.diagnostics.virtual_text,
+ signs = O.lang.latex.diagnostics.signs,
+ underline = O.lang.latex.diagnostics.underline,
+ update_in_insert = true,
+ }),
+ },
+ filetypes = { "tex", "bib" },
+ settings = {
+ texlab = {
+ auxDirectory = O.lang.latex.aux_directory,
+ bibtexFormatter = O.lang.latex.bibtex_formatter,
+ build = {
+ args = O.lang.latex.build.args,
+ executable = O.lang.latex.build.executable,
+ forwardSearchAfter = O.lang.latex.build.forward_search_after,
+ onSave = O.lang.latex.build.on_save,
+ },
+ chktex = {
+ onEdit = O.lang.latex.chktex.on_edit,
+ onOpenAndSave = O.lang.latex.chktex.on_open_and_save,
+ },
+ diagnosticsDelay = O.lang.latex.diagnostics_delay,
+ formatterLineLength = O.lang.latex.formatter_line_length,
+ forwardSearch = {
+ args = preview_settings,
+ executable = O.lang.latex.forward_search.executable,
+ },
+ latexFormatter = O.lang.latex.latex_formatter,
+ latexindent = {
+ modifyLineBreaks = O.lang.latex.latexindent.modify_line_breaks,
+ },
+ },
+ },
+ }
+ vim.g.vimtex_compiler_method = "latexmk"
+ vim.g.vimtex_view_method = "zathura"
+ vim.g.vimtex_fold_enabled = 0
+ vim.g.vimtex_quickfix_ignore_filters = O.lang.latex.ignore_errors
+
+ O.plugin.which_key.mappings["t"] = {
+ name = "+Latex",
+ c = { "<cmd>VimtexCompile<cr>", "Toggle Compilation Mode" },
+ f = { "<cmd>call vimtex#fzf#run()<cr>", "Fzf Find" },
+ i = { "<cmd>VimtexInfo<cr>", "Project Information" },
+ s = { "<cmd>VimtexStop<cr>", "Stop Project Compilation" },
+ t = { "<cmd>VimtexTocToggle<cr>", "Toggle Table Of Content" },
+ v = { "<cmd>VimtexView<cr>", "View PDF" },
+ b = { "<cmd>TexlabBuild<cr>", "Build with Texlab" },
+ p = { "<cmd>TexlabForward<cr>", "Preview with Texlab" },
+ }
+
+ -- Compile on initialization, cleanup on quit
+ vim.api.nvim_exec(
+ [[
+ augroup vimtex_event_1
+ au!
+ au User VimtexEventQuit call vimtex#compiler#clean(0)
+ au User VimtexEventInitPost call vimtex#compiler#compile()
+ augroup END
+ ]],
+ false
+ )
+ if O.lang.latex.auto_save then
+ vim.api.nvim_exec([[au FocusLost * :wa]], false)
+ end
+end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M
diff --git a/.config/nvim/lua/lang/typescript.lua b/.config/nvim/lua/lang/typescript.lua
new file mode 100644
index 0000000..178c6f5
--- /dev/null
+++ b/.config/nvim/lua/lang/typescript.lua
@@ -0,0 +1,25 @@
+local M = {}
+
+M.config = function()
+ -- TODO: implement config for language
+ return "No config available!"
+end
+
+M.format = function()
+ -- TODO: implement formatter for language
+ return "No formatter available!"
+end
+
+M.lint = function()
+ -- TODO: implement linters (if applicable)
+ return "No linters configured!"
+end
+
+M.lsp = function() end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M
diff --git a/.config/nvim/lua/lang/typescriptreact.lua b/.config/nvim/lua/lang/typescriptreact.lua
new file mode 100644
index 0000000..178c6f5
--- /dev/null
+++ b/.config/nvim/lua/lang/typescriptreact.lua
@@ -0,0 +1,25 @@
+local M = {}
+
+M.config = function()
+ -- TODO: implement config for language
+ return "No config available!"
+end
+
+M.format = function()
+ -- TODO: implement formatter for language
+ return "No formatter available!"
+end
+
+M.lint = function()
+ -- TODO: implement linters (if applicable)
+ return "No linters configured!"
+end
+
+M.lsp = function() end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M
diff --git a/.config/nvim/lua/lang/vim.lua b/.config/nvim/lua/lang/vim.lua
new file mode 100644
index 0000000..bab91e6
--- /dev/null
+++ b/.config/nvim/lua/lang/vim.lua
@@ -0,0 +1,40 @@
+local M = {}
+
+M.config = function()
+ O.lang.vim = {
+ linters = { "vint" },
+ lsp = {
+ path = DATA_PATH .. "/lspinstall/vim/node_modules/.bin/vim-language-server",
+ },
+ }
+end
+
+M.format = function()
+ -- TODO: implement formatter for language
+ return "No formatter available!"
+end
+
+M.lint = function()
+ require("lint").linters_by_ft = {
+ vim = O.lang.vim.linters,
+ }
+end
+
+M.lsp = function()
+ if require("utils").check_lsp_client_active "vimls" then
+ return
+ end
+
+ -- npm install -g vim-language-server
+ require("lspconfig").vimls.setup {
+ cmd = { DATA_PATH .. "/lspinstall/vim/node_modules/.bin/vim-language-server", "--stdio" },
+ on_attach = require("lsp").common_on_attach,
+ }
+end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M
diff --git a/.config/nvim/lua/lang/yaml.lua b/.config/nvim/lua/lang/yaml.lua
new file mode 100644
index 0000000..7f9eb71
--- /dev/null
+++ b/.config/nvim/lua/lang/yaml.lua
@@ -0,0 +1,54 @@
+local M = {}
+
+M.config = function()
+ O.lang.yaml = {
+ formatter = {
+ exe = "prettier",
+ args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote" },
+ stdin = true,
+ },
+ lsp = {
+ path = DATA_PATH .. "/lspinstall/yaml/node_modules/.bin/yaml-language-server",
+ },
+ }
+end
+
+M.format = function()
+ O.formatters.filetype["yaml"] = {
+ function()
+ return {
+ exe = O.lang.yaml.formatter.exe,
+ args = O.lang.yaml.formatter.args,
+ stdin = O.lang.yaml.formatter.stdin,
+ }
+ end,
+ }
+ require("formatter.config").set_defaults {
+ logging = false,
+ filetype = O.formatters.filetype,
+ }
+end
+
+M.lint = function()
+ -- TODO: implement linters (if applicable)
+ return "No linters configured!"
+end
+
+M.lsp = function()
+ if require("utils").check_lsp_client_active "yamlls" then
+ return
+ end
+
+ -- npm install -g yaml-language-server
+ require("lspconfig").yamlls.setup {
+ cmd = { O.lang.yaml.lsp.path, "--stdio" },
+ on_attach = require("lsp").common_on_attach,
+ }
+end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M
diff --git a/.config/nvim/lua/lang/zig.lua b/.config/nvim/lua/lang/zig.lua
new file mode 100644
index 0000000..e000cfe
--- /dev/null
+++ b/.config/nvim/lua/lang/zig.lua
@@ -0,0 +1,58 @@
+local M = {}
+
+M.config = function()
+ O.lang.zig = {
+ formatter = {
+ exe = "zig",
+ args = { "fmt" },
+ stdin = false,
+ },
+ lsp = {
+ path = "zls",
+ },
+ }
+end
+
+M.format = function()
+ O.formatters.filetype["zig"] = {
+ function()
+ return {
+ exe = O.lang.zig.formatter.exe,
+ args = O.lang.zig.formatter.args,
+ stdin = O.lang.zig.formatter.stdin,
+ }
+ end,
+ }
+
+ require("formatter.config").set_defaults {
+ logging = false,
+ filetype = O.formatters.filetype,
+ }
+end
+
+M.lint = function()
+ -- TODO: implement linters (if applicable)
+ return "No linters configured!"
+end
+
+M.lsp = function()
+ if require("utils").check_lsp_client_active "zls" then
+ return
+ end
+ -- Because lspinstall don't support zig yet,
+ -- So we need zls preset in global lib
+ -- Further custom install zls in
+ -- https://github.com/zigtools/zls/wiki/Downloading-and-Building-ZLS
+ require("lspconfig").zls.setup {
+ cmd = { O.lang.zig.lsp.path },
+ root_dir = require("lspconfig").util.root_pattern(".git", "build.zig", "zls.json"),
+ on_attach = require("lsp").common_on_attach,
+ }
+end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M
diff --git a/.config/nvim/lua/lang/zsh.lua b/.config/nvim/lua/lang/zsh.lua
new file mode 100644
index 0000000..31e9bf3
--- /dev/null
+++ b/.config/nvim/lua/lang/zsh.lua
@@ -0,0 +1,53 @@
+local M = {}
+
+M.config = function()
+ O.lang.zsh = {
+ lsp = {
+ path = DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server",
+ },
+ }
+end
+
+M.format = function()
+ -- TODO: implement format for language
+ return "No format available!"
+end
+
+M.lint = function()
+ -- zsh
+ local zsh_arguments = {}
+
+ if not require("utils").check_lsp_client_active "efm" then
+ require("lspconfig").efm.setup {
+ -- init_options = {initializationOptions},
+ cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
+ init_options = { documentFormatting = true, codeAction = false },
+ root_dir = require("lspconfig").util.root_pattern ".git/",
+ filetypes = { "zsh" },
+ settings = {
+ rootMarkers = { ".git/" },
+ languages = {
+ zsh = zsh_arguments,
+ },
+ },
+ }
+ end
+end
+
+M.lsp = function()
+ if not require("utils").check_lsp_client_active "bashls" then
+ -- npm i -g bash-language-server
+ require("lspconfig").bashls.setup {
+ cmd = { O.lang.zsh.lsp.path, "start" },
+ on_attach = require("lsp").common_on_attach,
+ filetypes = { "sh", "zsh" },
+ }
+ end
+end
+
+M.dap = function()
+ -- TODO: implement dap
+ return "No DAP configured!"
+end
+
+return M
diff --git a/.config/nvim/lua/cfg/lsp/emmet-ls.lua b/.config/nvim/lua/lsp/emmet-ls.lua
index fcb7f62..e38747a 100644
--- a/.config/nvim/lua/cfg/lsp/emmet-ls.lua
+++ b/.config/nvim/lua/lsp/emmet-ls.lua
@@ -2,22 +2,22 @@
-- return
-- end
-local nvim_lsp = require'lspconfig'
-local configs = require'lspconfig/configs'
+local nvim_lsp = require "lspconfig"
+local configs = require "lspconfig/configs"
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
configs.emmet_ls = {
default_config = {
- cmd = {'emmet-ls', '--stdio'};
- filetypes = {'html', 'css', 'javascript', 'typescript'};
+ cmd = { "emmet-ls", "--stdio" },
+ filetypes = { "html", "css", "javascript", "typescript", "vue" },
root_dir = function()
return vim.loop.cwd()
- end;
- settings = {};
- };
+ end,
+ settings = {},
+ },
}
-nvim_lsp.emmet_ls.setup{
+nvim_lsp.emmet_ls.setup {
-- on_attach = on_attach;
}
diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/lsp/init.lua
new file mode 100644
index 0000000..6a52b9d
--- /dev/null
+++ b/.config/nvim/lua/lsp/init.lua
@@ -0,0 +1,264 @@
+-- TODO: figure out why this don't work
+vim.fn.sign_define(
+ "LspDiagnosticsSignError",
+ { texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError" }
+)
+vim.fn.sign_define(
+ "LspDiagnosticsSignWarning",
+ { texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning" }
+)
+vim.fn.sign_define(
+ "LspDiagnosticsSignHint",
+ { texthl = "LspDiagnosticsSignHint", text = "", numhl = "LspDiagnosticsSignHint" }
+)
+vim.fn.sign_define(
+ "LspDiagnosticsSignInformation",
+ { texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation" }
+)
+
+-- local opts = { border = "single" }
+-- TODO revisit this
+-- local border = {
+-- { "🭽", "FloatBorder" },
+-- { "▔", "FloatBorder" },
+-- { "🭾", "FloatBorder" },
+-- { "▕", "FloatBorder" },
+-- { "🭿", "FloatBorder" },
+-- { "▁", "FloatBorder" },
+-- { "🭼", "FloatBorder" },
+-- { "▏", "FloatBorder" },
+-- }
+
+-- My font didn't like this :/
+-- vim.api.nvim_set_keymap(
+-- "n",
+-- "gl",
+-- '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics({ show_header = false, border = { { "🭽", "FloatBorder" }, { "▔", "FloatBorder" }, { "🭾", "FloatBorder" }, { "▕", "FloatBorder" }, { "🭿", "FloatBorder" }, { "▁", "FloatBorder" }, { "🭼", "FloatBorder" }, { "▏", "FloatBorder" }, } })<CR>',
+-- { noremap = true, silent = true }
+-- )
+
+if O.lsp.default_keybinds then
+ vim.cmd "nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>"
+ vim.cmd "nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>"
+ vim.cmd "nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>"
+ vim.cmd "nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>"
+ vim.api.nvim_set_keymap(
+ "n",
+ "gl",
+ '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics({ show_header = false, border = "single" })<CR>',
+ { noremap = true, silent = true }
+ )
+
+ vim.cmd "nnoremap <silent> gp <cmd>lua require'lsp'.PeekDefinition()<CR>"
+ vim.cmd "nnoremap <silent> K :lua vim.lsp.buf.hover()<CR>"
+ vim.cmd "nnoremap <silent> <C-p> :lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = O.lsp.popup_border}})<CR>"
+ vim.cmd "nnoremap <silent> <C-n> :lua vim.lsp.diagnostic.goto_next({popup_opts = {border = O.lsp.popup_border}})<CR>"
+ vim.cmd "nnoremap <silent> <tab> <cmd>lua vim.lsp.buf.signature_help()<CR>"
+ -- scroll down hover doc or scroll in definition preview
+ -- scroll up hover doc
+ vim.cmd 'command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()'
+end
+
+-- Set Default Prefix.
+-- Note: You can set a prefix per lsp server in the lv-globals.lua file
+vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
+ virtual_text = O.lsp.diagnostics.virtual_text,
+ signs = O.lsp.diagnostics.signs,
+ underline = O.lsp.document_highlight,
+})
+
+vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
+ border = O.lsp.popup_border,
+})
+
+vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
+ border = O.lsp.popup_border,
+})
+
+-- symbols for autocomplete
+vim.lsp.protocol.CompletionItemKind = {
+ "  (Text) ",
+ "  (Method)",
+ "  (Function)",
+ "  (Constructor)",
+ " ﴲ (Field)",
+ "[] (Variable)",
+ "  (Class)",
+ " ﰮ (Interface)",
+ "  (Module)",
+ " 襁 (Property)",
+ "  (Unit)",
+ "  (Value)",
+ " 練 (Enum)",
+ "  (Keyword)",
+ "  (Snippet)",
+ "  (Color)",
+ "  (File)",
+ "  (Reference)",
+ "  (Folder)",
+ "  (EnumMember)",
+ " ﲀ (Constant)",
+ " ﳤ (Struct)",
+ "  (Event)",
+ "  (Operator)",
+ "  (TypeParameter)",
+}
+
+--[[ " autoformat
+autocmd BufWritePre *.js lua vim.lsp.buf.formatting_sync(nil, 100)
+autocmd BufWritePre *.jsx lua vim.lsp.buf.formatting_sync(nil, 100)
+autocmd BufWritePre *.lua lua vim.lsp.buf.formatting_sync(nil, 100) ]]
+-- Java
+-- autocmd FileType java nnoremap ca <Cmd>lua require('jdtls').code_action()<CR>
+
+local function lsp_highlight_document(client)
+ if O.lsp.document_highlight == false then
+ return -- we don't need further
+ end
+ -- Set autocommands conditional on server_capabilities
+ if client.resolved_capabilities.document_highlight then
+ vim.api.nvim_exec(
+ [[
+ hi LspReferenceRead cterm=bold ctermbg=red guibg=#464646
+ hi LspReferenceText cterm=bold ctermbg=red guibg=#464646
+ hi LspReferenceWrite cterm=bold ctermbg=red guibg=#464646
+ augroup lsp_document_highlight
+ autocmd! * <buffer>
+ autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
+ autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
+ augroup END
+ ]],
+ false
+ )
+ end
+end
+local lsp_config = {}
+
+-- Taken from https://www.reddit.com/r/neovim/comments/gyb077/nvimlsp_peek_defination_javascript_ttserver/
+function lsp_config.preview_location(location, context, before_context)
+ -- location may be LocationLink or Location (more useful for the former)
+ context = context or 15
+ before_context = before_context or 0
+ local uri = location.targetUri or location.uri
+ if uri == nil then
+ return
+ end
+ local bufnr = vim.uri_to_bufnr(uri)
+ if not vim.api.nvim_buf_is_loaded(bufnr) then
+ vim.fn.bufload(bufnr)
+ end
+
+ local range = location.targetRange or location.range
+ local contents = vim.api.nvim_buf_get_lines(
+ bufnr,
+ range.start.line - before_context,
+ range["end"].line + 1 + context,
+ false
+ )
+ local filetype = vim.api.nvim_buf_get_option(bufnr, "filetype")
+ return vim.lsp.util.open_floating_preview(contents, filetype, { border = O.lsp.popup_border })
+end
+
+function lsp_config.preview_location_callback(_, method, result)
+ local context = 15
+ if result == nil or vim.tbl_isempty(result) then
+ print("No location found: " .. method)
+ return nil
+ end
+ if vim.tbl_islist(result) then
+ lsp_config.floating_buf, lsp_config.floating_win = lsp_config.preview_location(result[1], context)
+ else
+ lsp_config.floating_buf, lsp_config.floating_win = lsp_config.preview_location(result, context)
+ end
+end
+
+function lsp_config.PeekDefinition()
+ if vim.tbl_contains(vim.api.nvim_list_wins(), lsp_config.floating_win) then
+ vim.api.nvim_set_current_win(lsp_config.floating_win)
+ else
+ local params = vim.lsp.util.make_position_params()
+ return vim.lsp.buf_request(0, "textDocument/definition", params, lsp_config.preview_location_callback)
+ end
+end
+
+function lsp_config.PeekTypeDefinition()
+ if vim.tbl_contains(vim.api.nvim_list_wins(), lsp_config.floating_win) then
+ vim.api.nvim_set_current_win(lsp_config.floating_win)
+ else
+ local params = vim.lsp.util.make_position_params()
+ return vim.lsp.buf_request(0, "textDocument/typeDefinition", params, lsp_config.preview_location_callback)
+ end
+end
+
+function lsp_config.PeekImplementation()
+ if vim.tbl_contains(vim.api.nvim_list_wins(), lsp_config.floating_win) then
+ vim.api.nvim_set_current_win(lsp_config.floating_win)
+ else
+ local params = vim.lsp.util.make_position_params()
+ return vim.lsp.buf_request(0, "textDocument/implementation", params, lsp_config.preview_location_callback)
+ end
+end
+
+function lsp_config.common_on_attach(client, bufnr)
+ if O.lsp.on_attach_callback then
+ O.lsp.on_attach_callback(client, bufnr)
+ end
+ lsp_highlight_document(client)
+end
+
+function lsp_config.tsserver_on_attach(client, _)
+ -- lsp_config.common_on_attach(client, bufnr)
+ client.resolved_capabilities.document_formatting = false
+
+ local ts_utils = require "nvim-lsp-ts-utils"
+
+ -- defaults
+ ts_utils.setup {
+ debug = false,
+ disable_commands = false,
+ enable_import_on_completion = false,
+ import_all_timeout = 5000, -- ms
+
+ -- eslint
+ eslint_enable_code_actions = true,
+ eslint_enable_disable_comments = true,
+ -- eslint_bin = O.lang.tsserver.linter,
+ eslint_config_fallback = nil,
+ eslint_enable_diagnostics = true,
+
+ -- formatting
+ enable_formatting = O.lang.tsserver.autoformat,
+ formatter = O.lang.tsserver.formatter.exe,
+ formatter_config_fallback = nil,
+
+ -- parentheses completion
+ complete_parens = false,
+ signature_help_in_parens = false,
+
+ -- update imports on file move
+ update_imports_on_move = false,
+ require_confirmation_on_move = false,
+ watch_dir = nil,
+ }
+
+ -- required to fix code action ranges
+ ts_utils.setup_client(client)
+
+ -- TODO: keymap these?
+ -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gs", ":TSLspOrganize<CR>", {silent = true})
+ -- vim.api.nvim_buf_set_keymap(bufnr, "n", "qq", ":TSLspFixCurrent<CR>", {silent = true})
+ -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", ":TSLspRenameFile<CR>", {silent = true})
+ -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", ":TSLspImportAll<CR>", {silent = true})
+end
+
+require("utils").define_augroups {
+ _general_lsp = {
+ { "FileType", "lspinfo", "nnoremap <silent> <buffer> q :q<CR>" },
+ },
+}
+
+-- Use a loop to conveniently both setup defined servers
+-- and map buffer local keybindings when the language server attaches
+-- local servers = {"pyright", "tsserver"}
+-- for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup {on_attach = on_attach} end
+return lsp_config
diff --git a/.config/nvim/lua/lsp/tailwindcss-ls.lua b/.config/nvim/lua/lsp/tailwindcss-ls.lua
new file mode 100644
index 0000000..38c1e7c
--- /dev/null
+++ b/.config/nvim/lua/lsp/tailwindcss-ls.lua
@@ -0,0 +1,13 @@
+-- TODO: what is a tailwindcss filetype
+local lspconfig = require "lspconfig"
+
+lspconfig.tailwindcss.setup {
+ cmd = {
+ "node",
+ DATA_PATH .. "/lspinstall/tailwindcss/tailwindcss-intellisense/extension/dist/server/tailwindServer.js",
+ "--stdio",
+ },
+ filetypes = O.lang.tailwindcss.filetypes,
+ root_dir = require("lspconfig/util").root_pattern("tailwind.config.js", "postcss.config.ts", ".postcssrc"),
+ on_attach = require("lsp").common_on_attach,
+}
diff --git a/.config/nvim/lua/lsp/ts-fmt-lint.lua b/.config/nvim/lua/lsp/ts-fmt-lint.lua
new file mode 100644
index 0000000..7cebfd8
--- /dev/null
+++ b/.config/nvim/lua/lsp/ts-fmt-lint.lua
@@ -0,0 +1,72 @@
+-- Example configuations here: https://github.com/mattn/efm-langserver
+local M = {}
+
+M.setup = function()
+ vim.cmd "let proj = FindRootDirectory()"
+ local root_dir = vim.api.nvim_get_var "proj"
+
+ local get_linter_instance = function()
+ -- prioritize local instance over global
+ local local_instance = root_dir .. "/node_modules/.bin/" .. O.lang.tsserver.linter
+ if vim.fn.executable(local_instance) == 1 then
+ return local_instance
+ end
+ return O.lang.tsserver.linter
+ end
+
+ local tsserver_args = {}
+ local formattingSupported = false
+
+ if O.lang.tsserver.linter == "eslint" or O.lang.tsserver.linter == "eslint_d" then
+ local eslint = {
+ lintCommand = get_linter_instance() .. " -f visualstudio --stdin --stdin-filename ${INPUT}",
+ lintStdin = true,
+ lintFormats = {
+ "%f(%l,%c): %tarning %m",
+ "%f(%l,%c): %trror %m",
+ },
+ lintSource = O.lang.tsserver.linter,
+ lintIgnoreExitCode = true,
+ }
+ table.insert(tsserver_args, eslint)
+ -- Only eslint_d supports --fix-to-stdout
+ if string.find(get_linter_instance(), "eslint_d") then
+ formattingSupported = true
+ local eslint_fix = {
+ formatCommand = get_linter_instance() .. " --fix-to-stdout --stdin --stdin-filename ${INPUT}",
+ formatStdin = true,
+ }
+ table.insert(tsserver_args, eslint_fix)
+ end
+ end
+
+ require("lspconfig").efm.setup {
+ -- init_options = {initializationOptions},
+ cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
+ init_options = { documentFormatting = formattingSupported, codeAction = false },
+ root_dir = require("lspconfig").util.root_pattern(".git/", "package.json"),
+ filetypes = {
+ "vue",
+ "javascript",
+ "javascriptreact",
+ "typescript",
+ "typescriptreact",
+ "javascript.jsx",
+ "typescript.tsx",
+ },
+ settings = {
+ rootMarkers = { ".git/", "package.json" },
+ languages = {
+ vue = tsserver_args,
+ javascript = tsserver_args,
+ javascriptreact = tsserver_args,
+ ["javascript.jsx"] = tsserver_args,
+ typescript = tsserver_args,
+ ["typescript.tsx"] = tsserver_args,
+ typescriptreact = tsserver_args,
+ },
+ },
+ }
+end
+
+return M
diff --git a/.config/nvim/lua/lsp/tsserver-ls.lua b/.config/nvim/lua/lsp/tsserver-ls.lua
new file mode 100644
index 0000000..c687dfc
--- /dev/null
+++ b/.config/nvim/lua/lsp/tsserver-ls.lua
@@ -0,0 +1,83 @@
+vim.cmd "let proj = FindRootDirectory()"
+local root_dir = vim.api.nvim_get_var "proj"
+
+-- use the global prettier if you didn't find the local one
+local prettier_instance = root_dir .. "/node_modules/.bin/prettier"
+if vim.fn.executable(prettier_instance) ~= 1 then
+ prettier_instance = O.lang.tsserver.formatter.exe
+end
+
+O.formatters.filetype["javascriptreact"] = {
+ function()
+ local args = { "--stdin-filepath", vim.fn.fnameescape(vim.api.nvim_buf_get_name(0)) }
+ local extend_args = O.lang.tsserver.formatter.args
+
+ if extend_args then
+ for i = 1, #extend_args do
+ table.insert(args, extend_args[i])
+ end
+ end
+
+ return {
+ exe = prettier_instance,
+ args = args,
+ stdin = true,
+ }
+ end,
+}
+O.formatters.filetype["javascript"] = O.formatters.filetype["javascriptreact"]
+O.formatters.filetype["typescript"] = O.formatters.filetype["javascriptreact"]
+O.formatters.filetype["typescriptreact"] = O.formatters.filetype["javascriptreact"]
+
+require("formatter.config").set_defaults {
+ logging = false,
+ filetype = O.formatters.filetype,
+}
+
+if require("utils").check_lsp_client_active "tsserver" then
+ return
+end
+
+-- npm install -g typescript typescript-language-server
+-- require'snippets'.use_suggested_mappings()
+-- local capabilities = vim.lsp.protocol.make_client_capabilities()
+-- capabilities.textDocument.completion.completionItem.snippetSupport = true;
+-- local on_attach_common = function(client)
+-- print("LSP Initialized")
+-- require'completion'.on_attach(client)
+-- require'illuminate'.on_attach(client)
+-- end
+
+local on_attach = function(client, bufnr)
+ local lsp = require "lsp"
+ lsp.common_on_attach(client, bufnr)
+ lsp.tsserver_on_attach(client, bufnr)
+end
+
+require("lspconfig").tsserver.setup {
+ cmd = {
+ DATA_PATH .. "/lspinstall/typescript/node_modules/.bin/typescript-language-server",
+ "--stdio",
+ },
+ filetypes = {
+ "javascript",
+ "javascriptreact",
+ "javascript.jsx",
+ "typescript",
+ "typescriptreact",
+ "typescript.tsx",
+ },
+ on_attach = on_attach,
+ -- This makes sure tsserver is not used for formatting (I prefer prettier)
+ settings = { documentFormatting = false },
+ handlers = {
+ -- ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
+ -- virtual_text = O.lang.tsserver.diagnostics.virtual_text,
+ -- signs = O.lang.tsserver.diagnostics.signs,
+ -- underline = O.lang.tsserver.diagnostics.underline,
+ -- update_in_insert = true,
+ -- }),
+ },
+}
+
+require("lsp.ts-fmt-lint").setup()
diff --git a/.config/nvim/lua/plugin-loader.lua b/.config/nvim/lua/plugin-loader.lua
new file mode 100644
index 0000000..4cf72c8
--- /dev/null
+++ b/.config/nvim/lua/plugin-loader.lua
@@ -0,0 +1,49 @@
+local plugin_loader = {}
+
+function plugin_loader:init()
+ local execute = vim.api.nvim_command
+ local fn = vim.fn
+
+ local install_path = "~/.local/share/nvim/site/pack/packer/start/packer.nvim"
+ if fn.empty(fn.glob(install_path)) > 0 then
+ execute("!git clone https://github.com/wbthomason/packer.nvim " .. install_path)
+ execute "packadd packer.nvim"
+ end
+
+ local packer_ok, packer = pcall(require, "packer")
+ if not packer_ok then
+ return
+ end
+
+ local util = require "packer.util"
+
+ packer.init {
+ package_root = util.join_paths "~/.local/share/nvim/site/pack/",
+ compile_path = util.join_paths("~/.config/nvim", "plugin", "packer_compiled.lua"),
+ git = { clone_timeout = 300 },
+ display = {
+ open_fn = function()
+ return util.float { border = "single" }
+ end,
+ },
+ }
+
+ self.packer = packer
+ return self
+end
+
+function plugin_loader:load(configurations)
+ return self.packer.startup(function(use)
+ for _, plugins in ipairs(configurations) do
+ for _, plugin in ipairs(plugins) do
+ use(plugin)
+ end
+ end
+ end)
+end
+
+return {
+ init = function()
+ return plugin_loader:init()
+ end,
+}
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
index d94611b..e019fbd 100644
--- a/.config/nvim/lua/plugins.lua
+++ b/.config/nvim/lua/plugins.lua
@@ -1,270 +1,295 @@
-local execute = vim.api.nvim_command
-local fn = vim.fn
-
-local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim"
-
-if fn.empty(fn.glob(install_path)) > 0 then
- execute("!git clone https://github.com/wbthomason/packer.nvim " .. install_path)
- execute "packadd packer.nvim"
-end
-
-local packer_ok, packer = pcall(require, "packer")
-if not packer_ok then
- return
-end
-
-packer.init {
- git = { clone_timeout = 300 },
- display = {
- open_fn = function()
- return require("packer.util").float { border = "single" }
+return {
+ -- Packer can manage itself as an optional plugin
+ { "wbthomason/packer.nvim" },
+
+ -- TODO: refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function)
+ { "neovim/nvim-lspconfig" },
+ {
+ "kabouzeid/nvim-lspinstall",
+ event = "VimEnter",
+ config = function()
+ local lspinstall = require "lspinstall"
+ lspinstall.setup()
+ if O.plugin.lspinstall.on_config_done then
+ O.plugin.lspinstall.on_config_done(lspinstall)
+ end
end,
},
-}
-return require("packer").startup(function(use)
- -- Packer can manage itself as an optional plugin
- use "wbthomason/packer.nvim"
+ { "nvim-lua/popup.nvim" },
+ { "nvim-lua/plenary.nvim" },
+ { "tjdevries/astronauta.nvim" },
- -- TODO refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function)
- use { "neovim/nvim-lspconfig" }
- use { "kabouzeid/nvim-lspinstall", event = "BufRead" }
-- Telescope
- use { "nvim-lua/popup.nvim" }
- use { "nvim-lua/plenary.nvim" }
- use { "tjdevries/astronauta.nvim" }
- use {
+ {
"nvim-telescope/telescope.nvim",
- config = [[require('cfg.telescope')]],
- -- event = "BufEnter",
- }
+ config = function()
+ require("core.telescope").setup()
+ if O.plugin.telescope.on_config_done then
+ O.plugin.telescope.on_config_done(require "telescope")
+ end
+ end,
+ },
-- Autocomplete
- use {
+ {
"hrsh7th/nvim-compe",
- event = "InsertEnter",
+ -- event = "InsertEnter",
+ config = function()
+ require("core.compe").setup()
+ if O.plugin.compe.on_config_done then
+ O.plugin.compe.on_config_done(require "compe")
+ end
+ end,
+ },
+
+ -- Autopairs
+ {
+ "windwp/nvim-autopairs",
+ -- event = "InsertEnter",
config = function()
- require("cfg.compe").config()
+ require "core.autopairs"
+ if O.plugin.autopairs.on_config_done then
+ O.plugin.autopairs.on_config_done(require "nvim-autopairs")
+ end
end,
- }
+ },
+
+ -- Snippets
- use { "hrsh7th/vim-vsnip", event = "InsertEnter" }
- use { "rafamadriz/friendly-snippets", event = "InsertEnter" }
+ { "hrsh7th/vim-vsnip", event = "InsertEnter" },
+ { "rafamadriz/friendly-snippets", event = "InsertEnter" },
-- Treesitter
- use { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }
+ {
+ "nvim-treesitter/nvim-treesitter",
+ config = function()
+ require("core.treesitter").setup()
+ if O.plugin.treesitter.on_config_done then
+ O.plugin.treesitter.on_config_done(require "nvim-treesitter.configs")
+ end
+ end,
+ },
- -- Neoformat
- use {
- "sbdchd/neoformat",
+ -- Formatter.nvim
+ {
+ "mhartington/formatter.nvim",
config = function()
- require "cfg.neoformat"
+ require "core.formatter"
+ if O.plugin.formatter.on_config_done then
+ O.plugin.formatter.on_config_done(require "formatter")
+ end
end,
- event = "BufWinEnter",
- }
+ },
- use {
+ -- Linter
+ {
+ "mfussenegger/nvim-lint",
+ config = function()
+ require("core.linter").setup()
+ if O.plugin.lint.on_config_done then
+ O.plugin.lint.on_config_done(require "lint")
+ end
+ end,
+ },
+
+ -- NvimTree
+ {
"kyazdani42/nvim-tree.lua",
- -- event = "BufEnter",
+ -- event = "BufWinOpen",
-- cmd = "NvimTreeToggle",
- commit = "fd7f60e242205ea9efc9649101c81a07d5f458bb",
+ -- commit = "fd7f60e242205ea9efc9649101c81a07d5f458bb",
config = function()
- require("cfg.nvimtree").config()
+ require("core.nvimtree").setup()
+ if O.plugin.nvimtree.on_config_done then
+ O.plugin.nvimtree.on_config_done(require "nvim-tree.config")
+ end
end,
- }
+ },
- use {
+ {
"lewis6991/gitsigns.nvim",
+
config = function()
- require("cfg.gitsigns").config()
+ require("core.gitsigns").setup()
+ if O.plugin.gitsigns.on_config_done then
+ O.plugin.gitsigns.on_config_done(require "gitsigns")
+ end
end,
event = "BufRead",
- }
+ },
-- whichkey
- use {
+ {
"folke/which-key.nvim",
config = function()
- require "cfg.which-key"
+ require("core.which-key").setup()
+ if O.plugin.which_key.on_config_done then
+ O.plugin.which_key.on_config_done(require "which-key")
+ end
end,
event = "BufWinEnter",
- }
-
- -- Autopairs
- use {
- "windwp/nvim-autopairs",
- event = "InsertEnter",
- after = { "telescope.nvim" },
- config = function()
- require "cfg.autopairs"
- end,
- }
+ },
-- Comments
- use {
+ {
"terrortylor/nvim-comment",
- event = "BufWinEnter",
+ event = "BufRead",
config = function()
local status_ok, nvim_comment = pcall(require, "nvim_comment")
if not status_ok then
return
end
nvim_comment.setup()
+ if O.plugin.comment.on_config_done then
+ O.plugin.comment.on_config_done(nvim_comment)
+ end
end,
- }
+ },
- -- Color
- use { "christianchiarulli/nvcode-color-schemes.vim", opt = true }
+ {
+ "ahmedkhalf/lsp-rooter.nvim",
+ config = function()
+ if O.plugin.rooter.on_config_done then
+ O.plugin.rooter.on_config_done()
+ end
+ end,
+ },
-- Icons
- use { "kyazdani42/nvim-web-devicons" }
+ { "kyazdani42/nvim-web-devicons" },
-- Status Line and Bufferline
- use {
+ {
"glepnir/galaxyline.nvim",
config = function()
- require "cfg.galaxyline"
+ require "core.galaxyline"
+ if O.plugin.galaxyline.on_config_done then
+ O.plugin.galaxyline.on_config_done(require "galaxyline")
+ end
end,
- -- event = "VimEnter",
- }
+ event = "BufWinEnter",
+ disable = not O.plugin.galaxyline.active,
+ },
- use {
+ {
"romgrk/barbar.nvim",
config = function()
- require "cfg.barbar"
+ require "core.bufferline"
+ if O.plugin.bufferline.on_config_done then
+ O.plugin.bufferline.on_config_done()
+ end
end,
event = "BufWinEnter",
- }
+ },
+
+ -- Debugging
+ {
+ "mfussenegger/nvim-dap",
+ -- event = "BufWinEnter",
+ config = function()
+ require("core.dap").setup()
+ if O.plugin.dap.on_config_done then
+ O.plugin.dap.on_config_done(require "dap")
+ end
+ end,
+ disable = not O.plugin.dap.active,
+ },
+
+ -- Debugger management
+ {
+ "Pocco81/DAPInstall.nvim",
+ -- event = "BufWinEnter",
+ -- event = "BufRead",
+ disable = not O.plugin.dap.active,
+ },
-- Builtins, these do not load by default
-- Dashboard
- use {
+ {
"ChristianChiarulli/dashboard-nvim",
event = "BufWinEnter",
+ config = function()
+ require("core.dashboard").setup()
+ if O.plugin.dashboard.on_config_done then
+ O.plugin.dashboard.on_config_done(require "dashboard")
+ end
+ end,
disable = not O.plugin.dashboard.active,
- }
+ },
+
+ {
+ "akinsho/nvim-toggleterm.lua",
+ event = "BufWinEnter",
+ config = function()
+ require("core.terminal").setup()
+ if O.plugin.terminal.on_config_done then
+ O.plugin.terminal.on_config_done(require "toggleterm")
+ end
+ end,
+ disable = not O.plugin.terminal.active,
+ },
-- Zen Mode
- use {
+ {
"folke/zen-mode.nvim",
cmd = "ZenMode",
- -- event = "BufRead",
+ event = "BufRead",
config = function()
- require("cfg.zen").config()
+ require("core.zen").setup()
+ if O.plugin.zen.on_config_done then
+ O.plugin.zen.on_config_done(require "zen-mode")
+ end
end,
disable = not O.plugin.zen.active,
- }
+ },
- use {
- "norcalli/nvim-colorizer.lua",
+ -- Hop
+ {
+ "phaazon/hop.nvim",
event = "BufWinEnter",
config = function()
- require "cfg.colorizer"
- end,
- disable = not O.plugin.colorizer.active,
- }
-
- use {
- "lukas-reineke/indent-blankline.nvim",
- event = "BufRead",
- setup = function()
- vim.g.indentLine_enabled = 1
- vim.g.indent_blankline_char = "▏"
-
- vim.g.indent_blankline_filetype_exclude = {
- "help",
- "terminal",
- "dashboard",
- }
- vim.g.indent_blankline_buftype_exclude = { "terminal" }
-
- vim.g.indent_blankline_show_trailing_blankline_indent = false
- vim.g.indent_blankline_show_first_indent_level = true
+ require("core.hop").config()
+ if O.plugin.hop.on_config_done then
+ O.plugin.hop.on_config_done(require "hop")
+ end
end,
- disable = not O.plugin.indent_line.active,
- }
-
- -- comments in context
- use {
- "JoosepAlviste/nvim-ts-context-commentstring",
- event = "BufRead",
- disable = not O.plugin.ts_context_commentstring.active,
- }
-
- -- Symbol Outline
- use {
- "simrat39/symbols-outline.nvim",
- cmd = "SymbolsOutline",
- disable = not O.plugin.symbol_outline.active,
- }
-
- -- diagnostics
- use {
- "folke/trouble.nvim",
- cmd = "TroubleToggle",
- disable = not O.plugin.trouble.active,
- }
-
- -- Use fzy for telescope
- use {
- "nvim-telescope/telescope-fzy-native.nvim",
- event = "BufRead",
- disable = not O.plugin.telescope_fzy.active,
- }
+ disable = not O.plugin.hop.active,
+ },
- -- Use project for telescope
- use {
- "nvim-telescope/telescope-project.nvim",
- event = "BufRead",
- setup = function()
- vim.cmd [[packadd telescope.nvim]]
+ {
+ "norcalli/nvim-colorizer.lua",
+ event = "BufWinEnter",
+ config = function()
+ require("core.colorizer").config()
+ if O.plugin.colorizer.on_config_done then
+ O.plugin.colorizer.on_config_done(require "nvim-colorizer")
+ end
end,
- disable = not O.plugin.telescope_project.active,
- }
-
- -- Sane gx for netrw_gx bug
- use {
- "felipec/vim-sanegx",
- event = "BufRead",
- disable = not O.plugin.sanegx.active,
- }
-
- -- Diffview
- use {
- "sindrets/diffview.nvim",
- event = "BufRead",
- disable = not O.plugin.diffview.active,
- }
+ disable = not O.plugin.colorizer.active,
+ },
- -- Lush Create Color Schemes
- use {
- "rktjmp/lush.nvim",
- -- cmd = {"LushRunQuickstart", "LushRunTutorial", "Lushify"},
- disable = not O.plugin.lush.active,
- }
+ ---------------------------------------------------------------------------------
-- LANGUAGE SPECIFIC GOES HERE
- use {
+ {
"lervag/vimtex",
ft = "tex",
- config = function()
- require "cfg.vimtex"
- end,
- }
+ },
-- Rust tools
-- TODO: use lazy loading maybe?
- use {
+ {
"simrat39/rust-tools.nvim",
disable = not O.lang.rust.rust_tools.active,
- }
+ },
-- Elixir
- use { "elixir-editors/vim-elixir", ft = { "elixir", "eelixir", "euphoria3" } }
+ { "elixir-editors/vim-elixir", ft = { "elixir", "eelixir", "euphoria3" } },
-- Javascript / Typescript
- use {
+ {
"jose-elias-alvarez/nvim-lsp-ts-utils",
ft = {
"javascript",
@@ -274,52 +299,6 @@ return require("packer").startup(function(use)
"typescriptreact",
"typescript.tsx",
},
- }
-
- -- Autotags <div>|</div>
- use {
- "windwp/nvim-ts-autotag",
- event = "InsertEnter",
- disable = not O.plugin.ts_autotag.active,
- }
-
- -- Custom semantic text objects
- use {
- "nvim-treesitter/nvim-treesitter-textobjects",
- disable= not O.plugin.ts_textobjects.active,
- }
-
- -- Smart text objects
- use {
- "RRethy/nvim-treesitter-textsubjects",
- disable = not O.plugin.ts_textsubjects.active,
- }
-
- -- Text objects using hint labels
- use {
- "mfussenegger/nvim-ts-hint-textobject",
- event = "BufRead",
- disable = not O.plugin.ts_hintobjects.active,
- }
- -- vim rooter for projects
- use {
- "airblade/vim-rooter",
- event = "BufWinEnter",
- disable = not O.plugin.vim_rooter.active,
- }
-
- -- hop
- use {
- "phaazon/hop.nvim",
- event = "BufRead",
- config = function()
- require("cfg.hop").config()
- end,
- disable = not O.plugin.hop.active,
- }
-
- for _, plugin in pairs(O.user_plugins) do
- packer.use(plugin)
- end
+ },
-end)
+}
diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua
index 914561d..aa2bdd8 100644
--- a/.config/nvim/lua/settings.lua
+++ b/.config/nvim/lua/settings.lua
@@ -9,53 +9,29 @@ cmd "filetype plugin on"
cmd('let &titleold="' .. TERMINAL .. '"')
cmd "set inccommand=split"
cmd "set iskeyword+=-"
-cmd "set whichwrap+=<,>,[,],h,l"
+
+if O.line_wrap_cursor_movement then
+ cmd "set whichwrap+=<,>,[,],h,l"
+end
+
if O.transparent_window then
cmd "au ColorScheme * hi Normal ctermbg=none guibg=none"
cmd "au ColorScheme * hi SignColumn ctermbg=none guibg=none"
+ cmd "au ColorScheme * hi NormalNC ctermbg=none guibg=none"
+ cmd "au ColorScheme * hi MsgArea ctermbg=none guibg=none"
+ cmd "au ColorScheme * hi TelescopeBorder ctermbg=none guibg=none"
+ cmd "au ColorScheme * hi NvimTreeNormal ctermbg=none guibg=none"
+ cmd "let &fcs='eob: '"
end
---- COLORSCHEME ---
-
-vim.g.colors_name = O.colorscheme
-
--- SETTINGS ---
-opt.backup = false -- creates a backup file
-opt.clipboard = O.clipboard -- allows neovim to access the system clipboard
-opt.cmdheight = O.cmdheight -- more space in the neovim command line for displaying messages
-opt.colorcolumn = "99999" -- fix indentline for now
-opt.completeopt = { "menuone", "noselect" }
-opt.conceallevel = 0 -- so that `` is visible in markdown files
-opt.fileencoding = "utf-8" -- the encoding written to a file
-opt.guifont = "monospace:h17" -- the font used in graphical neovim applications
-opt.hidden = O.hidden_files -- required to keep multiple buffers and open multiple buffers
-opt.hlsearch = O.hl_search -- highlight all matches on previous search pattern
-opt.ignorecase = O.ignore_case -- ignore case in search patterns
-opt.mouse = "a" -- allow the mouse to be used in neovim
-opt.pumheight = 10 -- pop up menu height
-opt.showmode = false -- we don't need to see things like -- INSERT -- anymore
-opt.showtabline = 2 -- always show tabs
-opt.smartcase = O.smart_case -- smart case
-opt.smartindent = true -- make indenting smarter again
-opt.splitbelow = true -- force all horizontal splits to go below current window
-opt.splitright = true -- force all vertical splits to go to the right of current window
-opt.swapfile = false -- creates a swapfile
-opt.termguicolors = true -- set term gui colors (most terminals support this)
-opt.timeoutlen = O.timeoutlen -- time to wait for a mapped sequence to complete (in milliseconds)
-opt.title = true -- set the title of window to the value of the titlestring
-opt.titlestring = "%<%F%=%l/%L - nvim" -- what the title of the window will be set to
-opt.undodir = CACHE_PATH .. "/undo" -- set an undo directory
-opt.undofile = true -- enable persisten undo
-opt.updatetime = 300 -- faster completion
-opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
-opt.expandtab = true -- convert tabs to spaces
-opt.shiftwidth = 4 -- the number of spaces inserted for each indentation
opt.shortmess:append "c"
-opt.tabstop = 4 -- insert 4 spaces for a tab
-opt.cursorline = O.cursorline -- highlight the current line
-opt.number = O.number -- set numbered lines
-opt.relativenumber = O.relative_number -- set relative numbered lines
-opt.numberwidth = O.number_width -- set number column width to 2 {default 4}
-opt.signcolumn = "yes" -- always show the sign column, otherwise it would shift the text each time
-opt.wrap = O.wrap_lines -- display lines as one long line
+
+for _, plugin in pairs(O.disabled_built_ins) do
+ vim.g["loaded_" .. plugin] = 1
+end
+
+for k, v in pairs(O.default_options) do
+ vim.opt[k] = v
+end
diff --git a/.config/nvim/lua/utils/init.lua b/.config/nvim/lua/utils/init.lua
new file mode 100644
index 0000000..bad55ce
--- /dev/null
+++ b/.config/nvim/lua/utils/init.lua
@@ -0,0 +1,232 @@
+local utils = {}
+
+-- recursive Print (structure, limit, separator)
+local function r_inspect_settings(structure, limit, separator)
+ limit = limit or 100 -- default item limit
+ separator = separator or "." -- indent string
+ if limit < 1 then
+ print "ERROR: Item limit reached."
+ return limit - 1
+ end
+ if structure == nil then
+ io.write("-- O", separator:sub(2), " = nil\n")
+ return limit - 1
+ end
+ local ts = type(structure)
+
+ if ts == "table" then
+ for k, v in pairs(structure) do
+ -- replace non alpha keys wih ["key"]
+ if tostring(k):match "[^%a_]" then
+ k = '["' .. tostring(k) .. '"]'
+ end
+ limit = r_inspect_settings(v, limit, separator .. "." .. tostring(k))
+ if limit < 0 then
+ break
+ end
+ end
+ return limit
+ end
+
+ if ts == "string" then
+ -- escape sequences
+ structure = string.format("%q", structure)
+ end
+ separator = separator:gsub("%.%[", "%[")
+ if type(structure) == "function" then
+ -- don't print functions
+ io.write("-- O", separator:sub(2), " = function ()\n")
+ else
+ io.write("O", separator:sub(2), " = ", tostring(structure), "\n")
+ end
+ return limit - 1
+end
+
+function utils.generate_settings()
+ -- Opens a file in append mode
+ local file = io.open("settings.lua", "w")
+
+ -- sets the default output file as test.lua
+ io.output(file)
+
+ -- write all `O` related settings to `settings.lua` file
+ r_inspect_settings(O, 10000, ".")
+
+ -- closes the open file
+ io.close(file)
+end
+
+function utils.reload_config()
+ vim.cmd "source ~/.config/nvim/config.lua"
+ vim.cmd "source ~/.config/nvim/lua/plugins.lua"
+ local plugins = require "plugins"
+ local plugin_loader = require("plugin-loader").init()
+ plugin_loader:load { plugins, O.user_plugins }
+ vim.cmd "source ~/.config/nvim/lua/settings.lua"
+ vim.cmd "source ~/.config/nvim/lua/core/formatter.lua"
+ vim.cmd ":PackerCompile"
+ vim.cmd ":PackerInstall"
+ -- vim.cmd ":PackerClean"
+end
+
+function utils.check_lsp_client_active(name)
+ local clients = vim.lsp.get_active_clients()
+ for _, client in pairs(clients) do
+ if client.name == name then
+ return true
+ end
+ end
+ return false
+end
+
+function utils.add_keymap(mode, opts, keymaps)
+ for _, keymap in ipairs(keymaps) do
+ vim.api.nvim_set_keymap(mode, keymap[1], keymap[2], opts)
+ end
+end
+
+function utils.add_keymap_normal_mode(opts, keymaps)
+ utils.add_keymap("n", opts, keymaps)
+end
+
+function utils.add_keymap_visual_mode(opts, keymaps)
+ utils.add_keymap("v", opts, keymaps)
+end
+
+function utils.add_keymap_visual_block_mode(opts, keymaps)
+ utils.add_keymap("x", opts, keymaps)
+end
+
+function utils.add_keymap_insert_mode(opts, keymaps)
+ utils.add_keymap("i", opts, keymaps)
+end
+
+function utils.add_keymap_term_mode(opts, keymaps)
+ utils.add_keymap("t", opts, keymaps)
+end
+
+function utils.define_augroups(definitions) -- {{{1
+ -- Create autocommand groups based on the passed definitions
+ --
+ -- The key will be the name of the group, and each definition
+ -- within the group should have:
+ -- 1. Trigger
+ -- 2. Pattern
+ -- 3. Text
+ -- just like how they would normally be defined from Vim itself
+ for group_name, definition in pairs(definitions) do
+ vim.cmd("augroup " .. group_name)
+ vim.cmd "autocmd!"
+
+ for _, def in pairs(definition) do
+ local command = table.concat(vim.tbl_flatten { "autocmd", def }, " ")
+ vim.cmd(command)
+ end
+
+ vim.cmd "augroup END"
+ end
+end
+
+function utils.unrequire(m)
+ package.loaded[m] = nil
+ _G[m] = nil
+end
+
+utils.define_augroups {
+
+ _general_settings = {
+ {
+ "TextYankPost",
+ "*",
+ "lua require('vim.highlight').on_yank({higroup = 'Search', timeout = 200})",
+ },
+ {
+ "BufWinEnter",
+ "*",
+ "setlocal formatoptions-=c formatoptions-=r formatoptions-=o",
+ },
+ {
+ "BufWinEnter",
+ "dashboard",
+ "setlocal cursorline signcolumn=yes cursorcolumn number",
+ },
+ {
+ "BufRead",
+ "*",
+ "setlocal formatoptions-=c formatoptions-=r formatoptions-=o",
+ },
+ {
+ "BufNewFile",
+ "*",
+ "setlocal formatoptions-=c formatoptions-=r formatoptions-=o",
+ },
+ { "BufWritePost", "config.lua", "lua require('utils').reload_config()" },
+ -- { "VimLeavePre", "*", "set title set titleold=" },
+ },
+ _solidity = {
+ { "BufWinEnter", ".tf", "setlocal filetype=hcl" },
+ { "BufRead", "*.tf", "setlocal filetype=hcl" },
+ { "BufNewFile", "*.tf", "setlocal filetype=hcl" },
+ },
+ -- _solidity = {
+ -- {'BufWinEnter', '.sol', 'setlocal filetype=solidity'}, {'BufRead', '*.sol', 'setlocal filetype=solidity'},
+ -- {'BufNewFile', '*.sol', 'setlocal filetype=solidity'}
+ -- },
+ -- _gemini = {
+ -- {'BufWinEnter', '.gmi', 'setlocal filetype=markdown'}, {'BufRead', '*.gmi', 'setlocal filetype=markdown'},
+ -- {'BufNewFile', '*.gmi', 'setlocal filetype=markdown'}
+ -- },
+ _markdown = {
+ { "FileType", "markdown", "setlocal wrap" },
+ { "FileType", "markdown", "setlocal spell" },
+ },
+ _buffer_bindings = {
+ { "FileType", "floaterm", "nnoremap <silent> <buffer> q :q<CR>" },
+ },
+ _auto_resize = {
+ -- will cause split windows to be resized evenly if main window is resized
+ { "VimResized", "*", "wincmd =" },
+ },
+ _packer_compile = {
+ -- will cause split windows to be resized evenly if main window is resized
+ { "BufWritePost", "plugins.lua", "PackerCompile" },
+ },
+
+ -- _fterm_lazygit = {
+ -- -- will cause esc key to exit lazy git
+ -- {"TermEnter", "*", "call LazyGitNativation()"}
+ -- },
+ -- _mode_switching = {
+ -- -- will switch between absolute and relative line numbers depending on mode
+ -- {'InsertEnter', '*', 'if &relativenumber | let g:ms_relativenumberoff = 1 | setlocal number norelativenumber | endif'},
+ -- {'InsertLeave', '*', 'if exists("g:ms_relativenumberoff") | setlocal relativenumber | endif'},
+ -- {'InsertEnter', '*', 'if &cursorline | let g:ms_cursorlineoff = 1 | setlocal nocursorline | endif'},
+ -- {'InsertLeave', '*', 'if exists("g:ms_cursorlineoff") | setlocal cursorline | endif'},
+ -- },
+ _user_autocommands = O.user_autocommands,
+}
+
+function utils.gsub_args(args)
+ if args == nil or type(args) ~= "table" then
+ return args
+ end
+ local buffer_filepath = vim.fn.fnameescape(vim.api.nvim_buf_get_name(0))
+ for i = 1, #args do
+ args[i] = string.gsub(args[i], "${FILEPATH}", buffer_filepath)
+ end
+ return args
+end
+
+vim.cmd [[
+ function! QuickFixToggle()
+ if empty(filter(getwininfo(), 'v:val.quickfix'))
+ copen
+ else
+ cclose
+ endif
+endfunction
+]]
+
+return utils
+
+-- TODO: find a new home for these autocommands"