diff --git a/.editorconfig b/.editorconfig index 6e73fcd..e65e74a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,27 +3,10 @@ root = true [*] charset = utf-8 end_of_line = lf -# indent_size = 4 +indent_size = 2 indent_style = space insert_final_newline = true -# max_line_length = 160 -# tab_width = 4 trim_trailing_whitespace = true -[{*.yaml,*.yml}] -indent_size = 2 - -[*.sh] -indent_size = 2 -tab_width = 2 - -shell_variant = bash # like -ln=posix -binary_next_line = true # like -bn -switch_case_indent = true # like -ci -space_redirects = true # like -sr -keep_padding = false # like -kp -function_next_line = true # like -fn -never_split = false # like -ns - [local/bin/antigen.zsh] ignore = true diff --git a/config/alias b/config/alias index 1958b47..57eb1b7 100644 --- a/config/alias +++ b/config/alias @@ -58,18 +58,17 @@ alias zapds='find . -name ".DS_Store" -print -delete' alias t='tail -f' # tail with follow flag on alias dn='du -chd1' # directory usage, return only the total -alias code_scanner='docker run \ - --env SOURCE_CODE="$PWD" \ - --volume "$PWD":/code \ +alias code_scanner="docker run \ + --env SOURCE_CODE='${PWD}' \ + --volume '${PWD}':/code \ --volume /var/run/docker.sock:/var/run/docker.sock \ registry.gitlab.com/gitlab-org/ci-cd/codequality:${CODEQUALITY_VERSION:-latest} \ - /code' + /code" alias composerUp='composer global update' alias npmUp='npm -g up' -alias zedit='$EDITOR ~/.zshrc ~/.alias' -alias zdots='$EDITOR ~/.dotfiles' +alias zedit='$EDITOR ~/.dotfiles' if [[ -f "$HOME/.aliases.local" ]]; then # shellcheck disable=SC1091 diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 1486974..3dc4ad9 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -66,14 +66,12 @@ require('packer').startup(function(use) -- Fuzzy Finder (files, lsp, etc) use { 'nvim-telescope/telescope.nvim', - branch = '0.1.x', - requires = { 'nvim-lua/plenary.nvim' } - } + branch = '0.1.x', requires = { 'nvim-lua/plenary.nvim' } } -- Fuzzy Finder Algorithm which requires local dependencies to be built. -- Only load if `make` is available use { 'nvim-telescope/telescope-fzf-native.nvim', - run = 'make', cond = vim.fn.executable 'make' == 1 } + run = 'make', cond = vim.fn.executable 'make' == 1 } -- Add custom plugins to packer from -- ~/.config/nvim/lua/custom/plugins.lua @@ -106,11 +104,11 @@ local packer_group = vim.api.nvim_create_augroup('Packer', { clear = true }) vim.api.nvim_create_autocmd('BufWritePost', { command = 'source | PackerCompile', group = packer_group, - pattern = { vim.fn.expand '$MYVIMRC', '~/.dotfiles/config/nvim/**/*.lua' }, + pattern = { vim.fn.expand '$MYVIMRC' }, }) -- Automatically run PackerSync for plugins.lua files. vim.api.nvim_create_autocmd('BufWritePost', { - command = 'source | PackerSync', + command = 'source | PackerSync | PackerCompile', group = packer_group, pattern = { '~/.dotfiles/config/nvim/**/plugins.lua' }, }) @@ -121,7 +119,7 @@ vim.api.nvim_create_autocmd('BufWritePost', { -- Set highlight on search vim.o.hlsearch = false --- Make line numbers default, enabled relative linenumbers +-- Make line numbers default, enabled relative line numbers vim.wo.number = true vim.opt.relativenumber = true @@ -169,9 +167,145 @@ vim.g.maplocalleader = ' ' -- See `:help vim.keymap.set()` vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) --- Remap for dealing with word wrap -vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) -vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) +-- Misc options. +vim.o.incsearch = true + +-- Keymap settings, etc. +-- ~/.config/nvim/lua/custom/keymaps.lua +local map = vim.api.nvim_set_keymap +local default_options_table = { + expr = true, + silent = true, + noremap = true, +} + +-- normal mode keymap setter +---@param keys string Trigger keys +---@param func string Function or command to run +---@param opts table Optional table of vim.keymap.set options. +---@param desc string Optional description +local nmap = function(keys, func, opts, desc) + if desc then + desc = 'keymaps.nmap: ' .. desc + end + + local options = default_options_table + + -- If we have options, merge them to the local options table + if opts then + for k, v in pairs(opts) do + options[k] = v + end + end + + vim.keymap.set('n', keys, func, options) +end + +-- visual mode keymap setter +---@param keys string Trigger keys +---@param func string Function or command to run +---@param opts table Optional table of vim.keymap.set options. +---@param desc string Optional description +local vmap = function(keys, func, opts, desc) + if desc then + desc = 'keymaps.vmap: ' .. desc + end + + local options = default_options_table + + -- If we have options, merge them to the local options table + if opts then + for k, v in pairs(opts) do + options[k] = v + end + end + + vim.keymap.set('v', keys, func, options) +end + +-- Format document +nmap("D", ":Format") + +-- Deal with word wrap +nmap('k', "v:count == 0 ? 'gk' : 'k'") +nmap('j', "v:count == 0 ? 'gj' : 'j'") + +-- Diagnostic keymaps +nmap('dz', vim.diagnostic.goto_prev) +nmap('dx', vim.diagnostic.goto_next) +nmap('e', vim.diagnostic.open_float) +nmap('q', vim.diagnostic.setloclist) + +-- +-- ThePrimeagen/refactoring.nvim +-- https://github.com/ThePrimeagen/refactoring.nvim +-- + +-- Remaps for the refactoring operations currently offered by the plugin +local rf = { noremap = true, silent = true, expr = false } +vmap("re", [[ lua require('refactoring').refactor('Extract Function')]], rf) +vmap("rf", [[ lua require('refactoring').refactor('Extract Function To File')]], rf) +vmap("rv", [[ lua require('refactoring').refactor('Extract Variable')]], rf) +vmap("ri", [[ lua require('refactoring').refactor('Inline Variable')]], rf) + +-- Extract block doesn't need visual mode +nmap("rb", [[ lua require('refactoring').refactor('Extract Block')]], rf) +nmap("rbf", [[ lua require('refactoring').refactor('Extract Block To File')]], rf) + +-- Inline variable can also pick up the identifier currently under the cursor without visual mode +nmap("ri", [[ lua require('refactoring').refactor('Inline Variable')]], rf) + +-- prompt for a refactor to apply when the remap is triggered +vmap("rr", ":lua require('refactoring').select_refactor()", rf) + +-- +-- +-- + +-- barbar keymaps +local barbar_opts = { noremap = true, silent = true } + +-- Move to previous/next +map('n', '', 'BufferPrevious', barbar_opts) +map('n', '', 'BufferNext', barbar_opts) +-- Re-order to previous/next +map('n', '', 'BufferMovePrevious', barbar_opts) +map('n', '>', 'BufferMoveNext', barbar_opts) +-- Goto buffer in position... +map('n', 'b1', 'BufferGoto 1', barbar_opts) +map('n', 'b2', 'BufferGoto 2', barbar_opts) +map('n', 'b3', 'BufferGoto 3', barbar_opts) +map('n', 'b4', 'BufferGoto 4', barbar_opts) +map('n', 'b5', 'BufferGoto 5', barbar_opts) +map('n', 'b6', 'BufferGoto 6', barbar_opts) +map('n', 'b7', 'BufferGoto 7', barbar_opts) +map('n', 'b8', 'BufferGoto 8', barbar_opts) +map('n', 'b9', 'BufferGoto 9', barbar_opts) +map('n', 'b0', 'BufferLast', barbar_opts) +-- Pin/unpin buffer +map('n', '', 'BufferPin', barbar_opts) +-- Close buffer +map('n', '', 'BufferClose', barbar_opts) +-- Wipeout buffer +-- :BufferWipeout +-- Close commands +-- :BufferCloseAllButCurrent +-- :BufferCloseAllButPinned +-- :BufferCloseAllButCurrentOrPinned +-- :BufferCloseBuffersLeft +-- :BufferCloseBuffersRight +-- Magic buffer-picking mode +map('n', '', 'BufferPick', barbar_opts) +-- Sort automatically by... +map('n', 'bb', 'BufferOrderByBufferNumber', barbar_opts) +map('n', 'bd', 'BufferOrderByDirectory', barbar_opts) +map('n', 'bl', 'BufferOrderByLanguage', barbar_opts) +map('n', 'bw', 'BufferOrderByWindowNumber', barbar_opts) + +-- Other: +-- :BarbarEnable - enables barbar (enabled by default) +-- :BarbarDisable - very bad command, should never be used + local highlight_group = vim.api.nvim_create_augroup( 'YankHighlight', { clear = true } @@ -236,34 +370,27 @@ require('telescope').setup { -- Enable telescope fzf native, if installed pcall(require('telescope').load_extension, 'fzf') +local ks = vim.keymap.set +local tl = require('telescope.builtin') + -- See `:help telescope.builtin` -vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, - { desc = '[?] Find recently opened files' }) -vim.keymap.set('n', '', require('telescope.builtin').buffers, - { desc = '[ ] Find existing buffers' }) -vim.keymap.set('n', '/', function() +ks('n', '?', tl.oldfiles, { desc = '[?] Find recently opened files' }) +ks('n', '', tl.buffers, { desc = '[ ] Find existing buffers' }) +ks('n', '/', function() -- You can pass additional configuration to telescope to -- change theme, layout, etc. - require('telescope.builtin').current_buffer_fuzzy_find( + tl.current_buffer_fuzzy_find( require('telescope.themes').get_dropdown { winblend = 10, previewer = false, }) end, { desc = '[/] Fuzzily search in current buffer]' }) -vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, - { desc = '[S]earch [F]iles' }) -vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, - { desc = '[S]earch [H]elp' }) -vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, - { desc = '[S]earch current [W]ord' }) -vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, - { desc = '[S]earch by [G]rep' }) -vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, - { desc = '[S]earch [D]iagnostics' }) - --- Load custom treesitter grammar for org filetype -require('orgmode').setup_ts_grammar() +ks('n', 'sf', tl.find_files, { desc = '[S]earch [F]iles' }) +ks('n', 'sh', tl.help_tags, { desc = '[S]earch [H]elp' }) +ks('n', 'sw', tl.grep_string, { desc = '[S]earch current [W]ord' }) +ks('n', 'sg', tl.live_grep, { desc = '[S]earch by [G]rep' }) +ks('n', 'sd', tl.diagnostics, { desc = '[S]earch [D]iagnostics' }) -- [[ Configure Treesitter ]] -- See `:help nvim-treesitter` @@ -355,20 +482,16 @@ require('nvim-treesitter.configs').setup { }, } +-- Load custom treesitter grammar for org filetype +require('orgmode').setup_ts_grammar() require('orgmode').setup({ org_agenda_files = { - '~/Library/Mobile Documents/iCloud~md~obsidian/Documents/_nvalt/**/*', - '~/.dotfiles/local/org/**/*' + vim.fn.expand '~/.local/share/_nvalt/**/*', + vim.fn.expand '~/.dotfiles/local/org/**/*' }, - org_default_notes_file = '~/Library/Mobile Documents/iCloud~md~obsidian/Documents/_nvalt/refile.org', + org_default_notes_file = vim.fn.expand '~/.local/share/_nvalt/refile.org', }) --- Diagnostic keymaps -vim.keymap.set('n', 'dz', vim.diagnostic.goto_prev) -vim.keymap.set('n', 'dx', vim.diagnostic.goto_next) -vim.keymap.set('n', 'e', vim.diagnostic.open_float) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist) - -- LSP settings. -- This function gets run when an LSP connects to a particular buffer. local on_attach = function(_, bufnr) @@ -380,7 +503,7 @@ local on_attach = function(_, bufnr) -- In this case, we create a function that lets us more -- easily define mappings specific for LSP related items. -- It sets the mode, buffer and description for us each time. - local nmap = function(keys, func, desc) + local nm = function(keys, func, desc) if desc then desc = 'LSP: ' .. desc end @@ -388,31 +511,29 @@ local on_attach = function(_, bufnr) vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) end - nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') - nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') + local t = require('telescope.builtin') + local vbuf = vim.lsp.buf - nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') - nmap('gr', require('telescope.builtin').lsp_references, - '[G]oto [R]eferences') - nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation') - nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') - nmap('ds', require('telescope.builtin').lsp_document_symbols, - '[D]ocument [S]ymbols') - nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, - '[W]orkspace [S]ymbols') + nm('rn', vbuf.rename, '[R]e[n]ame') + nm('ca', vbuf.code_action, '[C]ode [A]ction') + + nm('gd', vbuf.definition, '[G]oto [D]efinition') + nm('gr', t.lsp_references, '[G]oto [R]eferences') + nm('gI', vbuf.implementation, '[G]oto [I]mplementation') + nm('D', vbuf.type_definition, 'Type [D]efinition') + nm('ds', t.lsp_document_symbols, '[D]ocument [S]ymbols') + nm('ws', t.lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') -- See `:help K` for why this keymap - nmap('K', vim.lsp.buf.hover, 'Hover Documentation') - nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') + nm('K', vbuf.hover, 'Hover Documentation') + nm('', vbuf.signature_help, 'Signature Documentation') -- Lesser used LSP functionality - nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - nmap('wa', vim.lsp.buf.add_workspace_folder, - '[W]orkspace [A]dd Folder') - nmap('wr', vim.lsp.buf.remove_workspace_folder, - '[W]orkspace [R]emove Folder') - nmap('wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + nm('gD', vbuf.declaration, '[G]oto [D]eclaration') + nm('wa', vbuf.add_workspace_folder, '[W]orkspace [A]dd Folder') + nm('wr', vbuf.remove_workspace_folder, '[W]orkspace [R]emove Folder') + nm('wl', function() + print(vim.inspect(vbuf.list_workspace_folders())) end, '[W]orkspace [L]ist Folders') -- Create a command `:Format` local to the LSP buffer @@ -427,6 +548,10 @@ end -- Setup mason so it can manage external tooling require('mason').setup() +require("null-ls").setup() +require("mason-null-ls").setup({ + automatic_setup = true, +}) -- Enable the following language servers. -- Feel free to add/remove any LSPs that you want here. @@ -463,7 +588,6 @@ local servers = { 'marksman', -- markdown -- n -- o - 'spectral', --openapi -- p 'intelephense', 'phpactor', 'psalm', 'pyright', @@ -496,7 +620,8 @@ require("mason-lspconfig").setup_handlers { -- The first entry (without a key) will be the default handler -- and will be called for each installed server that doesn't have -- a dedicated handler. - function(server_name) -- default handler (optional) + function(server_name) + -- default handler (optional) require("lspconfig")[server_name].setup {} end, } @@ -515,8 +640,7 @@ end -- Turn on lsp status information require('fidget').setup() --- Example custom configuration for lua --- +-- Example custom configuration for lua. -- Make runtime files discoverable to the server local runtime_path = vim.split(package.path, ';') table.insert(runtime_path, 'lua/?.lua') @@ -591,50 +715,7 @@ cmp.setup { }, } --- barbar keymaps -local map = vim.api.nvim_set_keymap -local opts = { noremap = true, silent = true } --- Move to previous/next -map('n', '', 'BufferPrevious', opts) -map('n', '', 'BufferNext', opts) --- Re-order to previous/next -map('n', '', 'BufferMovePrevious', opts) -map('n', '>', 'BufferMoveNext', opts) --- Goto buffer in position... -map('n', 'b1', 'BufferGoto 1', opts) -map('n', 'b2', 'BufferGoto 2', opts) -map('n', 'b3', 'BufferGoto 3', opts) -map('n', 'b4', 'BufferGoto 4', opts) -map('n', 'b5', 'BufferGoto 5', opts) -map('n', 'b6', 'BufferGoto 6', opts) -map('n', 'b7', 'BufferGoto 7', opts) -map('n', 'b8', 'BufferGoto 8', opts) -map('n', 'b9', 'BufferGoto 9', opts) -map('n', 'b0', 'BufferLast', opts) --- Pin/unpin buffer -map('n', '', 'BufferPin', opts) --- Close buffer -map('n', '', 'BufferClose', opts) --- Wipeout buffer --- :BufferWipeout --- Close commands --- :BufferCloseAllButCurrent --- :BufferCloseAllButPinned --- :BufferCloseAllButCurrentOrPinned --- :BufferCloseBuffersLeft --- :BufferCloseBuffersRight --- Magic buffer-picking mode -map('n', '', 'BufferPick', opts) --- Sort automatically by... -map('n', 'bb', 'BufferOrderByBufferNumber', opts) -map('n', 'bd', 'BufferOrderByDirectory', opts) -map('n', 'bl', 'BufferOrderByLanguage', opts) -map('n', 'bw', 'BufferOrderByWindowNumber', opts) - --- Other: --- :BarbarEnable - enables barbar (enabled by default) --- :BarbarDisable - very bad command, should never be used vim.api.nvim_create_autocmd("BufWritePost", { pattern = "plugins.lua", command = "source | PackerSync" }) diff --git a/config/nvim/lua/custom/plugins.lua b/config/nvim/lua/custom/plugins.lua index 5ec4d03..68096bd 100644 --- a/config/nvim/lua/custom/plugins.lua +++ b/config/nvim/lua/custom/plugins.lua @@ -1,185 +1,146 @@ return function(use) - -- 💥 Create key bindings that stick. - -- WhichKey is a lua plugin that displays a popup with - -- possible keybindings of the command you started typing. - use({ "folke/which-key.nvim", - config = function() require("which-key").setup({}) end - }) + -- 💥 Create key bindings that stick. + -- WhichKey is a lua plugin that displays a popup with + -- possible keybindings of the command you started typing. + -- https://github.com/folke/which-key.nvim + use({ + "folke/which-key.nvim", + config = function() + require("which-key").setup({}) + end + }) - -- 🍨 Soothing pastel theme for (Neo)vim - -- https://github.com/catppuccin/nvim - -- use { "catppuccin/nvim", as = "catppuccin" } - -- vim.cmd.colorscheme('catppuccin-latte') + -- 🍨 Soothing pastel theme for (Neo)vim + -- https://github.com/catppuccin/nvim + -- use { "catppuccin/nvim", as = "catppuccin" } + -- vim.cmd.colorscheme('catppuccin-latte') - -- markdown preview plugin for (neo)vim - -- https://github.com/iamcco/markdown-preview.nvim - use({ "iamcco/markdown-preview.nvim", - run = function() vim.fn["mkdp#util#install"]() end, - }) + -- markdown preview plugin for (neo)vim + -- https://github.com/iamcco/markdown-preview.nvim + use({ + "iamcco/markdown-preview.nvim", + run = function() + vim.fn["mkdp#util#install"]() + end, + }) - -- The neovim tabline plugin. - -- https://github.com/romgrk/barbar.nvim - use 'nvim-tree/nvim-web-devicons' - use { 'romgrk/barbar.nvim', wants = 'nvim-web-devicons' } + -- The neovim tabline plugin. + -- https://github.com/romgrk/barbar.nvim + use 'nvim-tree/nvim-web-devicons' + use { 'romgrk/barbar.nvim', wants = 'nvim-web-devicons' } - -- Pretty UI - use 'stevearc/dressing.nvim' -- Neovim plugin to improve the default vim.ui interfaces - use 'rcarriga/nvim-notify' -- A fancy, configurable, notification manager for NeoVim - use 'vigoux/notifier.nvim' -- Non-intrusive notification system for neovim - use { 'folke/todo-comments.nvim', -- ✅ Highlight, list and search todo comments in your projects - requires = 'nvim-lua/plenary.nvim', - config = function() require('todo-comments').setup {} end, + -- + -- Pretty UI + -- + + -- Neovim plugin to improve the default vim.ui interfaces + use 'stevearc/dressing.nvim' + -- A fancy, configurable, notification manager for NeoVim + use 'rcarriga/nvim-notify' + -- Non-intrusive notification system for neovim + use 'vigoux/notifier.nvim' + -- ✅ Highlight, list and search todo comments in your projects + use { + 'folke/todo-comments.nvim', + requires = 'nvim-lua/plenary.nvim', + config = function() + require('todo-comments').setup {} + end, + } + + -- The Refactoring library based off the Refactoring book by Martin Fowler + -- https://github.com/ThePrimeagen/refactoring.nvim + use { + "ThePrimeagen/refactoring.nvim", + requires = { + { "nvim-lua/plenary.nvim" }, + { "nvim-treesitter/nvim-treesitter" } } + } - -- The Refactoring library based off the Refactoring book by Martin Fowler - -- https://github.com/ThePrimeagen/refactoring.nvim - use { - "ThePrimeagen/refactoring.nvim", - requires = { - { "nvim-lua/plenary.nvim" }, - { "nvim-treesitter/nvim-treesitter" } + -- An asynchronous linter plugin for Neovim complementary to + -- the built-in Language Server Protocol support. + -- https://github.com/mfussenegger/nvim-lint + use 'mfussenegger/nvim-lint' + vim.api.nvim_create_autocmd({ "BufWritePost" }, { + callback = function() + require("lint").try_lint() + end, + }) + + -- nvim orgmode, to get me use nvim even more. + use({ + "nvim-orgmode/orgmode", + config = function() + require('orgmode').setup_ts_grammar() + end, + }) + + -- Markdown support + use 'preservim/vim-markdown' + use 'godlygeek/tabular' + + -- obsidian plugin for nvim + -- https://github.com/epwalsh/obsidian.nvim + use({ + "epwalsh/obsidian.nvim", + config = function() + require("obsidian").setup({ + dir = '~/.local/share/_nvalt', + notes_subdir = "notes", + daily_notes = { + folder = "_daily" + }, + completion = { + nvim_cmp = true, -- if using nvim-cmp, otherwise set to false } - } + }) + end + }) - -- An asynchronous linter plugin for Neovim complementary to the built-in Language Server Protocol support. - -- https://github.com/mfussenegger/nvim-lint - use 'mfussenegger/nvim-lint' - vim.api.nvim_create_autocmd({ "BufWritePost" }, { - callback = function() require("lint").try_lint() end, - }) + -- Creates missing folders on save + -- https://github.com/jghauser/mkdir.nvim + use { 'jghauser/mkdir.nvim' } - -- nvim orgmode, to get me use nvim even more. - use({ "nvim-orgmode/orgmode", - config = function() require("orgmode").setup({}) end, - }) + -- Neovim plugin for dimming the highlights of unused + -- functions, variables, parameters, and more + -- https://github.com/zbirenbaum/neodim + use { + "zbirenbaum/neodim", + event = "LspAttach", + config = function() + require("neodim").setup({ + alpha = 0.75, + blend_color = "#000000", + update_in_insert = { + enable = true, + delay = 100, + }, + hide = { + virtual_text = true, + signs = true, + underline = true, + } + }) + end + } - -- Markdown support - use 'preservim/vim-markdown' - use 'godlygeek/tabular' + -- EditorConfig plugin for Neovim + -- https://github.com/gpanders/editorconfig.nvim + use { 'gpanders/editorconfig.nvim' } - -- obsidian plugin for nvim - -- https://github.com/epwalsh/obsidian.nvim - use({ "epwalsh/obsidian.nvim", - config = function() - require("obsidian").setup({ - dir = '~/.local/share/_nvalt', - notes_subdir = "notes", - daily_notes = { - folder = "_daily" - }, - completion = { - nvim_cmp = true, -- if using nvim-cmp, otherwise set to false - } - }) - end - }) + -- Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua. + -- https://github.com/jose-elias-alvarez/null-ls.nvim + use { "jose-elias-alvarez/null-ls.nvim" } - -- Creates missing folders on save - -- https://github.com/jghauser/mkdir.nvim - use { 'jghauser/mkdir.nvim' } - - -- Neovim plugin for dimming the highlights of unused - -- functions, variables, parameters, and more - -- https://github.com/zbirenbaum/neodim - use { "zbirenbaum/neodim", - event = "LspAttach", - config = function() - require("neodim").setup({ - alpha = 0.75, - blend_color = "#000000", - update_in_insert = { - enable = true, - delay = 100, - }, - hide = { - virtual_text = true, - signs = true, - underline = true, - } - }) - end - } - - -- EditorConfig plugin for Neovim - -- https://github.com/gpanders/editorconfig.nvim - use { 'gpanders/editorconfig.nvim' } - - -- Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua. - -- https://github.com/jose-elias-alvarez/null-ls.nvim - use ({ "jose-elias-alvarez/null-ls.nvim", - requires = { "nvim-lua/plenary.nvim" }, - config = function () - local null_ls = require("null-ls") - - null_ls.setup({ - sources = { - null_ls.builtins.formatting.blade_formatter, - null_ls.builtins.formatting.eslint, - null_ls.builtins.formatting.fixjson, - null_ls.builtins.formatting.lua_format, - null_ls.builtins.formatting.markdownlint, - null_ls.builtins.formatting.prettier, - null_ls.builtins.formatting.shfmt, - null_ls.builtins.formatting.stylelint, - -- null_ls.builtins.formatting.stylua, - null_ls.builtins.formatting.terraform_fmt, - null_ls.builtins.formatting.trim_whitespace, - null_ls.builtins.formatting.yamlfmt, - null_ls.builtins.diagnostics.alex, - null_ls.builtins.diagnostics.ansiblelint, - null_ls.builtins.diagnostics.actionlint, - null_ls.builtins.diagnostics.codespell, - null_ls.builtins.diagnostics.dotenv_linter, - null_ls.builtins.diagnostics.editorconfig_checker, - null_ls.builtins.diagnostics.eslint, - null_ls.builtins.diagnostics.hadolint, - null_ls.builtins.diagnostics.jsonlint, - null_ls.builtins.diagnostics.luacheck, - null_ls.builtins.diagnostics.markdownlint, - null_ls.builtins.diagnostics.php, - null_ls.builtins.diagnostics.phpcs, - null_ls.builtins.diagnostics.phpstan, - null_ls.builtins.diagnostics.psalm, - null_ls.builtins.diagnostics.shellcheck, - null_ls.builtins.diagnostics.spectral, - null_ls.builtins.diagnostics.stylelint, - null_ls.builtins.diagnostics.todo_comments, - null_ls.builtins.diagnostics.trail_space, - null_ls.builtins.diagnostics.xo, - null_ls.builtins.diagnostics.yamllint, - null_ls.builtins.completion.spell, - null_ls.builtins.completion.luasnip, - null_ls.builtins.code_actions.eslint, - null_ls.builtins.code_actions.shellcheck, - null_ls.builtins.code_actions.xo, - } - }) - end - }) - - - local map = vim.api.nvim_set_keymap - - map("n", "ff", ":Format", { noremap = true, silent = true }) - - -- Remaps for the refactoring operations currently offered by the plugin - local refact_opts = { noremap = true, silent = true, expr = false } - map("v", "re", [[ lua require('refactoring').refactor('Extract Function')]], refact_opts) - map("v", "rf", [[ lua require('refactoring').refactor('Extract Function To File')]], - refact_opts) - map("v", "rv", [[ lua require('refactoring').refactor('Extract Variable')]], refact_opts) - map("v", "ri", [[ lua require('refactoring').refactor('Inline Variable')]], refact_opts) - - -- Extract block doesn't need visual mode - map("n", "rb", [[ lua require('refactoring').refactor('Extract Block')]], refact_opts) - map("n", "rbf", [[ lua require('refactoring').refactor('Extract Block To File')]], refact_opts) - - -- Inline variable can also pick up the identifier currently under the cursor without visual mode - map("n", "ri", [[ lua require('refactoring').refactor('Inline Variable')]], refact_opts) - - -- prompt for a refactor to apply when the remap is triggered - map("v", "rr", ":lua require('refactoring').select_refactor()", refact_opts) + -- mason-null-ls bridges mason.nvim with the null-ls plugin + -- - making it easier to use both plugins together. + -- https://github.com/jay-babu/mason-null-ls.nvim + use { + "jayp0521/mason-null-ls.nvim", + requires = { "jose-elias-alvarez/null-ls.nvim" } + } end diff --git a/config/nvim/plugin/.gitignore b/config/nvim/plugin/.gitignore new file mode 100644 index 0000000..d547881 --- /dev/null +++ b/config/nvim/plugin/.gitignore @@ -0,0 +1 @@ +packer_compiled.lua diff --git a/local/bin/dfm b/local/bin/dfm index dac4d9e..e6a3cf7 100755 --- a/local/bin/dfm +++ b/local/bin/dfm @@ -109,7 +109,7 @@ function section_dotfiles rcup -B 0 -g \ | tee "$INSTALL_SCRIPT" 1> /dev/null \ && sed -i '' "s|$HOME|\$HOME|g" "$INSTALL_SCRIPT" \ - && sed -i '' "s|install.sh|$(basename $INSTALL_SCRIPT)|g" "$INSTALL_SCRIPT" + && sed -i '' "s|install.sh|$(basename "$INSTALL_SCRIPT")|g" "$INSTALL_SCRIPT" $0 dotfiles shfmt msg_done "🎉 Done!" ;;