diff --git a/lua/markaya/lazy.lua b/lua/markaya/lazy.lua new file mode 100644 index 0000000..03bd194 --- /dev/null +++ b/lua/markaya/lazy.lua @@ -0,0 +1,28 @@ +-- [[ Install `lazy.nvim` plugin manager ]] +local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' +if not vim.loop.fs_stat(lazypath) then + local lazyrepo = 'https://github.com/folke/lazy.nvim.git' + vim.fn.system { + 'git', + 'clone', + '--filter=blob:none', + -- Ovde zakljuฤavamo na v11.17.5 umesto '--branch=stable' + '--branch=v11.17.5', + lazyrepo, + lazypath + } +end +vim.opt.rtp:prepend(lazypath) + +-- Setup lazy.nvim +require('lazy').setup('markaya.plugins', { + -- Opciono: takoฤ‘e moลพete dodati samu lazy.nvim u listu specifikacija + -- unutar foldera 'markaya/plugins' kako biste osigurali da je Lazy uvek na toj verziji + ui = { + icons = vim.g.have_nerd_font and {} or { + cmd = 'โŒ˜', config = '๐Ÿ› ', event = '๐Ÿ“…', ft = '๐Ÿ“‚', init = 'โš™', + keys = '๐Ÿ—', plugin = '๐Ÿ”Œ', runtime = '๐Ÿ’ป', require = '๐ŸŒ™', + source = '๐Ÿ“„', start = '๐Ÿš€', task = '๐Ÿ“Œ', lazy = '๐Ÿ’ค ', + }, + }, +}) diff --git a/lua/markaya/plugins/blink.lua b/lua/markaya/plugins/blink.lua new file mode 100644 index 0000000..92ca52e --- /dev/null +++ b/lua/markaya/plugins/blink.lua @@ -0,0 +1,63 @@ +return { + 'saghen/blink.cmp', + -- optional: provides snippets for the snippet source + dependencies = { 'rafamadriz/friendly-snippets' }, + + -- use a release tag to download pre-built binaries + version = 'v1.8.0', + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { + preset = 'default', + -- [''] = { function(cmp) cmp.show({ providers = { 'snippets' } }) end }, + [''] = { 'snippet_forward', 'fallback' }, + [''] = { 'snippet_backward', 'fallback' }, + [''] = { 'scroll_documentation_up' }, + [''] = { 'scroll_documentation_down' }, + }, + + appearance = { + nerd_font_variant = 'mono', + }, + + signature = { enabled = true }, + + completion = { + menu = { + border = 'rounded', + }, + ghost_text = { + enabled = true, + show_with_menu = false, + }, + documentation = { auto_show = true }, + }, + + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { 'lsp', 'path', 'snippets', 'buffer' }, + }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = 'prefer_rust_with_warning' }, + }, + opts_extend = { 'sources.default' }, +} diff --git a/lua/markaya/plugins/conform.lua b/lua/markaya/plugins/conform.lua new file mode 100644 index 0000000..97e69c6 --- /dev/null +++ b/lua/markaya/plugins/conform.lua @@ -0,0 +1,36 @@ +return { + { + 'stevearc/conform.nvim', + version = 'v9.1.0', + lazy = false, + keys = { + { + 'f', + function() + require('conform').format { async = true, lsp_fallback = true } + end, + mode = '', + desc = '[F]ormat buffer', + }, + }, + opts = { + notify_on_error = false, + format_on_save = function(bufnr) + local disable_filetypes = { c = true, cpp = true } + return { + timeout_ms = 500, + lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], + } + end, + formatters_by_ft = { + lua = { 'stylua' }, + -- Conform can also run multiple formatters sequentially + -- python = { "isort", "black" }, + -- + -- You can use a sub-list to tell conform to run *until* a formatter + -- is found. + -- javascript = { { "prettierd", "prettier" } }, + }, + }, + }, +} diff --git a/lua/markaya/plugins/fugitive.lua b/lua/markaya/plugins/fugitive.lua new file mode 100644 index 0000000..9385620 --- /dev/null +++ b/lua/markaya/plugins/fugitive.lua @@ -0,0 +1,41 @@ +return { + 'tpope/vim-fugitive', + commit = '61b51c0', + config = function() + vim.keymap.set('n', 'gs', vim.cmd.Git, { desc = ':Git' }) + + local markaya_fugitive = vim.api.nvim_create_augroup('markaya_fugitive', {}) + + local autocmd = vim.api.nvim_create_autocmd + autocmd('BufWinEnter', { + group = markaya_fugitive, + pattern = '*', + callback = function() + if vim.bo.ft ~= 'fugitive' then + return + end + + local bufnr = vim.api.nvim_get_current_buf() + local opts = { buffer = bufnr, remap = false } + + -- TODO: Must fix these remaps to work + + --[[ vim.keymap.set('n', 'p', function() + vim.cmd.Git 'push' + end, vim.tbl_deep_extend('keep', opts, { desc = 'Git push' })) + + vim.keymap.set('n', 'P', function() + vim.cmd.Git { 'pull', '--rebase' } + end, vim.tbl_deep_extend('keep', opts, { desc = 'Git pull --rebase' })) + + -- NOTE: It allows me to easily set the branch i am pushing and any tracking + -- needed if i did not set the branch up correctly + + vim.keymap.set('n', 't', ':Git push -u origin ', vim.tbl_deep_extend('keep', opts, { desc = 'Git pull --rebase' })) ]] + end, + }) + + -- vim.keymap.set('n', 'gu', 'diffget //2') + -- vim.keymap.set('n', 'gh', 'diffget //3') + end, +} diff --git a/lua/markaya/plugins/gitsigns.lua b/lua/markaya/plugins/gitsigns.lua new file mode 100644 index 0000000..8ae2074 --- /dev/null +++ b/lua/markaya/plugins/gitsigns.lua @@ -0,0 +1,67 @@ +return { + { + 'lewis6991/gitsigns.nvim', + version = 'v1.0.2', + config = function() + require('gitsigns').setup { + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = 'โ€พ' }, + changedelete = { text = '~' }, + }, + on_attach = function(bufnr) + local gitsigns = require 'gitsigns' + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map('n', ']c', function() + if vim.wo.diff then + vim.cmd.normal { ']c', bang = true } + else + gitsigns.nav_hunk 'next' + end + end, { desc = 'Jump to next git [c]hange' }) + + map('n', '[c', function() + if vim.wo.diff then + vim.cmd.normal { '[c', bang = true } + else + gitsigns.nav_hunk 'prev' + end + end, { desc = 'Jump to previous git [c]hange' }) + + -- Actions + -- visual mode + map('v', 'hs', function() + gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'stage git hunk' }) + map('v', 'hr', function() + gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'reset git hunk' }) + -- normal mode + map('n', 'hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) + map('n', 'hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) + map('n', 'hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) + map('n', 'hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' }) + map('n', 'hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) + map('n', 'hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) + map('n', 'hb', gitsigns.blame_line, { desc = 'git [b]lame line' }) + map('n', 'hd', gitsigns.diffthis, { desc = 'git [d]iff against index' }) + map('n', 'hD', function() + gitsigns.diffthis '@' + end, { desc = 'git [D]iff against last commit' }) + -- Toggles + map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) + map('n', 'tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' }) + end, + } + end, + }, +} diff --git a/lua/markaya/plugins/harpoon.lua b/lua/markaya/plugins/harpoon.lua new file mode 100644 index 0000000..d8800b3 --- /dev/null +++ b/lua/markaya/plugins/harpoon.lua @@ -0,0 +1,31 @@ +return { + 'ThePrimeagen/harpoon', + branch = 'harpoon2', + commit = '87b1a35', + dependencies = { 'nvim-telescope/telescope.nvim', 'nvim-lua/plenary.nvim' }, + config = function() + local harpoon = require 'harpoon' + + harpoon:setup() + + vim.keymap.set('n', 'a', function() + harpoon:list():add() + end, { desc = '[A]dd to Harpoon List' }) + vim.keymap.set('n', '', function() + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, { desc = 'Toggle Harpoon List' }) + + vim.keymap.set('n', '', function() + harpoon:list():select(1) + end, { desc = '1st in Harpoon List' }) + vim.keymap.set('n', '', function() + harpoon:list():select(2) + end, { desc = '2nd in Harpoon List' }) + vim.keymap.set('n', '', function() + harpoon:list():select(3) + end, { desc = '3rd in Harpoon List' }) + vim.keymap.set('n', '', function() + harpoon:list():select(4) + end, { desc = '4th in Harpoon List' }) + end, +} diff --git a/lua/markaya/plugins/indent_line.lua b/lua/markaya/plugins/indent_line.lua new file mode 100644 index 0000000..857c841 --- /dev/null +++ b/lua/markaya/plugins/indent_line.lua @@ -0,0 +1,12 @@ +return { + { -- Add indentation guides even on blank lines + 'lukas-reineke/indent-blankline.nvim', + version = 'v3.9.0', + -- See `:help ibl` + main = 'ibl', + opts = {}, + config = function () + require("ibl").setup() + end + }, +} diff --git a/lua/markaya/plugins/lspconfig.lua b/lua/markaya/plugins/lspconfig.lua new file mode 100644 index 0000000..a68f7ea --- /dev/null +++ b/lua/markaya/plugins/lspconfig.lua @@ -0,0 +1,154 @@ +return { + { + 'neovim/nvim-lspconfig', + version = 'v2.5.0', + dependencies = { + { 'j-hui/fidget.nvim', version = 'v1.6.1', opts = {} }, + { 'saghen/blink.cmp' }, + { + 'folke/lazydev.nvim', + version = 'v1.10.0', + ft = 'lua', -- only load on lua files + opts = { + library = { + -- See the configuration section for more details + -- Load luvit types when the `vim.uv` word is found + { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, + }, + }, + }, + }, + opts = { + servers = { + lua_ls = {}, + gopls = {}, + pyright = {}, + golangci_lint_ls = { + init_options = { + command = { + 'golangci-lint', + 'run', + '--output.json.path', + 'stdout', + '--show-stats=false', + '--issues-exit-code=1', + }, + }, + }, + }, + }, + config = function(_, opts) + --local lspconfig = require 'lspconfig' + for server, config in pairs(opts.servers) do + -- passing config.capabilities to blink.cmp merges with the capabilities in your + -- `opts[server].capabilities, if you've defined it + config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities) + -- lspconfig[server].setup(config) + + vim.lsp.enable(server) + vim.lsp.config(server, config) + end + + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), + callback = function(event) + local map = function(keys, func, desc) + vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end + + local opts = { buffer = event.buf } + -- Jump to the definition of the word under your cursor. + -- This is where a variable was first declared, or where a function is defined, etc. + -- To jump back, press . + map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + + -- Find references for the word under your cursor. + map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + + -- Jump to the implementation of the word under your cursor. + -- Useful when your language has ways of declaring types without an actual implementation. + map('gi', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + + -- Jump to the type of the word under your cursor. + -- Useful when you're not sure what type a variable is and you want to see + -- the definition of its *type*, not where it was *defined*. + map('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') + + -- Fuzzy find all the symbols in your current document. + -- Symbols are things like variables, functions, types, etc. + map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + + -- Fuzzy find all the symbols in your current workspace. + -- Similar to document symbols, except searches over your entire project. + map('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + + -- Rename the variable under your cursor. + -- Most Language Servers support renaming across files, etc. + map('rn', vim.lsp.buf.rename, '[R]e[n]ame') + + -- Execute a code action, usually your cursor needs to be on top of an error + -- or a suggestion from your LSP for this to activate. + map('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') + + -- Opens a popup that displays documentation about the word under your cursor + -- See `:help K` for why this keymap. + map('K', vim.lsp.buf.hover, 'Hover Documentation') + + -- WARN: This is not Goto Definition, this is Goto Declaration. + -- For example, in C this would take you to the header. + map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + + -- NOTE: Primagean + vim.keymap.set('i', '', function() + vim.lsp.buf.signature_help() + end, vim.tbl_deep_extend('keep', opts, { desc = 'LSP: Signature Help' })) + + map('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace folder [A]dd') + map('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace folder [R]emove') + map('wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, '[W]orkspace folders, [L]ist') + + -- The following two autocommands are used to highlight references of the + -- word under your cursor when your cursor rests there for a little while. + -- See `:help CursorHold` for information about when this is executed + -- + -- When you move your cursor, the highlights will be cleared (the second autocommand). + local client = vim.lsp.get_client_by_id(event.data.client_id) + if client and client.server_capabilities.documentHighlightProvider then + local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) + vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.document_highlight, + }) + + vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references, + }) + + vim.api.nvim_create_autocmd('LspDetach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } + end, + }) + end + + -- The following autocommand is used to enable inlay hints in your + -- code, if the language server you are using supports them + -- + -- This may be unwanted, since they displace some of your code + if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then + map('th', function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled {}) + end, '[T]oggle Inlay [H]ints') + end + end, + }) + end, + }, +} diff --git a/lua/markaya/plugins/lualine.lua b/lua/markaya/plugins/lualine.lua new file mode 100644 index 0000000..c3b696c --- /dev/null +++ b/lua/markaya/plugins/lualine.lua @@ -0,0 +1,14 @@ +return { + 'nvim-lualine/lualine.nvim', + commit = '47f91c4', + dependencies = { + {'nvim-tree/nvim-web-devicons', commit = '8033534'}, + }, + config = function() + require('lualine').setup { + options = { + theme = 'codedark', + }, + } + end, +} diff --git a/lua/markaya/plugins/noneckpain.lua b/lua/markaya/plugins/noneckpain.lua new file mode 100644 index 0000000..3bfc3f2 --- /dev/null +++ b/lua/markaya/plugins/noneckpain.lua @@ -0,0 +1,12 @@ +return { + 'shortcuts/no-neck-pain.nvim', + version = 'v2.5.3', + config = function() + require('no-neck-pain').setup { + width = 130, + autocmds = { + enableOnVimEnter = true, + }, + } + end, +} diff --git a/lua/markaya/plugins/nvim-lint.lua b/lua/markaya/plugins/nvim-lint.lua new file mode 100644 index 0000000..16baeb9 --- /dev/null +++ b/lua/markaya/plugins/nvim-lint.lua @@ -0,0 +1,50 @@ +return { + 'mfussenegger/nvim-lint', + commit = 'ca6ea12', + event = { 'BufReadPre', 'BufNewFile' }, + config = function() + local lint = require 'lint' + + -- To allow other plugins to add linters to require('lint').linters_by_ft, + -- instead set linters_by_ft like this: + lint.linters_by_ft = lint.linters_by_ft or {} + -- lint.linters_by_ft['markdown'] = { 'markdownlint-cli2' } + -- + -- However, note that this will enable a set of default linters, + -- which will cause errors unless these tools are available: + -- { + -- clojure = { "clj-kondo" }, + -- dockerfile = { "hadolint" }, + -- inko = { "inko" }, + -- janet = { "janet" }, + -- json = { "jsonlint" }, + -- markdown = { "vale" }, + -- rst = { "vale" }, + -- ruby = { "ruby" }, + -- terraform = { "tflint" }, + -- text = { "vale" } + -- } + -- + -- You can disable the default linters by setting their filetypes to nil: + -- lint.linters_by_ft['clojure'] = nil + -- lint.linters_by_ft['dockerfile'] = nil + -- lint.linters_by_ft['inko'] = nil + -- lint.linters_by_ft['janet'] = nil + -- lint.linters_by_ft['json'] = nil + -- lint.linters_by_ft['markdown'] = nil + -- lint.linters_by_ft['rst'] = nil + -- lint.linters_by_ft['ruby'] = nil + -- lint.linters_by_ft['terraform'] = nil + -- lint.linters_by_ft['text'] = nil + + -- Create autocommand which carries out the actual linting + -- on the specified events. + local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true }) + vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { + group = lint_augroup, + callback = function() + lint.try_lint() + end, + }) + end, +} diff --git a/lua/markaya/plugins/telescope.lua b/lua/markaya/plugins/telescope.lua new file mode 100644 index 0000000..36a9d60 --- /dev/null +++ b/lua/markaya/plugins/telescope.lua @@ -0,0 +1,82 @@ +return { + { -- Fuzzy Finder (files, lsp, etc) + 'nvim-telescope/telescope.nvim', + event = 'VimEnter', + tag = 'v0.2.1' + dependencies = { + 'nvim-lua/plenary.nvim', + { + 'nvim-telescope/telescope-fzf-native.nvim', + build = 'make', + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, + { 'nvim-telescope/telescope-ui-select.nvim' }, + { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + }, + config = function() + require('telescope').setup { + extensions = { + ['ui-select'] = { + require('telescope.themes').get_dropdown(), + }, + fzf = {}, + }, + } + + -- https://www.youtube.com/watch?v=xdXE1tOT-qg&list=PLep05UYkc6wTyBe7kPjQFWVXTlhKeQejM&index=11 + -- On this video there is a tutorial how to create live multigrep to filter files over + -- multiple arguments + -- e.g. .lua[ ]telescope -- will search all .lua files with telescope in them + + pcall(require('telescope').load_extension, 'fzf') + pcall(require('telescope').load_extension, 'ui-select') + + local builtin = require 'telescope.builtin' + vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) + vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) + -- most important + --vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) + vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) + -- + vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) + vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) + vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) + vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) + vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + vim.keymap.set('n', '', builtin.git_files, { desc = 'Git files' }) + + vim.keymap.set('n', 'pws', function() + local word = vim.fn.expand '' + builtin.grep_string { search = word } + end, { desc = '[S]earch current [w]ord' }) + + vim.keymap.set('n', 'pWs', function() + local word = vim.fn.expand '' + builtin.grep_string { search = word } + end, { desc = '[S]earch current [W]ORD' }) + + vim.keymap.set('n', '/', function() + builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = false, + }) + end, { desc = '[/] Fuzzily search in current buffer' }) + + vim.keymap.set('n', 's/', function() + builtin.live_grep { + grep_open_files = true, + prompt_title = 'Live Grep in Open Files', + } + end, { desc = '[S]earch [/] in Open Files' }) + + -- Shortcut for searching your Neovim configuration files + vim.keymap.set('n', 'sn', function() + builtin.find_files { cwd = vim.fn.stdpath 'config' } + end, { desc = '[S]earch [N]eovim files' }) + + require('markaya.telescope.multigrep').setup() + end, + }, +} diff --git a/lua/markaya/plugins/treesitter.lua b/lua/markaya/plugins/treesitter.lua new file mode 100644 index 0000000..59888a5 --- /dev/null +++ b/lua/markaya/plugins/treesitter.lua @@ -0,0 +1,33 @@ +return { + { -- Highlight, edit, and navigate code + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + tag = 'v0.10.0', + opts = { + ensure_installed = { + 'lua', + 'luadoc', + 'vim', + 'vimdoc', + 'bash', + -- Go ecosystem + 'go', + 'gomod', + 'gowork', + 'gosum' + }, + -- Autoinstall languages that are not installed + auto_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = { 'ruby' }, + }, + indent = { enable = true, disable = { 'ruby' } }, + }, + config = function(_, opts) + require('nvim-treesitter.install').prefer_git = true + ---@diagnostic disable-next-line: missing-fields + require('nvim-treesitter.configs').setup(opts) + end, + }, +} diff --git a/lua/markaya/plugins/trouble.lua b/lua/markaya/plugins/trouble.lua new file mode 100644 index 0000000..a0ff123 --- /dev/null +++ b/lua/markaya/plugins/trouble.lua @@ -0,0 +1,38 @@ +return { + "folke/trouble.nvim", + version = 'v3.7.1', + opts = {}, -- for default options, refer to the configuration section for custom setup. + cmd = "Trouble", + keys = { + { + "xx", + "Trouble diagnostics toggle", + desc = "Diagnostics (Trouble)", + }, + { + "xX", + "Trouble diagnostics toggle filter.buf=0", + desc = "Buffer Diagnostics (Trouble)", + }, + { + "cs", + "Trouble symbols toggle focus=false", + desc = "Symbols (Trouble)", + }, + { + "cl", + "Trouble lsp toggle focus=false win.position=right", + desc = "LSP Definitions / references / ... (Trouble)", + }, + { + "xL", + "Trouble loclist toggle", + desc = "Location List (Trouble)", + }, + { + "xQ", + "Trouble qflist toggle", + desc = "Quickfix List (Trouble)", + }, + }, +} diff --git a/lua/markaya/plugins/undotree.lua b/lua/markaya/plugins/undotree.lua new file mode 100644 index 0000000..ac07211 --- /dev/null +++ b/lua/markaya/plugins/undotree.lua @@ -0,0 +1,8 @@ +return { + 'mbbill/undotree', + commit = '0f1c981', + ignore_install = { '' }, + config = function() + vim.keymap.set('n', 'u', vim.cmd.UndotreeToggle, { desc = 'UndotreeToggle' }) + end, +} diff --git a/lua/markaya/plugins/vim_sleuth.lua b/lua/markaya/plugins/vim_sleuth.lua new file mode 100644 index 0000000..ebff0cb --- /dev/null +++ b/lua/markaya/plugins/vim_sleuth.lua @@ -0,0 +1,4 @@ +return { + 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically + tag = 'v2.0', +} diff --git a/lua/markaya/telescope/multigrep.lua b/lua/markaya/telescope/multigrep.lua new file mode 100644 index 0000000..b2539f0 --- /dev/null +++ b/lua/markaya/telescope/multigrep.lua @@ -0,0 +1,54 @@ +local pickers = require 'telescope.pickers' +local finders = require 'telescope.finders' +local make_entry = require 'telescope.make_entry' +local conf = require('telescope.config').values + +local M = {} + +local live_multigrep = function(opts) + opts = opts or {} + opts.cwd = opts.cwd or vim.uv.cwd() + + local finder = finders.new_async_job { + command_generator = function(prompt) + if not prompt or prompt == '' then + return nil + end + local pieces = vim.split(prompt, ' ') + local args = { 'rg' } + if pieces[1] then + table.insert(args, '-e') + table.insert(args, pieces[1]) + end + + if pieces[2] then + table.insert(args, '-g') + table.insert(args, pieces[2]) + end + + ---@diagnostic disable-next-line: deprecated + return vim.tbl_flatten { + args, + { '--color=never', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case' }, + } + end, + entry_maker = make_entry.gen_from_vimgrep(opts), + cwd = opts.cwd, + } + + pickers + .new(opts, { + debounce = 100, + prompt_title = 'Multi Grep', + finder = finder, + previewer = conf.grep_previewer(opts), + sorter = require('telescope.sorters').empty(), + }) + :find() +end + +M.setup = function() + vim.keymap.set('n', 'sg', live_multigrep, { desc = '[S]earch Multi [G]rep' }) +end + +return M