mirror of
https://github.com/xsghetti/HyprCrux.git
synced 2025-07-01 13:00:38 -04:00
add nvim config
This commit is contained in:
parent
e740023762
commit
4dbb2cbe7e
31 changed files with 691 additions and 0 deletions
21
.config/nvim/LICENSE
Normal file
21
.config/nvim/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2024 xSghetti
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
1
.config/nvim/README.md
Normal file
1
.config/nvim/README.md
Normal file
|
@ -0,0 +1 @@
|
|||

|
9
.config/nvim/init.lua
Normal file
9
.config/nvim/init.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
require("crux.core")
|
||||
require("crux.lazy")
|
||||
require('mini.animate').setup()
|
||||
-- Set Color Scheme
|
||||
vim.cmd([[:colorscheme pywal]])
|
||||
require('staline').setup()
|
||||
require('ibl').setup()
|
||||
|
||||
|
42
.config/nvim/lazy-lock.json
Normal file
42
.config/nvim/lazy-lock.json
Normal file
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
|
||||
"activate.nvim": { "branch": "main", "commit": "8566e9a342fe2d4fc92fcb28b4ea281e2ed927d5" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "41283fb402713fc8b327e60907f74e46166f4cfd" },
|
||||
"auto-session": { "branch": "main", "commit": "879f5b30207bd53101e1034ca91330f23746f601" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "99337f63f0a3c3ab9519f3d1da7618ca4f91cffe" },
|
||||
"catppuccin": { "branch": "main", "commit": "31fcfb02c47952d5c75aec893b93b2878abe5fbb" },
|
||||
"cellular-automaton.nvim": { "branch": "main", "commit": "11aea08aa084f9d523b0142c2cd9441b8ede09ed" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "6741f1062d3dc6e4755367a7e9b347b553623f04" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "682157939e57bd6a2c86277dfd4d6fbfce63dbac" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "65e20ab94a26d0e14acac5049b8641336819dfc7" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "b02c9eae6a250f98908c146d1dc1a891f5019f0a" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "37a336b653f8594df75c827ed589f1c91d91ff6c" },
|
||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
|
||||
"mason.nvim": { "branch": "main", "commit": "0950b15060067f752fde13a779a994f59516ce3d" },
|
||||
"mini.animate": { "branch": "main", "commit": "320fb35460238c436407cd779f63abad98e84870" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "02893eeb9d6e8503817bd52385e111cba9a90500" },
|
||||
"noice.nvim": { "branch": "main", "commit": "03c6a75661e68012e30b0ed81f050358b1e2233c" },
|
||||
"nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" },
|
||||
"nvim-lsp-file-operations": { "branch": "master", "commit": "92a673de7ecaa157dd230d0128def10beb56d103" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "53a3c6444ec5006b567071614c83edc8ad651f6d" },
|
||||
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "8b2c5c678be4b49dff6a2df794877000113fd77b" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "6cd4ce6cab184e8787f164a182954534221f2af2" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "c0cfc1738361b5da1cd0a962dd6f774cc444f856" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
|
||||
"pywal.nvim": { "branch": "main", "commit": "d11b673c0e3d6eb8cbee7ea8cf4a8911f6ee24b9" },
|
||||
"staline.nvim": { "branch": "main", "commit": "d337bc9b343df3328921ef4c3f8ff604102d0201" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" },
|
||||
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"vim-floaterm": { "branch": "master", "commit": "4e28c8dd0271e10a5f55142fb6fe9b1599ee6160" },
|
||||
"vim-tmux-navigator": { "branch": "master", "commit": "5b3c701686fb4e6629c100ed32e827edf8dad01e" },
|
||||
"vim-wintabs": { "branch": "master", "commit": "6d18d62ae0f293a108afee8c514706027faefcf3" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "0099511294f16b81c696004fa6a403b0ae61f7a0" }
|
||||
}
|
3
.config/nvim/lua/crux/core/init.lua
Normal file
3
.config/nvim/lua/crux/core/init.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
require("crux.core.options")
|
||||
require("crux.core.options")
|
||||
require("crux.core.keymaps")
|
32
.config/nvim/lua/crux/core/keymaps.lua
Normal file
32
.config/nvim/lua/crux/core/keymaps.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
-- set leader key to space
|
||||
vim.g.mapleader = " "
|
||||
|
||||
local keymap = vim.keymap -- for conciseness
|
||||
|
||||
---------------------
|
||||
-- General Keymaps -------------------
|
||||
|
||||
-- use jk to exit insert mode
|
||||
keymap.set("i", "jk", "<ESC>", { desc = "Exit insert mode with jk" })
|
||||
|
||||
-- clear search highlights
|
||||
keymap.set("n", "<leader>nh", ":nohl<CR>", { desc = "Clear search highlights" })
|
||||
|
||||
-- delete single character without copying into register
|
||||
-- keymap.set("n", "x", '"_x')
|
||||
|
||||
-- increment/decrement numbers
|
||||
keymap.set("n", "<leader>+", "<C-a>", { desc = "Increment number" }) -- increment
|
||||
keymap.set("n", "<leader>-", "<C-x>", { desc = "Decrement number" }) -- decrement
|
||||
|
||||
-- window management
|
||||
keymap.set("n", "<leader>sv", "<C-w>v", { desc = "Split window vertically" }) -- split window vertically
|
||||
keymap.set("n", "<leader>sh", "<C-w>s", { desc = "Split window horizontally" }) -- split window horizontally
|
||||
keymap.set("n", "<leader>se", "<C-w>=", { desc = "Make splits equal size" }) -- make split windows equal width & height
|
||||
keymap.set("n", "<leader>sx", "<cmd>close<CR>", { desc = "Close current split" }) -- close current split window
|
||||
|
||||
keymap.set("n", "<leader>to", "<cmd>tabnew<CR>", { desc = "Open new tab" }) -- open new tab
|
||||
keymap.set("n", "<leader>tx", "<cmd>tabclose<CR>", { desc = "Close current tab" }) -- close current tab
|
||||
keymap.set("n", "<leader>tn", "<cmd>tabn<CR>", { desc = "Go to next tab" }) -- go to next tab
|
||||
keymap.set("n", "<leader>tp", "<cmd>tabp<CR>", { desc = "Go to previous tab" }) -- go to previous tab
|
||||
keymap.set("n", "<leader>tf", "<cmd>tabnew %<CR>", { desc = "Open current buffer in new tab" }) -- move current buffer to new tab
|
44
.config/nvim/lua/crux/core/options.lua
Normal file
44
.config/nvim/lua/crux/core/options.lua
Normal file
|
@ -0,0 +1,44 @@
|
|||
vim.cmd("let g:netrw_liststyle = 3")
|
||||
|
||||
local opt = vim.opt -- for conciseness
|
||||
|
||||
-- line numbers
|
||||
opt.relativenumber = false -- show relative line numbers
|
||||
opt.number = true -- shows absolute line number on cursor line (when relative number is on)
|
||||
|
||||
-- tabs & indentation
|
||||
opt.tabstop = 2 -- 2 spaces for tabs (prettier default)
|
||||
opt.shiftwidth = 2 -- 2 spaces for indent width
|
||||
opt.expandtab = true -- expand tab to spaces
|
||||
opt.autoindent = true -- copy indent from current line when starting new one
|
||||
|
||||
-- line wrapping
|
||||
opt.wrap = false -- disable line wrapping
|
||||
|
||||
-- search settings
|
||||
opt.ignorecase = true -- ignore case when searching
|
||||
opt.smartcase = true -- if you include mixed case in your search, assumes you want case-sensitive
|
||||
|
||||
-- cursor line
|
||||
opt.cursorline = true -- highlight the current cursor line
|
||||
|
||||
-- appearance
|
||||
|
||||
-- turn on termguicolors for nightfly colorscheme to work
|
||||
-- (have to use iterm2 or any other true color terminal)
|
||||
opt.termguicolors = true
|
||||
opt.background = "dark" -- colorschemes that can be light or dark will be made dark
|
||||
opt.signcolumn = "yes" -- show sign column so that text doesn't shift
|
||||
|
||||
-- backspace
|
||||
opt.backspace = "indent,eol,start" -- allow backspace on indent, end of line or insert mode start position
|
||||
|
||||
-- clipboard
|
||||
opt.clipboard:append("unnamedplus") -- use system clipboard as default register
|
||||
|
||||
-- split windows
|
||||
opt.splitright = true -- split vertical window to the right
|
||||
opt.splitbelow = true -- split horizontal window to the bottom
|
||||
|
||||
-- turn off swapfile
|
||||
opt.swapfile = false
|
20
.config/nvim/lua/crux/lazy.lua
Normal file
20
.config/nvim/lua/crux/lazy.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({ { import = "crux.plugins" }, { import = "crux.plugins.lsp" } }, {
|
||||
checker = {
|
||||
enabled = true,
|
||||
notify = false,
|
||||
},
|
||||
})
|
||||
|
13
.config/nvim/lua/crux/plugins/activate.lua
Normal file
13
.config/nvim/lua/crux/plugins/activate.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
return {
|
||||
"roobert/activate.nvim",
|
||||
keys = {
|
||||
{
|
||||
"<leader>P",
|
||||
'<CMD>lua require("activate").list_plugins()<CR>',
|
||||
desc = "Plugins",
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
{ 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } }
|
||||
}
|
||||
}
|
39
.config/nvim/lua/crux/plugins/alpha.lua
Normal file
39
.config/nvim/lua/crux/plugins/alpha.lua
Normal file
|
@ -0,0 +1,39 @@
|
|||
return {
|
||||
"goolord/alpha-nvim",
|
||||
event = "VimEnter",
|
||||
config = function()
|
||||
local alpha = require("alpha")
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
|
||||
-- Set header
|
||||
dashboard.section.header.val = {
|
||||
[[ ]],
|
||||
[[ ]],
|
||||
[[ ████ ██████ █████ ██ ]],
|
||||
[[ ███████████ █████ ]],
|
||||
[[ █████████ ███████████████████ ███ ███████████ ]],
|
||||
[[ █████████ ███ █████████████ █████ ██████████████ ]],
|
||||
[[ █████████ ██████████ █████████ █████ █████ ████ █████ ]],
|
||||
[[ ███████████ ███ ███ █████████ █████ █████ ████ █████ ]],
|
||||
[[ ██████ █████████████████████ ████ █████ █████ ████ ██████ ]],
|
||||
[[ ]],
|
||||
}
|
||||
|
||||
-- Set menu
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button( "L", " Lazy ", "<cmd>Lazy<CR>"),
|
||||
dashboard.button( "N", " New File ", "<cmd>ene<CR>"),
|
||||
dashboard.button( "Y", " Hyprland ", ":e ~/.config/hypr/<CR>"),
|
||||
dashboard.button( "P", " Plugins ", ":e ~/.config/nvim/lua/crux/plugins<CR>"),
|
||||
dashboard.button( "H", " Command Help ", ":Telescope help_tags<CR>"),
|
||||
dashboard.button( "C", " Colors ", ":Telescope colorscheme<CR>"),
|
||||
dashboard.button( "Q", " Quit ", ":qa<CR>"),
|
||||
}
|
||||
|
||||
-- Send config to alpha
|
||||
alpha.setup(dashboard.opts)
|
||||
|
||||
-- Disable folding on alpha buffer
|
||||
vim.cmd([[autocmd FileType alpha setlocal nofoldenable]])
|
||||
end,
|
||||
}
|
16
.config/nvim/lua/crux/plugins/auto-session.lua
Normal file
16
.config/nvim/lua/crux/plugins/auto-session.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
"rmagatti/auto-session",
|
||||
config = function()
|
||||
local auto_session = require("auto-session")
|
||||
|
||||
auto_session.setup({
|
||||
auto_restore_enabled = false,
|
||||
auto_session_suppress_dirs = { "~/", "~/Dev/", "~/Downloads", "~/Documents", "~/Desktop/" },
|
||||
})
|
||||
|
||||
local keymap = vim.keymap
|
||||
|
||||
keymap.set("n", "<leader>wr", "<cmd>SessionRestore<CR>", { desc = "Restore session for cwd" }) -- restore last workspace session for current directory
|
||||
keymap.set("n", "<leader>ws", "<cmd>SessionSave<CR>", { desc = "Save session for auto session root dir" }) -- save workspace session for current working directory
|
||||
end,
|
||||
}
|
30
.config/nvim/lua/crux/plugins/autopairs.lua
Normal file
30
.config/nvim/lua/crux/plugins/autopairs.lua
Normal file
|
@ -0,0 +1,30 @@
|
|||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
event = { "InsertEnter" },
|
||||
dependencies = {
|
||||
"hrsh7th/nvim-cmp",
|
||||
},
|
||||
config = function()
|
||||
-- import nvim-autopairs
|
||||
local autopairs = require("nvim-autopairs")
|
||||
|
||||
-- configure autopairs
|
||||
autopairs.setup({
|
||||
check_ts = true, -- enable treesitter
|
||||
ts_config = {
|
||||
lua = { "string" }, -- don't add pairs in lua string treesitter nodes
|
||||
javascript = { "template_string" }, -- don't add pairs in javscript template_string treesitter nodes
|
||||
java = false, -- don't check treesitter on java
|
||||
},
|
||||
})
|
||||
|
||||
-- import nvim-autopairs completion functionality
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
|
||||
-- import nvim-cmp plugin (completions plugin)
|
||||
local cmp = require("cmp")
|
||||
|
||||
-- make autopairs and completion work together
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
}
|
11
.config/nvim/lua/crux/plugins/bufferline.lua
Normal file
11
.config/nvim/lua/crux/plugins/bufferline.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
return {
|
||||
"akinsho/bufferline.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
version = "*",
|
||||
opts = {
|
||||
options = {
|
||||
mode = "tabs",
|
||||
separator_style = "slant",
|
||||
},
|
||||
},
|
||||
}
|
2
.config/nvim/lua/crux/plugins/catppuccin.lua
Normal file
2
.config/nvim/lua/crux/plugins/catppuccin.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
return{
|
||||
"catppuccin/nvim", name = "catppuccin", priority = 1000 }
|
3
.config/nvim/lua/crux/plugins/cellular-automation.lua
Normal file
3
.config/nvim/lua/crux/plugins/cellular-automation.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
"eandrju/cellular-automaton.nvim"
|
||||
}
|
4
.config/nvim/lua/crux/plugins/dressing.lua
Normal file
4
.config/nvim/lua/crux/plugins/dressing.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
"stevearc/dressing.nvim",
|
||||
event = "VeryLazy",
|
||||
}
|
3
.config/nvim/lua/crux/plugins/floaterm.lua
Normal file
3
.config/nvim/lua/crux/plugins/floaterm.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
"voldikss/vim-floaterm"
|
||||
}
|
3
.config/nvim/lua/crux/plugins/indent-blankline.lua
Normal file
3
.config/nvim/lua/crux/plugins/indent-blankline.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
return{
|
||||
"lukas-reineke/indent-blankline.nvim", main = "ibl", opts = {}
|
||||
}
|
4
.config/nvim/lua/crux/plugins/init.lua
Normal file
4
.config/nvim/lua/crux/plugins/init.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
"nvim-lua/plenary.nvim", -- lua functions that many plugins use
|
||||
"christoomey/vim-tmux-navigator", -- tmux & split window navigation
|
||||
}
|
137
.config/nvim/lua/crux/plugins/lsp/lspconfig.lua
Normal file
137
.config/nvim/lua/crux/plugins/lsp/lspconfig.lua
Normal file
|
@ -0,0 +1,137 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
{ "antosha417/nvim-lsp-file-operations", config = true },
|
||||
{ "folke/neodev.nvim", opts = {} },
|
||||
},
|
||||
config = function()
|
||||
-- import lspconfig plugin
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
-- import mason_lspconfig plugin
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
|
||||
-- import cmp-nvim-lsp plugin
|
||||
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||
|
||||
local keymap = vim.keymap -- for conciseness
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
callback = function(ev)
|
||||
-- Buffer local mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local opts = { buffer = ev.buf, silent = true }
|
||||
|
||||
-- set keybinds
|
||||
opts.desc = "Show LSP references"
|
||||
keymap.set("n", "gR", "<cmd>Telescope lsp_references<CR>", opts) -- show definition, references
|
||||
|
||||
opts.desc = "Go to declaration"
|
||||
keymap.set("n", "gD", vim.lsp.buf.declaration, opts) -- go to declaration
|
||||
|
||||
opts.desc = "Show LSP definitions"
|
||||
keymap.set("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts) -- show lsp definitions
|
||||
|
||||
opts.desc = "Show LSP implementations"
|
||||
keymap.set("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts) -- show lsp implementations
|
||||
|
||||
opts.desc = "Show LSP type definitions"
|
||||
keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<CR>", opts) -- show lsp type definitions
|
||||
|
||||
opts.desc = "See available code actions"
|
||||
keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection
|
||||
|
||||
opts.desc = "Smart rename"
|
||||
keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts) -- smart rename
|
||||
|
||||
opts.desc = "Show buffer diagnostics"
|
||||
keymap.set("n", "<leader>D", "<cmd>Telescope diagnostics bufnr=0<CR>", opts) -- show diagnostics for file
|
||||
|
||||
opts.desc = "Show line diagnostics"
|
||||
keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts) -- show diagnostics for line
|
||||
|
||||
opts.desc = "Go to previous diagnostic"
|
||||
keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) -- jump to previous diagnostic in buffer
|
||||
|
||||
opts.desc = "Go to next diagnostic"
|
||||
keymap.set("n", "]d", vim.diagnostic.goto_next, opts) -- jump to next diagnostic in buffer
|
||||
|
||||
opts.desc = "Show documentation for what is under cursor"
|
||||
keymap.set("n", "K", vim.lsp.buf.hover, opts) -- show documentation for what is under cursor
|
||||
|
||||
opts.desc = "Restart LSP"
|
||||
keymap.set("n", "<leader>rs", ":LspRestart<CR>", opts) -- mapping to restart lsp if necessary
|
||||
end,
|
||||
})
|
||||
|
||||
-- used to enable autocompletion (assign to every lsp server config)
|
||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
|
||||
-- Change the Diagnostic symbols in the sign column (gutter)
|
||||
-- (not in youtube nvim video)
|
||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
|
||||
mason_lspconfig.setup_handlers({
|
||||
-- default handler for installed servers
|
||||
function(server_name)
|
||||
lspconfig[server_name].setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["svelte"] = function()
|
||||
-- configure svelte server
|
||||
lspconfig["svelte"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = function(client, bufnr)
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
pattern = { "*.js", "*.ts" },
|
||||
callback = function(ctx)
|
||||
-- Here use ctx.match instead of ctx.file
|
||||
client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match })
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end,
|
||||
["graphql"] = function()
|
||||
-- configure graphql language server
|
||||
lspconfig["graphql"].setup({
|
||||
capabilities = capabilities,
|
||||
filetypes = { "graphql", "gql", "svelte", "typescriptreact", "javascriptreact" },
|
||||
})
|
||||
end,
|
||||
["emmet_ls"] = function()
|
||||
-- configure emmet language server
|
||||
lspconfig["emmet_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" },
|
||||
})
|
||||
end,
|
||||
["lua_ls"] = function()
|
||||
-- configure lua server (with special settings)
|
||||
lspconfig["lua_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
-- make the language server recognize "vim" global
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
54
.config/nvim/lua/crux/plugins/lsp/mason.lua
Normal file
54
.config/nvim/lua/crux/plugins/lsp/mason.lua
Normal file
|
@ -0,0 +1,54 @@
|
|||
return {
|
||||
"williamboman/mason.nvim",
|
||||
dependencies = {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
},
|
||||
config = function()
|
||||
-- import mason
|
||||
local mason = require("mason")
|
||||
|
||||
-- import mason-lspconfig
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
|
||||
local mason_tool_installer = require("mason-tool-installer")
|
||||
|
||||
-- enable mason and configure icons
|
||||
mason.setup({
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
mason_lspconfig.setup({
|
||||
-- list of servers for mason to install
|
||||
ensure_installed = {
|
||||
"tsserver",
|
||||
"html",
|
||||
"cssls",
|
||||
"tailwindcss",
|
||||
"svelte",
|
||||
"lua_ls",
|
||||
"graphql",
|
||||
"emmet_ls",
|
||||
"prismals",
|
||||
"pyright",
|
||||
},
|
||||
})
|
||||
|
||||
mason_tool_installer.setup({
|
||||
ensure_installed = {
|
||||
"prettier", -- prettier formatter
|
||||
"stylua", -- lua formatter
|
||||
"isort", -- python formatter
|
||||
"black", -- python formatter
|
||||
"pylint",
|
||||
"eslint_d",
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
3
.config/nvim/lua/crux/plugins/mini-animate.lua
Normal file
3
.config/nvim/lua/crux/plugins/mini-animate.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
"echasnovski/mini.animate"
|
||||
}
|
15
.config/nvim/lua/crux/plugins/noice.lua
Normal file
15
.config/nvim/lua/crux/plugins/noice.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
-- add any options here
|
||||
},
|
||||
dependencies = {
|
||||
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
|
||||
"MunifTanjim/nui.nvim",
|
||||
-- OPTIONAL:
|
||||
-- `nvim-notify` is only needed, if you want to use the notification view.
|
||||
-- If not available, we use `mini` as the fallback
|
||||
"rcarriga/nvim-notify",
|
||||
}
|
||||
}
|
63
.config/nvim/lua/crux/plugins/nvim-cmp.lua
Normal file
63
.config/nvim/lua/crux/plugins/nvim-cmp.lua
Normal file
|
@ -0,0 +1,63 @@
|
|||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer", -- source for text in buffer
|
||||
"hrsh7th/cmp-path", -- source for file system paths
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
-- follow latest release.
|
||||
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
|
||||
-- install jsregexp (optional!).
|
||||
build = "make install_jsregexp",
|
||||
},
|
||||
"saadparwaiz1/cmp_luasnip", -- for autocompletion
|
||||
"rafamadriz/friendly-snippets", -- useful snippets
|
||||
"onsails/lspkind.nvim", -- vs-code like pictograms
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
-- loads vscode style snippets from installed plugins (e.g. friendly-snippets)
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
cmp.setup({
|
||||
completion = {
|
||||
completeopt = "menu,menuone,preview,noselect",
|
||||
},
|
||||
snippet = { -- configure how nvim-cmp interacts with snippet engine
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
|
||||
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||
["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||
}),
|
||||
-- sources for autocompletion
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp"},
|
||||
{ name = "luasnip" }, -- snippets
|
||||
{ name = "buffer" }, -- text within current buffer
|
||||
{ name = "path" }, -- file system paths
|
||||
}),
|
||||
|
||||
-- configure lspkind for vs-code like pictograms in completion menu
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
maxwidth = 50,
|
||||
ellipsis_char = "...",
|
||||
}),
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
56
.config/nvim/lua/crux/plugins/nvim-tree.lua
Normal file
56
.config/nvim/lua/crux/plugins/nvim-tree.lua
Normal file
|
@ -0,0 +1,56 @@
|
|||
return {
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
dependencies = "nvim-tree/nvim-web-devicons",
|
||||
config = function()
|
||||
local nvimtree = require("nvim-tree")
|
||||
|
||||
-- recommended settings from nvim-tree documentation
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
nvimtree.setup({
|
||||
view = {
|
||||
width = 35,
|
||||
relativenumber = true,
|
||||
},
|
||||
-- change folder arrow icons
|
||||
renderer = {
|
||||
indent_markers = {
|
||||
enable = true,
|
||||
},
|
||||
icons = {
|
||||
glyphs = {
|
||||
folder = {
|
||||
arrow_closed = "", -- arrow when folder is closed
|
||||
arrow_open = "", -- arrow when folder is open
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- disable window_picker for
|
||||
-- explorer to work well with
|
||||
-- window splits
|
||||
actions = {
|
||||
open_file = {
|
||||
window_picker = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
filters = {
|
||||
custom = { ".DS_Store" },
|
||||
},
|
||||
git = {
|
||||
ignore = false,
|
||||
},
|
||||
})
|
||||
|
||||
-- set keymaps
|
||||
local keymap = vim.keymap -- for conciseness
|
||||
|
||||
keymap.set("n", "<leader>ee", "<cmd>NvimTreeToggle<CR>", { desc = "Toggle file explorer" }) -- toggle file explorer
|
||||
keymap.set("n", "<leader>ef", "<cmd>NvimTreeFindFileToggle<CR>", { desc = "Toggle file explorer on current file" }) -- toggle file explorer on current file
|
||||
keymap.set("n", "<leader>ec", "<cmd>NvimTreeCollapse<CR>", { desc = "Collapse file explorer" }) -- collapse file explorer
|
||||
keymap.set("n", "<leader>er", "<cmd>NvimTreeRefresh<CR>", { desc = "Refresh file explorer" }) -- refresh file explorer
|
||||
end
|
||||
}
|
5
.config/nvim/lua/crux/plugins/nvim-treesitter.lua
Normal file
5
.config/nvim/lua/crux/plugins/nvim-treesitter.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
return{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
}
|
||||
|
3
.config/nvim/lua/crux/plugins/pywal.lua
Normal file
3
.config/nvim/lua/crux/plugins/pywal.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
"alphatechnolog/pywal.nvim"
|
||||
}
|
3
.config/nvim/lua/crux/plugins/staline.lua
Normal file
3
.config/nvim/lua/crux/plugins/staline.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
"tamton-aquib/staline.nvim"
|
||||
}
|
36
.config/nvim/lua/crux/plugins/telescope.lua
Normal file
36
.config/nvim/lua/crux/plugins/telescope.lua
Normal file
|
@ -0,0 +1,36 @@
|
|||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
branch = "0.1.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
config = function()
|
||||
local telescope = require("telescope")
|
||||
local actions = require("telescope.actions")
|
||||
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
path_display = { "smart" },
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-k>"] = actions.move_selection_previous, -- move to prev result
|
||||
["<C-j>"] = actions.move_selection_next, -- move to next result
|
||||
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
telescope.load_extension("fzf")
|
||||
|
||||
-- set keymaps
|
||||
local keymap = vim.keymap -- for conciseness
|
||||
|
||||
keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>", { desc = "Fuzzy find files in cwd" })
|
||||
keymap.set("n", "<leader>fr", "<cmd>Telescope oldfiles<cr>", { desc = "Fuzzy find recent files" })
|
||||
keymap.set("n", "<leader>fs", "<cmd>Telescope live_grep<cr>", { desc = "Find string in cwd" })
|
||||
keymap.set("n", "<leader>fc", "<cmd>Telescope grep_string<cr>", { desc = "Find string under cursor in cwd" })
|
||||
end,
|
||||
}
|
13
.config/nvim/lua/crux/plugins/which-key.lua
Normal file
13
.config/nvim/lua/crux/plugins/which-key.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
return {
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 500
|
||||
end,
|
||||
opts = {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
},
|
||||
}
|
3
.config/nvim/lua/crux/plugins/wintabs.lua
Normal file
3
.config/nvim/lua/crux/plugins/wintabs.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
return{
|
||||
"zefei/vim-wintabs"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue