Initial commit
This commit is contained in:
commit
4dbc00732c
82
init.lua
Normal file
82
init.lua
Normal file
@ -0,0 +1,82 @@
|
||||
require("core.options")
|
||||
require("core.keymaps")
|
||||
require("core.autostart")
|
||||
|
||||
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
|
||||
error("Error cloning lazy.nvim:\n" .. out)
|
||||
end
|
||||
end ---@diagnostic disable-next-line: undefined-field
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
|
||||
-- Neotree
|
||||
require("plugins.neotree"),
|
||||
|
||||
-- Colorscheme
|
||||
require("plugins.colorscheme"),
|
||||
|
||||
-- Bufferline
|
||||
require("plugins.bufferline"),
|
||||
|
||||
-- Lualine
|
||||
require("plugins.lualine"),
|
||||
|
||||
-- Treesitter
|
||||
require("plugins.treesitter"),
|
||||
|
||||
-- Telescope
|
||||
require("plugins.telescope"),
|
||||
|
||||
-- LSP
|
||||
require("plugins.lsp"),
|
||||
|
||||
-- Autocomplete
|
||||
require("plugins.autocompletion"),
|
||||
|
||||
-- Formatting
|
||||
require("plugins.none-ls"),
|
||||
|
||||
-- Gitsigns
|
||||
require("plugins.gitsigns"),
|
||||
|
||||
-- Indent blankline
|
||||
require("plugins.indent-blankline"),
|
||||
|
||||
-- Misc
|
||||
require("plugins.misc"),
|
||||
|
||||
-- Toggleterm
|
||||
require("plugins.toggleterm"),
|
||||
|
||||
-- Rest
|
||||
require("plugins.rest"),
|
||||
|
||||
-- md-preview
|
||||
require("plugins.md-preview"),
|
||||
|
||||
-- Session Manager
|
||||
require("plugins.session-manager"),
|
||||
|
||||
-- Alpha
|
||||
require("plugins.alpha"),
|
||||
|
||||
-- Leap
|
||||
require("plugins.leap"),
|
||||
})
|
||||
|
||||
-- Setup color scheme
|
||||
require("catppuccin").setup()
|
||||
vim.cmd.colorscheme("catppuccin-mocha")
|
||||
|
||||
require("toggleterm").setup({
|
||||
open_mapping = [[<C-l>]],
|
||||
direction = "float",
|
||||
border = "shadow",
|
||||
})
|
||||
|
||||
require("peek").setup({ app = "browser" })
|
50
lazy-lock.json
Normal file
50
lazy-lock.json
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" },
|
||||
"auto-session": { "branch": "main", "commit": "095b0b54d40c8cc7fe37f2ae4d948ec3069bb1c2" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
|
||||
"catppuccin": { "branch": "main", "commit": "5b5e3aef9ad7af84f463d17b5479f06b87d5c429" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
|
||||
"cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "31f2a2657b6261724313281fe0d8ba6f43f4a4fa" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "d600d3922c1d001422689319a8f915136bb64e1e" },
|
||||
"hererocks": { "branch": "master", "commit": "c9c5444dea1e07e005484014a8231aa667be30b6" },
|
||||
"image.nvim": { "branch": "master", "commit": "2e2d28b7734b5efdfc1219f4da8a46c761587bc2" },
|
||||
"image_preview.nvim": { "branch": "main", "commit": "3f3f46210ba13bf82b1eb750b2d6d90eb211ee24" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"leap.nvim": { "branch": "main", "commit": "8a0efa79133fee211017d769c8031512192008b3" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "86fe39534b7da729a1ac56c0466e76f2c663dc42" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
|
||||
"mason-null-ls.nvim": { "branch": "main", "commit": "de19726de7260c68d94691afb057fa73d3cc53e7" },
|
||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "1255518cb067e038a4755f5cb3e980f79b6ab89c" },
|
||||
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
|
||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "9b5d67119c46e3262ffe1508fe6d8540b79ad75d" },
|
||||
"none-ls-extras.nvim": { "branch": "main", "commit": "1214d729e3408470a7b7a428415a395e5389c13c" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "fb50cf17e926a037c9f8d96d8db29ddbd04965d4" },
|
||||
"nui.nvim": { "branch": "main", "commit": "8d3bce9764e627b62b07424e0df77f680d47ffdb" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "1a3a429efec62af632dfd8fa9b52fa226f655ec2" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "684eeac91ed8e297685a97ef70031d19ac1de25a" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "c90dee4e930ab9f49fa6d77f289bff335b49e972" },
|
||||
"nvim-window-picker": { "branch": "main", "commit": "6382540b2ae5de6c793d4aa2e3fe6dbb518505ec" },
|
||||
"peek.nvim": { "branch": "master", "commit": "5820d937d5414baea5f586dc2a3d912a74636e5b" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"rest.nvim": { "branch": "main", "commit": "2ded89dbda1fd3c1430685ffadf2df8beb28336d" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" },
|
||||
"vim-bbye": { "branch": "master", "commit": "25ef93ac5a87526111f43e5110675032dbcacf56" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" },
|
||||
"vim-rhubarb": { "branch": "master", "commit": "386daa2e9d98e23e27ad089afcbe5c5a903e488d" },
|
||||
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
|
||||
"vim-tmux-navigator": { "branch": "master", "commit": "791dacfcfc8ccb7f6eb1c853050883b03e5a22fe" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
||||
}
|
19
lua/core/autostart.lua
Normal file
19
lua/core/autostart.lua
Normal file
@ -0,0 +1,19 @@
|
||||
os = require("os")
|
||||
|
||||
-- Execute on startup
|
||||
os.execute("sed -i -e s/padding=\\{x=15,y=15\\}/padding=\\{x=0,y=0\\}/g ~/.alacritty.toml")
|
||||
|
||||
-- On Exit
|
||||
function on_exit(args)
|
||||
os.execute("sed -i -e s/padding=\\{x=0,y=0\\}/padding=\\{x=15,y=15\\}/g ~/.alacritty.toml")
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ "ExitPre" }, {
|
||||
pattern = "*",
|
||||
callback = on_exit,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||
pattern = "*",
|
||||
command = "%s/ / /ge",
|
||||
})
|
77
lua/core/keymaps.lua
Normal file
77
lua/core/keymaps.lua
Normal file
@ -0,0 +1,77 @@
|
||||
-- Set leader key
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
-- Disable the spacebar key's default behavior in Normal and Visual modes
|
||||
vim.keymap.set({ "n", "v" }, "<Space>", "<Nop>", { silent = true })
|
||||
|
||||
-- For conciseness
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
-- save file without auto-formatting
|
||||
vim.keymap.set("n", "<C-s>", "<cmd>noautocmd w <CR>", opts)
|
||||
|
||||
-- quit file
|
||||
vim.keymap.set("n", "<C-q>", "<cmd> q <CR>", opts)
|
||||
|
||||
-- delete single character without copying into register
|
||||
vim.keymap.set("n", "x", '"_x', opts)
|
||||
|
||||
-- Vertical scroll and center
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz", opts)
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz", opts)
|
||||
vim.keymap.set("n", "<S-g>", "<S-g>zz", opts)
|
||||
|
||||
-- Find and center
|
||||
vim.keymap.set("n", "n", "nzzzv", opts)
|
||||
vim.keymap.set("n", "N", "Nzzzv", opts)
|
||||
|
||||
-- Resize with arrows
|
||||
vim.keymap.set("n", "k", ":resize -2<CR>", opts)
|
||||
vim.keymap.set("n", "j", ":resize +2<CR>", opts)
|
||||
vim.keymap.set("n", "h", ":vertical resize -2<CR>", opts)
|
||||
vim.keymap.set("n", "l", ":vertical resize +2<CR>", opts)
|
||||
|
||||
-- Buffers
|
||||
vim.keymap.set("n", "<Tab>", ":bnext<CR>", opts)
|
||||
vim.keymap.set("n", "<S-Tab>", ":bprevious<CR>", opts)
|
||||
vim.keymap.set("n", "<leader>q", ":bdelete!<CR>:bnext<CR>", opts) -- close buffer
|
||||
vim.keymap.set("n", "<leader>b", "<cmd> enew <CR>", opts) -- new buffer
|
||||
|
||||
-- Window management
|
||||
vim.keymap.set("n", "<leader>v", "<C-w>v", opts) -- split window vertically
|
||||
vim.keymap.set("n", "<leader>h", "<C-w>s", opts) -- split window horizontally
|
||||
vim.keymap.set("n", "<leader>se", "<C-w>=", opts) -- make split windows equal width & height
|
||||
vim.keymap.set("n", "<leader>xs", ":close<CR>", opts) -- close current split window
|
||||
|
||||
-- Navigate between splits
|
||||
vim.keymap.set("n", "<C-Up>", ":wincmd k<CR>", opts)
|
||||
vim.keymap.set("n", "<C-Down>", ":wincmd j<CR>", opts)
|
||||
vim.keymap.set("n", "<C-Left>", ":wincmd h<CR>", opts)
|
||||
vim.keymap.set("n", "<C-Right>", ":wincmd l<CR>", opts)
|
||||
|
||||
-- Tabs
|
||||
vim.keymap.set("n", "<leader>to", ":tabnew<CR>", opts) -- open new tab
|
||||
vim.keymap.set("n", "<leader>tx", ":tabclose<CR>", opts) -- close current tab
|
||||
vim.keymap.set("n", "<leader>tn", ":tabn<CR>", opts) -- go to next tab
|
||||
vim.keymap.set("n", "<leader>tp", ":tabp<CR>", opts) -- go to previous tab
|
||||
|
||||
-- Toggle line wrapping
|
||||
vim.keymap.set("n", "<leader>lw", "<cmd>set wrap!<CR>", opts)
|
||||
|
||||
-- Stay in indent mode
|
||||
vim.keymap.set("v", "<", "<gv", opts)
|
||||
vim.keymap.set("v", ">", ">gv", opts)
|
||||
|
||||
-- Keep last yanked when pasting
|
||||
vim.keymap.set("v", "p", '"_dP', opts)
|
||||
|
||||
-- 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", "<leader>d", vim.diagnostic.open_float, { desc = "Open floating diagnostic message" })
|
||||
-- vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
|
||||
|
||||
-- Move lines
|
||||
vim.keymap.set("n", "<C-Up>", ":m -2<CR>", opts)
|
||||
vim.keymap.set("n", "<C-Down>", ":m +1<CR>", opts)
|
42
lua/core/options.lua
Normal file
42
lua/core/options.lua
Normal file
@ -0,0 +1,42 @@
|
||||
vim.wo.number = true -- Make line numbers default (default: false)
|
||||
vim.o.clipboard = "unnamedplus" -- Sync clipboard between OS and Neovim. (default: '')
|
||||
vim.o.wrap = false -- Display lines as one long line (default: true)
|
||||
vim.o.linebreak = true -- Companion to wrap, don't split words (default: false)
|
||||
vim.o.mouse = "a" -- Enable mouse mode (default: '')
|
||||
vim.o.autoindent = true -- Copy indent from current line when starting new one (default: true)
|
||||
vim.o.ignorecase = true -- Case-insensitive searching UNLESS \C or capital in search (default: false)
|
||||
vim.o.smartcase = true -- Smart case (default: false)
|
||||
vim.o.shiftwidth = 4 -- The number of spaces inserted for each indentation (default: 8)
|
||||
vim.o.tabstop = 4 -- Insert n spaces for a tab (default: 8)
|
||||
vim.o.softtabstop = 4 -- Number of spaces that a tab counts for while performing editing operations (default: 0)
|
||||
vim.o.expandtab = true -- Convert tabs to spaces (default: false)
|
||||
vim.o.scrolloff = 4 -- Minimal number of screen lines to keep above and below the cursor (default: 0)
|
||||
vim.o.sidescrolloff = 8 -- Minimal number of screen columns either side of cursor if wrap is `false` (default: 0)
|
||||
vim.o.cursorline = false -- Highlight the current line (default: false)
|
||||
vim.o.splitbelow = true -- Force all horizontal splits to go below current window (default: false)
|
||||
vim.o.splitright = true -- Force all vertical splits to go to the right of current window (default: false)
|
||||
vim.o.hlsearch = false -- Set highlight on search (default: true)
|
||||
vim.o.showmode = false -- We don't need to see things like -- INSERT -- anymore (default: true)
|
||||
vim.opt.termguicolors = true -- Set termguicolors to enable highlight groups (default: false)
|
||||
vim.o.whichwrap = "bs<>[]hl" -- Which "horizontal" keys are allowed to travel to prev/next line (default: 'b,s')
|
||||
vim.o.numberwidth = 4 -- Set number column width to 2 {default 4} (default: 4)
|
||||
vim.o.swapfile = false -- Creates a swapfile (default: true)
|
||||
vim.o.smartindent = true -- Make indenting smarter again (default: false)
|
||||
vim.o.showtabline = 2 -- Always show tabs (default: 1)
|
||||
vim.o.backspace = "indent,eol,start" -- Allow backspace on (default: 'indent,eol,start')
|
||||
vim.o.pumheight = 10 -- Pop up menu height (default: 0)
|
||||
vim.o.conceallevel = 0 -- So that `` is visible in markdown files (default: 1)
|
||||
vim.wo.signcolumn = "yes" -- Keep signcolumn on by default (default: 'auto')
|
||||
vim.o.fileencoding = "utf-8" -- The encoding written to a file (default: 'utf-8')
|
||||
vim.o.cmdheight = 1 -- More space in the Neovim command line for displaying messages (default: 1)
|
||||
vim.o.breakindent = true -- Enable break indent (default: false)
|
||||
vim.o.updatetime = 250 -- Decrease update time (default: 4000)
|
||||
vim.o.timeoutlen = 300 -- Time to wait for a mapped sequence to complete (in milliseconds) (default: 1000)
|
||||
vim.o.backup = false -- Creates a backup file (default: false)
|
||||
vim.o.writebackup = false -- If a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited (default: true)
|
||||
vim.o.undofile = true -- Save undo history (default: false)
|
||||
vim.o.completeopt = "menuone,noselect" -- Set completeopt to have a better completion experience (default: 'menu,preview')
|
||||
vim.opt.shortmess:append("c") -- Don't give |ins-completion-menu| messages (default: does not include 'c')
|
||||
vim.opt.iskeyword:append("-") -- Hyphenated words recognized by searches (default: does not include '-')
|
||||
vim.opt.formatoptions:remove({ "c", "r", "o" }) -- Don't insert the current comment leader automatically for auto-wrapping comments using 'textwidth', hitting <Enter> in insert mode, or hitting 'o' or 'O' in normal mode. (default: 'croql')
|
||||
vim.opt.runtimepath:remove("/usr/share/vim/vimfiles") -- Separate Vim plugins from Neovim in case Vim still in use (default: includes this path if Vim is installed)
|
46
lua/plugins/alpha.lua
Normal file
46
lua/plugins/alpha.lua
Normal file
@ -0,0 +1,46 @@
|
||||
return {
|
||||
"goolord/alpha-nvim",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
|
||||
config = function()
|
||||
local alpha = require("alpha")
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
|
||||
dashboard.section.header.val = {
|
||||
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠠⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ]],
|
||||
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣀⡀⠀⠙⢶⣄⠀⠀⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ]],
|
||||
[[ ⠀⠀⠀⠀⢠⣶⣦⣤⣀⣀⣤⣤⣄⣀⠀⢀⣀⣴⠂⠀⠀⠀⠀⠀⠀⠀⠐⠉⠉⣉⣉⣽⣿⣿⣷⣾⣿⣷⣄⡸⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ]],
|
||||
[[ ⠀⠀⠀⠀⠿⠿⢿⣿⣿⣿⣭⣭⣿⣿⣿⣿⣟⣁⠀⠀⠀⠀⠀⠀⠀⠀⣠⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ]],
|
||||
[[ ⠀⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠶⠤⠀⠀⢠⡾⢿⣿⣿⣿⣿⡿⠉⠀⠀⠀⠈⠙⢻⣿⣿⣿⡛⢻⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ]],
|
||||
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠋⠀⠀⠀⠉⠻⣿⣿⣿⣿⣦⡀⠀⠁⠀⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣦⣿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ]],
|
||||
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣯⡙⢦⠀⠀⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠙⠻⠿⠿⣿⣿⣿⣿⣶⣄⠀⠀⠀⠀⠀⠀⠀ ]],
|
||||
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⡄⠀⠀⣿⣿⣿⣿⣿⣿⣿⣦⠀⠀⠀⠀⠰⣄⠀⠀⠀⠀⠈⠛⢿⣿⡏⠀⠀⠀⠀⠀⠀⠀ ]],
|
||||
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⡝⡇⠀⠀⠹⡇⠙⢿⣿⣿⣿⣿⣿⣶⣦⣄⣀⣈⣳⣶⣤⣤⣄⣀⠈⠋⠀⠀⠀⠀⠀⠀⠀⠀ ]],
|
||||
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿⣿⡇⠁⠀⠀⠀⠙⣠⠤⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡛⠻⣷⣄⡀⠀⠀⠀⠀⠀⠀⠀ ]],
|
||||
[[ ⠀⠀⠀⠀⠈⢲⡄⠀⢀⡠⠔⠂⠀⠀⠀⠀⣸⣿⣿⣿⡿⢹⠇⠀⠀⠀⠀⠈⢀⣤⣶⣾⣿⣿⣿⣿⣿⣿⣿⡟⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀ ]],
|
||||
[[ ⠀⠀⠀⠀⠀⣾⣧⣾⣿⣶⣶⣶⣤⣀⠀⠀⣿⣿⣿⣿⠇⠋⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⣿⠟⠛⢿⣿⣿⣿⣿⡄⠀⠻⣿⡿⠿⠛⠛⠛⠛⠿⡿⠀⠀⠀⠀ ]],
|
||||
[[ ⠀⠀⠀⢀⣼⣿⣿⣿⣿⣿⣿⣿⣷⣮⡁⠀⣿⣿⣿⣿⠀⠀⠀⠀⠀⢠⠞⣻⣿⣿⣿⡿⠁⠀⠀⠈⣿⣿⣿⣿⣧⠀⠀⠀⢀⡀⠀⠀⠀⣴⠀⠀⠀⠀⠀⠀ ]],
|
||||
[[ ⠀⠀⢠⡿⢹⣿⣿⡋⠀⠈⢻⣿⣿⣿⡟⠆⢻⣿⣿⣿⡇⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⡇⠀⠀⠀⠀⢸⣿⣿⣿⣿⠀⠀⠀⣀⣭⣽⣶⣬⣿⡄⠀⠀⠀⠀⠀ ]],
|
||||
[[ ⠀⠀⣰⣷⣿⣿⠿⠃⠀⠀⢸⣿⣿⣿⣿⡄⠘⣿⣿⣿⣿⣄⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣄⠀⠀⠀⣾⣿⣿⣿⣿⠀⠴⣻⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀ ]],
|
||||
[[ ⠀⣴⣿⡿⠋⠀⠀⠀⠀⠀⣼⣿⣿⣿⢿⡇⠀⠘⣿⣿⣿⣿⣦⡀⠀⠀⢸⡟⢿⣿⣿⣿⣿⣧⡀⣰⣿⣿⣿⣿⡏⠀⣼⣿⣿⣿⠋⠀⠉⣿⣿⣌⣷⠀⠀⠀ ]],
|
||||
[[ ⠀⠈⠛⠁⠀⠀⠀⠀⠀⢸⣿⣿⣿⡏⠘⠀⠀⠀⠈⢻⣿⣿⣿⣿⣷⣤⡀⠳⠀⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠈⣿⣿⣿⣿⠀⠀⠈⠛⠻⢿⣿⣷⡄⠀ ]],
|
||||
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣇⠀⠀⠀⠀⠀⠀⠉⠻⣿⣿⣿⣿⣿⣷⣶⣤⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⣿⢿⣿⣿⣧⡀⠀⠀⠀⠀⠈⠿⠇⠀ ]],
|
||||
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀⠀⠈⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⠀⠀⠘⠌⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀ ]],
|
||||
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣿⣿⣿⣶⣶⣤⣤⣤⣄⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠀⠀⢀⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀ ]],
|
||||
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⣀⣤⣤⣴⣾⣿⣿⣿⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀ ]],
|
||||
[[ ⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⡀⠀⠀⢤⣬⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⡁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ]],
|
||||
[[ ⠀⠀⠀⠀⠀⠀⠠⠾⣿⣿⣿⣶⣤⣤⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣠⣶⣦⣄⡀⠀⠀⣶⢒⠲⣄ ]],
|
||||
[[ ⣾⣥⣤⣼⣿⣶⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣾⣵⣾⡿ ]],
|
||||
}
|
||||
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button("<CR>", " Select Session", ":SessionSearch <CR>"),
|
||||
dashboard.button("<leader>ff", " Open file", ":Neotree float <CR>"),
|
||||
dashboard.button("<leader>fr", " Open recent files.", ":Telescope oldfiles <CR>"),
|
||||
}
|
||||
|
||||
alpha.setup(dashboard.opts)
|
||||
end,
|
||||
}
|
175
lua/plugins/autocompletion.lua
Normal file
175
lua/plugins/autocompletion.lua
Normal file
@ -0,0 +1,175 @@
|
||||
return { -- Autocompletion
|
||||
'hrsh7th/nvim-cmp',
|
||||
dependencies = {
|
||||
-- Snippet Engine & its associated nvim-cmp source
|
||||
{
|
||||
'L3MON4D3/LuaSnip',
|
||||
build = (function()
|
||||
-- Build Step is needed for regex support in snippets.
|
||||
-- This step is not supported in many windows environments.
|
||||
-- Remove the below condition to re-enable on windows.
|
||||
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
|
||||
return
|
||||
end
|
||||
return 'make install_jsregexp'
|
||||
end)(),
|
||||
dependencies = {
|
||||
-- `friendly-snippets` contains a variety of premade snippets.
|
||||
-- See the README about individual language/framework/plugin snippets:
|
||||
-- https://github.com/rafamadriz/friendly-snippets
|
||||
{
|
||||
'rafamadriz/friendly-snippets',
|
||||
config = function()
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
|
||||
-- Adds other completion capabilities.
|
||||
-- nvim-cmp does not ship with all sources by default. They are split
|
||||
-- into multiple repos for maintenance purposes.
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-path',
|
||||
},
|
||||
config = function()
|
||||
-- See `:help cmp`
|
||||
local cmp = require 'cmp'
|
||||
local luasnip = require 'luasnip'
|
||||
luasnip.config.setup {}
|
||||
|
||||
local kind_icons = {
|
||||
Text = '',
|
||||
Method = 'm',
|
||||
Function = '',
|
||||
Constructor = '',
|
||||
Field = '',
|
||||
Variable = '',
|
||||
Class = '',
|
||||
Interface = '',
|
||||
Module = '',
|
||||
Property = '',
|
||||
Unit = '',
|
||||
Value = '',
|
||||
Enum = '',
|
||||
Keyword = '',
|
||||
Snippet = '',
|
||||
Color = '',
|
||||
File = '',
|
||||
Reference = '',
|
||||
Folder = '',
|
||||
EnumMember = '',
|
||||
Constant = '',
|
||||
Struct = '',
|
||||
Event = '',
|
||||
Operator = '',
|
||||
TypeParameter = '',
|
||||
}
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
completion = { completeopt = 'menu,menuone,noinsert' },
|
||||
|
||||
-- For an understanding of why these mappings were
|
||||
-- chosen, you will need to read `:help ins-completion`
|
||||
--
|
||||
-- No, but seriously. Please read `:help ins-completion`, it is really good!
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
-- Select the [n]ext item
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
-- Select the [p]revious item
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
|
||||
-- Scroll the documentation window [b]ack / [f]orward
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
|
||||
-- Accept ([y]es) the completion.
|
||||
-- This will auto-import if your LSP supports it.
|
||||
-- This will expand snippets if the LSP sent a snippet.
|
||||
['<Tab>'] = cmp.mapping.confirm { select = true },
|
||||
|
||||
-- If you prefer more traditional completion keymaps,
|
||||
-- you can uncomment the following lines
|
||||
--['<CR>'] = cmp.mapping.confirm { select = true },
|
||||
--['<Tab>'] = cmp.mapping.select_next_item(),
|
||||
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||
|
||||
-- Manually trigger a completion from nvim-cmp.
|
||||
-- Generally you don't need this, because nvim-cmp will display
|
||||
-- completions whenever it has completion options available.
|
||||
['<C-Space>'] = cmp.mapping.complete {},
|
||||
|
||||
-- Think of <c-l> as moving to the right of your snippet expansion.
|
||||
-- So if you have a snippet that's like:
|
||||
-- function $name($args)
|
||||
-- $body
|
||||
-- end
|
||||
--
|
||||
-- <c-l> will move you to the right of each of the expansion locations.
|
||||
-- <c-h> is similar, except moving you backwards.
|
||||
['<C-l>'] = cmp.mapping(function()
|
||||
if luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<C-h>'] = cmp.mapping(function()
|
||||
if luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
|
||||
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
||||
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
|
||||
-- Select next/previous item with Tab / Shift + Tab
|
||||
-- ['<Tab>'] = cmp.mapping(function(fallback)
|
||||
-- if cmp.visible() then
|
||||
-- cmp.select_next_item()
|
||||
-- elseif luasnip.expand_or_locally_jumpable() then
|
||||
-- luasnip.expand_or_jump()
|
||||
-- else
|
||||
-- fallback()
|
||||
-- end
|
||||
-- end, { 'i', 's' }),
|
||||
-- ['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
-- if cmp.visible() then
|
||||
-- cmp.select_prev_item()
|
||||
-- elseif luasnip.locally_jumpable(-1) then
|
||||
-- luasnip.jump(-1)
|
||||
-- else
|
||||
-- fallback()
|
||||
-- end
|
||||
-- end, { 'i', 's' }),
|
||||
},
|
||||
sources = {
|
||||
{
|
||||
name = 'lazydev',
|
||||
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
|
||||
group_index = 0,
|
||||
},
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' },
|
||||
},
|
||||
formatting = {
|
||||
fields = { 'kind', 'abbr', 'menu' },
|
||||
format = function(entry, vim_item)
|
||||
vim_item.kind = string.format('%s', kind_icons[vim_item.kind])
|
||||
vim_item.menu = ({
|
||||
nvim_lsp = '[LSP]',
|
||||
luasnip = '[Snippet]',
|
||||
buffer = '[Buffer]',
|
||||
path = '[Path]',
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
66
lua/plugins/bufferline.lua
Normal file
66
lua/plugins/bufferline.lua
Normal file
@ -0,0 +1,66 @@
|
||||
return {
|
||||
"akinsho/bufferline.nvim",
|
||||
dependencies = {
|
||||
"moll/vim-bbye",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
config = function()
|
||||
require("bufferline").setup({
|
||||
options = {
|
||||
mode = "buffers", -- set to "tabs" to only show tabpages instead
|
||||
themable = true, -- allows highlight groups to be overriden i.e. sets highlights as default
|
||||
numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string,
|
||||
close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||
buffer_close_icon = "✗",
|
||||
close_icon = "✗",
|
||||
path_components = 1, -- Show only the file name without the directory
|
||||
modified_icon = "●",
|
||||
left_trunc_marker = "",
|
||||
right_trunc_marker = "",
|
||||
max_name_length = 30,
|
||||
max_prefix_length = 30, -- prefix used when a buffer is de-duplicated
|
||||
tab_size = 21,
|
||||
diagnostics = false,
|
||||
diagnostics_update_in_insert = false,
|
||||
color_icons = true,
|
||||
show_buffer_icons = true,
|
||||
show_buffer_close_icons = true,
|
||||
show_close_icon = true,
|
||||
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
|
||||
separator_style = { "│", "│" }, -- | "thick" | "thin" | { 'any', 'any' },
|
||||
enforce_regular_tabs = true,
|
||||
always_show_bufferline = true,
|
||||
show_tab_indicators = false,
|
||||
indicator = {
|
||||
-- icon = '▎', -- this should be omitted if indicator style is not 'icon'
|
||||
style = "none", -- Options: 'icon', 'underline', 'none'
|
||||
},
|
||||
icon_pinned = "",
|
||||
minimum_padding = 1,
|
||||
maximum_padding = 5,
|
||||
maximum_length = 15,
|
||||
sort_by = "insert_at_end",
|
||||
offset = {
|
||||
filetype = "neo-tree",
|
||||
text = "Nvim Tree",
|
||||
separator = true,
|
||||
text_align = "left",
|
||||
},
|
||||
},
|
||||
highlights = {
|
||||
separator = {
|
||||
fg = "#434C5E",
|
||||
},
|
||||
buffer_selected = {
|
||||
bold = true,
|
||||
italic = false,
|
||||
},
|
||||
-- separator_selected = {},
|
||||
-- tab_selected = {},
|
||||
-- background = {},
|
||||
-- indicator_selected = {},
|
||||
-- fill = {},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
6
lua/plugins/colorscheme.lua
Normal file
6
lua/plugins/colorscheme.lua
Normal file
@ -0,0 +1,6 @@
|
||||
return {
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
priority = 1000,
|
||||
lazy = false,
|
||||
}
|
20
lua/plugins/gitsigns.lua
Normal file
20
lua/plugins/gitsigns.lua
Normal file
@ -0,0 +1,20 @@
|
||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
return {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = "+" },
|
||||
change = { text = "~" },
|
||||
delete = { text = "_" },
|
||||
topdelete = { text = "‾" },
|
||||
changedelete = { text = "~" },
|
||||
},
|
||||
signs_staged = {
|
||||
add = { text = "+" },
|
||||
change = { text = "~" },
|
||||
delete = { text = "_" },
|
||||
topdelete = { text = "‾" },
|
||||
changedelete = { text = "~" },
|
||||
},
|
||||
},
|
||||
}
|
25
lua/plugins/indent-blankline.lua
Normal file
25
lua/plugins/indent-blankline.lua
Normal file
@ -0,0 +1,25 @@
|
||||
return {
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
main = "ibl",
|
||||
opts = {
|
||||
indent = {
|
||||
char = "▏",
|
||||
},
|
||||
scope = {
|
||||
show_start = false,
|
||||
show_end = false,
|
||||
show_exact_scope = false,
|
||||
},
|
||||
exclude = {
|
||||
filetypes = {
|
||||
"help",
|
||||
"startify",
|
||||
"dashboard",
|
||||
"packer",
|
||||
"neogitstatus",
|
||||
"NvimTree",
|
||||
"Trouble",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
7
lua/plugins/leap.lua
Normal file
7
lua/plugins/leap.lua
Normal file
@ -0,0 +1,7 @@
|
||||
return {
|
||||
"ggandor/leap.nvim",
|
||||
config = function()
|
||||
require("leap").set_default_keymaps()
|
||||
require("leap").opts.case_sensitive = true
|
||||
end,
|
||||
}
|
248
lua/plugins/lsp.lua
Normal file
248
lua/plugins/lsp.lua
Normal file
@ -0,0 +1,248 @@
|
||||
return {
|
||||
-- Main LSP Configuration
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
-- Automatically install LSPs and related tools to stdpath for Neovim
|
||||
{ "williamboman/mason.nvim", config = true }, -- NOTE: Must be loaded before dependants
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
|
||||
-- Useful status updates for LSP.
|
||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||
{ "j-hui/fidget.nvim", opts = {} },
|
||||
|
||||
-- Allows extra capabilities provided by nvim-cmp
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
config = function()
|
||||
-- Brief aside: **What is LSP?**
|
||||
--
|
||||
-- LSP is an initialism you've probably heard, but might not understand what it is.
|
||||
--
|
||||
-- LSP stands for Language Server Protocol. It's a protocol that helps editors
|
||||
-- and language tooling communicate in a standardized fashion.
|
||||
--
|
||||
-- In general, you have a "server" which is some tool built to understand a particular
|
||||
-- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers
|
||||
-- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone
|
||||
-- processes that communicate with some "client" - in this case, Neovim!
|
||||
--
|
||||
-- LSP provides Neovim with features like:
|
||||
-- - Go to definition
|
||||
-- - Find references
|
||||
-- - Autocompletion
|
||||
-- - Symbol Search
|
||||
-- - and more!
|
||||
--
|
||||
-- Thus, Language Servers are external tools that must be installed separately from
|
||||
-- Neovim. This is where `mason` and related plugins come into play.
|
||||
--
|
||||
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully
|
||||
-- and elegantly composed help section, `:help lsp-vs-treesitter`
|
||||
|
||||
-- This function gets run when an LSP attaches to a particular buffer.
|
||||
-- That is to say, every time a new file is opened that is associated with
|
||||
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
|
||||
-- function will be executed to configure the current buffer
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
|
||||
callback = function(event)
|
||||
-- NOTE: Remember that Lua is a real programming language, and as such it is possible
|
||||
-- to define small helper and utility functions so you don't have to repeat yourself.
|
||||
--
|
||||
-- In this case, we create a function that lets us more easily define mappings specific
|
||||
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
||||
local map = function(keys, func, desc, mode)
|
||||
mode = mode or "n"
|
||||
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
|
||||
end
|
||||
|
||||
-- Jump to the definition of the word under your cursor.
|
||||
-- This is where a variable was first declared, or where a function is defined, etc.
|
||||
-- To jump back, press <C-t>.
|
||||
map("gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition")
|
||||
|
||||
-- Find references for the word under your cursor.
|
||||
map("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
|
||||
|
||||
-- Jump to the implementation of the word under your cursor.
|
||||
-- Useful when your language has ways of declaring types without an actual implementation.
|
||||
map("gI", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation")
|
||||
|
||||
-- Jump to the type of the word under your cursor.
|
||||
-- Useful when you're not sure what type a variable is and you want to see
|
||||
-- the definition of its *type*, not where it was *defined*.
|
||||
map("<leader>D", require("telescope.builtin").lsp_type_definitions, "Type [D]efinition")
|
||||
|
||||
-- Fuzzy find all the symbols in your current document.
|
||||
-- Symbols are things like variables, functions, types, etc.
|
||||
map("<leader>ds", require("telescope.builtin").lsp_document_symbols, "[D]ocument [S]ymbols")
|
||||
|
||||
-- Fuzzy find all the symbols in your current workspace.
|
||||
-- Similar to document symbols, except searches over your entire project.
|
||||
map("<leader>ws", require("telescope.builtin").lsp_dynamic_workspace_symbols, "[W]orkspace [S]ymbols")
|
||||
|
||||
-- Rename the variable under your cursor.
|
||||
-- Most Language Servers support renaming across files, etc.
|
||||
map("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
|
||||
|
||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
||||
-- or a suggestion from your LSP for this to activate.
|
||||
map("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction", { "n", "x" })
|
||||
|
||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||
-- For example, in C this would take you to the header.
|
||||
map("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
|
||||
|
||||
-- The following two autocommands are used to highlight references of the
|
||||
-- word under your cursor when your cursor rests there for a little while.
|
||||
-- See `:help CursorHold` for information about when this is executed
|
||||
--
|
||||
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
|
||||
local highlight_augroup = vim.api.nvim_create_augroup("kickstart-lsp-highlight", { clear = false })
|
||||
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.document_highlight,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("LspDetach", {
|
||||
group = vim.api.nvim_create_augroup("kickstart-lsp-detach", { clear = true }),
|
||||
callback = function(event2)
|
||||
vim.lsp.buf.clear_references()
|
||||
vim.api.nvim_clear_autocmds({ group = "kickstart-lsp-highlight", buffer = event2.buf })
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- The following code creates a keymap to toggle inlay hints in your
|
||||
-- code, if the language server you are using supports them
|
||||
--
|
||||
-- This may be unwanted, since they displace some of your code
|
||||
if client and client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
|
||||
map("<leader>th", function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf }))
|
||||
end, "[T]oggle Inlay [H]ints")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- LSP servers and clients are able to communicate to each other what features they support.
|
||||
-- By default, Neovim doesn't support everything that is in the LSP specification.
|
||||
-- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.
|
||||
-- So, we create new capabilities with nvim cmp, and then broadcast that to the servers.
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = vim.tbl_deep_extend("force", capabilities, require("cmp_nvim_lsp").default_capabilities())
|
||||
|
||||
-- Enable the following language servers
|
||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||
--
|
||||
-- Add any additional override configuration in the following tables. Available keys are:
|
||||
-- - cmd (table): Override the default command used to start the server
|
||||
-- - filetypes (table): Override the default list of associated filetypes for the server
|
||||
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
|
||||
-- - settings (table): Override the default settings passed when initializing the server.
|
||||
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
||||
local servers = {
|
||||
-- clangd = {},
|
||||
-- gopls = {},
|
||||
-- pyright = {},
|
||||
-- rust_analyzer = {},
|
||||
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||
--
|
||||
-- Some languages (like typescript) have entire language plugins that can be useful:
|
||||
-- https://github.com/pmizio/typescript-tools.nvim
|
||||
--
|
||||
-- But for many setups, the LSP (`tsserver`) will work just fine
|
||||
ts_ls = {}, -- tsserver is deprecated
|
||||
ruff = {},
|
||||
pylsp = {
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
pyflakes = { enabled = false },
|
||||
pycodestyle = { enabled = false },
|
||||
autopep8 = { enabled = false },
|
||||
yapf = { enabled = false },
|
||||
mccabe = { enabled = false },
|
||||
pylsp_mypy = { enabled = false },
|
||||
pylsp_black = { enabled = false },
|
||||
pylsp_isort = { enabled = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
html = { filetypes = { "html", "twig", "hbs" } },
|
||||
cssls = {},
|
||||
tailwindcss = {},
|
||||
dockerls = {},
|
||||
sqlls = {},
|
||||
jsonls = {},
|
||||
yamlls = {},
|
||||
clangd = {},
|
||||
ocamllsp = {},
|
||||
|
||||
lua_ls = {
|
||||
-- cmd = {...},
|
||||
-- filetypes = { ...},
|
||||
-- capabilities = {},
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
runtime = { version = "LuaJIT" },
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
"${3rd}/luv/library",
|
||||
unpack(vim.api.nvim_get_runtime_file("", true)),
|
||||
},
|
||||
},
|
||||
diagnostics = { disable = { "missing-fields" } },
|
||||
format = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Ensure the servers and tools above are installed
|
||||
-- To check the current status of installed tools and/or manually install
|
||||
-- other tools, you can run
|
||||
-- :Mason
|
||||
--
|
||||
-- You can press `g?` for help in this menu.
|
||||
require("mason").setup()
|
||||
|
||||
-- You can add other tools here that you want Mason to install
|
||||
-- for you, so that they are available from within Neovim.
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, {
|
||||
"stylua", -- Used to format Lua code
|
||||
})
|
||||
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
handlers = {
|
||||
function(server_name)
|
||||
local server = servers[server_name] or {}
|
||||
-- This handles overriding only values explicitly passed
|
||||
-- by the server configuration above. Useful when disabling
|
||||
-- certain features of an LSP (for example, turning off formatting for tsserver)
|
||||
server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {})
|
||||
require("lspconfig")[server_name].setup(server)
|
||||
end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
72
lua/plugins/lualine.lua
Normal file
72
lua/plugins/lualine.lua
Normal file
@ -0,0 +1,72 @@
|
||||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
config = function()
|
||||
local mode = {
|
||||
'mode',
|
||||
fmt = function(str)
|
||||
return ' ' .. str
|
||||
-- return ' ' .. str:sub(1, 1) -- displays only the first character of the mode
|
||||
end,
|
||||
}
|
||||
|
||||
local filename = {
|
||||
'filename',
|
||||
file_status = true, -- displays file status (readonly status, modified status)
|
||||
path = 0, -- 0 = just filename, 1 = relative path, 2 = absolute path
|
||||
}
|
||||
|
||||
local hide_in_width = function()
|
||||
return vim.fn.winwidth(0) > 100
|
||||
end
|
||||
|
||||
local diagnostics = {
|
||||
'diagnostics',
|
||||
sources = { 'nvim_diagnostic' },
|
||||
sections = { 'error', 'warn' },
|
||||
symbols = { error = ' ', warn = ' ', info = ' ', hint = ' ' },
|
||||
colored = false,
|
||||
update_in_insert = false,
|
||||
always_visible = false,
|
||||
cond = hide_in_width,
|
||||
}
|
||||
|
||||
local diff = {
|
||||
'diff',
|
||||
colored = false,
|
||||
symbols = { added = ' ', modified = ' ', removed = ' ' }, -- changes diff symbols
|
||||
cond = hide_in_width,
|
||||
}
|
||||
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'nord', -- Set theme based on environment variable
|
||||
-- Some useful glyphs:
|
||||
-- https://www.nerdfonts.com/cheat-sheet
|
||||
--
|
||||
section_separators = { left = '', right = '' },
|
||||
component_separators = { left = '', right = '' },
|
||||
disabled_filetypes = { 'alpha', 'neo-tree' },
|
||||
always_divide_middle = true,
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { mode },
|
||||
lualine_b = { 'branch' },
|
||||
lualine_c = { filename },
|
||||
lualine_x = { diagnostics, diff, { 'encoding', cond = hide_in_width }, { 'filetype', cond = hide_in_width } },
|
||||
lualine_y = { 'location' },
|
||||
lualine_z = { 'progress' },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { { 'filename', path = 1 } },
|
||||
lualine_x = { { 'location', padding = 0 } },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {},
|
||||
extensions = { 'fugitive' },
|
||||
}
|
||||
end,
|
||||
}
|
10
lua/plugins/md-preview.lua
Normal file
10
lua/plugins/md-preview.lua
Normal file
@ -0,0 +1,10 @@
|
||||
return {
|
||||
"toppair/peek.nvim",
|
||||
event = { "VeryLazy" },
|
||||
build = "deno task --quiet build:fast",
|
||||
config = function()
|
||||
require("peek").setup()
|
||||
vim.api.nvim_create_user_command("PeekOpen", require("peek").open, {})
|
||||
vim.api.nvim_create_user_command("PeekClose", require("peek").close, {})
|
||||
end,
|
||||
}
|
52
lua/plugins/misc.lua
Normal file
52
lua/plugins/misc.lua
Normal file
@ -0,0 +1,52 @@
|
||||
-- Standalone plugins with less than 10 lines of config go here
|
||||
return {
|
||||
{
|
||||
-- Image preview
|
||||
"adelarsq/image_preview.nvim",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("image_preview").setup()
|
||||
end,
|
||||
},
|
||||
{
|
||||
-- Tmux & split window navigation
|
||||
"christoomey/vim-tmux-navigator",
|
||||
},
|
||||
{
|
||||
-- Detect tabstop and shiftwidth automatically
|
||||
"tpope/vim-sleuth",
|
||||
},
|
||||
{
|
||||
-- Powerful Git integration for Vim
|
||||
"tpope/vim-fugitive",
|
||||
},
|
||||
{
|
||||
-- GitHub integration for vim-fugitive
|
||||
"tpope/vim-rhubarb",
|
||||
},
|
||||
{
|
||||
-- Hints keybinds
|
||||
"folke/which-key.nvim",
|
||||
},
|
||||
{
|
||||
-- Autoclose parentheses, brackets, quotes, etc.
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
config = true,
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
-- Highlight todo, notes, etc in comments
|
||||
"folke/todo-comments.nvim",
|
||||
event = "VimEnter",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = { signs = false },
|
||||
},
|
||||
{
|
||||
-- High-performance color highlighter
|
||||
"norcalli/nvim-colorizer.lua",
|
||||
config = function()
|
||||
require("colorizer").setup()
|
||||
end,
|
||||
},
|
||||
}
|
315
lua/plugins/neotree.lua
Normal file
315
lua/plugins/neotree.lua
Normal file
@ -0,0 +1,315 @@
|
||||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"MunifTanjim/nui.nvim",
|
||||
"3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
|
||||
{
|
||||
"s1n7ax/nvim-window-picker",
|
||||
version = "2.*",
|
||||
config = function()
|
||||
require("window-picker").setup({
|
||||
filter_rules = {
|
||||
include_current_win = false,
|
||||
autoselect_one = true,
|
||||
-- filter using buffer options
|
||||
bo = {
|
||||
-- if the file type is one of following, the window will be ignored
|
||||
filetype = { "neo-tree", "neo-tree-popup", "notify" },
|
||||
-- if the buffer type is one of following, the window will be ignored
|
||||
buftype = { "terminal", "quickfix" },
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
-- If you want icons for diagnostic errors, you'll need to define them somewhere:
|
||||
vim.fn.sign_define("DiagnosticSignError", { text = " ", texthl = "DiagnosticSignError" })
|
||||
vim.fn.sign_define("DiagnosticSignWarn", { text = " ", texthl = "DiagnosticSignWarn" })
|
||||
vim.fn.sign_define("DiagnosticSignInfo", { text = " ", texthl = "DiagnosticSignInfo" })
|
||||
vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
|
||||
|
||||
require("neo-tree").setup({
|
||||
close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab
|
||||
popup_border_style = "rounded",
|
||||
enable_git_status = true,
|
||||
enable_diagnostics = true,
|
||||
-- enable_normal_mode_for_inputs = false, -- Enable normal mode for input dialogs.
|
||||
open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes
|
||||
sort_case_insensitive = false, -- used when sorting files and directories in the tree
|
||||
sort_function = nil, -- use a custom function for sorting files and directories in the tree
|
||||
-- sort_function = function (a,b)
|
||||
-- if a.type == b.type then
|
||||
-- return a.path > b.path
|
||||
-- else
|
||||
-- return a.type > b.type
|
||||
-- end
|
||||
-- end , -- this sorts files and directories descendantly
|
||||
default_component_configs = {
|
||||
container = {
|
||||
enable_character_fade = true,
|
||||
},
|
||||
indent = {
|
||||
indent_size = 2,
|
||||
padding = 1, -- extra padding on left hand side
|
||||
-- indent guides
|
||||
with_markers = true,
|
||||
indent_marker = "│",
|
||||
last_indent_marker = "└",
|
||||
highlight = "NeoTreeIndentMarker",
|
||||
-- expander config, needed for nesting files
|
||||
with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders
|
||||
expander_collapsed = "",
|
||||
expander_expanded = "",
|
||||
expander_highlight = "NeoTreeExpander",
|
||||
},
|
||||
icon = {
|
||||
folder_closed = "",
|
||||
folder_open = "",
|
||||
folder_empty = "",
|
||||
-- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there
|
||||
-- then these will never be used.
|
||||
default = "*",
|
||||
highlight = "NeoTreeFileIcon",
|
||||
},
|
||||
modified = {
|
||||
symbol = "[+]",
|
||||
highlight = "NeoTreeModified",
|
||||
},
|
||||
name = {
|
||||
trailing_slash = false,
|
||||
use_git_status_colors = true,
|
||||
highlight = "NeoTreeFileName",
|
||||
},
|
||||
git_status = {
|
||||
symbols = {
|
||||
-- Change type
|
||||
added = "", -- or "✚", but this is redundant info if you use git_status_colors on the name
|
||||
modified = "", -- or "", but this is redundant info if you use git_status_colors on the name
|
||||
deleted = "✖", -- this can only be used in the git_status source
|
||||
renamed = "", -- this can only be used in the git_status source
|
||||
-- Status type
|
||||
untracked = "",
|
||||
ignored = "",
|
||||
unstaged = "",
|
||||
staged = "",
|
||||
conflict = "",
|
||||
},
|
||||
},
|
||||
-- If you don't want to use these columns, you can set `enabled = false` for each of them individually
|
||||
file_size = {
|
||||
enabled = true,
|
||||
required_width = 64, -- min width of window required to show this column
|
||||
},
|
||||
type = {
|
||||
enabled = true,
|
||||
required_width = 122, -- min width of window required to show this column
|
||||
},
|
||||
last_modified = {
|
||||
enabled = true,
|
||||
required_width = 88, -- min width of window required to show this column
|
||||
},
|
||||
created = {
|
||||
enabled = true,
|
||||
required_width = 110, -- min width of window required to show this column
|
||||
},
|
||||
symlink_target = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
-- A list of functions, each representing a global custom command
|
||||
-- that will be available in all sources (if not overridden in `opts[source_name].commands`)
|
||||
-- see `:h neo-tree-custom-commands-global`
|
||||
commands = {},
|
||||
window = {
|
||||
position = "left",
|
||||
width = 40,
|
||||
mapping_options = {
|
||||
noremap = true,
|
||||
nowait = true,
|
||||
},
|
||||
mappings = {
|
||||
["<space>"] = {
|
||||
"toggle_node",
|
||||
nowait = false, -- disable `nowait` if you have existing combos starting with this char that you want to use
|
||||
},
|
||||
["<2-LeftMouse>"] = "open",
|
||||
["<cr>"] = "open",
|
||||
["<esc>"] = "cancel", -- close preview or floating neo-tree window
|
||||
["P"] = { "toggle_preview", config = { use_float = true } },
|
||||
["l"] = "open",
|
||||
["S"] = "open_split",
|
||||
["s"] = "open_vsplit",
|
||||
-- ["S"] = "split_with_window_picker",
|
||||
-- ["s"] = "vsplit_with_window_picker",
|
||||
["t"] = "open_tabnew",
|
||||
-- ["<cr>"] = "open_drop",
|
||||
-- ["t"] = "open_tab_drop",
|
||||
["w"] = "open_with_window_picker",
|
||||
--["P"] = "toggle_preview", -- enter preview mode, which shows the current node without focusing
|
||||
["C"] = "close_node",
|
||||
-- ['C'] = 'close_all_subnodes',
|
||||
["z"] = "close_all_nodes",
|
||||
--["Z"] = "expand_all_nodes",
|
||||
["a"] = {
|
||||
"add",
|
||||
-- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details
|
||||
-- some commands may take optional config options, see `:h neo-tree-mappings` for details
|
||||
config = {
|
||||
show_path = "none", -- "none", "relative", "absolute"
|
||||
},
|
||||
},
|
||||
["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion.
|
||||
["d"] = "delete",
|
||||
["r"] = "rename",
|
||||
["y"] = "copy_to_clipboard",
|
||||
["x"] = "cut_to_clipboard",
|
||||
["p"] = "paste_from_clipboard",
|
||||
["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add":
|
||||
-- ["c"] = {
|
||||
-- "copy",
|
||||
-- config = {
|
||||
-- show_path = "none" -- "none", "relative", "absolute"
|
||||
-- }
|
||||
--}
|
||||
["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add".
|
||||
["q"] = "close_window",
|
||||
["R"] = "refresh",
|
||||
["?"] = "show_help",
|
||||
["<"] = "prev_source",
|
||||
[">"] = "next_source",
|
||||
["i"] = "show_file_details",
|
||||
},
|
||||
},
|
||||
nesting_rules = {},
|
||||
filesystem = {
|
||||
filtered_items = {
|
||||
visible = false, -- when true, they will just be displayed differently than normal items
|
||||
hide_dotfiles = false,
|
||||
hide_gitignored = false,
|
||||
hide_hidden = false, -- only works on Windows for hidden files/directories
|
||||
hide_by_name = {
|
||||
".DS_Store",
|
||||
"thumbs.db",
|
||||
"node_modules",
|
||||
"__pycache__",
|
||||
".virtual_documents",
|
||||
".git",
|
||||
".python-version",
|
||||
".venv",
|
||||
},
|
||||
hide_by_pattern = { -- uses glob style patterns
|
||||
--"*.meta",
|
||||
--"*/src/*/tsconfig.json",
|
||||
},
|
||||
always_show = { -- remains visible even if other settings would normally hide it
|
||||
--".gitignored",
|
||||
},
|
||||
never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show
|
||||
--".DS_Store",
|
||||
--"thumbs.db"
|
||||
},
|
||||
never_show_by_pattern = { -- uses glob style patterns
|
||||
--".null-ls_*",
|
||||
},
|
||||
},
|
||||
follow_current_file = {
|
||||
enabled = false, -- This will find and focus the file in the active buffer every time
|
||||
-- -- the current file is changed while the tree is open.
|
||||
leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal`
|
||||
},
|
||||
group_empty_dirs = false, -- when true, empty folders will be grouped together
|
||||
hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree
|
||||
-- in whatever position is specified in window.position
|
||||
-- "open_current", -- netrw disabled, opening a directory opens within the
|
||||
-- window like netrw would, regardless of window.position
|
||||
-- "disabled", -- netrw left alone, neo-tree does not handle opening dirs
|
||||
use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes
|
||||
-- instead of relying on nvim autocmd events.
|
||||
window = {
|
||||
mappings = {
|
||||
["<bs>"] = "navigate_up",
|
||||
["."] = "set_root",
|
||||
["H"] = "toggle_hidden",
|
||||
["/"] = "fuzzy_finder",
|
||||
["D"] = "fuzzy_finder_directory",
|
||||
["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm
|
||||
-- ["D"] = "fuzzy_sorter_directory",
|
||||
["f"] = "filter_on_submit",
|
||||
["<c-x>"] = "clear_filter",
|
||||
["[g"] = "prev_git_modified",
|
||||
["]g"] = "next_git_modified",
|
||||
["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } },
|
||||
["oc"] = { "order_by_created", nowait = false },
|
||||
["od"] = { "order_by_diagnostics", nowait = false },
|
||||
["og"] = { "order_by_git_status", nowait = false },
|
||||
["om"] = { "order_by_modified", nowait = false },
|
||||
["on"] = { "order_by_name", nowait = false },
|
||||
["os"] = { "order_by_size", nowait = false },
|
||||
["ot"] = { "order_by_type", nowait = false },
|
||||
},
|
||||
fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode
|
||||
["<down>"] = "move_cursor_down",
|
||||
["<C-n>"] = "move_cursor_down",
|
||||
["<up>"] = "move_cursor_up",
|
||||
["<C-p>"] = "move_cursor_up",
|
||||
},
|
||||
},
|
||||
|
||||
commands = {}, -- Add a custom command or override a global one using the same function name
|
||||
},
|
||||
buffers = {
|
||||
follow_current_file = {
|
||||
enabled = true, -- This will find and focus the file in the active buffer every time
|
||||
-- -- the current file is changed while the tree is open.
|
||||
leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal`
|
||||
},
|
||||
group_empty_dirs = true, -- when true, empty folders will be grouped together
|
||||
show_unloaded = true,
|
||||
window = {
|
||||
mappings = {
|
||||
["bd"] = "buffer_delete",
|
||||
["<bs>"] = "navigate_up",
|
||||
["."] = "set_root",
|
||||
["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } },
|
||||
["oc"] = { "order_by_created", nowait = false },
|
||||
["od"] = { "order_by_diagnostics", nowait = false },
|
||||
["om"] = { "order_by_modified", nowait = false },
|
||||
["on"] = { "order_by_name", nowait = false },
|
||||
["os"] = { "order_by_size", nowait = false },
|
||||
["ot"] = { "order_by_type", nowait = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
git_status = {
|
||||
window = {
|
||||
position = "float",
|
||||
mappings = {
|
||||
["A"] = "git_add_all",
|
||||
["gu"] = "git_unstage_file",
|
||||
["ga"] = "git_add_file",
|
||||
["gr"] = "git_revert_file",
|
||||
["gc"] = "git_commit",
|
||||
["gp"] = "git_push",
|
||||
["gg"] = "git_commit_and_push",
|
||||
["o"] = { "show_help", nowait = false, config = { title = "Order by", prefix_key = "o" } },
|
||||
["oc"] = { "order_by_created", nowait = false },
|
||||
["od"] = { "order_by_diagnostics", nowait = false },
|
||||
["om"] = { "order_by_modified", nowait = false },
|
||||
["on"] = { "order_by_name", nowait = false },
|
||||
["os"] = { "order_by_size", nowait = false },
|
||||
["ot"] = { "order_by_type", nowait = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.cmd([[nnoremap \ :Neotree reveal<cr>]])
|
||||
vim.keymap.set("n", "<leader>e", ":Neotree toggle position=left<CR>", { noremap = true, silent = true }) -- focus file explorer
|
||||
vim.keymap.set("n", "<leader>ngs", ":Neotree float git_status<CR>", { noremap = true, silent = true }) -- open git status window
|
||||
end,
|
||||
}
|
58
lua/plugins/none-ls.lua
Normal file
58
lua/plugins/none-ls.lua
Normal file
@ -0,0 +1,58 @@
|
||||
return {
|
||||
"nvimtools/none-ls.nvim",
|
||||
dependencies = {
|
||||
"nvimtools/none-ls-extras.nvim",
|
||||
"jayp0521/mason-null-ls.nvim", -- ensure dependencies are installed
|
||||
},
|
||||
config = function()
|
||||
local null_ls = require("null-ls")
|
||||
local formatting = null_ls.builtins.formatting -- to setup formatters
|
||||
local diagnostics = null_ls.builtins.diagnostics -- to setup linters
|
||||
|
||||
-- Formatters & linters for mason to install
|
||||
require("mason-null-ls").setup({
|
||||
ensure_installed = {
|
||||
"prettier", -- ts/js formatter
|
||||
"stylua", -- lua formatter
|
||||
"eslint_d", -- ts/js linter
|
||||
"shfmt", -- Shell formatter
|
||||
"checkmake", -- linter for Makefiles
|
||||
"ruff", -- Python linter and formatter
|
||||
"clangd",
|
||||
},
|
||||
automatic_installation = true,
|
||||
})
|
||||
|
||||
local sources = {
|
||||
diagnostics.checkmake,
|
||||
formatting.prettier.with({ filetypes = { "html", "json", "yaml", "markdown" } }),
|
||||
formatting.stylua,
|
||||
formatting.shfmt.with({ args = { "-i", "4" } }),
|
||||
formatting.terraform_fmt,
|
||||
require("none-ls.formatting.ruff").with({
|
||||
extra_args = { "--extend-select", "I" },
|
||||
}),
|
||||
require("none-ls.formatting.ruff_format"),
|
||||
formatting.clang_format,
|
||||
}
|
||||
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
null_ls.setup({
|
||||
-- debug = true, -- Enable debug mode. Inspect logs with :NullLsLog.
|
||||
sources = sources,
|
||||
-- you can reuse a shared lspconfig on_attach callback here
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ async = false })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
10
lua/plugins/rest.lua
Normal file
10
lua/plugins/rest.lua
Normal file
@ -0,0 +1,10 @@
|
||||
return {
|
||||
"rest-nvim/rest.nvim",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
table.insert(opts.ensure_installed, "http")
|
||||
end,
|
||||
},
|
||||
}
|
18
lua/plugins/session-manager.lua
Normal file
18
lua/plugins/session-manager.lua
Normal file
@ -0,0 +1,18 @@
|
||||
return {
|
||||
"rmagatti/auto-session",
|
||||
config = function()
|
||||
require("auto-session").setup({
|
||||
auto_session_suppress_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
|
||||
session_lens = {
|
||||
buftypes_to_ignore = {},
|
||||
load_on_setup = true,
|
||||
theme_conf = { border = true },
|
||||
previewer = false,
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<Leader>ls", require("auto-session.session-lens").search_session, {
|
||||
noremap = true,
|
||||
})
|
||||
end,
|
||||
}
|
116
lua/plugins/telescope.lua
Normal file
116
lua/plugins/telescope.lua
Normal file
@ -0,0 +1,116 @@
|
||||
return { -- Fuzzy Finder (files, lsp, etc)
|
||||
"nvim-telescope/telescope.nvim",
|
||||
event = "VimEnter",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
|
||||
-- `build` is used to run some command when the plugin is installed/updated.
|
||||
-- This is only run then, not every time Neovim starts up.
|
||||
build = "make",
|
||||
|
||||
-- `cond` is a condition used to determine whether this plugin should be
|
||||
-- installed and loaded.
|
||||
cond = function()
|
||||
return vim.fn.executable("make") == 1
|
||||
end,
|
||||
},
|
||||
{ "nvim-telescope/telescope-ui-select.nvim" },
|
||||
|
||||
-- Useful for getting pretty icons, but requires a Nerd Font.
|
||||
{ "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font },
|
||||
},
|
||||
config = function()
|
||||
-- Telescope is a fuzzy finder that comes with a lot of different things that
|
||||
-- it can fuzzy find! It's more than just a "file finder", it can search
|
||||
-- many different aspects of Neovim, your workspace, LSP, and more!
|
||||
--
|
||||
-- The easiest way to use Telescope, is to start by doing something like:
|
||||
-- :Telescope help_tags
|
||||
--
|
||||
-- After running this command, a window will open up and you're able to
|
||||
-- type in the prompt window. You'll see a list of `help_tags` options and
|
||||
-- a corresponding preview of the help.
|
||||
--
|
||||
-- Two important keymaps to use while in Telescope are:
|
||||
-- - Insert mode: <c-/>
|
||||
-- - Normal mode: ?
|
||||
--
|
||||
-- This opens a window that shows you all of the keymaps for the current
|
||||
-- Telescope picker. This is really useful to discover what Telescope can
|
||||
-- do as well as how to actually do it!
|
||||
|
||||
-- [[ Configure Telescope ]]
|
||||
-- See `:help telescope` and `:help telescope.setup()`
|
||||
require("telescope").setup({
|
||||
-- You can put your default mappings / updates / etc. in here
|
||||
-- All the info you're looking for is in `:help telescope.setup()`
|
||||
--
|
||||
-- defaults = {
|
||||
-- mappings = {
|
||||
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
|
||||
-- },
|
||||
-- },
|
||||
-- pickers = {}
|
||||
pickers = {
|
||||
find_files = {
|
||||
file_ignore_patterns = { "node_modules", ".git", ".venv" },
|
||||
hidden = true,
|
||||
},
|
||||
},
|
||||
live_grep = {
|
||||
file_ignore_patterns = { "node_modules", ".git", ".venv" },
|
||||
additional_args = function(_)
|
||||
return { "--hidden" }
|
||||
end,
|
||||
},
|
||||
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown(),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Enable Telescope extensions if they are installed
|
||||
pcall(require("telescope").load_extension, "fzf")
|
||||
pcall(require("telescope").load_extension, "ui-select")
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<leader>sh", builtin.help_tags, { desc = "[S]earch [H]elp" })
|
||||
vim.keymap.set("n", "<leader>sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" })
|
||||
vim.keymap.set("n", "<leader>sf", builtin.find_files, { desc = "[S]earch [F]iles" })
|
||||
vim.keymap.set("n", "<leader>ss", builtin.builtin, { desc = "[S]earch [S]elect Telescope" })
|
||||
vim.keymap.set("n", "<leader>sw", builtin.grep_string, { desc = "[S]earch current [W]ord" })
|
||||
vim.keymap.set("n", "<leader>sg", builtin.live_grep, { desc = "[S]earch by [G]rep" })
|
||||
vim.keymap.set("n", "<leader>sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" })
|
||||
vim.keymap.set("n", "<leader>sr", builtin.resume, { desc = "[S]earch [R]esume" })
|
||||
vim.keymap.set("n", "<leader>s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set("n", "<leader><leader>", builtin.buffers, { desc = "[ ] Find existing buffers" })
|
||||
|
||||
-- Slightly advanced example of overriding default behavior and theme
|
||||
vim.keymap.set("n", "<leader>/", function()
|
||||
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
||||
builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
}))
|
||||
end, { desc = "[/] Fuzzily search in current buffer" })
|
||||
|
||||
-- It's also possible to pass additional configuration options.
|
||||
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
||||
vim.keymap.set("n", "<leader>s/", function()
|
||||
builtin.live_grep({
|
||||
grep_open_files = true,
|
||||
prompt_title = "Live Grep in Open Files",
|
||||
})
|
||||
end, { desc = "[S]earch [/] in Open Files" })
|
||||
|
||||
-- Shortcut for searching your Neovim configuration files
|
||||
vim.keymap.set("n", "<leader>sn", function()
|
||||
builtin.find_files({ cwd = vim.fn.stdpath("config") })
|
||||
end, { desc = "[S]earch [N]eovim files" })
|
||||
end,
|
||||
}
|
10
lua/plugins/toggleterm.lua
Normal file
10
lua/plugins/toggleterm.lua
Normal file
@ -0,0 +1,10 @@
|
||||
return {
|
||||
-- amongst your other plugins
|
||||
"akinsho/toggleterm.nvim",
|
||||
version = "*",
|
||||
config = true,
|
||||
|
||||
-- config = function()
|
||||
-- vim.keymap.set("n", "<leader>tt", "<cmd> ToggleTerm direction=float <CR>", { noremap = true, silent = true })
|
||||
-- end,
|
||||
}
|
33
lua/plugins/treesitter.lua
Normal file
33
lua/plugins/treesitter.lua
Normal file
@ -0,0 +1,33 @@
|
||||
return { -- Highlight, edit, and navigate code
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
'bash',
|
||||
'c',
|
||||
'cpp',
|
||||
'python',
|
||||
'javascript',
|
||||
'html',
|
||||
'css'
|
||||
},
|
||||
-- Autoinstall languages that are not installed
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
|
||||
-- If you are experiencing weird indenting issues, add the language to
|
||||
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
|
||||
additional_vim_regex_highlighting = { 'ruby' },
|
||||
},
|
||||
indent = { enable = true, disable = { 'ruby' } },
|
||||
},
|
||||
-- There are additional nvim-treesitter modules that you can use to interact
|
||||
-- with nvim-treesitter. You should go explore a few and see what interests you:
|
||||
--
|
||||
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
|
||||
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
|
||||
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user