From 8ad3acaa15ed0eb2c31a561f009ffec570d0fafd Mon Sep 17 00:00:00 2001 From: Domipoke <42298508+Domipoke@users.noreply.github.com> Date: Thu, 25 Jun 2026 19:20:54 +0200 Subject: [PATCH] nvim --- nvim/init.lua | 113 +++++++++++++++++++++++++ nvim/lazy-lock.json | 32 +++++++ nvim/lua/core/init.lua | 2 + nvim/lua/core/keymaps.lua | 78 +++++++++++++++++ nvim/lua/core/settings.lua | 96 +++++++++++++++++++++ nvim/lua/lazy-init.lua | 40 +++++++++ nvim/lua/plugins/alpha.lua | 30 +++++++ nvim/lua/plugins/colors.lua | 48 +++++++++++ nvim/lua/plugins/comment.lua | 17 ++++ nvim/lua/plugins/fzf.lua | 43 ++++++++++ nvim/lua/plugins/git.lua | 12 +++ nvim/lua/plugins/incline.lua | 61 ++++++++++++++ nvim/lua/plugins/indent.lua | 11 +++ nvim/lua/plugins/lualine.lua | 10 +++ nvim/lua/plugins/mason.lua | 39 +++++++++ nvim/lua/plugins/mini-bracket.lua | 15 ++++ nvim/lua/plugins/neo-tree.lua | 13 +++ nvim/lua/plugins/none-ls.lua | 17 ++++ nvim/lua/plugins/nvim-autopair.lua | 28 ++++++ nvim/lua/plugins/nvim-cmp.lua | 44 ++++++++++ nvim/lua/plugins/nvim-lspconfig.lua | 122 +++++++++++++++++++++++++++ nvim/lua/plugins/nvim-treesitter.lua | 22 +++++ nvim/lua/plugins/refactor.lua | 18 ++++ nvim/lua/plugins/rename.lua | 6 ++ nvim/nvim-pack-lock.json | 36 ++++++++ nvim/wakatime.txt | 2 + 26 files changed, 955 insertions(+) create mode 100644 nvim/init.lua create mode 100644 nvim/lazy-lock.json create mode 100644 nvim/lua/core/init.lua create mode 100644 nvim/lua/core/keymaps.lua create mode 100644 nvim/lua/core/settings.lua create mode 100644 nvim/lua/lazy-init.lua create mode 100644 nvim/lua/plugins/alpha.lua create mode 100644 nvim/lua/plugins/colors.lua create mode 100644 nvim/lua/plugins/comment.lua create mode 100644 nvim/lua/plugins/fzf.lua create mode 100644 nvim/lua/plugins/git.lua create mode 100644 nvim/lua/plugins/incline.lua create mode 100644 nvim/lua/plugins/indent.lua create mode 100644 nvim/lua/plugins/lualine.lua create mode 100644 nvim/lua/plugins/mason.lua create mode 100644 nvim/lua/plugins/mini-bracket.lua create mode 100644 nvim/lua/plugins/neo-tree.lua create mode 100644 nvim/lua/plugins/none-ls.lua create mode 100644 nvim/lua/plugins/nvim-autopair.lua create mode 100644 nvim/lua/plugins/nvim-cmp.lua create mode 100644 nvim/lua/plugins/nvim-lspconfig.lua create mode 100644 nvim/lua/plugins/nvim-treesitter.lua create mode 100644 nvim/lua/plugins/refactor.lua create mode 100644 nvim/lua/plugins/rename.lua create mode 100644 nvim/nvim-pack-lock.json create mode 100644 nvim/wakatime.txt diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 0000000..b3853af --- /dev/null +++ b/nvim/init.lua @@ -0,0 +1,113 @@ +require('core') +require('lazy-init') + +-- -- Set as the leader key +-- -- See `:h mapleader` +-- -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) +-- vim.g.mapleader = ' ' + +-- -- OPTIONS +-- -- +-- -- See `:h vim.o` +-- -- NOTE: You can change these options as you wish! +-- -- For more options, you can see `:h option-list` +-- -- To see documentation for an option, you can use `:h 'optionname'`, for example `:h 'number'` +-- -- (Note the single quotes) + +-- vim.o.number = true -- Show line numbers in a column. + +-- -- Show line numbers relative to where the cursor is. +-- -- Affects the 'number' option above, see `:h number_relativenumber`. +-- vim.o.relativenumber = true + +-- -- Sync clipboard between OS and Neovim. Schedule the setting after `UIEnter` because it can +-- -- increase startup-time. Remove this option if you want your OS clipboard to remain independent. +-- -- See `:h 'clipboard'` +-- vim.api.nvim_create_autocmd('UIEnter', { +-- callback = function() +-- vim.o.clipboard = 'unnamedplus' +-- end, +-- }) + +-- -- Case-insensitive searching UNLESS \C or one or more capital letters in the search term +-- vim.o.ignorecase = true +-- vim.o.smartcase = true + +-- vim.o.cursorline = true -- Highlight the line where the cursor is on. +-- vim.o.scrolloff = 10 -- Keep this many screen lines above/below the cursor. +-- vim.o.list = true -- Show and trailing spaces. + +-- -- Tabs +-- vim.o.tabstop = 4 +-- -- If performing an operation that would fail due to unsaved changes in the buffer (like `:q`), +-- -- instead raise a dialog asking if you wish to save the current file(s). See `:h 'confirm'` +-- vim.o.confirm = true + +-- -- KEYMAPS +-- -- +-- -- See `:h vim.keymap.set()`, `:h mapping`, `:h keycodes` + +-- -- Use to exit terminal mode +-- vim.keymap.set('t', '', '') + +-- -- Map , , , to navigate between windows in any modes +-- vim.keymap.set({ 't', 'i' }, '', 'h') +-- vim.keymap.set({ 't', 'i' }, '', 'j') +-- vim.keymap.set({ 't', 'i' }, '', 'k') +-- vim.keymap.set({ 't', 'i' }, '', 'l') +-- vim.keymap.set({ 'n' }, '', 'h') +-- vim.keymap.set({ 'n' }, '', 'j') +-- vim.keymap.set({ 'n' }, '', 'k') +-- vim.keymap.set({ 'n' }, '', 'l') + +-- -- AUTOCOMMANDS (EVENT HANDLERS) +-- -- +-- -- See `:h lua-guide-autocommands`, `:h autocmd`, `:h nvim_create_autocmd()` + +-- -- Highlight when yanking (copying) text. +-- -- Try it with `yap` in normal mode. See `:h vim.hl.on_yank()` +-- vim.api.nvim_create_autocmd('TextYankPost', { +-- desc = 'Highlight when yanking (copying) text', +-- callback = function() +-- vim.hl.on_yank() +-- end, +-- }) + +-- -- USER COMMANDS: DEFINE CUSTOM COMMANDS +-- -- +-- -- See `:h nvim_create_user_command()` and `:h user-commands` + +-- -- Create a command `:GitBlameLine` that print the git blame for the current line +-- vim.api.nvim_create_user_command('GitBlameLine', function() +-- local line_number = vim.fn.line('.') -- Get the current line number. See `:h line()` +-- local filename = vim.api.nvim_buf_get_name(0) +-- print(vim.system({ 'git', 'blame', '-L', line_number .. ',+1', filename }):wait().stdout) +-- end, { desc = 'Print the git blame for the current line' }) + +-- -- PLUGINS +-- -- +-- -- See `:h :packadd`, `:h vim.pack` + +-- -- Add the "nohlsearch" package to automatically disable search highlighting after +-- -- 'updatetime' and when going to insert mode. +-- vim.cmd('packadd! nohlsearch') + +-- -- Install third-party plugins via "vim.pack.add()". + +-- --require('fzf-lua').setup { fzf_colors = true } +-- --require('mini.completion').setup {} +-- --require('quicker').setup {} +-- --require('gitsigns').setup {} + +-- -- Tokyo Night package +-- -- +-- --require("tokyonight").setup({ +-- -- style = "night", +-- -- transparent = true, +-- --}) + +-- --vim.cmd("colorscheme tokyonight") +-- -- Clipboard sync +-- vim.opt.clipboard = "unnamedplus" + +-- require('config.lazy') diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json new file mode 100644 index 0000000..54e1eef --- /dev/null +++ b/nvim/lazy-lock.json @@ -0,0 +1,32 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "LuaSnip": { "branch": "master", "commit": "0abc8f390b278c3b4aabc4c004ac8a088b65cf24" }, + "alpha-nvim": { "branch": "main", "commit": "6c6a89d5b068b5251c8bdf0dd57bb921bcfeeb09" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, + "fzf-lua": { "branch": "main", "commit": "988416cc782dfe28bff3f0da9b8c943b236cd86a" }, + "git.nvim": { "branch": "main", "commit": "7cfb3080c68125dbf6b7ee129f3108fdb275c4dd" }, + "gitsigns.nvim": { "branch": "main", "commit": "dd3f588bacbeb041be6facf1742e42097f62165d" }, + "inc-rename.nvim": { "branch": "main", "commit": "0074b551a17338ccdcd299bd86687cc651bcb33d" }, + "incline.nvim": { "branch": "main", "commit": "debd628e9395f7a9da57bdc31ce75ca6b40a880b" }, + "indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "lualine.nvim": { "branch": "master", "commit": "221ce6b2d999187044529f49da6554a92f740a96" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "0a695750d747db1e7e70bcf0267ef8951c95fc83" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "443f1ef8b5e6bf47045cb2217b6f748a223cf7dc" }, + "mason.nvim": { "branch": "main", "commit": "16ba83bfc8a25f52bb545134f5bee082b195c460" }, + "mini.bracketed": { "branch": "main", "commit": "d94d51dcee625723aaaf8d38174b48522eaf9131" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "ebd66767191714e008ce73b769518a763ff31bdc" }, + "none-ls.nvim": { "branch": "main", "commit": "01f8e62ea11603e59ad9ff7afcfa94fd183f76d6" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-autopairs": { "branch": "master", "commit": "7b9923abad60b903ece7c52940e1321d39eccc79" }, + "nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" }, + "nvim-lspconfig": { "branch": "master", "commit": "07dff35e7c95288861200b788ef32d6103f107f0" }, + "nvim-treesitter": { "branch": "master", "commit": "cf12346a3414fa1b06af75c79faebe7f76df080a" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "6141a40173c6efa98242dc951ed4b6f892c97027" }, + "nvim-web-devicons": { "branch": "master", "commit": "dfbfaa967a6f7ec50789bead7ef87e336c1fa63c" }, + "onedark.nvim": { "branch": "master", "commit": "df4792accde9db0043121f32628bcf8e645d9aea" }, + "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, + "refactoring.nvim": { "branch": "master", "commit": "624c01e8175901484eac74512baf35e9dfe269b8" } +} diff --git a/nvim/lua/core/init.lua b/nvim/lua/core/init.lua new file mode 100644 index 0000000..e42b216 --- /dev/null +++ b/nvim/lua/core/init.lua @@ -0,0 +1,2 @@ +require('core.keymaps') +require('core.settings') \ No newline at end of file diff --git a/nvim/lua/core/keymaps.lua b/nvim/lua/core/keymaps.lua new file mode 100644 index 0000000..9d7ec99 --- /dev/null +++ b/nvim/lua/core/keymaps.lua @@ -0,0 +1,78 @@ +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +-- Keymaps for better default experience +vim.keymap.set({ "n", "v" }, "", "", { silent = true }) + +-- Space + s saves the file +vim.keymap.set("n", "s", ":write", { silent = true }) + +-- Move normally between wrapped lines +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 }) + +-- Shift + q - Quit +vim.keymap.set("n", "Q", "q") + +-- vv - Makes vertical split +vim.keymap.set("n", "vv", "v") +-- ss - Makes horizontal split +vim.keymap.set("n", "ss", "s") + +-- Quick jumping between splits +vim.keymap.set("n", "", "j") +vim.keymap.set("n", "", "k") +vim.keymap.set("n", "", "h") +vim.keymap.set("n", "", "l") + +-- Indenting in visual mode (tab/shift+tab) +vim.keymap.set("v", "", ">gv") +vim.keymap.set("v", "", " y y`]") +vim.cmd("vnoremap p p`]") +vim.cmd("nnoremap p p`]") + +-- Space + Space to clean search highlight +vim.keymap.set("n", "h", ":noh", { silent = true }) + +-- Fixes pasting after visual selection. +vim.keymap.set("v", "p", '"_dP') + +-- Select all +vim.keymap.set("n", "", "ggG") + +-- Save with root permission (not working for now) +--vim.api.nvim_create_user_command('W', 'w !sudo tee > /dev/null %', {}) + +-- Disable continuations +vim.keymap.set("n", "o", "o^Da", opts) +vim.keymap.set("n", "O", "O^Da", opts) + +-- Jumplist +vim.keymap.set("n", "", "", opts) + +-- New tab +vim.keymap.set("n", "te", ":tabedit") +vim.keymap.set("n", "", ":tabnext", opts) +vim.keymap.set("n", "", ":tabprev", opts) + +-- Resize window +vim.keymap.set("n", "", "<") +vim.keymap.set("n", "", ">") +vim.keymap.set("n", "", "+") +vim.keymap.set("n", "", "-") + +-- Diagnostics +vim.keymap.set("n", "", function() + vim.diagnostic.goto_next() +end, opts) + +vim.keymap.set("n", "r", function() + require("craftzdog.hsl").replaceHexWithHSL() +end) + +vim.keymap.set("n", "i", function() + require("craftzdog.lsp").toggleInlayHints() +end) \ No newline at end of file diff --git a/nvim/lua/core/settings.lua b/nvim/lua/core/settings.lua new file mode 100644 index 0000000..52bf56e --- /dev/null +++ b/nvim/lua/core/settings.lua @@ -0,0 +1,96 @@ +-- Set as the leader key +vim.g.mapleader = " " +vim.g.maplocalleader = " " + +-- Set highlight on search +vim.o.hlsearch = true + +-- Make line numbers default +vim.wo.number = true + +-- Enable mouse mode +vim.o.mouse = "a" + +-- Sync clipboard between OS and Neovim. +vim.o.clipboard = "unnamedplus" + +-- Enable break indent +vim.o.breakindent = true + +-- No swap files +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.writebackup = false +-- Save undo history +vim.o.undofile = true +vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" + +-- Case-insensitive searching UNLESS \C or capital in search +vim.o.ignorecase = true +vim.o.smartcase = true + +-- Keep signcolumn on by default +vim.wo.signcolumn = "yes" + +-- Decrease update time +vim.o.updatetime = 250 +vim.o.timeoutlen = 300 + +-- Set completeopt to have a better completion experience +vim.o.completeopt = "menuone,noselect" + +-- NOTE: You should make sure your terminal supports this +vim.o.termguicolors = true + +-- Don't show modes (insert/visual) +vim.opt.showmode = true + +-- " Open splits on the right and below +vim.opt.splitbelow = true +vim.opt.splitright = true + +-- " update vim after file update from outside +vim.opt.autoread = true + +-- " Indentation +vim.opt.autoindent = true +vim.opt.smartindent = true +vim.opt.smarttab = true +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 + +-- " Always use spaces insted of tabs +vim.opt.expandtab = true + +-- " Don't wrap lines +vim.opt.wrap = true +-- " Wrap lines at convenient points +vim.opt.linebreak = true + +-- " Show line breaks +vim.opt.showbreak = "↳" + +-- " Start scrolling when we'are 8 lines aways from borders +vim.opt.scrolloff = 8 +vim.opt.sidescrolloff = 15 +vim.opt.sidescroll = 5 + +-- " This makes vim act like all other editors, buffers can +-- " exist in the background without being in a window. +vim.opt.hidden = true + +-- " Add the g flag to search/replace by default +vim.opt.gdefault = true + +-- Lazy redraw +vim.o.lazyredraw = true + +-- Spell checker + +vim.opt.spelllang = "en_us" +vim.opt.spell = true + +-- Remove $ + +vim.cmd("set nolist") \ No newline at end of file diff --git a/nvim/lua/lazy-init.lua b/nvim/lua/lazy-init.lua new file mode 100644 index 0000000..18ad1d8 --- /dev/null +++ b/nvim/lua/lazy-init.lua @@ -0,0 +1,40 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + + -- automatically check for plugin updates + checker = { enabled = true, notify = false }, + change_detection = { notify = false }, + rocks = { + enabled = false, + hererocks = false + } +}) diff --git a/nvim/lua/plugins/alpha.lua b/nvim/lua/plugins/alpha.lua new file mode 100644 index 0000000..f520f7c --- /dev/null +++ b/nvim/lua/plugins/alpha.lua @@ -0,0 +1,30 @@ + +return { + "goolord/alpha-nvim", + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + + config = function() + local alpha = require("alpha") + local dashboard = require("alpha.themes.startify") + + dashboard.section.header.val = { + [[▐▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▌]], + [[▐ ▄▄▄ ██ ▄█▀ ██▓ ██▓▓█████▄ ▄▄▄██▀▀▀██ ▄█▀▌]], + [[▐▒████▄ ██▄█▒ ▓██▒▓██▒▒██▀ ██▌ ▒██ ██▄█▒ ▌]], + [[▐▒██ ▀█▄ ▓███▄░ ▒██▒▒██▒░██ █▌ ░██ ▓███▄░ ▌]], + [[▐░██▄▄▄▄██ ▓██ █▄ ░██░░██░░▓█▄ ▌▓██▄██▓ ▓██ █▄ ▌]], + [[▐ ▓█ ▓██▒▒██▒ █▄░██░░██░░▒████▓ ▓███▒ ▒██▒ █▄▌]], + [[▐ ▒▒ ▓▒█░▒ ▒▒ ▓▒░▓ ░▓ ▒▒▓ ▒ ▒▓▒▒░ ▒ ▒▒ ▓▒▌]], + [[▐ ▒ ▒▒ ░░ ░▒ ▒░ ▒ ░ ▒ ░ ░ ▒ ▒ ▒ ░▒░ ░ ░▒ ▒░▌]], + [[▐ ░ ▒ ░ ░░ ░ ▒ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ░░ ░ ▌]], + [[▐ ░ ░░ ░ ░ ░ ░ ░ ░ ░ ░ ▌]], + [[▐ ░ ▌]], + [[▐▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▌]], + } + + alpha.setup(dashboard.opts) + end, + } + \ No newline at end of file diff --git a/nvim/lua/plugins/colors.lua b/nvim/lua/plugins/colors.lua new file mode 100644 index 0000000..2cb5e9f --- /dev/null +++ b/nvim/lua/plugins/colors.lua @@ -0,0 +1,48 @@ +return { + "navarasu/onedark.nvim", + priority = 1000, + config = function() + require('onedark').setup { + -- Main options -- + style = 'dark', -- Default theme style. Choose between 'dark', 'darker', 'cool', 'deep', 'warm', 'warmer' and 'light' + transparent = false, -- Show/hide background + term_colors = true, -- Change terminal color as per the selected theme style + ending_tildes = false, -- Show the end-of-buffer tildes. By default they are hidden + cmp_itemkind_reverse = false, -- reverse item kind highlights in cmp menu + + -- toggle theme style --- + toggle_style_key = nil, -- keybind to toggle theme style. Leave it nil to disable it, or set it to a string, for example "ts" + toggle_style_list = {'dark', 'darker', 'cool', 'deep', 'warm', 'warmer', 'light'}, -- List of styles to toggle between + + -- Change code style --- + -- Options are italic, bold, underline, none + -- You can configure multiple style with comma separated, For e.g., keywords = 'italic,bold' + code_style = { + comments = 'italic', + keywords = 'none', + functions = 'none', + strings = 'none', + variables = 'none' + }, + + -- Lualine options -- + lualine = { + transparent = false, -- lualine center bar transparency + }, + + -- Custom Highlights -- + colors = {}, -- Override default colors + highlights = {}, -- Override highlight groups + + -- Plugins Config -- + diagnostics = { + darker = true, -- darker colors for diagnostic + undercurl = true, -- use undercurl instead of underline for diagnostics + background = true, -- use background color for virtual text + }, + } + vim.cmd([[ + colorscheme onedark + ]]) + end + } \ No newline at end of file diff --git a/nvim/lua/plugins/comment.lua b/nvim/lua/plugins/comment.lua new file mode 100644 index 0000000..0d77b60 --- /dev/null +++ b/nvim/lua/plugins/comment.lua @@ -0,0 +1,17 @@ +return { + "numToStr/Comment.nvim", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "JoosepAlviste/nvim-ts-context-commentstring", + }, + config = function() + local comment = require("Comment") + + local ts_context_commentstring = require("ts_context_commentstring.integrations.comment_nvim") + + comment.setup({ + -- for commenting tsx and jsx files + pre_hook = ts_context_commentstring.create_pre_hook(), + }) + end, + } \ No newline at end of file diff --git a/nvim/lua/plugins/fzf.lua b/nvim/lua/plugins/fzf.lua new file mode 100644 index 0000000..fb71fa1 --- /dev/null +++ b/nvim/lua/plugins/fzf.lua @@ -0,0 +1,43 @@ +return { + "ibhagwan/fzf-lua", + event = "VeryLazy", + config = function() + require("fzf-lua").setup({ + colorscheme = "onedark", + winopts = { + fullscreen = true, + preview = { + layout = "vertical", + vertical = "up:45%", -- up|down:size + }, + }, + fzf_opts = { + ["--keep-right"] = "", -- https://github.com/ibhagwan/fzf-lua/issues/269 + ["--layout"] = "default", + -- ["--ansi"] = false, + }, + keymap = { + fzf = { + ["ctrl-r"] = "select-all+accept", -- https://github.com/ibhagwan/fzf-lua/issues/324 + }, + }, + files = { + git_icons = true, + file_icons = true, + }, + }) + + vim.keymap.set("n", "", "lua require('fzf-lua').files()", { silent = true }) + + vim.keymap.set("n", "b", "lua require('fzf-lua').buffers()", { desc = "Fuzzy find recent files" }) + + vim.keymap.set( + "n", + "/", + "lua require('fzf-lua').live_grep_resume()", + { desc = "Find string in cwd" } + ) + + vim.keymap.set("n", "gr", ":FzfLua lsp_references") + end, + } \ No newline at end of file diff --git a/nvim/lua/plugins/git.lua b/nvim/lua/plugins/git.lua new file mode 100644 index 0000000..3136423 --- /dev/null +++ b/nvim/lua/plugins/git.lua @@ -0,0 +1,12 @@ +return { + "dinhhuy258/git.nvim", + event = "BufReadPre", + opts = { + keymaps = { + -- Open blame window + blame = "gb", + -- Open file/folder in git repository + browse = "go", + }, + }, +} \ No newline at end of file diff --git a/nvim/lua/plugins/incline.lua b/nvim/lua/plugins/incline.lua new file mode 100644 index 0000000..13162f0 --- /dev/null +++ b/nvim/lua/plugins/incline.lua @@ -0,0 +1,61 @@ +return { + "b0o/incline.nvim", + dependencies = { "navarasu/onedark.nvim", "kyazdani42/nvim-web-devicons", "lewis6991/gitsigns.nvim" }, + event = "BufReadPre", + priority = 1200, + config = function() + local devicons = require("nvim-web-devicons") + + require("incline").setup { + render = function(props) + local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ':t') + if filename == '' then + filename = '[No Name]' + end + local ft_icon, ft_color = devicons.get_icon_color(filename) + + local function get_git_diff() + local icons = { removed = '', changed = '', added = '' } + local signs = vim.b[props.buf].gitsigns_status_dict + local labels = {} + if signs == nil then + return labels + end + for name, icon in pairs(icons) do + if tonumber(signs[name]) and signs[name] > 0 then + table.insert(labels, { icon .. signs[name] .. ' ', group = 'Diff' .. name }) + end + end + if #labels > 0 then + table.insert(labels, { '┊ ' }) + end + return labels + end + + local function get_diagnostic_label() + local icons = { error = '', warn = '', info = '', hint = '' } + local label = {} + + for severity, icon in pairs(icons) do + local n = #vim.diagnostic.get(props.buf, { severity = vim.diagnostic.severity[string.upper(severity)] }) + if n > 0 then + table.insert(label, { icon .. n .. ' ', group = 'DiagnosticSign' .. severity }) + end + end + if #label > 0 then + table.insert(label, { '┊ ' }) + end + return label + end + + return { + { get_diagnostic_label() }, + { get_git_diff() }, + { (ft_icon or '') .. ' ', guifg = ft_color, guibg = 'none' }, + { filename .. ' ', gui = vim.bo[props.buf].modified and 'bold,italic' or 'bold' }, + { '┊  ' .. vim.api.nvim_win_get_number(props.win), group = 'DevIconWindows' }, + } + end, + } + end, +} diff --git a/nvim/lua/plugins/indent.lua b/nvim/lua/plugins/indent.lua new file mode 100644 index 0000000..631d8d2 --- /dev/null +++ b/nvim/lua/plugins/indent.lua @@ -0,0 +1,11 @@ +return { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + opts = {}, + config = function() + require("ibl").setup({ + scope = { enabled = false }, + indent = { char = "|" }, + }) + end + } \ No newline at end of file diff --git a/nvim/lua/plugins/lualine.lua b/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..578cfeb --- /dev/null +++ b/nvim/lua/plugins/lualine.lua @@ -0,0 +1,10 @@ +return { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + opts = { + options = { + -- globalstatus = false, + theme = "onedark", + }, + }, +} \ No newline at end of file diff --git a/nvim/lua/plugins/mason.lua b/nvim/lua/plugins/mason.lua new file mode 100644 index 0000000..9b66bac --- /dev/null +++ b/nvim/lua/plugins/mason.lua @@ -0,0 +1,39 @@ +return { + "williamboman/mason.nvim", + dependencies = { + "williamboman/mason-lspconfig.nvim", + "WhoIsSethDaniel/mason-tool-installer.nvim", + }, + config = function() + local mason = require("mason") + local mason_lspconfig = require("mason-lspconfig") + local mason_tool_installer = require("mason-tool-installer") + + mason.setup({}) + + -- Repo with all lsp server: https://github.com/williamboman/mason-lspconfig.nvim?tab=readme-ov-file#available-lsp-servers + mason_lspconfig.setup({ + ensure_installed = { + "lua_ls", + "html", + "cssls", + "dockerls", + "docker_compose_language_service", + "rust_analyzer", + "jsonls", + "markdown_oxide", + "tailwindcss", + }, + automatic_installation = true, + }) + + mason_tool_installer.setup({ + ensure_installed = { + "prettier", + "stylua", + "eslint_d", + "prettierd", + }, + }) + end, +} diff --git a/nvim/lua/plugins/mini-bracket.lua b/nvim/lua/plugins/mini-bracket.lua new file mode 100644 index 0000000..7fb21f4 --- /dev/null +++ b/nvim/lua/plugins/mini-bracket.lua @@ -0,0 +1,15 @@ +-- Go forward/backward with square brackets +return { + "echasnovski/mini.bracketed", + event = "BufReadPost", + config = function() + local bracketed = require("mini.bracketed") + bracketed.setup({ + file = { suffix = "" }, + window = { suffix = "" }, + quickfix = { suffix = "" }, + yank = { suffix = "" }, + treesitter = { suffix = "n" }, + }) + end, +} \ No newline at end of file diff --git a/nvim/lua/plugins/neo-tree.lua b/nvim/lua/plugins/neo-tree.lua new file mode 100644 index 0000000..edba057 --- /dev/null +++ b/nvim/lua/plugins/neo-tree.lua @@ -0,0 +1,13 @@ +return { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + "MunifTanjim/nui.nvim", + }, + config = function() + vim.keymap.set("n", "", ":Neotree filesystem reveal left", {}) + vim.keymap.set("n", "bf", ":Neotree buffers reveal float", {}) + end, +} \ No newline at end of file diff --git a/nvim/lua/plugins/none-ls.lua b/nvim/lua/plugins/none-ls.lua new file mode 100644 index 0000000..2b383f0 --- /dev/null +++ b/nvim/lua/plugins/none-ls.lua @@ -0,0 +1,17 @@ +return { + "nvimtools/none-ls.nvim", + config = function() + local null_ls = require("null-ls") + null_ls.setup({ + sources = { + null_ls.builtins.formatting.stylua, + null_ls.builtins.formatting.prettier, + null_ls.builtins.diagnostics.erb_lint, + null_ls.builtins.diagnostics.rubocop, + null_ls.builtins.formatting.rubocop, + }, + }) + + vim.keymap.set("n", "gf", vim.lsp.buf.format, {}) + end, +} \ No newline at end of file diff --git a/nvim/lua/plugins/nvim-autopair.lua b/nvim/lua/plugins/nvim-autopair.lua new file mode 100644 index 0000000..75dbce1 --- /dev/null +++ b/nvim/lua/plugins/nvim-autopair.lua @@ -0,0 +1,28 @@ +return { + "windwp/nvim-autopairs", + event = "InsertEnter", + dependencies = { + "hrsh7th/nvim-cmp", + }, + config = function() + local autopairs = require("nvim-autopairs") + + autopairs.setup({ + check_ts = true, -- enable treesitter + ts_config = { + lua = { "string" }, -- don't add pairs in lua string treesitter nodes + javascript = { "template_string" }, -- don't add pairs in javscript template_string treesitter nodes + java = false, -- don't check treesitter on java + }, + }) + + -- import nvim-autopairs completion functionality + local cmp_autopairs = require("nvim-autopairs.completion.cmp") + + -- import nvim-cmp plugin (completions plugin) + local cmp = require("cmp") + + -- make autopairs and completion work together + cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) + end, + } \ No newline at end of file diff --git a/nvim/lua/plugins/nvim-cmp.lua b/nvim/lua/plugins/nvim-cmp.lua new file mode 100644 index 0000000..fe4f14c --- /dev/null +++ b/nvim/lua/plugins/nvim-cmp.lua @@ -0,0 +1,44 @@ +return { + { + "hrsh7th/cmp-nvim-lsp" + }, + { + "L3MON4D3/LuaSnip", + dependencies = { + "saadparwaiz1/cmp_luasnip", + "rafamadriz/friendly-snippets", + }, + }, + { + "hrsh7th/nvim-cmp", + config = function() + local cmp = require("cmp") + require("luasnip.loaders.from_vscode").lazy_load() + + cmp.setup({ + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, -- For luasnip users. + }, { + { name = "buffer" }, + }), + }) + end, + }, +} \ No newline at end of file diff --git a/nvim/lua/plugins/nvim-lspconfig.lua b/nvim/lua/plugins/nvim-lspconfig.lua new file mode 100644 index 0000000..cea88d3 --- /dev/null +++ b/nvim/lua/plugins/nvim-lspconfig.lua @@ -0,0 +1,122 @@ +return { + "neovim/nvim-lspconfig", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "hrsh7th/cmp-nvim-lsp", + }, + enabled = true, + config = function() + local lspconfig = require("lspconfig") + local util = require("lspconfig.util") + local cmp_nvim_lsp = require("cmp_nvim_lsp") + + -- Disable inline error messages + vim.diagnostic.config({ + virtual_text = false, + float = { + border = "single", + }, + }) + + -- Add border to floating window + vim.lsp.handlers["textDocument/signatureHelp"] = + vim.lsp.buf.hover({ border = "single", silent = true }) + vim.lsp.handlers["textDocument/hover"] = + vim.lsp.buf.hover({ border = "single", silend = true }) + + -- Make float window transparent start + + local set_hl_for_floating_window = function() + vim.api.nvim_set_hl(0, "NormalFloat", { + link = "Normal", + }) + vim.api.nvim_set_hl(0, "FloatBorder", { + bg = "none", + }) + end + + set_hl_for_floating_window() + + vim.api.nvim_create_autocmd("ColorScheme", { + pattern = "*", + desc = "Avoid overwritten by loading color schemes later", + callback = set_hl_for_floating_window, + }) + + -- Make float window transparent end + + local on_attach = function(client, bufnr) + vim.keymap.set( + "n", + "K", + vim.lsp.buf.hover, + { buffer = bufnr, desc = "Show documentation for what is under cursor" } + ) + vim.keymap.set("n", "rn", vim.lsp.buf.rename, { buffer = bufnr, desc = "Smart rename" }) + vim.keymap.set( + { "n", "v" }, + "gf", + vim.lsp.buf.code_action, + { buffer = bufnr, desc = "See available code actions" } + ) + vim.keymap.set( + "n", + "d", + vim.diagnostic.open_float, + { buffer = bufnr, desc = "Show diagnostics for line" } + ) + -- vim.keymap.set("n", "gR", "Telescope lsp_references", {buffer = bufnr, desc = 'Show definition, references'}) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, { buffer = bufnr, desc = "Go to definition" }) + end + + local capabilities = cmp_nvim_lsp.default_capabilities() + local signs = { Error = "✖", Warn = "", Hint = "󰠠", Info = "" } + for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) + end + + -- List config: + + -- configure html server + lspconfig["html"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + + -- configure lua server (with special settings) + lspconfig["lua_ls"].setup({ + capabilities = capabilities, + on_attach = on_attach, + settings = { -- custom settings for lua + Lua = { + -- make the language server recognize "vim" global + diagnostics = { + globals = { "vim" }, + }, + workspace = { + -- make language server aware of runtime files + library = { + [vim.fn.expand("$VIMRUNTIME/lua")] = true, + [vim.fn.stdpath("config") .. "/lua"] = true, + }, + }, + }, + }, + }) + + -- configure css server + lspconfig["cssls"].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + + lspconfig["ruff_lsp"].setup({}) + lspconfig["rust_analyzer"].setup({}) + lspconfig["dockerls"].setup({}) + lspconfig["jsonls"].setup({}) + lspconfig["markdown_oxide"].setup({}) + lspconfig["docker_compose_language_service"].setup({}) + lspconfig["svelte"].setup({}) + end, +} diff --git a/nvim/lua/plugins/nvim-treesitter.lua b/nvim/lua/plugins/nvim-treesitter.lua new file mode 100644 index 0000000..6756b05 --- /dev/null +++ b/nvim/lua/plugins/nvim-treesitter.lua @@ -0,0 +1,22 @@ +return { + "nvim-treesitter/nvim-treesitter", + branch = "master", + lazy = false, + build = ":TSUpdate", + config = function() + require('nvim-treesitter.configs').setup({ + ensure_installed = { "lua", "vim", "vimdoc", "python", "go", "typescript", "javascript" }, + sync_install = false, + auto_install = true, + + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + + indent = { + enable = true + } + }) + end +} diff --git a/nvim/lua/plugins/refactor.lua b/nvim/lua/plugins/refactor.lua new file mode 100644 index 0000000..02a9284 --- /dev/null +++ b/nvim/lua/plugins/refactor.lua @@ -0,0 +1,18 @@ + +-- Refactoring tool +return { + "ThePrimeagen/refactoring.nvim", + keys = { + { + "r", + function() + require("refactoring").select_refactor() + end, + mode = "v", + noremap = true, + silent = true, + expr = false, + }, + }, + opts = {}, +} \ No newline at end of file diff --git a/nvim/lua/plugins/rename.lua b/nvim/lua/plugins/rename.lua new file mode 100644 index 0000000..67cf369 --- /dev/null +++ b/nvim/lua/plugins/rename.lua @@ -0,0 +1,6 @@ +-- Incremental rename +return { + "smjonas/inc-rename.nvim", + cmd = "IncRename", + config = true, +} \ No newline at end of file diff --git a/nvim/nvim-pack-lock.json b/nvim/nvim-pack-lock.json new file mode 100644 index 0000000..fc0e1bb --- /dev/null +++ b/nvim/nvim-pack-lock.json @@ -0,0 +1,36 @@ +{ + "plugins": { + "fzf-lua": { + "rev": "3ff77862f6c62f7b850668435ae43aa026de8758", + "src": "https://github.com/ibhagwan/fzf-lua" + }, + "gitsigns.nvim": { + "rev": "dd3f588bacbeb041be6facf1742e42097f62165d", + "src": "https://github.com/lewis6991/gitsigns.nvim" + }, + "mini.completion": { + "rev": "6937ff1d7bf47ab58046c6685cc9057aa481ecb2", + "src": "https://github.com/nvim-mini/mini.completion" + }, + "nvim-lspconfig": { + "rev": "246572944c2a1e2a646c2e7609ff619b0fe74c18", + "src": "https://github.com/neovim/nvim-lspconfig" + }, + "nvim-treesitter": { + "rev": "4916d6592ede8c07973490d9322f187e07dfefac", + "src": "https://github.com/nvim-treesitter/nvim-treesitter" + }, + "nvim-treesitter-textobjects": { + "rev": "851e865342e5a4cb1ae23d31caf6e991e1c99f1e", + "src": "https://github.com/nvim-treesitter/nvim-treesitter-textobjects" + }, + "quicker.nvim": { + "rev": "1c9322b7e2967472548ba9bccd1ccd40e49d0a49", + "src": "https://github.com/stevearc/quicker.nvim" + }, + "tokyonight.nvim": { + "rev": "cdc07ac78467a233fd62c493de29a17e0cf2b2b6", + "src": "https://github.com/folke/tokyonight.nvim" + } + } +} diff --git a/nvim/wakatime.txt b/nvim/wakatime.txt new file mode 100644 index 0000000..497b769 --- /dev/null +++ b/nvim/wakatime.txt @@ -0,0 +1,2 @@ +//return { 'wakatime/vim-wakatime', lazy = false } +