From d74417b8e2984c6b576523e8e74d300a781cec81 Mon Sep 17 00:00:00 2001 From: Marko Ristic Date: Thu, 15 Jan 2026 08:25:49 +0100 Subject: [PATCH] add nvim config --- .gitignore | 5 - nvim/init.lua | 1 + nvim/lua/markaya/init.lua | 2 + nvim/lua/markaya/lazy.lua | 28 ++++ nvim/lua/markaya/plugins/blink.lua | 63 +++++++ nvim/lua/markaya/plugins/conform.lua | 36 ++++ nvim/lua/markaya/plugins/fugitive.lua | 41 +++++ nvim/lua/markaya/plugins/gitsigns.lua | 67 ++++++++ nvim/lua/markaya/plugins/harpoon.lua | 31 ++++ nvim/lua/markaya/plugins/indent_line.lua | 12 ++ nvim/lua/markaya/plugins/lspconfig.lua | 154 ++++++++++++++++++ nvim/lua/markaya/plugins/lualine.lua | 14 ++ nvim/lua/markaya/plugins/noneckpain.lua | 12 ++ nvim/lua/markaya/plugins/nvim-lint.lua | 50 ++++++ nvim/lua/markaya/plugins/telescope.lua | 82 ++++++++++ nvim/lua/markaya/plugins/treesitter.lua | 33 ++++ nvim/lua/markaya/plugins/trouble.lua | 38 +++++ nvim/lua/markaya/plugins/undotree.lua | 8 + nvim/lua/markaya/plugins/vim_sleuth.lua | 4 + nvim/lua/markaya/remap.lua | 41 +++++ nvim/lua/markaya/settings.lua | 101 ++++++++++++ nvim/lua/markaya/telescope/multigrep.lua | 54 ++++++ nvim/nvim/.stylua.toml | 7 + nvim/nvim/init.lua | 1 + nvim/nvim/lazy-lock.json | 26 +++ nvim/nvim/lua/markaya/init.lua | 3 + nvim/nvim/lua/markaya/lazy.lua | 28 ++++ nvim/nvim/lua/markaya/plugins/blink.lua | 63 +++++++ nvim/nvim/lua/markaya/plugins/catppuccin.lua | 8 + nvim/nvim/lua/markaya/plugins/conform.lua | 36 ++++ nvim/nvim/lua/markaya/plugins/fugitive.lua | 41 +++++ nvim/nvim/lua/markaya/plugins/gitsigns.lua | 67 ++++++++ nvim/nvim/lua/markaya/plugins/harpoon.lua | 31 ++++ nvim/nvim/lua/markaya/plugins/indent_line.lua | 12 ++ nvim/nvim/lua/markaya/plugins/lspconfig.lua | 154 ++++++++++++++++++ nvim/nvim/lua/markaya/plugins/lualine.lua | 14 ++ nvim/nvim/lua/markaya/plugins/noneckpain.lua | 12 ++ nvim/nvim/lua/markaya/plugins/nvim-lint.lua | 50 ++++++ nvim/nvim/lua/markaya/plugins/telescope.lua | 82 ++++++++++ nvim/nvim/lua/markaya/plugins/treesitter.lua | 33 ++++ nvim/nvim/lua/markaya/plugins/trouble.lua | 38 +++++ nvim/nvim/lua/markaya/plugins/undotree.lua | 8 + nvim/nvim/lua/markaya/plugins/vim_sleuth.lua | 4 + nvim/nvim/lua/markaya/remap.lua | 41 +++++ nvim/nvim/lua/markaya/settings.lua | 101 ++++++++++++ nvim/nvim/lua/markaya/telescope/multigrep.lua | 54 ++++++ 46 files changed, 1786 insertions(+), 5 deletions(-) create mode 100644 nvim/init.lua create mode 100644 nvim/lua/markaya/init.lua create mode 100644 nvim/lua/markaya/lazy.lua create mode 100644 nvim/lua/markaya/plugins/blink.lua create mode 100644 nvim/lua/markaya/plugins/conform.lua create mode 100644 nvim/lua/markaya/plugins/fugitive.lua create mode 100644 nvim/lua/markaya/plugins/gitsigns.lua create mode 100644 nvim/lua/markaya/plugins/harpoon.lua create mode 100644 nvim/lua/markaya/plugins/indent_line.lua create mode 100644 nvim/lua/markaya/plugins/lspconfig.lua create mode 100644 nvim/lua/markaya/plugins/lualine.lua create mode 100644 nvim/lua/markaya/plugins/noneckpain.lua create mode 100644 nvim/lua/markaya/plugins/nvim-lint.lua create mode 100644 nvim/lua/markaya/plugins/telescope.lua create mode 100644 nvim/lua/markaya/plugins/treesitter.lua create mode 100644 nvim/lua/markaya/plugins/trouble.lua create mode 100644 nvim/lua/markaya/plugins/undotree.lua create mode 100644 nvim/lua/markaya/plugins/vim_sleuth.lua create mode 100644 nvim/lua/markaya/remap.lua create mode 100644 nvim/lua/markaya/settings.lua create mode 100644 nvim/lua/markaya/telescope/multigrep.lua create mode 100644 nvim/nvim/.stylua.toml create mode 100644 nvim/nvim/init.lua create mode 100644 nvim/nvim/lazy-lock.json create mode 100644 nvim/nvim/lua/markaya/init.lua create mode 100644 nvim/nvim/lua/markaya/lazy.lua create mode 100644 nvim/nvim/lua/markaya/plugins/blink.lua create mode 100644 nvim/nvim/lua/markaya/plugins/catppuccin.lua create mode 100644 nvim/nvim/lua/markaya/plugins/conform.lua create mode 100644 nvim/nvim/lua/markaya/plugins/fugitive.lua create mode 100644 nvim/nvim/lua/markaya/plugins/gitsigns.lua create mode 100644 nvim/nvim/lua/markaya/plugins/harpoon.lua create mode 100644 nvim/nvim/lua/markaya/plugins/indent_line.lua create mode 100644 nvim/nvim/lua/markaya/plugins/lspconfig.lua create mode 100644 nvim/nvim/lua/markaya/plugins/lualine.lua create mode 100644 nvim/nvim/lua/markaya/plugins/noneckpain.lua create mode 100644 nvim/nvim/lua/markaya/plugins/nvim-lint.lua create mode 100644 nvim/nvim/lua/markaya/plugins/telescope.lua create mode 100644 nvim/nvim/lua/markaya/plugins/treesitter.lua create mode 100644 nvim/nvim/lua/markaya/plugins/trouble.lua create mode 100644 nvim/nvim/lua/markaya/plugins/undotree.lua create mode 100644 nvim/nvim/lua/markaya/plugins/vim_sleuth.lua create mode 100644 nvim/nvim/lua/markaya/remap.lua create mode 100644 nvim/nvim/lua/markaya/settings.lua create mode 100644 nvim/nvim/lua/markaya/telescope/multigrep.lua diff --git a/.gitignore b/.gitignore index cc345c7..de96c2a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,9 +4,6 @@ .AppleDouble .LSOverride -# Icon must end with two \r -Icon - # Thumbnails ._* @@ -29,7 +26,5 @@ Temporary Items tags test.sh .luarc.json -nvim spell/ -lazy-lock.json diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 0000000..c7eedf7 --- /dev/null +++ b/nvim/init.lua @@ -0,0 +1 @@ +require 'markaya' diff --git a/nvim/lua/markaya/init.lua b/nvim/lua/markaya/init.lua new file mode 100644 index 0000000..b238450 --- /dev/null +++ b/nvim/lua/markaya/init.lua @@ -0,0 +1,2 @@ +require 'markaya.settings' +require 'markaya.remap' diff --git a/nvim/lua/markaya/lazy.lua b/nvim/lua/markaya/lazy.lua new file mode 100644 index 0000000..03bd194 --- /dev/null +++ b/nvim/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/nvim/lua/markaya/plugins/blink.lua b/nvim/lua/markaya/plugins/blink.lua new file mode 100644 index 0000000..92ca52e --- /dev/null +++ b/nvim/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/nvim/lua/markaya/plugins/conform.lua b/nvim/lua/markaya/plugins/conform.lua new file mode 100644 index 0000000..97e69c6 --- /dev/null +++ b/nvim/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/nvim/lua/markaya/plugins/fugitive.lua b/nvim/lua/markaya/plugins/fugitive.lua new file mode 100644 index 0000000..9385620 --- /dev/null +++ b/nvim/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/nvim/lua/markaya/plugins/gitsigns.lua b/nvim/lua/markaya/plugins/gitsigns.lua new file mode 100644 index 0000000..8ae2074 --- /dev/null +++ b/nvim/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/nvim/lua/markaya/plugins/harpoon.lua b/nvim/lua/markaya/plugins/harpoon.lua new file mode 100644 index 0000000..d8800b3 --- /dev/null +++ b/nvim/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/nvim/lua/markaya/plugins/indent_line.lua b/nvim/lua/markaya/plugins/indent_line.lua new file mode 100644 index 0000000..857c841 --- /dev/null +++ b/nvim/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/nvim/lua/markaya/plugins/lspconfig.lua b/nvim/lua/markaya/plugins/lspconfig.lua new file mode 100644 index 0000000..a68f7ea --- /dev/null +++ b/nvim/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/nvim/lua/markaya/plugins/lualine.lua b/nvim/lua/markaya/plugins/lualine.lua new file mode 100644 index 0000000..c3b696c --- /dev/null +++ b/nvim/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/nvim/lua/markaya/plugins/noneckpain.lua b/nvim/lua/markaya/plugins/noneckpain.lua new file mode 100644 index 0000000..3bfc3f2 --- /dev/null +++ b/nvim/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/nvim/lua/markaya/plugins/nvim-lint.lua b/nvim/lua/markaya/plugins/nvim-lint.lua new file mode 100644 index 0000000..16baeb9 --- /dev/null +++ b/nvim/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/nvim/lua/markaya/plugins/telescope.lua b/nvim/lua/markaya/plugins/telescope.lua new file mode 100644 index 0000000..5942eee --- /dev/null +++ b/nvim/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/nvim/lua/markaya/plugins/treesitter.lua b/nvim/lua/markaya/plugins/treesitter.lua new file mode 100644 index 0000000..59888a5 --- /dev/null +++ b/nvim/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/nvim/lua/markaya/plugins/trouble.lua b/nvim/lua/markaya/plugins/trouble.lua new file mode 100644 index 0000000..a0ff123 --- /dev/null +++ b/nvim/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/nvim/lua/markaya/plugins/undotree.lua b/nvim/lua/markaya/plugins/undotree.lua new file mode 100644 index 0000000..ac07211 --- /dev/null +++ b/nvim/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/nvim/lua/markaya/plugins/vim_sleuth.lua b/nvim/lua/markaya/plugins/vim_sleuth.lua new file mode 100644 index 0000000..ebff0cb --- /dev/null +++ b/nvim/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/nvim/lua/markaya/remap.lua b/nvim/lua/markaya/remap.lua new file mode 100644 index 0000000..315c190 --- /dev/null +++ b/nvim/lua/markaya/remap.lua @@ -0,0 +1,41 @@ +vim.keymap.set('n', 'pv', vim.cmd.Ex, { desc = 'Browse project files' }) + +vim.keymap.set('v', 'J', ":m '>+1gv=gv", { desc = 'Move highlighted line up' }) +vim.keymap.set('v', 'K', ":m '>-2gv=gv", { desc = 'Move highlighted line down' }) + +-- Primagean kemap to save your pasted text inside buffer after you paste it over highlighted text +-- This usuaslly causes highlighted text to be deleted which is them moved to buffer +-- Remap is useful when changing some text on multiple places using same text +vim.keymap.set('x', 'p', '"_dP') + +vim.keymap.set('n', '', 'zz', { desc = 'Move half page down and center cursor' }) +vim.keymap.set('n', '', 'zz', { desc = 'Move half page up and center cursor' }) + +vim.keymap.set('n', 'n', 'nzzzv', { desc = 'Center view when moving to next instance of search' }) +vim.keymap.set('n', 'N', 'Nzzzv', { desc = 'Center view when moving to .instance of search' }) + +-- When pressing Esc key, also remove highlighted text from search. +vim.keymap.set('n', '', 'nohlsearch') + +vim.diagnostic.config { jump = { float = true } } +-- diagnostic keymaps - goto_prev & goto_next are deprecated so I added line above +-- vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'go to previous [d]iagnostic message' }) +-- vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'go to next [d]iagnostic message' }) +vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'show diagnostic [e]rror messages' }) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'open diagnostic [q]uickfix list' }) + +vim.keymap.set('n', 'zd', '_f[lrx', { desc = 'toggle checkbox done' }) +vim.keymap.set('n', 'zn', '_f[lr ', { desc = 'toggle checkbox not done' }) + +-- c for quicklist +vim.keymap.set('n', '', 'cnext', { desc = 'quicklist next item' }) +vim.keymap.set('n', '', 'cprev', { desc = 'quicklist next item' }) +--cclose closes + +--terminal options +vim.keymap.set('n', 'to', function() + vim.cmd.vnew() + vim.cmd.term() + vim.cmd.wincmd 'J' + vim.api.nvim_win_set_height(0, 15) +end) diff --git a/nvim/lua/markaya/settings.lua b/nvim/lua/markaya/settings.lua new file mode 100644 index 0000000..6ce56a0 --- /dev/null +++ b/nvim/lua/markaya/settings.lua @@ -0,0 +1,101 @@ +vim.g.mapleader = ' ' +vim.g.maplocalleader = [[\]] +vim.g.have_nerd_font = true + +-- [[ Setting options ]] +-- See `:help vim.opt` +-- For more options, you can see `:help option-list` +-- + +vim.opt.clipboard = 'unnamedplus' + +vim.opt.termguicolors = true + +vim.opt.number = true +vim.opt.relativenumber = true + +-- Enable mouse mode, can be useful for resizing splits for example! +-- vim.opt.mouse = 'a' + +-- Don't show the mode, since it's already in the status line +vim.opt.showmode = false + +-- Sync clipboard between OS and Neovim. +-- Remove this option if you want your OS clipboard to remain independent. +-- See `:help 'clipboard'` +--vim.opt.clipboard = 'unnamedplus' +-- + +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + +vim.opt.smartindent = true + +-- Enable break indent +vim.opt.breakindent = true + +-- Save undo history +vim.opt.undofile = true + +-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term +vim.opt.ignorecase = true +vim.opt.smartcase = true + +-- Keep signcolumn on by default +vim.opt.signcolumn = 'yes' + +-- line wrap +vim.opt.colorcolumn = { 80, 120, 160 } + +-- Decrease update time +vim.opt.updatetime = 250 + +-- Decrease mapped sequence wait time +-- Displays which-key popup sooner +vim.opt.timeoutlen = 300 + +-- Configure how new splits should be opened +-- vim.opt.splitright = true +-- vim.opt.splitbelow = true + +-- Sets how neovim will display certain whitespace characters in the editor. +-- See `:help 'list'` +-- and `:help 'listchars'` +vim.opt.list = true +vim.opt.listchars = { tab = 'ยป ', trail = 'ยท', nbsp = 'โฃ' } + +-- Preview substitutions live, as you type! +vim.opt.inccommand = 'split' + +-- Show which line your cursor is on +vim.opt.cursorline = true + +-- Minimal number of screen lines to keep above and below the cursor. +vim.opt.scrolloff = 10 + +-- [[ Basic Keymaps ]] +-- See `:help vim.keymap.set()` + +-- Set highlight on search, but clear on pressing in normal mode +vim.opt.hlsearch = true + +-- highlight when yanking (copying) text +-- try it with `yap` in normal mode +-- see `:help vim.highlight.on_yank()` +vim.api.nvim_create_autocmd('textyankpost', { + desc = 'highlight when yanking (copying) text', + group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), + callback = function() + vim.hl.on_yank() + -- vim.highlight.on_yank() + end, +}) + +function GoToLinkDefinition() + vim.fn.search('\\[\\[', 'W') + vim.cmd 'normal gd' +end + +vim.api.nvim_create_user_command('FindAndGoToDefinition', GoToLinkDefinition, {}) diff --git a/nvim/lua/markaya/telescope/multigrep.lua b/nvim/lua/markaya/telescope/multigrep.lua new file mode 100644 index 0000000..b2539f0 --- /dev/null +++ b/nvim/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 diff --git a/nvim/nvim/.stylua.toml b/nvim/nvim/.stylua.toml new file mode 100644 index 0000000..e96067f --- /dev/null +++ b/nvim/nvim/.stylua.toml @@ -0,0 +1,7 @@ +column_width = 160 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferSingle" +call_parentheses = "None" + diff --git a/nvim/nvim/init.lua b/nvim/nvim/init.lua new file mode 100644 index 0000000..c7eedf7 --- /dev/null +++ b/nvim/nvim/init.lua @@ -0,0 +1 @@ +require 'markaya' diff --git a/nvim/nvim/lazy-lock.json b/nvim/nvim/lazy-lock.json new file mode 100644 index 0000000..58e3999 --- /dev/null +++ b/nvim/nvim/lazy-lock.json @@ -0,0 +1,26 @@ +{ + "blink.cmp": { "branch": "main", "commit": "b19413d214068f316c78978b08264ed1c41830ec" }, + "catppuccin": { "branch": "main", "commit": "cb5665990a797b102715188e73c44c3931b3b42e" }, + "conform.nvim": { "branch": "master", "commit": "3543d000dafbc41cc7761d860cfdb24e82154f75" }, + "fidget.nvim": { "branch": "main", "commit": "b61e8af9b8b68ee0ec7da5fb7a8c203aae854f2e" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "gitsigns.nvim": { "branch": "main", "commit": "7010000889bfb6c26065e0b0f7f1e6aa9163edd9" }, + "harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, + "lazydev.nvim": { "branch": "main", "commit": "01bc2aacd51cf9021eb19d048e70ce3dd09f7f93" }, + "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, + "no-neck-pain.nvim": { "branch": "main", "commit": "434fed70b1ee553f8f27e6da7b3899f71b3c6f99" }, + "nvim-lint": { "branch": "master", "commit": "ca6ea12daf0a4d92dc24c5c9ae22a1f0418ade37" }, + "nvim-lspconfig": { "branch": "master", "commit": "5bfcc89fd155b4ffc02d18ab3b7d19c2d4e246a7" }, + "nvim-treesitter": { "branch": "main", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-web-devicons": { "branch": "master", "commit": "803353450c374192393f5387b6a0176d0972b848" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "master", "commit": "3333a52ff548ba0a68af6d8da1e54f9cd96e9179" }, + "trouble.nvim": { "branch": "main", "commit": "748ca2789044607f19786b1d837044544c55e80a" }, + "undotree": { "branch": "master", "commit": "0f1c9816975b5d7f87d5003a19c53c6fd2ff6f7f" }, + "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }, + "vim-sleuth": { "branch": "master", "commit": "1d25e8e5dc4062e38cab1a461934ee5e9d59e5a8" } +} diff --git a/nvim/nvim/lua/markaya/init.lua b/nvim/nvim/lua/markaya/init.lua new file mode 100644 index 0000000..ff8ed57 --- /dev/null +++ b/nvim/nvim/lua/markaya/init.lua @@ -0,0 +1,3 @@ +require 'markaya.settings' +require 'markaya.remap' +require 'markaya.lazy' diff --git a/nvim/nvim/lua/markaya/lazy.lua b/nvim/nvim/lua/markaya/lazy.lua new file mode 100644 index 0000000..03bd194 --- /dev/null +++ b/nvim/nvim/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/nvim/nvim/lua/markaya/plugins/blink.lua b/nvim/nvim/lua/markaya/plugins/blink.lua new file mode 100644 index 0000000..92ca52e --- /dev/null +++ b/nvim/nvim/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/nvim/nvim/lua/markaya/plugins/catppuccin.lua b/nvim/nvim/lua/markaya/plugins/catppuccin.lua new file mode 100644 index 0000000..b2976e6 --- /dev/null +++ b/nvim/nvim/lua/markaya/plugins/catppuccin.lua @@ -0,0 +1,8 @@ +return { + { + "catppuccin/nvim", + version = 'v1.11.0', + name = "catppuccin", + priority = 1000 + } +} diff --git a/nvim/nvim/lua/markaya/plugins/conform.lua b/nvim/nvim/lua/markaya/plugins/conform.lua new file mode 100644 index 0000000..97e69c6 --- /dev/null +++ b/nvim/nvim/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/nvim/nvim/lua/markaya/plugins/fugitive.lua b/nvim/nvim/lua/markaya/plugins/fugitive.lua new file mode 100644 index 0000000..9385620 --- /dev/null +++ b/nvim/nvim/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/nvim/nvim/lua/markaya/plugins/gitsigns.lua b/nvim/nvim/lua/markaya/plugins/gitsigns.lua new file mode 100644 index 0000000..8ae2074 --- /dev/null +++ b/nvim/nvim/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/nvim/nvim/lua/markaya/plugins/harpoon.lua b/nvim/nvim/lua/markaya/plugins/harpoon.lua new file mode 100644 index 0000000..d8800b3 --- /dev/null +++ b/nvim/nvim/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/nvim/nvim/lua/markaya/plugins/indent_line.lua b/nvim/nvim/lua/markaya/plugins/indent_line.lua new file mode 100644 index 0000000..857c841 --- /dev/null +++ b/nvim/nvim/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/nvim/nvim/lua/markaya/plugins/lspconfig.lua b/nvim/nvim/lua/markaya/plugins/lspconfig.lua new file mode 100644 index 0000000..a68f7ea --- /dev/null +++ b/nvim/nvim/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/nvim/nvim/lua/markaya/plugins/lualine.lua b/nvim/nvim/lua/markaya/plugins/lualine.lua new file mode 100644 index 0000000..c3b696c --- /dev/null +++ b/nvim/nvim/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/nvim/nvim/lua/markaya/plugins/noneckpain.lua b/nvim/nvim/lua/markaya/plugins/noneckpain.lua new file mode 100644 index 0000000..3bfc3f2 --- /dev/null +++ b/nvim/nvim/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/nvim/nvim/lua/markaya/plugins/nvim-lint.lua b/nvim/nvim/lua/markaya/plugins/nvim-lint.lua new file mode 100644 index 0000000..16baeb9 --- /dev/null +++ b/nvim/nvim/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/nvim/nvim/lua/markaya/plugins/telescope.lua b/nvim/nvim/lua/markaya/plugins/telescope.lua new file mode 100644 index 0000000..5942eee --- /dev/null +++ b/nvim/nvim/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/nvim/nvim/lua/markaya/plugins/treesitter.lua b/nvim/nvim/lua/markaya/plugins/treesitter.lua new file mode 100644 index 0000000..59888a5 --- /dev/null +++ b/nvim/nvim/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/nvim/nvim/lua/markaya/plugins/trouble.lua b/nvim/nvim/lua/markaya/plugins/trouble.lua new file mode 100644 index 0000000..a0ff123 --- /dev/null +++ b/nvim/nvim/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/nvim/nvim/lua/markaya/plugins/undotree.lua b/nvim/nvim/lua/markaya/plugins/undotree.lua new file mode 100644 index 0000000..ac07211 --- /dev/null +++ b/nvim/nvim/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/nvim/nvim/lua/markaya/plugins/vim_sleuth.lua b/nvim/nvim/lua/markaya/plugins/vim_sleuth.lua new file mode 100644 index 0000000..ebff0cb --- /dev/null +++ b/nvim/nvim/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/nvim/nvim/lua/markaya/remap.lua b/nvim/nvim/lua/markaya/remap.lua new file mode 100644 index 0000000..315c190 --- /dev/null +++ b/nvim/nvim/lua/markaya/remap.lua @@ -0,0 +1,41 @@ +vim.keymap.set('n', 'pv', vim.cmd.Ex, { desc = 'Browse project files' }) + +vim.keymap.set('v', 'J', ":m '>+1gv=gv", { desc = 'Move highlighted line up' }) +vim.keymap.set('v', 'K', ":m '>-2gv=gv", { desc = 'Move highlighted line down' }) + +-- Primagean kemap to save your pasted text inside buffer after you paste it over highlighted text +-- This usuaslly causes highlighted text to be deleted which is them moved to buffer +-- Remap is useful when changing some text on multiple places using same text +vim.keymap.set('x', 'p', '"_dP') + +vim.keymap.set('n', '', 'zz', { desc = 'Move half page down and center cursor' }) +vim.keymap.set('n', '', 'zz', { desc = 'Move half page up and center cursor' }) + +vim.keymap.set('n', 'n', 'nzzzv', { desc = 'Center view when moving to next instance of search' }) +vim.keymap.set('n', 'N', 'Nzzzv', { desc = 'Center view when moving to .instance of search' }) + +-- When pressing Esc key, also remove highlighted text from search. +vim.keymap.set('n', '', 'nohlsearch') + +vim.diagnostic.config { jump = { float = true } } +-- diagnostic keymaps - goto_prev & goto_next are deprecated so I added line above +-- vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'go to previous [d]iagnostic message' }) +-- vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'go to next [d]iagnostic message' }) +vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'show diagnostic [e]rror messages' }) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'open diagnostic [q]uickfix list' }) + +vim.keymap.set('n', 'zd', '_f[lrx', { desc = 'toggle checkbox done' }) +vim.keymap.set('n', 'zn', '_f[lr ', { desc = 'toggle checkbox not done' }) + +-- c for quicklist +vim.keymap.set('n', '', 'cnext', { desc = 'quicklist next item' }) +vim.keymap.set('n', '', 'cprev', { desc = 'quicklist next item' }) +--cclose closes + +--terminal options +vim.keymap.set('n', 'to', function() + vim.cmd.vnew() + vim.cmd.term() + vim.cmd.wincmd 'J' + vim.api.nvim_win_set_height(0, 15) +end) diff --git a/nvim/nvim/lua/markaya/settings.lua b/nvim/nvim/lua/markaya/settings.lua new file mode 100644 index 0000000..6ce56a0 --- /dev/null +++ b/nvim/nvim/lua/markaya/settings.lua @@ -0,0 +1,101 @@ +vim.g.mapleader = ' ' +vim.g.maplocalleader = [[\]] +vim.g.have_nerd_font = true + +-- [[ Setting options ]] +-- See `:help vim.opt` +-- For more options, you can see `:help option-list` +-- + +vim.opt.clipboard = 'unnamedplus' + +vim.opt.termguicolors = true + +vim.opt.number = true +vim.opt.relativenumber = true + +-- Enable mouse mode, can be useful for resizing splits for example! +-- vim.opt.mouse = 'a' + +-- Don't show the mode, since it's already in the status line +vim.opt.showmode = false + +-- Sync clipboard between OS and Neovim. +-- Remove this option if you want your OS clipboard to remain independent. +-- See `:help 'clipboard'` +--vim.opt.clipboard = 'unnamedplus' +-- + +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + +vim.opt.smartindent = true + +-- Enable break indent +vim.opt.breakindent = true + +-- Save undo history +vim.opt.undofile = true + +-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term +vim.opt.ignorecase = true +vim.opt.smartcase = true + +-- Keep signcolumn on by default +vim.opt.signcolumn = 'yes' + +-- line wrap +vim.opt.colorcolumn = { 80, 120, 160 } + +-- Decrease update time +vim.opt.updatetime = 250 + +-- Decrease mapped sequence wait time +-- Displays which-key popup sooner +vim.opt.timeoutlen = 300 + +-- Configure how new splits should be opened +-- vim.opt.splitright = true +-- vim.opt.splitbelow = true + +-- Sets how neovim will display certain whitespace characters in the editor. +-- See `:help 'list'` +-- and `:help 'listchars'` +vim.opt.list = true +vim.opt.listchars = { tab = 'ยป ', trail = 'ยท', nbsp = 'โฃ' } + +-- Preview substitutions live, as you type! +vim.opt.inccommand = 'split' + +-- Show which line your cursor is on +vim.opt.cursorline = true + +-- Minimal number of screen lines to keep above and below the cursor. +vim.opt.scrolloff = 10 + +-- [[ Basic Keymaps ]] +-- See `:help vim.keymap.set()` + +-- Set highlight on search, but clear on pressing in normal mode +vim.opt.hlsearch = true + +-- highlight when yanking (copying) text +-- try it with `yap` in normal mode +-- see `:help vim.highlight.on_yank()` +vim.api.nvim_create_autocmd('textyankpost', { + desc = 'highlight when yanking (copying) text', + group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), + callback = function() + vim.hl.on_yank() + -- vim.highlight.on_yank() + end, +}) + +function GoToLinkDefinition() + vim.fn.search('\\[\\[', 'W') + vim.cmd 'normal gd' +end + +vim.api.nvim_create_user_command('FindAndGoToDefinition', GoToLinkDefinition, {}) diff --git a/nvim/nvim/lua/markaya/telescope/multigrep.lua b/nvim/nvim/lua/markaya/telescope/multigrep.lua new file mode 100644 index 0000000..b2539f0 --- /dev/null +++ b/nvim/nvim/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