├── .gitignore
├── LICENSE.md
├── README.md
├── init.lua
├── lazy-lock.json
└── lua
├── autocommands.lua
├── keymaps.lua
├── plugins
├── colorschemes.lua
├── init.lua
└── utils
│ ├── cmp.lua
│ ├── formatting.lua
│ ├── git.lua
│ ├── lsp.lua
│ ├── noice.lua
│ ├── snacks
│ ├── config.lua
│ ├── init.lua
│ └── keys.lua
│ └── utils.lua
└── settings.lua
/.gitignore:
--------------------------------------------------------------------------------
1 | lazy-lock.json
2 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | SOFTWARE.
20 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
My neovim config
2 |
3 | 
4 |
5 |
6 |
7 |
8 | [![Contributors][contributors-shield]][contributors-url]
9 | [![Forks][forks-shield]][forks-url]
10 | [![Stargazers][stars-shield]][stars-url]
11 | [![Issues][issues-shield]][issues-url]
12 |
13 |
14 |
15 |
16 |
17 |
18 | 
19 |
20 |
NOTE: my config has been rewritten. for the old version go to: Old branch
21 |
22 |
23 | My personal neovim config with all my plugins and shortcuts
24 |
25 |
26 | ·
27 | Report Bug
28 | ·
29 | Request Feature
30 |
31 |
32 |
33 |
34 |
35 | ## About
36 |
37 | 
38 |
39 | Everyone needs their own setup or tweak to the software they use everyday, to guarantee productivity and most importantly ***fun*** while working/coding.
40 |
41 | This is just my config with these features
42 | * Language servers (LSP)'s
43 | * Custom transparency keybinds, for tiling wm users. ```+t+t``` to toggle transparency
44 | * Custom terminal shortcuts to open terminals inside the editor in 3 possible places. ```+1 or +2 or +3```
45 | * Telescope as a fuzzyfinder to quickly navigate through your codebase. ```+s``` to see all available shortcuts
46 | * Bufferlines and Bufferwindows for better awareness while coding.
47 | * Nvimtree as the file *"tree"* for devs that are used to that. ```+e``` to toggle it
48 | * Different colorschemes with a shortcut to switch between them. ```+t+h```
49 |
50 | The Leader key is set to space
51 |
52 | And alot more features that help you improve your productivity.
53 | I'm not suggesting you to use my config!
54 |
55 | I'm suggesting you make your own, If you don't know how to get started check out:
56 | [Kickstarter.nvim](https://github.com/nvim-lua/kickstart.nvim).
57 | It's how I started this config too as you can see in the commit history.
58 |
59 | (back to top)
60 |
61 | 
62 |
63 |
64 | (back to top)
65 |
66 |
67 |
68 |
69 | ## Getting Started
70 |
71 | Although I recommend you to make your own config,
72 | Here are a couple of steps you can follow to get started with using nvim
73 |
74 | ### Installation
75 |
76 | 1. Make sure you have neovim installed: [Read more about it here](https://github.com/neovim/neovim/blob/master/INSTALL.md)
77 |
78 | 2. Clone my config
79 |
80 | ```sh
81 | git clone https://github.com/ErdajtSopjani/nvim
82 | ```
83 |
84 | 3. Make sure you have the necessary tools/languages installed for the LSP's here is the command for arch-based distros:
85 | ```sh
86 | sudo pacman -S nodejs clang python3 dotnet-sdk lua
87 | ```
88 |
89 | 5. Run neovim and let lazy install the plugins
90 | ```sh
91 | nvim
92 | ```
93 |
94 | 
95 |
96 |
97 | (back to top)
98 |
99 |
100 |
101 | For the new dashboard, install: `gh ext install meiji163/gh-notify`
102 |
103 |
104 | ## Usage
105 |
106 | If your're not familiar with vim/neovim and you want to get started open up neovim ```nvim``` and run ```:Tutor```.
107 | This will open up a window that will guide you through vim bindings:
108 |
109 | 
110 |
111 |
112 | If you want more info on the keybinds you can press SPACE as it's set as the main key.
113 | And a plugin called which key will guide you through the shortcuts:
114 |
115 | 
116 |
117 | (back to top)
118 |
119 |
120 |
121 |
122 |
123 |
124 | [contributors-shield]: https://img.shields.io/github/contributors/ErdajtSopjani/nvim?style=for-the-badge
125 | [contributors-url]: https://github.com/ErdajtSopjani/nvim/graphs/contributors
126 | [forks-shield]: https://img.shields.io/github/forks/ErdajtSopjani/nvim?style=for-the-badge
127 | [forks-url]: https://github.com/ErdajtSopjani/nvim/network/members
128 | [stars-shield]: https://img.shields.io/github/stars/ErdajtSopjani/nvim?style=for-the-badge
129 | [stars-url]: https://github.com/ErdajtSopjani/nvim/stargazers
130 | [issues-shield]: https://img.shields.io/github/issues/ErdajtSopjani/nvim?style=for-the-badge
131 | [issues-url]: https://github.com/ErdajtSopjani/nvim/issues
132 | [Bootstrap.com]: https://img.shields.io/github/languages/top/ErdajtSopjani/nvim?color=purple&style=for-the-badge
133 | [Bootstrap-url]: https://dotnet.microsoft.com/en-us/download
134 |
--------------------------------------------------------------------------------
/init.lua:
--------------------------------------------------------------------------------
1 | require("settings")
2 | require("autocommands")
3 | require("plugins.init")
4 | require("keymaps")
5 |
--------------------------------------------------------------------------------
/lazy-lock.json:
--------------------------------------------------------------------------------
1 | {
2 | "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
3 | "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
4 | "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
5 | "catppucin": { "branch": "main", "commit": "5b5e3aef9ad7af84f463d17b5479f06b87d5c429" },
6 | "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
7 | "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
8 | "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
9 | "conform.nvim": { "branch": "master", "commit": "db8a4a9edb217067b1d7a2e0362c74bfe9cc944d" },
10 | "copilot.vim": { "branch": "release", "commit": "5015939f131627a6a332c9e3ecad9a7cb4c2e549" },
11 | "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
12 | "everforest": { "branch": "master", "commit": "29d1f4f8b63dc91db277e977068f912939c8cae8" },
13 | "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
14 | "git-blame.nvim": { "branch": "master", "commit": "2883a7460f611c2705b23f12d58d398d5ce6ec00" },
15 | "github-nvim-theme": { "branch": "main", "commit": "c106c9472154d6b2c74b74565616b877ae8ed31d" },
16 | "gitsigns.nvim": { "branch": "main", "commit": "4c40357994f386e72be92a46f41fc1664c84c87d" },
17 | "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
18 | "lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" },
19 | "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
20 | "mason-tool-installer.nvim": { "branch": "main", "commit": "5639d58a3d11ff7c05c8e31e159bfedae55d7961" },
21 | "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
22 | "mini.icons": { "branch": "main", "commit": "ec61af6e606fc89ee3b1d8f2f20166a3ca917a36" },
23 | "multicursor.nvim": { "branch": "1.0", "commit": "c117b3fc537cda262a06638ca88fe6de1b53ab59" },
24 | "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
25 | "neogit": { "branch": "master", "commit": "12f78aaabb37b4946254dd5e47cf7b552904937a" },
26 | "nightfox.nvim": { "branch": "main", "commit": "ba47d4b4c5ec308718641ba7402c143836f35aa9" },
27 | "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
28 | "nui.nvim": { "branch": "main", "commit": "8d3bce9764e627b62b07424e0df77f680d47ffdb" },
29 | "nvim-autopairs": { "branch": "master", "commit": "68f0e5c3dab23261a945272032ee6700af86227a" },
30 | "nvim-cmp": { "branch": "main", "commit": "c27370703e798666486e3064b64d59eaf4bdc6d5" },
31 | "nvim-lspconfig": { "branch": "master", "commit": "84e0cd5a3c58e88ef706fdf4a1eed59ded1d3ce2" },
32 | "nvim-spectre": { "branch": "master", "commit": "ddd7383e856a7c939cb4f5143278fe041bbb8cb9" },
33 | "nvim-treesitter": { "branch": "master", "commit": "71ac531a6301b6d5f4dc4d7157ffd8bd8d6d769e" },
34 | "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
35 | "nvim-web-devicons": { "branch": "master", "commit": "ab4cfee554e501f497bce0856788d43cf2eb93d7" },
36 | "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
37 | "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" },
38 | "telescope.nvim": { "branch": "master", "commit": "814f102cd1da3dc78c7d2f20f2ef3ed3cdf0e6e4" },
39 | "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
40 | "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" },
41 | "transparent.nvim": { "branch": "main", "commit": "8a2749a2fa74f97fe6557f61b89ac7fd873f3c21" },
42 | "vim-dadbod": { "branch": "master", "commit": "9f0ca8bcef704659820a95c3bbd2c262583a66a1" },
43 | "vim-dadbod-completion": { "branch": "master", "commit": "3f5783c12e184e4b6f05dfcbd7c1a6da05b4d66e" },
44 | "vim-dadbod-ui": { "branch": "master", "commit": "f4d37b7312ae6489e5c04bee654ca521baac188a" },
45 | "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
46 | }
47 |
--------------------------------------------------------------------------------
/lua/autocommands.lua:
--------------------------------------------------------------------------------
1 | -- [[ Basic Autocommands ]]
2 | -- See `:help lua-guide-autocommands`
3 |
4 | -- Highlight when yanking (copying) text
5 | -- Try it with `yap` in normal mode
6 | -- See `:help vim.highlight.on_yank()`
7 | vim.api.nvim_create_autocmd("TextYankPost", {
8 | desc = "Highlight when yanking (copying) text",
9 | group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }),
10 | callback = function()
11 | vim.highlight.on_yank()
12 | end,
13 | })
14 |
15 | -- [[ Install `lazy.nvim` plugin manager ]]
16 | -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
17 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
18 | if not vim.loop.fs_stat(lazypath) then
19 | local lazyrepo = "https://github.com/folke/lazy.nvim.git"
20 | vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
21 | end ---@diagnostic disable-next-line: undefined-field
22 | vim.opt.rtp:prepend(lazypath)
23 |
--------------------------------------------------------------------------------
/lua/keymaps.lua:
--------------------------------------------------------------------------------
1 | -- [[ Basic Keymaps ]]
2 | -- See `:help vim.keymap.set()`
3 |
4 | -- Set highlight on search, but clear on pressing in normal mode
5 | vim.opt.hlsearch = true
6 | vim.keymap.set("n", "", "nohlsearch")
7 |
8 | -- Diagnostic keymaps
9 | vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous [D]iagnostic message" })
10 | vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next [D]iagnostic message" })
11 | vim.keymap.set("n", "E", vim.diagnostic.open_float, { desc = "Show diagnostic [E]rror messages" })
12 | vim.keymap.set("n", "q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" })
13 |
14 | vim.keymap.set("t", "", "", { desc = "Exit terminal mode" })
15 |
16 | vim.keymap.set("n", "", "", { desc = "Move focus to the left window" })
17 | vim.keymap.set("n", "", "", { desc = "Move focus to the right window" })
18 | vim.keymap.set("n", "", "", { desc = "Move focus to the lower window" })
19 | vim.keymap.set("n", "", "", { desc = "Move focus to the lower window" })
20 |
21 | vim.keymap.set("n", "md", "bd", { desc = "Close buffer" })
22 |
23 | vim.keymap.set("n", "mgb", "GitBlameToggle", { desc = "Toggle Git Blame" })
24 |
--------------------------------------------------------------------------------
/lua/plugins/colorschemes.lua:
--------------------------------------------------------------------------------
1 | return {
2 | {
3 | "projekt0n/github-nvim-theme",
4 | init = function()
5 | vim.cmd("set termguicolors")
6 | vim.cmd.colorscheme("github_dark_dimmed")
7 | vim.cmd([[highlight Cursor guifg=pine guibg=lightpink]])
8 | end,
9 | },
10 |
11 | {
12 | "EdenEast/nightfox.nvim",
13 | -- config = function()
14 | -- vim.cmd.colorscheme("carbonfox")
15 | -- vim.cmd([[highlight Cursor guifg=pine guibg=lightpink]])
16 | -- end,
17 | },
18 |
19 | {
20 | "folke/tokyonight.nvim",
21 | -- init = function()
22 | -- vim.cmd("set termguicolors")
23 | -- vim.cmd.colorscheme("tokyonight-moon")
24 | --
25 | -- vim.defer_fn(function()
26 | -- vim.cmd([[highlight Cursor guifg=#FFFFFF guibg=lightgreen]])
27 | -- end, 1)
28 | -- end,
29 | },
30 |
31 | {
32 | "sainnhe/everforest",
33 | -- config = function()
34 | -- vim.g.everforest_background = "soft"
35 | -- vim.g.everforest_terminal_colors = 1
36 | -- vim.g.everforest_enable_italic = 1
37 | -- vim.g.everforest_better_performance = 1
38 | -- vim.g.everforest_cursor = "aqua"
39 | -- vim.g.everforest_diagnostic_virtual_text = "colored"
40 | -- end,
41 | },
42 |
43 | {
44 | "catppuccin/nvim",
45 | -- config = function()
46 | -- -- vim.cmd [[autocmd VimEnter * highlight Cursor guibg=lightpink]]
47 | -- end,
48 | name = "catppucin",
49 | },
50 | }
51 |
--------------------------------------------------------------------------------
/lua/plugins/init.lua:
--------------------------------------------------------------------------------
1 | -- install lazy
2 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
3 | if not vim.loop.fs_stat(lazypath) then
4 | local lazyrepo = "https://github.com/folke/lazy.nvim.git"
5 | vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
6 | end ---@diagnostic disable-next-line: undefined-field
7 | vim.opt.rtp:prepend(lazypath)
8 |
9 | require("lazy").setup({
10 | require("plugins.colorschemes"),
11 | require("plugins.utils.cmp"),
12 | require("plugins.utils.git"),
13 | require("plugins.utils.snacks"),
14 | require("plugins.utils.lsp"),
15 | require("plugins.utils.formatting"),
16 | require("plugins.utils.noice"),
17 | require("plugins.utils.utils"),
18 | }, {
19 | ui = {
20 | -- If you have a Nerd Font, set icons to an empty table which will use the
21 | -- default lazy.nvim defined Nerd Font icons otherwise define a unicode icons table
22 | icons = vim.g.have_nerd_font and {} or {
23 | cmd = "⌘",
24 | config = "🛠",
25 | event = "📅",
26 | ft = "📂",
27 | init = "⚙",
28 | keys = "🗝",
29 | plugin = "🔌",
30 | runtime = "💻",
31 | require = "🌙",
32 | source = "📄",
33 | start = "🚀",
34 | task = "📌",
35 | lazy = "💤 ",
36 | },
37 | },
38 | })
39 |
--------------------------------------------------------------------------------
/lua/plugins/utils/cmp.lua:
--------------------------------------------------------------------------------
1 | return {
2 | { -- Autocompletion
3 | "hrsh7th/nvim-cmp",
4 | event = "InsertEnter",
5 | config = function()
6 | local cmp = require("cmp")
7 | local luasnip = require("luasnip")
8 | luasnip.config.setup({})
9 |
10 | cmp.setup({
11 | window = {
12 | documentation = {
13 | max_height = 15,
14 | max_width = 20,
15 | border = "rounded",
16 | },
17 | },
18 | snippet = {
19 | expand = function(args)
20 | luasnip.lsp_expand(args.body)
21 | end,
22 | },
23 | completion = { completeopt = "menu,menuone,noinsert" },
24 | mapping = cmp.mapping.preset.insert({
25 | [""] = cmp.mapping.select_next_item(),
26 | [""] = cmp.mapping.select_next_item(),
27 | [""] = cmp.mapping.select_prev_item(),
28 | [""] = cmp.mapping.select_prev_item(),
29 | [""] = cmp.mapping.select_next_item(),
30 | [""] = cmp.mapping.scroll_docs(-4),
31 | [""] = cmp.mapping.select_next_item(),
32 | [""] = cmp.mapping.scroll_docs(4),
33 | [""] = cmp.mapping.confirm({ select = true }),
34 | [""] = cmp.mapping.confirm({ select = true }),
35 | [""] = cmp.mapping.complete({}),
36 | [""] = cmp.mapping.complete({}),
37 | [""] = cmp.mapping(function()
38 | if luasnip.expand_or_locally_jumpable() then
39 | luasnip.expand_or_jump()
40 | end
41 | end, { "i", "s" }),
42 | [""] = cmp.mapping(function()
43 | if luasnip.expand_or_locally_jumpable() then
44 | luasnip.expand_or_jump()
45 | end
46 | end, { "i", "s" }),
47 | [""] = cmp.mapping(function()
48 | if luasnip.locally_jumpable(-1) then
49 | luasnip.jump(-1)
50 | end
51 | end, { "i", "s" }),
52 | [""] = cmp.mapping(function()
53 | if luasnip.locally_jumpable(-1) then
54 | luasnip.jump(-1)
55 | end
56 | end, { "i", "s" }),
57 | }),
58 | sources = {
59 | { name = "nvim_lsp" },
60 | { name = "vim-dadbod-completion" },
61 | { name = "luasnip" },
62 | { name = "path" },
63 | { name = "buffer", keyword_length = 5 },
64 | },
65 | })
66 | end,
67 | dependencies = {
68 | "L3MON4D3/LuaSnip",
69 | "saadparwaiz1/cmp_luasnip",
70 | "hrsh7th/cmp-nvim-lsp",
71 | "hrsh7th/cmp-path",
72 | },
73 | },
74 | }
75 |
--------------------------------------------------------------------------------
/lua/plugins/utils/formatting.lua:
--------------------------------------------------------------------------------
1 | return {
2 | {
3 | -- Autoformat
4 | "stevearc/conform.nvim",
5 | opts = {
6 | notify_on_error = true,
7 | format_on_save = function(bufnr)
8 | local disable_filetypes = { c = true, cpp = true, cs = true, php = false } -- Disable 'format_on_save lsp_fallback'
9 | return {
10 | async = false,
11 | timeout_ms = 1000,
12 | lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
13 | }
14 | end,
15 | formatters_by_ft = {
16 | -- php = { "php-cs-fixer" },
17 | lua = { "stylua" },
18 | rust = { "rustfmt" },
19 | sh = { "beautysh" },
20 | -- c = { "clang-format" },
21 | -- cpp = { "clang-format" },
22 | cs = { "csharpier" },
23 | },
24 | formatters = {
25 | ["php-cs-fixer"] = {
26 | command = "php-cs-fixer",
27 | args = {
28 | "fix",
29 | "--config=" .. "$HOME/.php-cs-fixer.php",
30 | "$FILENAME",
31 | },
32 | stdin = false,
33 | },
34 | },
35 | },
36 | },
37 | }
38 |
--------------------------------------------------------------------------------
/lua/plugins/utils/git.lua:
--------------------------------------------------------------------------------
1 | return {
2 | {
3 | "f-person/git-blame.nvim",
4 | event = "VeryLazy",
5 | opts = {
6 | message_template = " • • • <>",
7 | date_format = "%r",
8 | message_when_not_committed = "Uncommitted changes",
9 | delay = 0,
10 | highlight_group = "Question",
11 | virtual_text_column = 1,
12 | },
13 | config = function()
14 | vim.keymap.set("n", "mgb", "GitBlameToggle", { desc = "Toggle Git Blame" })
15 | end,
16 | },
17 |
18 | { -- Adds git related signs to the gutter, as well as utilities for managing changes
19 | "lewis6991/gitsigns.nvim",
20 | opts = {
21 | signs = {
22 | add = { text = "+" },
23 | change = { text = "~" },
24 | delete = { text = "_" },
25 | topdelete = { text = "‾" },
26 | changedelete = { text = "~" },
27 | },
28 | },
29 | },
30 |
31 | {
32 | "NeogitOrg/neogit",
33 | event = "VeryLazy",
34 | dependencies = {
35 | "nvim-lua/plenary.nvim", -- required
36 | "sindrets/diffview.nvim", -- optional - Diff integration
37 |
38 | "nvim-telescope/telescope.nvim",
39 | },
40 | config = function()
41 | vim.keymap.set("n", "mg", "Neogit", { desc = "Open Neogit" })
42 | vim.keymap.set("n", "mc", "Neogit commit", { desc = "Open Neogit commit" })
43 | end,
44 | },
45 | }
46 |
--------------------------------------------------------------------------------
/lua/plugins/utils/lsp.lua:
--------------------------------------------------------------------------------
1 | return {
2 | { -- LSP Configuration & Plugins
3 | "neovim/nvim-lspconfig",
4 | dependencies = {
5 | -- Automatically install LSPs and related tools to stdpath for neovim
6 | "hrsh7th/cmp-nvim-lsp", -- <— important
7 | "williamboman/mason.nvim",
8 | "williamboman/mason-lspconfig.nvim",
9 | "WhoIsSethDaniel/mason-tool-installer.nvim",
10 |
11 | -- Useful status updates for LSP.
12 | -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
13 | { "j-hui/fidget.nvim", opts = {} },
14 |
15 | -- `neodev` configures Lua LSP for your Neovim config, runtime and plugins
16 | -- used for completion, annotations and signatures of Neovim apis
17 | { "folke/neodev.nvim", opts = {} },
18 | },
19 | config = function()
20 | -- This function gets run when an LSP attaches to a particular buffer.
21 | -- That is to say, every time a new file is opened that is associated with
22 | -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
23 | -- function will be executed to configure the current buffer
24 | vim.diagnostic.config({
25 | virtual_text = true,
26 | signs = true,
27 | underline = true,
28 | update_in_insert = false,
29 | severity_sort = true,
30 | })
31 |
32 | vim.api.nvim_create_autocmd("LspAttach", {
33 | group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
34 | callback = function(event)
35 | -- NOTE: Remember that lua is a real programming language, and as such it is possible
36 | -- to define small helper and utility functions so you don't have to repeat yourself
37 | -- many times.
38 | --
39 | -- In this case, we create a function that lets us more easily define mappings specific
40 | -- for LSP related items. It sets the mode, buffer and description for us each time.
41 | local map = function(keys, func, desc)
42 | vim.keymap.set("n", keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
43 | end
44 |
45 | -- Jump to the definition of the word under your cursor.
46 | -- This is where a variable was first declared, or where a function is defined, etc.
47 | -- To jump back, press .
48 | map("gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition")
49 |
50 | -- Find references for the word under your cursor.
51 | map("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
52 |
53 | -- Jump to the implementation of the word under your cursor.
54 | -- Useful when your language has ways of declaring types without an actual implementation.
55 | map("gI", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation")
56 |
57 | -- Jump to the type of the word under your cursor.
58 | -- Useful when you're not sure what type a variable is and you want to see
59 | -- the definition of its *type*, not where it was *defined*.
60 | map("D", require("telescope.builtin").lsp_type_definitions, "Type [D]efinition")
61 |
62 | -- Fuzzy find all the symbols in your current document.
63 | -- Symbols are things like variables, functions, types, etc.
64 | map("ds", require("telescope.builtin").lsp_document_symbols, "[D]ocument [S]ymbols")
65 |
66 | -- Fuzzy find all the symbols in your current workspace
67 | -- Similar to document symbols, except searches over your whole project.
68 | map(
69 | "ws",
70 | require("telescope.builtin").lsp_dynamic_workspace_symbols,
71 | "[W]orkspace [S]ymbols"
72 | )
73 |
74 | -- Rename the variable under your cursor
75 | -- Most Language Servers support renaming across files, etc.
76 | map("rn", vim.lsp.buf.rename, "[R]e[n]ame")
77 |
78 | -- Execute a code action, usually your cursor needs to be on top of an error
79 | -- or a suggestion from your LSP for this to activate.
80 | map("ca", vim.lsp.buf.code_action, "[C]ode [A]ction")
81 |
82 | -- Opens a popup that displays documentation about the word under your cursor
83 | -- See `:help K` for why this keymap
84 | map("K", vim.lsp.buf.hover, "Hover Documentation")
85 |
86 | -- WARN: This is not Goto Definition, this is Goto Declaration.
87 | -- For example, in C this would take you to the header
88 | map("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
89 | -- The following two autocommands are used to highlight references of the
90 | -- word under your cursor when your cursor rests there for a little while.
91 | -- See `:help CursorHold` for information about when this is executed
92 | --
93 | -- When you move your cursor, the highlights will be cleared (the second autocommand).
94 | local client = vim.lsp.get_client_by_id(event.data.client_id)
95 | if client and client.server_capabilities.documentHighlightProvider then
96 | vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
97 | buffer = event.buf,
98 | callback = vim.lsp.buf.document_highlight,
99 | })
100 |
101 | vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
102 | buffer = event.buf,
103 | callback = vim.lsp.buf.clear_references,
104 | })
105 | end
106 | end,
107 | })
108 |
109 | -- LSP servers and clients are able to communicate to each other what features they support.
110 | -- By default, Neovim doesn't support everything that is in the LSP Specification.
111 | -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
112 | -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
113 | local capabilities = vim.lsp.protocol.make_client_capabilities()
114 | capabilities = vim.tbl_deep_extend("force", capabilities, require("cmp_nvim_lsp").default_capabilities())
115 |
116 | -- Enable the following language servers
117 | -- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
118 | --
119 | -- Add any additional override configuration in the following tables. Available keys are:
120 | -- - cmd (table): Override the default command used to start the server
121 | -- - filetypes (table): Override the default list of associated filetypes for the server
122 | -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
123 | -- - settings (table): Override the default settings passed when initializing the server.
124 | -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
125 | local servers = {
126 | -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
127 | --
128 | -- Some languages (like typescript) have entire language plugins that can be useful:
129 | -- https://github.com/pmizio/typescript-tools.nvim
130 | --
131 | -- But for many setups, the LSP (`tsserver`) will work just fine
132 | intelephense = {
133 | root_dir = require("lspconfig").util.root_pattern("composer.json", ".git", "*.php"),
134 | }, -- PHP
135 | ts_ls = {}, -- TypeScript and JavaScript
136 | csharp_ls = {
137 | settings = {
138 | OmniSharp = {
139 | diagnostics = {
140 | disabled = { "CS8019" },
141 | },
142 | },
143 | },
144 | },
145 | gradle_ls = {},
146 | gopls = {}, -- Golang
147 | bashls = {},
148 | solargraph = {}, -- Ruby
149 | -- tsserver = {}, -- TypeScript and JavaScript
150 | pyright = {}, -- Python
151 | clangd = {}, -- C and C++
152 | rust_analyzer = {}, -- Rust
153 | html = {}, -- HTML
154 | tailwindcss = {}, -- TailwindCSS
155 | -- cmd = {...},
156 | -- filetypes { ...},
157 | -- capabilities = {},
158 |
159 | lua_ls = {
160 | settings = {
161 | Lua = {
162 | completion = {
163 | callSnippet = "Replace",
164 | },
165 | -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
166 | diagnostics = { disable = { "missing-fields" } },
167 | },
168 | },
169 | },
170 | }
171 |
172 | require("mason").setup()
173 | require("mason-lspconfig").setup({
174 | ensure_installed = vim.tbl_keys(servers),
175 | automatic_installation = true,
176 | })
177 |
178 | local ensure_installed = vim.tbl_keys(servers or {})
179 | vim.list_extend(ensure_installed, {
180 | "stylua",
181 | "rustfmt",
182 | "rust_analyzer",
183 | "csharp_ls",
184 | "gradle_ls",
185 | "gopls",
186 | "bashls",
187 | "html",
188 | "pyright",
189 | "tailwindcss-language-server",
190 | "typescript-language-server",
191 | "clangd",
192 | "clang-format",
193 | })
194 | require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
195 |
196 | require("lspconfig").intelephense.setup({
197 | on_attach = function(client)
198 | -- Disable document formatting
199 | client.resolved_capabilities.document_formatting = false
200 | client.resolved_capabilities.document_range_formatting = false
201 | end,
202 | settings = {
203 | intelephense = {
204 | files = {
205 | maxSize = 5000000, -- Adjusts file size limit to 5MB, change as needed
206 | },
207 | },
208 | },
209 | })
210 |
211 | require("lspconfig").solargraph.setup({
212 | cmd = { "solargraph", "stdio" },
213 | filetypes = { "ruby", "rb" },
214 | capabilities = capabilities,
215 | })
216 |
217 | capabilities.offsetEncoding = { "utf-16" }
218 | require("lspconfig").clangd.setup({
219 | cmd = { "clangd", "--background-index", "--clang-tidy" },
220 | filetypes = { "c", "cpp", "objc", "objcpp" },
221 | capabilities = capabilities,
222 | single_file_support = true,
223 | })
224 |
225 | require("mason-lspconfig").setup({
226 | handlers = {
227 | function(server_name)
228 | local server = servers[server_name] or {}
229 | -- This handles overriding only values explicitly passed
230 | -- by the server configuration above. Useful when disabling
231 | -- certain features of an LSP (for example, turning off formatting for tsserver)
232 | server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {})
233 | require("lspconfig")[server_name].setup(server)
234 | end,
235 | },
236 | })
237 | end,
238 | },
239 | }
240 |
--------------------------------------------------------------------------------
/lua/plugins/utils/noice.lua:
--------------------------------------------------------------------------------
1 | return {
2 | {
3 | "folke/noice.nvim",
4 | event = "VeryLazy",
5 | dependencies = { "MunifTanjim/nui.nvim" },
6 | opts = {
7 | messages = { view = "notify", view_warn = "notify" },
8 | lsp = {
9 | override = {
10 | ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
11 | ["vim.lsp.util.stylize_markdown"] = true,
12 | ["cmp.entry.get_documentation"] = true,
13 | },
14 | progress = {
15 | enabled = true,
16 | throttle = 10000 / 30,
17 | },
18 | },
19 | presets = {
20 | bottom_search = false,
21 | -- command_palette = true,
22 | long_message_to_split = true,
23 | -- inc_rename = true,
24 | lsp_doc_border = true,
25 | },
26 |
27 | errors = {
28 | -- options for the message history that you get with `:Noice`
29 | view = "notify",
30 | opts = { enter = true, format = "details" },
31 | filter = { error = true },
32 | filter_opts = { reverse = true },
33 | },
34 | routes = {
35 | {
36 | filter = {
37 | event = "notify",
38 | find = "No information available",
39 | },
40 | opts = { skip = true },
41 | },
42 | {
43 | filter = {
44 | event = "msg_show",
45 | any = {
46 | { find = "%d+L, %d+B" },
47 | { find = "; after #%d+" },
48 | { find = "; before #%d+" },
49 | },
50 | },
51 | {
52 | filter = {
53 | event = "lsp",
54 | kind = "progress",
55 | cond = function(message)
56 | local client = vim.tbl_get(message.opts, "progress", "client")
57 | return client == "lua_ls"
58 | end,
59 | },
60 | opts = { skip = true },
61 | },
62 | view = "notify",
63 | },
64 | },
65 | },
66 | },
67 | }
68 |
--------------------------------------------------------------------------------
/lua/plugins/utils/snacks/config.lua:
--------------------------------------------------------------------------------
1 | return {
2 | bigfile = { enabled = true },
3 | dashboard = {
4 | enabled = true,
5 | preset = {
6 | header = [[
7 | ⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣤⠶⢶⡶⠶⣤⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀
8 | ⠀⠀⠀⠀⢀⣤⣾⣿⣿⣿⣿⠀⡸⢇⠀⣿⣿⣿⣿⣷⣤⡀⠀⠀⠀⠀
9 | ⠀⠀⠀⣴⢏⡉⠻⢿⣿⣿⣿⠤⠧⠼⠤⣿⣿⣿⣿⠟⢩⠿⣦⠀⠀⠀
10 | ⠀⢀⣾⣅⠘⢡⠆⡴⠛⢉⣠⣤⣶⠀⠀⠀⠉⠛⢯⣠⠔⠠⠚⣷⡀⠀
11 | ⠀⣾⣿⣿⣷⣦⡞⢀⣴⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⢻⣤⣶⣿⣿⣷⠀
12 | ⢠⣿⣿⣿⣿⡟⠀⣾⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣿⣿⡄
13 | ⢸⣿⣿⣿⣿⡇⠘⠛⠛⠛⠛⠛⠛⣤⣤⣤⣤⣤⣤⡄⢸⣿⣿⣿⣿⡇
14 | ⠘⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⡿⠀⣼⣿⣿⣿⣿⠃
15 | ⠀⢿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⠟⠁⣼⣿⣿⣿⣿⡿⠀
16 | ⠀⠈⢿⣿⣿⣿⣿⣷⣤⣀⠀⠀⠀⠿⠛⠋⣁⣤⣾⣿⣿⣿⣿⡿⠁⠀
17 | ⠀⠀⠀⠻⣿⣿⣿⣿⣿⣿⣿⣶⣶⣶⣶⣿⣿⣿⣿⣿⣿⣿⠟⠀⠀⠀
18 | ⠀⠀⠀⠀⠈⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠁⠀⠀⠀⠀
19 | ⠀⠀⠀⠀⠀⠀⠀⠈⠙⠛⠛⠿⠿⠿⠿⠛⠛⠋⠁⠀⠀⠀⠀⠀⠀⠀]],
20 | },
21 | sections = {
22 | { section = "header" },
23 | { section = "keys", gap = 1, padding = 1 },
24 | {
25 | pane = 2,
26 | icon = " ",
27 | desc = "Browse Repo",
28 | padding = 3,
29 | key = "b",
30 | action = function()
31 | Snacks.gitbrowse()
32 | end,
33 | },
34 | { pane = 2, icon = " ", title = "Projects", section = "projects", indent = 2, padding = 2 },
35 | function()
36 | local in_git = Snacks.git.get_root() ~= nil
37 | local cmds = {
38 | {
39 | title = "Notifications",
40 | cmd = "gh notify -s -a -n5",
41 | action = function()
42 | vim.ui.open("https://github.com/notifications")
43 | end,
44 | key = "n",
45 | icon = " ",
46 | height = 5,
47 | enabled = true,
48 | },
49 | {
50 | icon = " ",
51 | title = "Git Status",
52 | cmd = "git --no-pager diff --stat -B -M -C",
53 | height = 10,
54 | },
55 | }
56 | return vim.tbl_map(function(cmd)
57 | return vim.tbl_extend("force", {
58 | pane = 2,
59 | section = "terminal",
60 | enabled = in_git,
61 | padding = 1,
62 | ttl = 5 * 60,
63 | indent = 3,
64 | }, cmd)
65 | end, cmds)
66 | end,
67 | { section = "startup" },
68 | },
69 | },
70 | explorer = { enabled = true },
71 | indent = { enabled = false },
72 | input = { enabled = true },
73 | notifier = { enabled = false },
74 | picker = { enabled = true },
75 | quickfile = { enabled = true },
76 | scope = { enabled = true },
77 | scroll = { enabled = false },
78 | statuscolumn = { enabled = true },
79 | words = { enabled = true },
80 | -- styles = {
81 | -- },
82 | }
83 |
--------------------------------------------------------------------------------
/lua/plugins/utils/snacks/init.lua:
--------------------------------------------------------------------------------
1 | -- lua/snacks/init.lua
2 | local config = require("plugins.utils.snacks.config")
3 | local keys = require("plugins.utils.snacks.keys")
4 |
5 | return {
6 | "folke/snacks.nvim",
7 | priority = 1000,
8 | lazy = false,
9 | opts = config,
10 | keys = keys,
11 | init = function()
12 | vim.api.nvim_create_autocmd("User", {
13 | pattern = "VeryLazy",
14 | callback = function()
15 | _G.dd = function(...)
16 | require("snacks").debug.inspect(...)
17 | end
18 | _G.bt = function()
19 | require("snacks").debug.backtrace()
20 | end
21 | vim.print = _G.dd
22 |
23 | local S = require("snacks")
24 | S.toggle.option("spell", { name = "Spelling" }):map("us")
25 | S.toggle.option("wrap", { name = "Wrap" }):map("uw")
26 | S.toggle.option("relativenumber", { name = "Relative Number" }):map("uL")
27 | S.toggle.diagnostics():map("ud")
28 | S.toggle.line_number():map("ul")
29 | S.toggle
30 | .option("conceallevel", {
31 | off = 0,
32 | on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2,
33 | })
34 | :map("uc")
35 | S.toggle.treesitter():map("uT")
36 | S.toggle
37 | .option("background", { off = "light", on = "dark", name = "Dark Background" })
38 | :map("ub")
39 | S.toggle.inlay_hints():map("uh")
40 | S.toggle.indent():map("ug")
41 | S.toggle.dim():map("uD")
42 | end,
43 | })
44 | end,
45 | }
46 |
--------------------------------------------------------------------------------
/lua/plugins/utils/snacks/keys.lua:
--------------------------------------------------------------------------------
1 | local keys = {
2 | -- Top Pickers & Explorer
3 | {
4 | "",
5 | function()
6 | Snacks.picker.smart()
7 | end,
8 | desc = "Smart Find Files",
9 | },
10 | {
11 | ",",
12 | function()
13 | Snacks.picker.buffers()
14 | end,
15 | desc = "Buffers",
16 | },
17 | {
18 | "sg",
19 | function()
20 | Snacks.picker.grep()
21 | end,
22 | desc = "Grep",
23 | },
24 | {
25 | ":",
26 | function()
27 | Snacks.picker.command_history()
28 | end,
29 | desc = "Command History",
30 | },
31 | {
32 | "N",
33 | function()
34 | Snacks.picker.notifications()
35 | end,
36 | desc = "Notification History",
37 | },
38 | {
39 | "e",
40 | function()
41 | Snacks.explorer()
42 | end,
43 | desc = "File Explorer",
44 | },
45 | {
46 | "fb",
47 | function()
48 | Snacks.picker.buffers()
49 | end,
50 | desc = "Buffers",
51 | },
52 | {
53 | "fc",
54 | function()
55 | Snacks.picker.files({ cwd = vim.fn.stdpath("config") })
56 | end,
57 | desc = "Find Config File",
58 | },
59 | {
60 | "sf",
61 | function()
62 | Snacks.picker.files()
63 | end,
64 | desc = "Find Files",
65 | },
66 | {
67 | "fg",
68 | function()
69 | Snacks.picker.git_files()
70 | end,
71 | desc = "Find Git Files",
72 | },
73 | {
74 | "fp",
75 | function()
76 | Snacks.picker.projects()
77 | end,
78 | desc = "Projects",
79 | },
80 | {
81 | "fr",
82 | function()
83 | Snacks.picker.recent()
84 | end,
85 | desc = "Recent",
86 | },
87 | -- Git
88 | {
89 | "mga",
90 | function()
91 | Snacks.picker.git_branches()
92 | end,
93 | desc = "Git Branches",
94 | },
95 | {
96 | "mgl",
97 | function()
98 | Snacks.picker.git_log()
99 | end,
100 | desc = "Git Log",
101 | },
102 | {
103 | "mgL",
104 | function()
105 | Snacks.picker.git_log_line()
106 | end,
107 | desc = "Git Log Line",
108 | },
109 | {
110 | "mgs",
111 | function()
112 | Snacks.picker.git_status()
113 | end,
114 | desc = "Git Status",
115 | },
116 | {
117 | "mgS",
118 | function()
119 | Snacks.picker.git_stash()
120 | end,
121 | desc = "Git Stash",
122 | },
123 | {
124 | "gd",
125 | function()
126 | Snacks.picker.git_diff()
127 | end,
128 | desc = "Git Diff (Hunks)",
129 | },
130 | {
131 | "gf",
132 | function()
133 | Snacks.picker.git_log_file()
134 | end,
135 | desc = "Git Log File",
136 | },
137 | -- Grep
138 | {
139 | "sB",
140 | function()
141 | Snacks.picker.lines()
142 | end,
143 | desc = "Buffer Lines",
144 | },
145 | {
146 | "sb",
147 | function()
148 | Snacks.picker.grep_buffers()
149 | end,
150 | desc = "Grep Open Buffers",
151 | },
152 | {
153 | "sg",
154 | function()
155 | Snacks.picker.grep()
156 | end,
157 | desc = "Grep",
158 | },
159 | {
160 | "s,",
161 | function()
162 | Snacks.picker.grep_word()
163 | end,
164 | desc = "Visual selection or word",
165 | mode = { "n", "x" },
166 | },
167 | -- Search
168 | {
169 | 's"',
170 | function()
171 | Snacks.picker.registers()
172 | end,
173 | desc = "Registers",
174 | },
175 | {
176 | "s/",
177 | function()
178 | Snacks.picker.search_history()
179 | end,
180 | desc = "Search History",
181 | },
182 | {
183 | "sa",
184 | function()
185 | Snacks.picker.autocmds()
186 | end,
187 | desc = "Autocmds",
188 | },
189 | {
190 | "sb",
191 | function()
192 | Snacks.picker.lines()
193 | end,
194 | desc = "Buffer Lines",
195 | },
196 | {
197 | "sc",
198 | function()
199 | Snacks.picker.command_history()
200 | end,
201 | desc = "Command History",
202 | },
203 | {
204 | "sC",
205 | function()
206 | Snacks.picker.commands()
207 | end,
208 | desc = "Commands",
209 | },
210 | {
211 | "sd",
212 | function()
213 | Snacks.picker.diagnostics()
214 | end,
215 | desc = "Diagnostics",
216 | },
217 | {
218 | "sD",
219 | function()
220 | Snacks.picker.diagnostics_buffer()
221 | end,
222 | desc = "Buffer Diagnostics",
223 | },
224 | {
225 | "sh",
226 | function()
227 | Snacks.picker.help()
228 | end,
229 | desc = "Help Pages",
230 | },
231 | {
232 | "sH",
233 | function()
234 | Snacks.picker.highlights()
235 | end,
236 | desc = "Highlights",
237 | },
238 | {
239 | "si",
240 | function()
241 | Snacks.picker.icons()
242 | end,
243 | desc = "Icons",
244 | },
245 | {
246 | "sj",
247 | function()
248 | Snacks.picker.jumps()
249 | end,
250 | desc = "Jumps",
251 | },
252 | {
253 | "sk",
254 | function()
255 | Snacks.picker.keymaps()
256 | end,
257 | desc = "Keymaps",
258 | },
259 | {
260 | "sl",
261 | function()
262 | Snacks.picker.loclist()
263 | end,
264 | desc = "Location List",
265 | },
266 | {
267 | "sm",
268 | function()
269 | Snacks.picker.marks()
270 | end,
271 | desc = "Marks",
272 | },
273 | {
274 | "sM",
275 | function()
276 | Snacks.picker.man()
277 | end,
278 | desc = "Man Pages",
279 | },
280 | {
281 | "sp",
282 | function()
283 | Snacks.picker.lazy()
284 | end,
285 | desc = "Search for Plugin Spec",
286 | },
287 | {
288 | "sq",
289 | function()
290 | Snacks.picker.qflist()
291 | end,
292 | desc = "Quickfix List",
293 | },
294 | {
295 | "sR",
296 | function()
297 | Snacks.picker.resume()
298 | end,
299 | desc = "Resume",
300 | },
301 | {
302 | "su",
303 | function()
304 | Snacks.picker.undo()
305 | end,
306 | desc = "Undo History",
307 | },
308 | {
309 | "th",
310 | function()
311 | Snacks.picker.colorschemes()
312 | end,
313 | desc = "Colorschemes",
314 | },
315 | -- LSP (pickers)
316 | {
317 | "gd",
318 | function()
319 | Snacks.picker.lsp_definitions()
320 | end,
321 | desc = "Goto Definition",
322 | },
323 | {
324 | "gD",
325 | function()
326 | Snacks.picker.lsp_declarations()
327 | end,
328 | desc = "Goto Declaration",
329 | },
330 | {
331 | "gr",
332 | function()
333 | Snacks.picker.lsp_references()
334 | end,
335 | nowait = true,
336 | desc = "References",
337 | },
338 | {
339 | "gI",
340 | function()
341 | Snacks.picker.lsp_implementations()
342 | end,
343 | desc = "Goto Implementation",
344 | },
345 | {
346 | "gy",
347 | function()
348 | Snacks.picker.lsp_type_definitions()
349 | end,
350 | desc = "Goto T[y]pe Definition",
351 | },
352 | {
353 | "ss",
354 | function()
355 | Snacks.picker.lsp_symbols()
356 | end,
357 | desc = "LSP Symbols",
358 | },
359 | {
360 | "sS",
361 | function()
362 | Snacks.picker.lsp_workspace_symbols()
363 | end,
364 | desc = "LSP Workspace Symbols",
365 | },
366 | -- Other
367 | {
368 | "z",
369 | function()
370 | Snacks.zen()
371 | end,
372 | desc = "Toggle Zen Mode",
373 | },
374 | {
375 | "Z",
376 | function()
377 | Snacks.zen.zoom()
378 | end,
379 | desc = "Toggle Zoom",
380 | },
381 | {
382 | ".",
383 | function()
384 | Snacks.scratch()
385 | end,
386 | desc = "Toggle Scratch Buffer",
387 | },
388 | {
389 | "S",
390 | function()
391 | Snacks.scratch.select()
392 | end,
393 | desc = "Select Scratch Buffer",
394 | },
395 | {
396 | "n",
397 | function()
398 | Snacks.notifier.show_history()
399 | end,
400 | desc = "Notification History",
401 | },
402 | {
403 | "bd",
404 | function()
405 | Snacks.bufdelete()
406 | end,
407 | desc = "Delete Buffer",
408 | },
409 | {
410 | "cR",
411 | function()
412 | Snacks.rename.rename_file()
413 | end,
414 | desc = "Rename File",
415 | },
416 | {
417 | "gB",
418 | function()
419 | Snacks.gitbrowse()
420 | end,
421 | desc = "Git Browse",
422 | mode = { "n", "v" },
423 | },
424 | {
425 | "gg",
426 | function()
427 | Snacks.lazygit()
428 | end,
429 | desc = "Lazygit",
430 | },
431 | {
432 | "un",
433 | function()
434 | Snacks.notifier.hide()
435 | end,
436 | desc = "Dismiss All Notifications",
437 | },
438 | -- {
439 | -- "",
440 | -- function()
441 | -- Snacks.terminal.toggle(nil, {
442 | -- shell = "zsh",
443 | -- win = {
444 | -- relative = "editor",
445 | -- position = "right",
446 | -- size = { width = 0.2 },
447 | -- border = "rounded",
448 | -- },
449 | -- })
450 | -- end,
451 | -- desc = "Toggle Bottom Terminal",
452 | -- mode = { "n", "t" },
453 | -- },
454 |
455 | -- Right (vertical)
456 | {
457 | "",
458 | function()
459 | Snacks.terminal.toggle(nil, {
460 | shell = "zsh",
461 | win = {
462 | relative = "editor",
463 | position = "right",
464 | size = { width = 0.2 },
465 | border = "rounded",
466 | },
467 | })
468 | end,
469 | desc = "Toggle Right Terminal",
470 | mode = { "n", "t" },
471 | },
472 |
473 | -- Floating
474 | {
475 | "",
476 | function()
477 | Snacks.terminal.toggle("zsh", {
478 | direction = "float", -- optional, setting cmd means float anyway
479 | })
480 | end,
481 | desc = "Toggle Floating Terminal",
482 | mode = { "n", "t" },
483 | },
484 | {
485 | "]]",
486 | function()
487 | Snacks.words.jump(vim.v.count1)
488 | end,
489 | desc = "Next Reference",
490 | mode = { "n", "t" },
491 | },
492 | {
493 | "[[",
494 | function()
495 | Snacks.words.jump(-vim.v.count1)
496 | end,
497 | desc = "Prev Reference",
498 | mode = { "n", "t" },
499 | },
500 | {
501 | "Nw",
502 | desc = "Neovim News",
503 | function()
504 | Snacks.win({
505 | file = vim.api.nvim_get_runtime_file("doc/news.txt", false)[1],
506 | width = 0.6,
507 | height = 0.6,
508 | wo = {
509 | spell = false,
510 | wrap = false,
511 | signcolumn = "yes",
512 | statuscolumn = " ",
513 | conceallevel = 3,
514 | },
515 | })
516 | end,
517 | },
518 | }
519 |
520 | return keys
521 |
--------------------------------------------------------------------------------
/lua/plugins/utils/utils.lua:
--------------------------------------------------------------------------------
1 | return {
2 | { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font },
3 |
4 | {
5 | "akinsho/bufferline.nvim",
6 | requires = "kyazdani42/nvim-web-devicons",
7 | opts = {
8 | options = {
9 | indicator = { icon = "▎", style = "icon" },
10 | offsets = {
11 | { filetype = "NvimTree", text = "File Explorer", text_align = "center", padding = 0 },
12 | },
13 | separator_style = "thin",
14 | },
15 | },
16 | config = function()
17 | require("bufferline").setup({
18 | vim.keymap.set("n", "L", "BufferLineCycleNext", { noremap = true, silent = true }),
19 | vim.keymap.set("n", "H", "BufferLineCyclePrev", { noremap = true, silent = true }),
20 | })
21 | end,
22 | },
23 |
24 | { -- SQL Database UI and completion
25 | "kristijanhusak/vim-dadbod-ui",
26 | dependencies = {
27 | { "tpope/vim-dadbod", lazy = true },
28 | { "kristijanhusak/vim-dadbod-completion", ft = { "sql", "mysql", "plsql" }, lazy = true },
29 | },
30 | cmd = {
31 | "DBUI",
32 | "DBUIToggle",
33 | "DBUIAddConnection",
34 | "DBUIFindBuffer",
35 | },
36 | init = function()
37 | -- Your DBUI configuration
38 | vim.g.db_ui_use_nerd_fonts = 1
39 | end,
40 | },
41 |
42 | {
43 | "nvim-treesitter/nvim-treesitter",
44 | build = ":TSUpdate",
45 | opts = {
46 | ensure_installed = { "bash", "c", "html", "lua", "markdown", "vim", "vimdoc", "python", "go" },
47 | auto_install = true,
48 | highlight = {
49 | enable = true,
50 | -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
51 | -- If you are experiencing weird indenting issues, add the language to
52 | -- the list of additional_vim_regex_highlighting and disabled languages for indent.
53 | additional_vim_regex_highlighting = { "ruby" },
54 | },
55 | indent = { enable = true, disable = { "ruby" } },
56 | },
57 | config = function(_, opts)
58 | -- [[ Configure Treesitter ]] See `:help nvim-treesitter`
59 |
60 | ---@diagnostic disable-next-line: missing-fields
61 | require("nvim-treesitter.configs").setup(opts)
62 | end,
63 | },
64 |
65 | {
66 | "nvim-lualine/lualine.nvim",
67 | opts = {
68 | options = {
69 | theme = "auto",
70 | height = 20,
71 | },
72 | },
73 | },
74 |
75 | -- Highlight todo, notes, etc in comments
76 | {
77 | "folke/todo-comments.nvim",
78 | event = "VimEnter",
79 | dependencies = { "nvim-lua/plenary.nvim" },
80 | opts = { signs = false },
81 | },
82 |
83 | { -- just transparency
84 | "xiyaowong/transparent.nvim",
85 | config = function()
86 | require("transparent").setup({
87 | extra_groups = {
88 | "NvimTreeNormal",
89 | "NvimTreeNormalNC",
90 | -- Add other groups
91 | },
92 | })
93 | vim.api.nvim_set_keymap("n", "tt", ":TransparentToggle", { noremap = true, silent = true })
94 | end,
95 | },
96 |
97 | {
98 | "echasnovski/mini.icons",
99 | },
100 |
101 | { "numToStr/Comment.nvim", opts = {} }, -- "gc" to comment visual regions/lines
102 |
103 | {
104 | "windwp/nvim-autopairs",
105 | config = function()
106 | require("nvim-autopairs").setup({})
107 | end,
108 | },
109 |
110 | { -- Useful plugin to show you pending keybinds.
111 | "folke/which-key.nvim",
112 | event = "VimEnter", -- Sets the loading event to 'VimEnter'
113 | config = function() -- This is the function that runs, AFTER loading
114 | -- Document existing key chains
115 | require("which-key").setup({
116 | ["c"] = { name = "[C]ode" },
117 | ["d"] = { name = "[D]ocument" },
118 | ["r"] = { name = "[R]ename" },
119 | ["s"] = { name = "[S]earch" },
120 | ["w"] = { name = "[W]orkspace" },
121 | })
122 | end,
123 | },
124 |
125 | { -- Adds git related signs to the gutter, as well as utilities for managing changes
126 | "lewis6991/gitsigns.nvim",
127 | opts = {
128 | signs = {
129 | add = { text = "+" },
130 | change = { text = "~" },
131 | delete = { text = "_" },
132 | topdelete = { text = "‾" },
133 | changedelete = { text = "~" },
134 | },
135 | },
136 | },
137 |
138 | { -- auto close html tags
139 | "windwp/nvim-ts-autotag",
140 | config = function()
141 | require("nvim-ts-autotag").setup()
142 | end,
143 | },
144 |
145 | {
146 | "github/copilot.vim",
147 | config = function()
148 | vim.keymap.set("n", "ce", "Copilot enable", { desc = "Enable Copilot" })
149 | vim.keymap.set("n", "cd", "Copilot disable", { desc = "Disable Copilot" })
150 |
151 | vim.keymap.set("i", "", 'copilot#Accept("")', { expr = true, replace_keycodes = false })
152 | vim.keymap.del("i", "")
153 |
154 | vim.g.copilot_no_tab_map = true
155 | vim.g.copilot_assume_mapped = true
156 | vim.keymap.set("i", "", "(copilot-accept-word)")
157 | vim.keymap.set("i", "", "(copilot-next)")
158 | end,
159 | },
160 |
161 | { -- find/replace across multiple files
162 | "nvim-pack/nvim-spectre",
163 | keys = {
164 | { "mfr", "Spectre", mode = { "n" } },
165 | },
166 | config = function()
167 | require("spectre").setup({ is_block_ui_break = true })
168 | end,
169 | },
170 |
171 | {
172 | "jake-stewart/multicursor.nvim",
173 | branch = "1.0",
174 | config = function()
175 | local mc = require("multicursor-nvim")
176 | mc.setup()
177 |
178 | local set = vim.keymap.set
179 |
180 | -- Add or skip cursor above/below the main cursor.
181 | set({ "n", "x" }, "", function()
182 | mc.lineAddCursor(-1)
183 | end)
184 | set({ "n", "x" }, "", function()
185 | mc.lineAddCursor(1)
186 | end)
187 | set({ "n", "x" }, "", function()
188 | mc.lineSkipCursor(-1)
189 | end)
190 | set({ "n", "x" }, "", function()
191 | mc.lineSkipCursor(1)
192 | end)
193 |
194 | -- Add or skip adding a new cursor by matching word/selection
195 | set({ "n", "x" }, "n", function()
196 | mc.matchAddCursor(1)
197 | end)
198 | set({ "n", "x" }, "s", function()
199 | mc.matchSkipCursor(1)
200 | end)
201 | set({ "n", "x" }, "N", function()
202 | mc.matchAddCursor(-1)
203 | end)
204 | set({ "n", "x" }, "S", function()
205 | mc.matchSkipCursor(-1)
206 | end)
207 |
208 | -- Add and remove cursors with control + left click.
209 | set("n", "", mc.handleMouse)
210 | set("n", "", mc.handleMouseDrag)
211 | set("n", "", mc.handleMouseRelease)
212 |
213 | -- Disable and enable cursors.
214 | set({ "n", "x" }, "", mc.toggleCursor)
215 |
216 | -- Mappings defined in a keymap layer only apply when there are
217 | -- multiple cursors. This lets you have overlapping mappings.
218 | mc.addKeymapLayer(function(layerSet)
219 | -- Select a different cursor as the main one.
220 | layerSet({ "n", "x" }, "", mc.prevCursor)
221 | layerSet({ "n", "x" }, "", mc.nextCursor)
222 |
223 | -- Delete the main cursor.
224 | layerSet({ "n", "x" }, "x", mc.deleteCursor)
225 |
226 | -- Enable and clear cursors using escape.
227 | layerSet("n", "", function()
228 | if not mc.cursorsEnabled() then
229 | mc.enableCursors()
230 | else
231 | mc.clearCursors()
232 | end
233 | end)
234 | end)
235 |
236 | -- Customize how cursors look.
237 | local hl = vim.api.nvim_set_hl
238 | hl(0, "MultiCursorCursor", { reverse = true })
239 | hl(0, "MultiCursorVisual", { link = "Visual" })
240 | hl(0, "MultiCursorSign", { link = "SignColumn" })
241 | hl(0, "MultiCursorMatchPreview", { link = "Search" })
242 | hl(0, "MultiCursorDisabledCursor", { reverse = true })
243 | hl(0, "MultiCursorDisabledVisual", { link = "Visual" })
244 | hl(0, "MultiCursorDisabledSign", { link = "SignColumn" })
245 | end,
246 | },
247 | }
248 |
--------------------------------------------------------------------------------
/lua/settings.lua:
--------------------------------------------------------------------------------
1 | vim.g.mapleader = " "
2 | vim.g.maplocalleader = " "
3 | -- Set to true if you have a Nerd Font installed
4 | vim.g.have_nerd_font = true
5 | -- Set cursor to fat cursor
6 | vim.opt.guicursor = "n-v-i-c:block-Cursor"
7 | -- [[ Setting options ]]
8 | -- See `:help vim.opt`
9 | -- NOTE: You can change these options as you wish!
10 | -- For more options, you can see `:help option-list`
11 | -- Set the number of spaces that a in the file counts for.
12 | vim.opt.tabstop = 4
13 | -- Set the number of spaces to use for each step of (auto)indent.
14 | vim.opt.shiftwidth = 4
15 | -- Convert tabs to spaces.
16 | vim.opt.expandtab = true
17 | -- Make line numbers default
18 | vim.opt.number = true
19 | -- You can also add relative line numbers, for help with jumping.
20 | -- Experiment for yourself to see if you like it!
21 | vim.opt.relativenumber = true
22 | -- Enable mouse mode, can be useful for resizing splits for example!
23 | vim.opt.mouse = "a"
24 | -- Don't show the mode, since it's already in status line
25 | vim.opt.showmode = false
26 | -- Sync clipboard between OS and Neovim.
27 | -- Remove this option if you want your OS clipboard to remain independent.
28 | -- See `:help 'clipboard'`
29 | vim.opt.clipboard = "unnamedplus"
30 | -- Enable break indent
31 | vim.opt.breakindent = true
32 | -- Save undo history
33 | vim.opt.undofile = true
34 | -- Case-insensitive searching UNLESS \C or capital in search
35 | vim.opt.ignorecase = true
36 | vim.opt.smartcase = true
37 | -- Keep signcolumn on by default
38 | vim.opt.signcolumn = "yes"
39 | -- Decrease update time
40 | vim.opt.updatetime = 250
41 | -- Decrease mapped sequence wait time
42 | -- Displays which-key popup sooner
43 | vim.opt.timeoutlen = 300
44 | -- Configure how new splits should be opened
45 | vim.opt.splitright = true
46 | vim.opt.splitbelow = true
47 | -- Sets how neovim will display certain whitespace in the editor.
48 | -- See `:help 'list'`
49 | -- and `:help 'listchars'`
50 | vim.opt.list = true
51 | vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
52 | -- Preview substitutions live, as you type!
53 | vim.opt.inccommand = "split"
54 | -- Show which line your cursor is on
55 | -- vim.opt.cursorline = true
56 | -- Minimal number of screen lines to keep above and below the cursor.
57 | vim.opt.scrolloff = 10
58 |
59 | -- set true color
60 | vim.opt.termguicolors = true
61 |
62 | vim.g.gitblame_enabled = 0
63 | vim.o.laststatus = 3
64 |
--------------------------------------------------------------------------------