aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim/lua/plugins
diff options
context:
space:
mode:
authorsrdusr <trevorgray@srdusr.com>2023-10-17 21:26:40 +0200
committersrdusr <trevorgray@srdusr.com>2023-10-17 21:26:40 +0200
commit54a7c1bf02da30c353ddb4af51b065d895801f47 (patch)
tree08dfaa302a7c7018d0dc03fe00518c8129c87c7b /.config/nvim/lua/plugins
parent1938838a043b13169a550af5ea37239adfc75293 (diff)
parentc3c0307c2fc26410249df9578c7bf16eb0caa9df (diff)
downloaddotfiles-54a7c1bf02da30c353ddb4af51b065d895801f47.tar.gz
dotfiles-54a7c1bf02da30c353ddb4af51b065d895801f47.zip
Merge commit '67d475c7259bf2448fa3f1d330885ea88036668d'
Diffstat (limited to '.config/nvim/lua/plugins')
-rw-r--r--.config/nvim/lua/plugins/cmp-gh-source.lua74
-rw-r--r--.config/nvim/lua/plugins/dashboard.lua50
-rw-r--r--.config/nvim/lua/plugins/fzf.lua60
-rw-r--r--.config/nvim/lua/plugins/git.lua11
-rw-r--r--.config/nvim/lua/plugins/heirline.lua1
-rw-r--r--.config/nvim/lua/plugins/leetcode.lua68
-rw-r--r--.config/nvim/lua/plugins/lsp.lua16
-rw-r--r--.config/nvim/lua/plugins/lspsaga.lua46
-rw-r--r--.config/nvim/lua/plugins/notify.lua18
-rw-r--r--.config/nvim/lua/plugins/null-ls.lua173
-rw-r--r--.config/nvim/lua/plugins/nvim-tree.lua1
-rw-r--r--.config/nvim/lua/plugins/prettier.lua19
-rw-r--r--.config/nvim/lua/plugins/scripts/lsp-ext.lua48
-rw-r--r--.config/nvim/lua/plugins/scripts/setcolors.lua121
-rw-r--r--.config/nvim/lua/plugins/scripts/toggleLsp.lua40
-rw-r--r--.config/nvim/lua/plugins/telescope.lua64
16 files changed, 265 insertions, 545 deletions
diff --git a/.config/nvim/lua/plugins/cmp-gh-source.lua b/.config/nvim/lua/plugins/cmp-gh-source.lua
index 05bba55..4990c35 100644
--- a/.config/nvim/lua/plugins/cmp-gh-source.lua
+++ b/.config/nvim/lua/plugins/cmp-gh-source.lua
@@ -1,4 +1,4 @@
-local ok, Job = pcall(require, "plenary.job")
+local ok, Job = pcall(require, 'plenary.job')
if not ok then
return
end
@@ -19,54 +19,52 @@ source.complete = function(self, _, callback)
-- You could remove this if you wanted, but this just makes it so we're
-- good programming citizens.
if not self.cache[bufnr] then
- Job
- :new({
- -- Uses `gh` executable to request the issues from the remote repository.
- "gh",
- "issue",
- "list",
- "--limit",
- "1000",
- "--json",
- "title,number,body",
+ Job:new({
+ -- Uses `gh` executable to request the issues from the remote repository.
+ 'gh',
+ 'issue',
+ 'list',
+ '--limit',
+ '1000',
+ '--json',
+ 'title,number,body',
- on_exit = function(job)
- local result = job:result()
- local ok, parsed = pcall(vim.json.decode, table.concat(result, ""))
- if not ok then
- vim.notify "Failed to parse gh result"
- return
- end
+ on_exit = function(job)
+ local result = job:result()
+ local ok, parsed = pcall(vim.json.decode, table.concat(result, ''))
+ if not ok then
+ vim.notify('Failed to parse gh result')
+ return
+ end
- local items = {}
- for _, gh_item in ipairs(parsed) do
- gh_item.body = string.gsub(gh_item.body or "", "\r", "")
+ local items = {}
+ for _, gh_item in ipairs(parsed) do
+ gh_item.body = string.gsub(gh_item.body or '', '\r', '')
- table.insert(items, {
- label = string.format("#%s", gh_item.number),
- documentation = {
- kind = "markdown",
- value = string.format("# %s\n\n%s", gh_item.title, gh_item.body),
- },
- })
- end
+ table.insert(items, {
+ label = string.format('#%s', gh_item.number),
+ documentation = {
+ kind = 'markdown',
+ value = string.format('# %s\n\n%s', gh_item.title, gh_item.body),
+ },
+ })
+ end
- callback { items = items, isIncomplete = false }
- self.cache[bufnr] = items
- end,
- })
- :start()
+ callback({ items = items, isIncomplete = false })
+ self.cache[bufnr] = items
+ end,
+ }):start()
else
- callback { items = self.cache[bufnr], isIncomplete = false }
+ callback({ items = self.cache[bufnr], isIncomplete = false })
end
end
source.get_trigger_characters = function()
- return { "#" }
+ return { '#' }
end
source.is_available = function()
- return vim.bo.filetype == "gitcommit"
+ return vim.bo.filetype == 'gitcommit'
end
-require("cmp").register_source("gh_issues", source.new())
+require('cmp').register_source('gh_issues', source.new())
diff --git a/.config/nvim/lua/plugins/dashboard.lua b/.config/nvim/lua/plugins/dashboard.lua
index a78332b..e25d536 100644
--- a/.config/nvim/lua/plugins/dashboard.lua
+++ b/.config/nvim/lua/plugins/dashboard.lua
@@ -1,4 +1,4 @@
-local db = require('dashboard')
+local db = require("dashboard")
--vim.api.nvim_create_autocmd("VimEnter", {
-- callback = function()
@@ -10,9 +10,9 @@ local db = require('dashboard')
--})
db.setup({
- theme = 'hyper',
+ theme = "hyper",
config = {
- mru = { limit = 10, label = '' },
+ mru = { limit = 10, label = "" },
project = { limit = 10 },
header = {
[[ ███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗]],
@@ -24,45 +24,45 @@ db.setup({
},
disable_move = false,
shortcut = {
- { desc = ' Plugins', group = 'Number', action = 'PackerStatus', key = 'p' },
+ { desc = " Plugins", group = "Number", action = "PackerStatus", key = "p" },
--{ desc = " Plugins", group = "@property", action = "PackerStatus", key = "p" },
{
- desc = ' Files',
- group = 'Number',
+ desc = " Files",
+ group = "Number",
--group = "Label",
- action = 'Telescope find_files',
- key = 'f',
+ action = "Telescope find_files",
+ key = "f",
},
{
- desc = ' Text',
- group = 'Number',
+ desc = " Text",
+ group = "Number",
--group = "Label",
- action = 'enew',
- key = 't',
+ action = "enew",
+ key = "t",
},
{
- desc = ' Grep',
- group = 'Number',
+ desc = " Grep",
+ group = "Number",
--group = "Label",
- action = 'Telescope live_grep',
- key = 'g',
+ action = "Telescope live_grep",
+ key = "g",
},
{
- desc = ' Scheme',
- group = 'Number',
+ desc = " Scheme",
+ group = "Number",
--group = "Label",
- action = 'Telescope colorscheme',
- key = 's',
+ action = "Telescope colorscheme",
+ key = "s",
},
{
- desc = ' Config',
- group = 'Number',
+ desc = " Config",
+ group = "Number",
--group = "Label",
- action = ':edit ~/.config.nvim/init.lua',
- key = 'c',
+ action = ":edit ~/.config/nvim/init.lua",
+ key = "c",
},
},
- footer = { '', 'Hello World!' },
+ footer = { "", "Hello World!" },
},
hide = {
statusline = false,
diff --git a/.config/nvim/lua/plugins/fzf.lua b/.config/nvim/lua/plugins/fzf.lua
new file mode 100644
index 0000000..5675e9f
--- /dev/null
+++ b/.config/nvim/lua/plugins/fzf.lua
@@ -0,0 +1,60 @@
+--vim.cmd([[
+-- let g:fzf_history_dir = '~/.local/share/fzf-history'
+-- map <leader>z :FZF<CR>
+-- map <leader>a :Files<CR>
+-- map <leader>l :Lines<CR>
+-- map <leader>L :BLines<CR>
+-- map <leader>B :Buffers<CR>
+-- map <leader>h :History:<CR>
+-- nnoremap <leader>g :Rg<CR>
+-- "nnoremap <leader>t :Tags<CR>
+-- nnoremap <leader>m :Marks<CR>
+-- " This is the default extra key bindings
+-- let g:fzf_action = {
+-- \ 'ctrl-t': 'tab split',
+-- \ 'ctrl-x': 'split',
+-- \ 'ctrl-y': 'vsplit' }
+-- let g:fzf_tags_command = 'ctags -R'
+-- " Border color
+-- let g:fzf_layout = {'up':'~90%', 'window': { 'width': 0.8, 'height': 0.8,'yoffset':0.5,'xoffset': 0.5, 'highlight': 'Todo', 'border': 'sharp' } }
+-- let $FZF_DEFAULT_OPTS = '--layout=reverse --info=inline'
+-- let $FZF_DEFAULT_COMMAND="rg --files --hidden"
+-- " Customize fzf colors to match your color scheme
+-- let g:fzf_colors =
+-- \ { 'fg': ['fg', 'Normal'],
+-- \ 'bg': ['bg', 'Normal'],
+-- \ 'hl': ['fg', 'Comment'],
+-- \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
+-- \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
+-- \ 'hl+': ['fg', 'Statement'],
+-- \ 'info': ['fg', 'PreProc'],
+-- \ 'border': ['fg', 'Ignore'],
+-- \ 'prompt': ['fg', 'Conditional'],
+-- \ 'pointer': ['fg', 'Exception'],
+-- \ 'marker': ['fg', 'Keyword'],
+-- \ 'spinner': ['fg', 'Label'],
+-- \ 'header': ['fg', 'Comment'] }
+-- " Get Files
+-- command! -bang -nargs=? -complete=dir Files
+-- \ call fzf#vim#files(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline']}), <bang>0)
+-- " Get text in files with Rg
+-- command! -bang -nargs=* Rg
+-- \ call fzf#vim#grep(
+-- \ 'rg --column --line-number --no-heading --color=always --smart-case '.shellescape(<q-args>), 1,
+-- \ fzf#vim#with_preview(), <bang>0)
+-- " Ripgrep advanced
+-- function! RipgrepFzf(query, fullscreen)
+-- let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case %s || true'
+-- let initial_command = printf(command_fmt, shellescape(a:query))
+-- let reload_command = printf(command_fmt, '{q}')
+-- let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
+-- call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
+-- endfunction
+-- command! -nargs=* -bang RG call RipgrepFzf(<q-args>, <bang>0)
+-- " Git grep
+-- command! -bang -nargs=* GGrep
+-- \ call fzf#vim#grep(
+-- \ 'git grep --line-number '.shellescape(<q-args>), 0,
+-- \ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), <bang>0)
+-- command! -bang FM call fzf#run(fzf#wrap({'source': 'cat ~/.fzf-marks | sed "s/.*: \(.*\)$/\1/" | sed "s#~#${HOME}#"', 'sink': 'lcd'}, <bang>0))
+--]])
diff --git a/.config/nvim/lua/plugins/git.lua b/.config/nvim/lua/plugins/git.lua
deleted file mode 100644
index 963f7f9..0000000
--- a/.config/nvim/lua/plugins/git.lua
+++ /dev/null
@@ -1,11 +0,0 @@
-local status, git = pcall(require, "git")
-if (not status) then return end
-
-git.setup({
- keymaps = {
- -- Open blame window
- blame = "<Leader>gb",
- -- Open file/folder in git repository
- browse = "<Leader>go",
- }
-})
diff --git a/.config/nvim/lua/plugins/heirline.lua b/.config/nvim/lua/plugins/heirline.lua
index 0f99de0..a5cd2bf 100644
--- a/.config/nvim/lua/plugins/heirline.lua
+++ b/.config/nvim/lua/plugins/heirline.lua
@@ -95,6 +95,7 @@ local ViMode = {
end,
update = {
'ModeChanged',
+ 'VimEnter',
pattern = '*:*',
callback = vim.schedule_wrap(function()
vim.cmd('redrawstatus')
diff --git a/.config/nvim/lua/plugins/leetcode.lua b/.config/nvim/lua/plugins/leetcode.lua
new file mode 100644
index 0000000..50369e1
--- /dev/null
+++ b/.config/nvim/lua/plugins/leetcode.lua
@@ -0,0 +1,68 @@
+---@alias lc.lang
+---| "cpp"
+---| "java"
+---| "python"
+---| "python3"
+---| "c"
+---| "csharp"
+---| "javascript"
+---| "typescript"
+---| "php"
+---| "swift"
+---| "kotlin"
+---| "dart"
+---| "golang"
+---| "ruby"
+---| "scala"
+---| "rust"
+---| "racket"
+---| "erlang"
+---| "elixir"
+
+---@alias lc.sql_lang
+---| "pythondata"
+---| "mysql"
+---| "mssql"
+---| "oraclesql"
+
+---@alias lc.domain
+---| "com"
+---| "cn"
+
+---@class lc.UserConfig
+local M = {
+ ---@type lc.domain
+ domain = 'com', -- For now "com" is the only one supported
+
+ ---@type string
+ arg = 'leetcode.nvim',
+
+ ---@type lc.lang
+ lang = 'cpp',
+
+ ---@type lc.sql_lang
+ sql = 'mysql',
+
+ ---@type string
+ directory = vim.fn.stdpath('data') .. '/leetcode/',
+
+ ---@type boolean
+ logging = true,
+
+ console = {
+ ---@type boolean
+ open_on_runcode = false,
+
+ size = {
+ width = '75%', ---@type string | integer
+ height = '75%', ---@type string | integer
+ },
+ dir = 'row', ---@type "col" | "row"
+ },
+
+ description = {
+ width = '40%', ---@type string | integer
+ },
+}
+
+return M
diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua
index 92278f3..8884599 100644
--- a/.config/nvim/lua/plugins/lsp.lua
+++ b/.config/nvim/lua/plugins/lsp.lua
@@ -142,10 +142,18 @@ augroup END
on_attach(client)
end
+ local cmp_nvim_lsp = require('cmp_nvim_lsp')
local servers = {
asm_lsp = {},
bashls = {},
- clangd = {},
+ clangd = {
+ on_attach = on_attach,
+ capabilities = cmp_nvim_lsp.default_capabilities(),
+ cmd = {
+ 'clangd',
+ '--offset-encoding=utf-16',
+ },
+ },
cssls = { filetypes = { 'css', 'scss', 'less', 'sass' }, root_dir = lspconfig.util.root_pattern('package.json', '.git') }, -- ghcide = {},
html = {},
jsonls = { prefer_null_ls = true, cmd = { '--stdio' } },
@@ -264,8 +272,10 @@ augroup END
-- }
-- null_ls.setup({
- local sources = { -- Diagnostics
- builtins.diagnostics.chktex, -- null_ls.builtins.code_actions.eslint_d,
+ local sources = {
+ -- Diagnostics
+ builtins.diagnostics.chktex,
+ -- null_ls.builtins.code_actions.eslint_d,
-- null_ls.builtins.diagnostics.eslint_d,
-- null_ls.builtins.formatting.eslint_d,
-- null_ls.builtins.diagnostics.cppcheck,
diff --git a/.config/nvim/lua/plugins/lspsaga.lua b/.config/nvim/lua/plugins/lspsaga.lua
deleted file mode 100644
index 4161ce9..0000000
--- a/.config/nvim/lua/plugins/lspsaga.lua
+++ /dev/null
@@ -1,46 +0,0 @@
-return function()
- local saga = require "lspsaga"
-
- saga.init_lsp_saga {
- use_saga_diagnostic_sign = false,
- finder_action_keys = {
- vsplit = "v",
- split = "s",
- quit = { "q", "<ESC>" },
- },
- code_action_icon = "💡",
- code_action_prompt = {
- enable = false,
- sign = false,
- virtual_text = false,
- },
- }
-
- require("as.highlights").highlight("LspSagaLightbulb", { guifg = "NONE", guibg = "NONE" })
-
--- as.vnoremap("<leader>ca", ":<c-u>lua require('lspsaga.codeaction').range_code_action()<CR>")
--- as.inoremap("<c-k>", "<cmd>lua require('lspsaga.signaturehelp').signature_help()<CR>")
--- as.nnoremap("K", "<cmd>lua require('lspsaga.hover').render_hover_doc()<CR>")
--- -- scroll down hover doc
--- as.nnoremap("<C-f>", "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<CR>")
--- -- scroll up hover doc
--- as.nnoremap("<C-b>", "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<CR>")
-
- require("which-key").register {
- ["<leader>rn"] = { require("lspsaga.rename").rename, "lsp: rename" },
- ["<leader>ca"] = { require("lspsaga.codeaction").code_action, "lsp: code action" },
- ["gp"] = { require("lspsaga.provider").preview_definition, "lsp: preview definition" },
- ["gh"] = { require("lspsaga.provider").lsp_finder, "lsp: finder" },
- -- jump diagnostic
- ["]c"] = { require("lspsaga.diagnostic").lsp_jump_diagnostic_prev, "lsp: previous diagnostic" },
- ["[c"] = { require("lspsaga.diagnostic").lsp_jump_diagnostic_next, "lsp: next diagnostic" },
- }
-
- -- augroup("LspSagaCursorCommands", {
- -- {
- -- events = { "CursorHold" },
- -- targets = { "*" },
- -- command = "lua require('lspsaga.diagnostic').show_cursor_diagnostics()",
- -- },
- -- })
-end
diff --git a/.config/nvim/lua/plugins/notify.lua b/.config/nvim/lua/plugins/notify.lua
new file mode 100644
index 0000000..dcb496a
--- /dev/null
+++ b/.config/nvim/lua/plugins/notify.lua
@@ -0,0 +1,18 @@
+require('notify').setup({
+ background_colour = '#000000',
+ icons = {
+ ERROR = '',
+ WARN = '',
+ INFO = '',
+ DEBUG = '',
+ TRACE = '✎',
+ },
+})
+
+vim.api.nvim_command('hi default link NotifyERRORBody Normal')
+vim.api.nvim_command('hi default link NotifyWARNBody Normal')
+vim.api.nvim_command('hi default link NotifyINFOBody Normal')
+vim.api.nvim_command('hi default link NotifyDEBUGBody Normal')
+vim.api.nvim_command('hi default link NotifyTRACEBody Normal')
+vim.api.nvim_command('hi default link NotifyLogTime Comment')
+vim.api.nvim_command('hi default link NotifyLogTitle Special')
diff --git a/.config/nvim/lua/plugins/null-ls.lua b/.config/nvim/lua/plugins/null-ls.lua
deleted file mode 100644
index 0ab0af8..0000000
--- a/.config/nvim/lua/plugins/null-ls.lua
+++ /dev/null
@@ -1,173 +0,0 @@
---[[null-ls.]]
---
--- null-language-server i.e. a sort of language server which does not provide any services such as formatting and diagnostics you expect from a language server. Instead it will need to install corresponding external “sources” and then hook these sources into the neovim lsp client through null-ls.
---
-local null_ls = require "null-ls"
-local builtins = null_ls.builtins
-
-local eslint_opts = {
- -- condition = function(utils)
- -- return utils.root_has_file ".eslintrc.js" or utils.root_has_file ".eslintrc" or utils.root_has_file ".eslintrc.json"
- -- end,
- -- diagnostics_format = "#{m} [#{c}]",
- prefer_local = true,
-}
-
-local sources = {
- builtins.formatting.stylua,
- builtins.formatting.shfmt.with({
- filetypes = { "bash", "zsh", "sh" },
- extra_args = { "-i", "2", "-ci" },
- }),
- builtins.formatting.shellharden,
- builtins.formatting.trim_whitespace.with { filetypes = { "tmux", "teal", "zsh" } },
- builtins.formatting.clang_format,
- builtins.formatting.rustfmt,
- builtins.formatting.sql_formatter,
- builtins.formatting.prettierd.with({
- filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "json", "yaml", "markdown", "html", "css", "scss", "less", "graphql", "vue", "svelte" },
- }),
- builtins.formatting.prettier.with({
- -- markdown, html/js formatting
- filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact", "json", "yaml", "markdown", "html",
- "css", "scss", "less", "graphql", "vue", "svelte" },
- extra_args = { "--single-quote", "--tab-width 4", "--print-width 200" },
- }),
-
- builtins.diagnostics.dotenv_linter,
- builtins.diagnostics.shellcheck.with({
- -- shell script diagnostics
- diagnostic_config = {
- -- see :help vim.diagnostic.config()
- underline = true,
- virtual_text = false,
- signs = true,
- update_in_insert = false,
- severity_sort = true,
- },
- diagnostics_format = "[#{c}] #{m} (#{s})",
- -- this will run every time the source runs,
- -- so you should prefer caching results if possible
- }),
- builtins.diagnostics.eslint_d.with(eslint_opts),
- builtins.diagnostics.todo_comments,
- builtins.diagnostics.vint,
-
- builtins.code_actions.shellcheck, -- shell script code actions
- builtins.code_actions.eslint_d.with(eslint_opts),
- builtins.code_actions.gitsigns,
- builtins.code_actions.gitrebase,
- builtins.hover.dictionary,
- builtins.hover.printenv,
-}
-
-local M = {}
-
-M.setup = function(on_attach)
- local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
-
- null_ls.setup({
- sources = sources,
- debug = false,
- on_attach = function(client, bufnr)
- -- Format on save
-
- if client.supports_method "textDocument/formatting" then
- vim.api.nvim_clear_autocmds { group = augroup, buffer = bufnr }
- vim.api.nvim_create_autocmd("BufWritePre", {
- group = augroup,
- buffer = bufnr,
- callback = function()
- vim.lsp.buf.format()
- end
- })
- end
- end,
- })
-end
-
-return M
-
---require("null-ls").setup({
--- --debug = true,
--- disabled_filetypes = { "PKGBUILD" },
--- timeout_ms = 5000,
--- async = true,
--- debounce = 150,
--- --log = {
--- -- enable = true,
--- -- level = 'warn',
--- -- use_console = 'async',
--- --},
--- update_in_insert = false,
--- --fallback_severity = vim.diagnostic.severity.ERROR,
--- --log_level = "warn",
--- --on_attach = nil,
--- --on_init = nil,
--- --on_exit = nil,
--- sources = {
--- --require("null-ls").builtins.formatting.shfmt, -- shell script formatting
--- require("null-ls").builtins.diagnostics.dotenv_linter,
--- --require("null-ls").builtins.diagnostics.editorconfig_checker,
--- require("null-ls").builtins.formatting.shfmt.with({
--- filetypes = { "bash", "zsh", "sh" },
--- extra_args = { "-i", "2", "-ci" },
--- }),
--- require("null-ls").builtins.formatting.prettier, -- markdown formatting
--- --require("null-ls").builtins.diagnostics.shellcheck, -- shell script diagnostics
--- require("null-ls").builtins.diagnostics.shellcheck.with({
--- diagnostic_config = {
--- -- see :help vim.diagnostic.config()
--- underline = true,
--- virtual_text = false,
--- signs = true,
--- update_in_insert = false,
--- severity_sort = true,
--- },
--- diagnostics_format = "[#{c}] #{m} (#{s})",
--- -- this will run every time the source runs,
--- -- so you should prefer caching results if possible
--- }),
----- require("null-ls").builtins.formatting.stylua, -- lua formatting
----- require("null-ls").builtins.formatting.black,
----- require("null-ls").builtins.formatting.prettierd,
----- require("null-ls").builtins.diagnostics.cspell.with {
----- filetypes = { "python", "rust", "typescript" },
----- },
----- --require("null-ls").builtins.diagnostics.luacheck,
----- --require("null-ls").builtins.diagnostics.eslint,
----- --require("null-ls").builtins.diagnostics.eslint_d,
----- require("null-ls").builtins.diagnostics.mdl,
----- require("null-ls").builtins.diagnostics.vint,
----- require("null-ls").builtins.completion.spell,
----- require("null-ls").builtins.formatting.clang_format,
----- require("null-ls").builtins.formatting.rustfmt,
----- require("null-ls").builtins.formatting.sql_formatter,
----- --require("null-ls").builtins.formatting.google_java_format,
----- require("null-ls").builtins.diagnostics.cppcheck,
--- require("null-ls").builtins.formatting.shellharden,
----- --require("null-ls").builtins.code_actions.eslint_d,
--- require("null-ls").builtins.code_actions.shellcheck, -- shell script code actions
--- require("null-ls").builtins.formatting.clang_format,
--- require("null-ls").builtins.formatting.rustfmt,
--- --require("null-ls").builtins.formatting.beautysh,
--- require("null-ls").builtins.formatting.sql_formatter,
--- require("null-ls").builtins.diagnostics.todo_comments,
--- --require("null-ls").builtins.diagnostics.zsh,
--- require("null-ls").builtins.hover.dictionary,
--- require("null-ls").builtins.hover.printenv,
--- },
--- -- default_timeout = 5000,
--- -- diagnostics_format = '[#{c}] #{m} (#{s})',
--- -- fallback_severity = vim.diagnostic.severity.ERROR,
--- -- log = {
--- -- enable = true,
--- -- level = 'warn',
--- -- use_console = 'async',
--- -- },
--- --on_attach = nil,
--- --on_init = nil,
--- --on_exit = nil,
--- --update_in_insert = false,
--- --update_in_leave = false,
---})
diff --git a/.config/nvim/lua/plugins/nvim-tree.lua b/.config/nvim/lua/plugins/nvim-tree.lua
index cab6f1b..f82a327 100644
--- a/.config/nvim/lua/plugins/nvim-tree.lua
+++ b/.config/nvim/lua/plugins/nvim-tree.lua
@@ -101,7 +101,6 @@ local float = {
local view = {
cursorline = true,
- hide_root_folder = false,
float = float,
--signcolumn = 'no',
width = function()
diff --git a/.config/nvim/lua/plugins/prettier.lua b/.config/nvim/lua/plugins/prettier.lua
deleted file mode 100644
index 05d4665..0000000
--- a/.config/nvim/lua/plugins/prettier.lua
+++ /dev/null
@@ -1,19 +0,0 @@
-local status, prettier = pcall(require, "prettier")
-if (not status) then return end
-
-prettier.setup {
- bin = 'prettierd',
- filetypes = {
- "c",
- "lua",
- "vim",
- --"css",
- --"javascript",
- --"javascriptreact",
- --"typescript",
- --"typescriptreact",
- --"json",
- --"scss",
- "less"
- }
-}
diff --git a/.config/nvim/lua/plugins/scripts/lsp-ext.lua b/.config/nvim/lua/plugins/scripts/lsp-ext.lua
deleted file mode 100644
index c4378c6..0000000
--- a/.config/nvim/lua/plugins/scripts/lsp-ext.lua
+++ /dev/null
@@ -1,48 +0,0 @@
---
--- lsp-ext.lua
-
-
-M = {}
-
-function M.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)
-end
-
-function M.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
- M.floating_buf, M.floating_win = M.preview_location(result[1], context)
- else
- M.floating_buf, M.floating_win = M.preview_location(result, context)
- end
-end
-
-function M.peek_definition()
- if vim.tbl_contains(vim.api.nvim_list_wins(), M.floating_win) then
- vim.api.nvim_set_current_win(M.floating_win)
- else
- local params = vim.lsp.util.make_position_params()
- return vim.lsp.buf_request(0, "textDocument/definition", params, M.preview_location_callback)
- end
-end
-
-return M
diff --git a/.config/nvim/lua/plugins/scripts/setcolors.lua b/.config/nvim/lua/plugins/scripts/setcolors.lua
deleted file mode 100644
index 605bc84..0000000
--- a/.config/nvim/lua/plugins/scripts/setcolors.lua
+++ /dev/null
@@ -1,121 +0,0 @@
-vim.cmd([[
-" Change the color scheme from a list of color scheme names.
-" Version 2010-09-12 from http://vim.wikia.com/wiki/VimTip341
-" Press key:
-" F8 next scheme
-" Shift-F8 previous scheme
-" Alt-F8 random scheme
-" Set the list of color schemes used by the above (default is 'all'):
-" :SetColors all (all $VIMRUNTIME/colors/*.vim)
-" :SetColors my (names built into script)
-" :SetColors blue ayu ron (these schemes)
-" :SetColors (display current scheme names)
-" Set the current color scheme based on time of day:
-" :SetColors now
-if v:version < 700 || exists('loaded_setcolors') || &cp
- finish
-endif
-
-let loaded_setcolors = 1
-let s:mycolors = ['everblush', 'ayu', 'gruvbox', 'molokai', 'onedark', 'srcery'] " colorscheme names that we use to set color
-
-" Set list of color scheme names that we will use, except
-" argument 'now' actually changes the current color scheme.
-function! s:SetColors(args)
- if len(a:args) == 0
- echo 'Current color scheme names:'
- let i = 0
- while i < len(s:mycolors)
- echo ' '.join(map(s:mycolors[i : i+4], 'printf("%-14s", v:val)'))
- let i += 5
- endwhile
- elseif a:args == 'all'
- let paths = split(globpath(&runtimepath, 'colors/*.vim'), "\n")
- let s:mycolors = uniq(sort(map(paths, 'fnamemodify(v:val, ":t:r")')))
- echo 'List of colors set from all installed color schemes'
- elseif a:args == 'my'
- let c1 = 'default srcery everblush'
- let c2 = 'gruvbox onedark'
- let c3 = 'ayu molokai'
- let s:mycolors = split(c1.' '.c2.' '.c3)
- echo 'List of colors set from built-in names'
- elseif a:args == 'now'
- call s:HourColor()
- else
- let s:mycolors = split(a:args)
- echo 'List of colors set from argument (space-separated names)'
- endif
-endfunction
-
-command! -nargs=* SetColors call s:SetColors('<args>')
-
-" Set next/previous/random (how = 1/-1/0) color from our list of colors.
-" The 'random' index is actually set from the current time in seconds.
-" Global (no 's:') so can easily call from command line.
-function! NextColor(how)
- call s:NextColor(a:how, 1)
-endfunction
-
-" Helper function for NextColor(), allows echoing of the color name to be
-" disabled.
-function! s:NextColor(how, echo_color)
- if len(s:mycolors) == 0
- call s:SetColors('all')
- endif
- if exists('g:colors_name')
- let current = index(s:mycolors, g:colors_name)
- else
- let current = -1
- endif
- let missing = []
- let how = a:how
- for i in range(len(s:mycolors))
- if how == 0
- let current = localtime() % len(s:mycolors)
- let how = 1 " in case random color does not exist
- else
- let current += how
- if !(0 <= current && current < len(s:mycolors))
- let current = (how>0 ? 0 : len(s:mycolors)-1)
- endif
- endif
- try
- execute 'colorscheme '.s:mycolors[current]
- break
- catch /E185:/
- call add(missing, s:mycolors[current])
- endtry
- endfor
- redraw
- if len(missing) > 0
- echo 'Error: colorscheme not found:' join(missing)
- endif
- if (a:echo_color)
- echo g:colors_name
- endif
-endfunction
-
-nnoremap <leader>cn :call NextColor(1)<CR>
-nnoremap <leader>cp :call NextColor(-1)<CR>
-nnoremap <leader>cc :call NextColor(0)<CR>
-
-" Set color scheme according to current time of day.
-function! s:HourColor()
- let hr = str2nr(strftime('%H'))
- if hr <= 3
- let i = 0
- elseif hr <= 7
- let i = 1
- elseif hr <= 14
- let i = 2
- elseif hr <= 18
- let i = 3
- else
- let i = 4
- endif
- let nowcolors = 'srcery onedark molokai'
- execute 'colorscheme '.split(nowcolors)[i]
- redraw
- echo g:colors_name
-endfunction
-]])
diff --git a/.config/nvim/lua/plugins/scripts/toggleLsp.lua b/.config/nvim/lua/plugins/scripts/toggleLsp.lua
deleted file mode 100644
index 28af698..0000000
--- a/.config/nvim/lua/plugins/scripts/toggleLsp.lua
+++ /dev/null
@@ -1,40 +0,0 @@
-local M = {}
-
-local check_function = function(bufnr, _)
- local ok, result = pcall(vim.api.nvim_buf_get_var, bufnr, 'lsp_enabled')
- -- No buffer local variable set, so just enable by default
- if not ok then
- return true
- end
-
- return result
-end
-
-vim.lsp.handlers["textDocument/publishDiagnostics"] =
- vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
- underline = check_function,
- virtual_text = check_function,
- signs = check_function
- })
-
-function M.Enable()
- vim.b.lsp_enabled = true
-end
-
-function M.Disable()
- vim.b.lsp_enabled = false
-end
-
-function M.Toggle()
- if vim.b.lsp_enabled == false then
- M.Enable()
- else
- M.Disable()
- end
-end
-
-vim.cmd [[
- command! -nargs=* ToggleLsp lua require'lsp.toggle'.Toggle()
-]]
-
-return M
diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua
index 0167aa3..cf0864a 100644
--- a/.config/nvim/lua/plugins/telescope.lua
+++ b/.config/nvim/lua/plugins/telescope.lua
@@ -340,6 +340,7 @@ function M.find_configs()
'~/.prettierrc.yml',
'~/.ssh',
'~/README.md',
+ '~/.config/inputrc',
},
file_ignore_patterns = {
'/nvim/startup.log',
@@ -391,7 +392,7 @@ function M.find_projects()
local search_dir = '~/projects'
pickers
.new({}, {
- prompt_title = 'Change Directory',
+ prompt_title = 'Find Projects',
finder = finders.new_oneshot_job({
'find',
vim.fn.expand(search_dir),
@@ -450,26 +451,49 @@ function M.find_notes()
end
function M.find_books()
- require('telescope.builtin').find_files({
- hidden = true,
- no_ignore = false,
- prompt_title = ' Find Books',
- path_display = { 'smart' },
- search_dirs = {
- '~/documents/books',
- '~/books',
- },
- layout_strategy = 'horizontal',
- layout_config = { preview_width = 0.65, width = 0.75 },
- })
-end
+ local search_dir = '~/documents/books'
-function M.file_explorer()
- require('telescope.builtin').file_browser({
- prompt_title = 'File Browser',
- cwd = '~',
- layout_strategy = 'horizontal',
- })
+ pickers
+ .new({}, {
+ prompt_title = 'Find Books',
+ finder = finders.new_oneshot_job({
+ 'find',
+ vim.fn.expand(search_dir),
+ '-type',
+ 'd',
+ '-o',
+ '-type',
+ 'f',
+ '-maxdepth',
+ '1',
+ }),
+ previewer = require('telescope.previewers').vim_buffer_cat.new({}),
+ sorter = config.generic_sorter({}),
+ attach_mappings = function(prompt_bufnr, map)
+ actions_set.select:replace(function()
+ local entry = actions_state.get_selected_entry()
+ if entry ~= nil then
+ local path = entry.value
+ actions.close(prompt_bufnr, false)
+
+ -- Determine whether it's a directory or a file
+ local is_directory = vim.fn.isdirectory(path)
+
+ if is_directory then
+ -- It's a directory, navigate to it
+ vim.fn.chdir(path)
+ vim.cmd('e .')
+ print('Selected directory: ' .. path)
+ else
+ -- It's a file, do something with it (open it, for example)
+ print('Selected file: ' .. path)
+ end
+ end
+ end)
+ return true
+ end,
+ })
+ :find()
end
function M.grep_current_dir()