diff --git a/README.md b/README.md index 1f8e6f40..7f54ce88 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,8 @@ Neovim's configurations are located under the following paths, depending on your | :- | :--- | | Linux | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | | MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | -| Windows | `%userprofile%\AppData\Local\nvim\` | +| Windows (cmd)| `%userprofile%\AppData\Local\nvim\` | +| Windows (powershell)| `$env:USERPROFILE\AppData\Local\nvim\` | Clone kickstart.nvim: @@ -45,10 +46,16 @@ git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HO ``` -# on Windows +# on Windows (cmd) git clone https://github.com/nvim-lua/kickstart.nvim.git %userprofile%\AppData\Local\nvim\ ``` +``` +# on Windows (powershell) +git clone https://github.com/nvim-lua/kickstart.nvim.git $env:USERPROFILE\AppData\Local\nvim\ +``` + + ### Post Installation Start Neovim diff --git a/init.lua b/init.lua index 5316d3cb..e1e2dd59 100644 --- a/init.lua +++ b/init.lua @@ -37,13 +37,14 @@ I hope you enjoy your Neovim journey, P.S. You can delete this when you're done too. It's your config now :) --]] + -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' --- Install package manager +-- [[ Install `lazy.nvim` plugin manager ]] -- https://github.com/folke/lazy.nvim -- `:help lazy.nvim.txt` for more info local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' @@ -59,6 +60,7 @@ if not vim.loop.fs_stat(lazypath) then end vim.opt.rtp:prepend(lazypath) +-- [[ Configure plugins ]] -- NOTE: Here is where you install your plugins. -- You can configure plugins using the `config` key. -- @@ -286,6 +288,12 @@ vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) +-- Diagnostic keymaps +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) +vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) + -- [[ Highlight on yank ]] -- See `:help vim.highlight.on_yank()` local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) @@ -313,6 +321,42 @@ require('telescope').setup { -- Enable telescope fzf native, if installed pcall(require('telescope').load_extension, 'fzf') +-- Telescope live_grep in git root +-- Function to find the git root directory based on the current buffer's path +local function find_git_root() + -- Use the current buffer's path as the starting point for the git search + local current_file = vim.api.nvim_buf_get_name(0) + local current_dir + local cwd = vim.fn.getcwd() + -- If the buffer is not associated with a file, return nil + if current_file == "" then + current_dir = cwd + else + -- Extract the directory from the current file's path + current_dir = vim.fn.fnamemodify(current_file, ":h") + end + + -- Find the Git root directory from the current file's path + local git_root = vim.fn.systemlist("git -C " .. vim.fn.escape(current_dir, " ") .. " rev-parse --show-toplevel")[1] + if vim.v.shell_error ~= 0 then + print("Not a git repository. Searching on current working directory") + return cwd + end + return git_root +end + +-- Custom live_grep function to search in git root +local function live_grep_git_root() + local git_root = find_git_root() + if git_root then + require('telescope.builtin').live_grep({ + search_dirs = {git_root}, + }) + end +end + +vim.api.nvim_create_user_command('LiveGrepGitRoot', live_grep_git_root, {}) + -- See `:help telescope.builtin` vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) vim.keymap.set('n', '', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) @@ -329,6 +373,7 @@ vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { des vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) +vim.keymap.set('n', 'sG', ':LiveGrepGitRoot', { desc = '[S]earch by [G]rep on Git Root' }) vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', 'sr', require('telescope.builtin').resume, { desc = '[S]earch [R]esume' }) @@ -401,12 +446,6 @@ vim.defer_fn(function() } end, 0) --- Diagnostic keymaps -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous diagnostic message' }) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' }) -vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) - -- [[ Configure LSP ]] -- This function gets run when an LSP connects to a particular buffer. local on_attach = function(_, bufnr) diff --git a/lazy-lock.json b/lazy-lock.json index 87c39904..f2b72f5a 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -18,7 +18,9 @@ "cmp-copilot": { "branch": "main", "commit": "1f3f31c54bd71e41ed157430702bc2837ea582ab" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp-tabnine": { "branch": "main", "commit": "b93f82ef5150e578677fc2e2b4b328b19eed77e1" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "codeium.vim": { "branch": "main", "commit": "1efe2a2cdf516094bdb211aa8a1d45ef01836207" }, "colorbuddy.nvim": { "branch": "dev", "commit": "8508c6f5f6ef03c59ea864870e215d19ac7ff8bb" }, "copilot-cmp": { "branch": "master", "commit": "72fbaa03695779f8349be3ac54fa8bd77eed3ee3" }, "copilot.lua": { "branch": "master", "commit": "73047082d72fcfdde1f73b7f17ad495cffcbafaa" }, @@ -90,7 +92,10 @@ "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, "rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" }, "sacredforest-vim": { "branch": "master", "commit": "829e8c6f983d832e79c787d5ef1b5c49da0402d9" }, + "sentiment.nvim": { "branch": "main", "commit": "54a6db15b630eccfa98c32a76baf90f21c6f1e40" }, "space-vim-dark": { "branch": "master", "commit": "0ab698bd2a3959e3bed7691ac55ba4d8abefd143" }, + "tabnine-nvim": { "branch": "master", "commit": "65954170e19d99a50beecc08871e2a2b4c7ec161" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, "telescope.nvim": { "branch": "0.1.x", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, "tender.vim": { "branch": "master", "commit": "7746453a045eaa97dc413a7209268345f33f3243" }, "todo-comments.nvim": { "branch": "main", "commit": "4a6737a8d70fe1ac55c64dfa47fcb189ca431872" }, @@ -98,11 +103,13 @@ "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" }, "vim-afterglow": { "branch": "master", "commit": "d27af1a1c8188523d2625475896b130b562bc98c" }, "vim-be-good": { "branch": "master", "commit": "c290810728a4f75e334b07dc0f3a4cdea908d351" }, + "vim-colors-lucid": { "branch": "master", "commit": "4efacf11f4bda195a4dd2612a87515a2ebd6b3a0" }, "vim-colors-off": { "branch": "main", "commit": "2879dc5d358a4856873ca708399b34a436a0f3ec" }, "vim-colors-pencil": { "branch": "master", "commit": "1101118fa3e3038568541e9a67511513aac5d19b" }, "vim-colors-plain": { "branch": "master", "commit": "908ed31ad398c18b47a3f4f71c97313754484ff8" }, "vim-colors-solarized": { "branch": "master", "commit": "528a59f26d12278698bb946f8fb82a63711eec21" }, "vim-dichromatic": { "branch": "master", "commit": "9765a72ce24ddae48afe12c316583a22c82ad812" }, + "vim-dogrun": { "branch": "main", "commit": "940814494be4adb066d4eb96409a85cb84c0bd6b" }, "vim-enfocado": { "branch": "main", "commit": "2a8fffdff1a20473f0fbacef10f2fb356e039b31" }, "vim-envy": { "branch": "master", "commit": "e1afb0cd542fc4afeb779f1c894abf5527d965ea" }, "vim-fish": { "branch": "master", "commit": "50b95cbbcd09c046121367d49039710e9dc9c15f" }, diff --git a/lua/custom/plugins/colorschemes/vim-colors-lucid.lua b/lua/custom/plugins/colorschemes/vim-colors-lucid.lua new file mode 100644 index 00000000..20edde6b --- /dev/null +++ b/lua/custom/plugins/colorschemes/vim-colors-lucid.lua @@ -0,0 +1 @@ +return { 'cseelus/vim-colors-lucid' } diff --git a/lua/custom/plugins/colorschemes/vim-dogrun.lua b/lua/custom/plugins/colorschemes/vim-dogrun.lua new file mode 100644 index 00000000..abaf936e --- /dev/null +++ b/lua/custom/plugins/colorschemes/vim-dogrun.lua @@ -0,0 +1 @@ +return { 'wadackel/vim-dogrun' } diff --git a/lua/custom/plugins/sentiment.lua b/lua/custom/plugins/sentiment.lua new file mode 100644 index 00000000..25b60f29 --- /dev/null +++ b/lua/custom/plugins/sentiment.lua @@ -0,0 +1,12 @@ +return { + 'utilyre/sentiment.nvim', + version = '*', + event = 'VeryLazy', -- keep for lazy loading + opts = { + -- config + }, + init = function() + -- `matchparen.vim` needs to be disabled manually in case of lazy loading + vim.g.loaded_matchparen = 1 + end, +}