formatting
This commit is contained in:
parent
3c84ec54bf
commit
452abf2029
25 changed files with 635 additions and 536 deletions
35
init.lua
35
init.lua
|
@ -1,29 +1,28 @@
|
||||||
require "options"
|
require("options")
|
||||||
require "keymaps"
|
require("keymaps")
|
||||||
|
|
||||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
local output = vim.fn.system({
|
local output = vim.fn.system({
|
||||||
"git",
|
"git",
|
||||||
"clone",
|
"clone",
|
||||||
"--filter=blob:none",
|
"--filter=blob:none",
|
||||||
"https://github.com/folke/lazy.nvim.git",
|
"https://github.com/folke/lazy.nvim.git",
|
||||||
"--branch=stable", -- latest stable release
|
"--branch=stable", -- latest stable release
|
||||||
lazypath,
|
lazypath,
|
||||||
})
|
})
|
||||||
if vim.api.nvim_get_vvar "shell_error" ~= 0 then
|
if vim.api.nvim_get_vvar("shell_error") ~= 0 then
|
||||||
vim.api.nvim_err_writeln("Error cloning lazy.nvim repository...\n\n" .. output)
|
vim.api.nvim_err_writeln("Error cloning lazy.nvim repository...\n\n" .. output)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
require("lazy").setup("plugins", {
|
require("lazy").setup("plugins", {
|
||||||
change_detection = {
|
change_detection = {
|
||||||
enabled = false,
|
enabled = false,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.cmd 'colorscheme material'
|
vim.cmd("colorscheme material")
|
||||||
require "tools"
|
require("tools")
|
||||||
require "autocommands"
|
require("autocommands")
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
function isEmpty()
|
function isEmpty()
|
||||||
return vim.api.nvim_buf_get_name(0) == "" or vim.fn.filereadable(vim.api.nvim_buf_get_name(0)) == 0 or vim.fn.line('$') == 1 and vim.fn.col('$') == 1
|
return vim.api.nvim_buf_get_name(0) == ""
|
||||||
|
or vim.fn.filereadable(vim.api.nvim_buf_get_name(0)) == 0
|
||||||
|
or vim.fn.line("$") == 1 and vim.fn.col("$") == 1
|
||||||
end
|
end
|
||||||
|
|
||||||
--vim.api.nvim_create_autocmd({ "VimEnter" }, {
|
--vim.api.nvim_create_autocmd({ "VimEnter" }, {
|
||||||
|
@ -10,25 +12,25 @@ end
|
||||||
-- end
|
-- end
|
||||||
--})
|
--})
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('BufRead', {
|
vim.api.nvim_create_autocmd("BufRead", {
|
||||||
pattern = ".env*",
|
pattern = ".env*",
|
||||||
command = "set filetype=sh"
|
command = "set filetype=sh",
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('BufRead', {
|
|
||||||
pattern = ".*rc",
|
|
||||||
command = "set filetype=sh"
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('BufRead', {
|
|
||||||
pattern = "Dockerfile.*",
|
|
||||||
command = "set filetype=dockerfile"
|
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("BufRead", {
|
vim.api.nvim_create_autocmd("BufRead", {
|
||||||
callback = function()
|
pattern = ".*rc",
|
||||||
vim.cmd.CccHighlighterEnable()
|
command = "set filetype=sh",
|
||||||
end,
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("BufRead", {
|
||||||
|
pattern = "Dockerfile.*",
|
||||||
|
command = "set filetype=dockerfile",
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("BufRead", {
|
||||||
|
callback = function()
|
||||||
|
vim.cmd.CccHighlighterEnable()
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
--vim.api.nvim_create_autocmd('BufEnter', {
|
--vim.api.nvim_create_autocmd('BufEnter', {
|
||||||
|
|
133
lua/keymaps.lua
133
lua/keymaps.lua
|
@ -11,63 +11,78 @@ vim.g.maplocalleader = " "
|
||||||
-- term_mode = "t",
|
-- term_mode = "t",
|
||||||
-- command_mode = "c",
|
-- command_mode = "c",
|
||||||
|
|
||||||
require('util').keymaps({
|
require("util").keymaps({
|
||||||
n = {
|
n = {
|
||||||
[";"] = { ":", desc = "No shift command mode" },
|
[";"] = { ":", desc = "No shift command mode" },
|
||||||
["n"] = { "nzzzv", desc = "Next search result centered" },
|
["n"] = { "nzzzv", desc = "Next search result centered" },
|
||||||
["N"] = { "Nzzzv", desc = "Previous search result centered" },
|
["N"] = { "Nzzzv", desc = "Previous search result centered" },
|
||||||
["<esc>"] = { ":noh<CR><esc>", desc = "Clear search on escape" },
|
["<esc>"] = { ":noh<CR><esc>", desc = "Clear search on escape" },
|
||||||
["<return>"] = {":noh<CR><return>", desc = "Clear search on return" },
|
["<return>"] = { ":noh<CR><return>", desc = "Clear search on return" },
|
||||||
["<leader>w"] = { "<cmd>w<cr>", desc = "Save" },
|
["<leader>a"] = { "ggVG", desc = "Select all" },
|
||||||
["<leader>q"] = { "<cmd>confirm q<cr>", desc = "Quit" },
|
["<leader>w"] = { "<cmd>w<cr>", desc = "Save" },
|
||||||
["|"] = { "<cmd>vsplit<cr>", desc = "Vertical Split" },
|
["<leader>q"] = { "<cmd>confirm q<cr>", desc = "Quit" },
|
||||||
["\\"] = { "<cmd>split<cr>", desc = "Horizontal Split" },
|
["<leader>cq"] = { "<cmd>bd<cr>", desc = "Close current buffer" },
|
||||||
["<C-d>"] = { "<C-d>zz", desc = "Vertical half page down and center cursor" },
|
["|"] = { "<cmd>vsplit<cr>", desc = "Vertical Split" },
|
||||||
["<C-u>"] = { "<C-u>zz", desc = "Vertical half page up and center cursor" },
|
["\\"] = { "<cmd>split<cr>", desc = "Horizontal Split" },
|
||||||
["<leader>y"] = { '"*y', desc = "Copy to system clipboard" },
|
["<C-d>"] = { "<C-d>zz", desc = "Vertical half page down and center cursor" },
|
||||||
["<Leader>p"] = { '"*p', desc = "Paste from system clipboard" },
|
["<C-u>"] = { "<C-u>zz", desc = "Vertical half page up and center cursor" },
|
||||||
["<leader>Q"] = { ":qa<CR>", desc = "Quit all" },
|
["<leader>y"] = { '"*y', desc = "Copy to system clipboard" },
|
||||||
["J"] = { "mzJ`z", desc = "Move line below onto this line" },
|
["<Leader>p"] = { '"*p', desc = "Paste from system clipboard" },
|
||||||
-- window navigation
|
["<leader>Q"] = { ":qa<CR>", desc = "Quit all" },
|
||||||
["<C-h>"] = { "<C-w>h", desc = "Move window left current" },
|
["J"] = { "mzJ`z", desc = "Move line below onto this line" },
|
||||||
["<C-j>"] = { "<C-w>j", desc = "Move window below current" },
|
-- window navigation
|
||||||
["<C-k>"] = { "<C-w>k", desc = "Move window above current" },
|
["<C-h>"] = { "<C-w>h", desc = "Move window left current" },
|
||||||
["<C-l>"] = { "<C-w>l", desc = "Move window right current" },
|
["<C-j>"] = { "<C-w>j", desc = "Move window below current" },
|
||||||
-- reformat LSP
|
["<C-k>"] = { "<C-w>k", desc = "Move window above current" },
|
||||||
["<leader>lf"] = { function() vim.lsp.buf.format() end, desc = "Reformat file" },
|
["<C-l>"] = { "<C-w>l", desc = "Move window right current" },
|
||||||
["<leader>ld"] = { function() vim.diagnostic.open_float() end, desc = "Show diagnostic message"},
|
-- reformat LSP
|
||||||
["<leader>ll"] = { function() vim.diagnostic.setloclist() end, desc = "Show diagnostic list"},
|
["<leader>lf"] = {
|
||||||
["<leader>lz"] = { ":LspRestart<CR>", desc = "Restart LSP Server" },
|
function()
|
||||||
},
|
vim.lsp.buf.format()
|
||||||
v = {
|
end,
|
||||||
["y"] = { '"*y', desc = "Copy to system clipboard" },
|
desc = "Reformat file",
|
||||||
["p"] = { '"*p', desc = "Paste from system clipboard" },
|
},
|
||||||
["J"] = { ":m '>+1<CR>gv=gv", desc = "Visually move block down"},
|
["<leader>ld"] = {
|
||||||
["K"] = { ":m '<-2<CR>gv=gv", desc = "Visually move block up"},
|
function()
|
||||||
},
|
vim.diagnostic.open_float()
|
||||||
i = {
|
end,
|
||||||
["<C-k>"] = { "<Up>", desc = "Up" },
|
desc = "Show diagnostic message",
|
||||||
["<C-j>"] = { "<Down>", desc = "Down" },
|
},
|
||||||
["<C-h>"] = { "<Left>", desc = "Left" },
|
["<leader>ll"] = {
|
||||||
["<C-l>"] = { "<Right>", desc = "Right" },
|
function()
|
||||||
["<C-4>"] = { "<End>", desc = "End" },
|
vim.diagnostic.setloclist()
|
||||||
["<C-6>"] = { "<Home>", desc = "Home" },
|
end,
|
||||||
},
|
desc = "Show diagnostic list",
|
||||||
c = {
|
},
|
||||||
["<C-h>"] = { "<Left>", desc = "Left" },
|
["<leader>lz"] = { ":LspRestart<CR>", desc = "Restart LSP Server" },
|
||||||
["<C-j>"] = { "<Down>", desc = "Down" },
|
},
|
||||||
["<C-k>"] = { "<Up>", desc = "Up" },
|
v = {
|
||||||
["<C-l>"] = { "<Right>", desc = "Right" },
|
["y"] = { '"*y', desc = "Copy to system clipboard" },
|
||||||
["<C-4>"] = { "<End>", desc = "End" },
|
["p"] = { '"*p', desc = "Paste from system clipboard" },
|
||||||
["<C-6>"] = { "<Home>", desc = "Home" },
|
["J"] = { ":m '>+1<CR>gv=gv", desc = "Visually move block down" },
|
||||||
},
|
["K"] = { ":m '<-2<CR>gv=gv", desc = "Visually move block up" },
|
||||||
x = {
|
},
|
||||||
["<leader>p"] = { '"_dP', desc = "Paste w/o copying replaced content" },
|
i = {
|
||||||
["<C-r"] = {'"hy:%s/<C-r>h//g<left><left>', desc = "Replace current selection"},
|
["<C-k>"] = { "<Up>", desc = "Up" },
|
||||||
},
|
["<C-j>"] = { "<Down>", desc = "Down" },
|
||||||
t = {
|
["<C-h>"] = { "<Left>", desc = "Left" },
|
||||||
["<Esc>"] = { "<C-\\><C-n>", desc = "Escape the terminal" },
|
["<C-l>"] = { "<Right>", desc = "Right" },
|
||||||
},
|
["<C-4>"] = { "<End>", desc = "End" },
|
||||||
|
["<C-6>"] = { "<Home>", desc = "Home" },
|
||||||
|
},
|
||||||
|
c = {
|
||||||
|
["<C-h>"] = { "<Left>", desc = "Left" },
|
||||||
|
["<C-j>"] = { "<Down>", desc = "Down" },
|
||||||
|
["<C-k>"] = { "<Up>", desc = "Up" },
|
||||||
|
["<C-l>"] = { "<Right>", desc = "Right" },
|
||||||
|
["<C-4>"] = { "<End>", desc = "End" },
|
||||||
|
["<C-6>"] = { "<Home>", desc = "Home" },
|
||||||
|
},
|
||||||
|
x = {
|
||||||
|
["<leader>p"] = { '"_dP', desc = "Paste w/o copying replaced content" },
|
||||||
|
["<C-r"] = { '"hy:%s/<C-r>h//g<left><left>', desc = "Replace current selection" },
|
||||||
|
},
|
||||||
|
t = {
|
||||||
|
["<Esc>"] = { "<C-\\><C-n>", desc = "Escape the terminal" },
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,6 @@ vim.opt.splitright = true
|
||||||
|
|
||||||
-- Set completeopt to have a better completion experience
|
-- Set completeopt to have a better completion experience
|
||||||
vim.o.completeopt = "menuone,noselect"
|
vim.o.completeopt = "menuone,noselect"
|
||||||
vim.diagnostic.config{
|
vim.diagnostic.config({
|
||||||
float={border="single"}
|
float = { border = "single" },
|
||||||
}
|
})
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# Plugins to look into
|
# Plugins to look into
|
||||||
|
|
||||||
- https://github.com/lvimuser/lsp-inlayhints.nvim/tree/anticonceal
|
- https://github.com/lvimuser/lsp-inlayhints.nvim/tree/anticonceal
|
||||||
- https://github.com/theHamsta/nvim-dap-virtual-text/tree/inline-text
|
- https://github.com/theHamsta/nvim-dap-virtual-text/tree/inline-text
|
||||||
- https://github.com/andythigpen/nvim-coverage
|
- https://github.com/andythigpen/nvim-coverage
|
||||||
|
@ -6,13 +7,13 @@
|
||||||
- https://github.com/johmsalas/text-case.nvim
|
- https://github.com/johmsalas/text-case.nvim
|
||||||
- gitsigns?
|
- gitsigns?
|
||||||
- casing plugins?
|
- casing plugins?
|
||||||
["<leader>,"] = { name = " Misc Tools" },
|
["<leader>,"] = { name = " Misc Tools" },
|
||||||
["<leader>,c"] = { name = " Casing" },
|
["<leader>,c"] = { name = " Casing" },
|
||||||
["<leader>,cs"] = { ":Snek<CR>", desc = "To Snek Case" },
|
["<leader>,cs"] = { ":Snek<CR>", desc = "To Snek Case" },
|
||||||
["<leader>,cc"] = { ":Camel<CR>", desc = "To Camel Case" },
|
["<leader>,cc"] = { ":Camel<CR>", desc = "To Camel Case" },
|
||||||
["<leader>,cp"] = { ":CamelB<CR>", desc = "To Pascal Case" },
|
["<leader>,cp"] = { ":CamelB<CR>", desc = "To Pascal Case" },
|
||||||
["<leader>,ck"] = { ":Kebab<CR>", desc = "To Kebab Case" },
|
["<leader>,ck"] = { ":Kebab<CR>", desc = "To Kebab Case" },
|
||||||
["<leader>,ce"] = { ":Screm<CR>", desc = "To Screm Case" },
|
["<leader>,ce"] = { ":Screm<CR>", desc = "To Screm Case" },
|
||||||
- https://github.com/tpope/vim-fugitive
|
- https://github.com/tpope/vim-fugitive
|
||||||
- https://github.com/folke/noice.nvim
|
- https://github.com/folke/noice.nvim
|
||||||
- greg's: https://github.com/gblock0/dotfiles/blob/master/nvim/.config/nvim/lua/gb/plugins.lua
|
- greg's: https://github.com/gblock0/dotfiles/blob/master/nvim/.config/nvim/lua/gb/plugins.lua
|
||||||
|
@ -21,4 +22,3 @@
|
||||||
- https://github.com/numToStr/Comment.nvim
|
- https://github.com/numToStr/Comment.nvim
|
||||||
- https://github.com/windwp/nvim-autopairs
|
- https://github.com/windwp/nvim-autopairs
|
||||||
- https://github.com/lukas-reineke/indent-blankline.nvim
|
- https://github.com/lukas-reineke/indent-blankline.nvim
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
return {
|
return {
|
||||||
"Pocco81/auto-save.nvim",
|
"Pocco81/auto-save.nvim",
|
||||||
event = "BufEnter",
|
event = "BufEnter",
|
||||||
opts = {
|
opts = {
|
||||||
trigger_events = { "InsertLeave", "TextChanged", "TextChangedI", "BufLeave" },
|
trigger_events = { "InsertLeave", "TextChanged", "TextChangedI", "BufLeave" },
|
||||||
condition = function (buf)
|
condition = function(buf)
|
||||||
local disallowed_filetypes = {"TelescopePrompt"}
|
local disallowed_filetypes = { "TelescopePrompt" }
|
||||||
local utils = require('auto-save.utils.data')
|
local utils = require("auto-save.utils.data")
|
||||||
if vim.fn.getbufvar(buf, "&modifiable") == 1 and utils.not_in(vim.fn.getbufvar(buf, "&filetype"), disallowed_filetypes) then
|
if
|
||||||
return true
|
vim.fn.getbufvar(buf, "&modifiable") == 1
|
||||||
end
|
and utils.not_in(vim.fn.getbufvar(buf, "&filetype"), disallowed_filetypes)
|
||||||
return false
|
then
|
||||||
end
|
return true
|
||||||
}
|
end
|
||||||
|
return false
|
||||||
|
end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
return {
|
return {
|
||||||
"uga-rosa/ccc.nvim",
|
"uga-rosa/ccc.nvim",
|
||||||
event = "BufRead",
|
event = "BufRead",
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>cp", ":CccPick <CR>", desc = "Color Picker" }
|
{ "<leader>cp", ":CccPick <CR>", desc = "Color Picker" },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,15 @@
|
||||||
vim.g.NERDCreateDefaultMappings = 0
|
vim.g.NERDCreateDefaultMappings = 0
|
||||||
vim.cmd('filetype plugin on')
|
vim.cmd("filetype plugin on")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"preservim/nerdcommenter",
|
"preservim/nerdcommenter",
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>/", ':call nerdcommenter#Comment(0, "toggle")<CR>', desc = "Toggle comments on selection" },
|
{ "<leader>/", ':call nerdcommenter#Comment(0, "toggle")<CR>', desc = "Toggle comments on selection" },
|
||||||
{ "<leader>/", ':call nerdcommenter#Comment(0, "toggle")<CR>', desc = "Toggle comments on selection", mode = "v" },
|
{
|
||||||
},
|
"<leader>/",
|
||||||
|
':call nerdcommenter#Comment(0, "toggle")<CR>',
|
||||||
|
desc = "Toggle comments on selection",
|
||||||
|
mode = "v",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,14 @@
|
||||||
return {
|
return {
|
||||||
"rest-nvim/rest.nvim",
|
"rest-nvim/rest.nvim",
|
||||||
event = "BufEnter *.http",
|
event = "BufEnter *.http",
|
||||||
requires = { "nvim-lua/plenary.nvim" },
|
requires = { "nvim-lua/plenary.nvim" },
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>r", function() require("rest-nvim").run() end, desc = "Send selected http request" }
|
{
|
||||||
}
|
"<leader>r",
|
||||||
|
function()
|
||||||
|
require("rest-nvim").run()
|
||||||
|
end,
|
||||||
|
desc = "Send selected http request",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,206 +1,206 @@
|
||||||
local servers = {
|
local servers = {
|
||||||
rust_analyzer = {
|
rust_analyzer = {
|
||||||
-- rust
|
-- rust
|
||||||
-- to enable rust-analyzer settings visit:
|
-- to enable rust-analyzer settings visit:
|
||||||
-- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc
|
-- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc
|
||||||
["rust-analyzer"] = {
|
["rust-analyzer"] = {
|
||||||
cargo = {
|
cargo = {
|
||||||
allFeatures = true,
|
allFeatures = true,
|
||||||
},
|
},
|
||||||
checkOnSave = {
|
checkOnSave = {
|
||||||
allFeatures = true,
|
allFeatures = true,
|
||||||
command = "clippy",
|
command = "clippy",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
tsserver = {
|
tsserver = {
|
||||||
-- typescript/javascript
|
-- typescript/javascript
|
||||||
},
|
},
|
||||||
pyright = {
|
pyright = {
|
||||||
-- python
|
-- python
|
||||||
},
|
},
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
-- lua
|
-- lua
|
||||||
Lua = {
|
Lua = {
|
||||||
workspace = { checkThirdParty = false },
|
workspace = { checkThirdParty = false },
|
||||||
telemetry = { enable = false },
|
telemetry = { enable = false },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
bashls = {
|
bashls = {
|
||||||
-- bash
|
-- bash
|
||||||
},
|
},
|
||||||
cssls = {
|
cssls = {
|
||||||
-- css
|
-- css
|
||||||
},
|
},
|
||||||
cssmodules_ls = {
|
cssmodules_ls = {
|
||||||
-- css modules
|
-- css modules
|
||||||
},
|
},
|
||||||
dockerls = {
|
dockerls = {
|
||||||
-- docker
|
-- docker
|
||||||
},
|
},
|
||||||
docker_compose_language_service = {
|
docker_compose_language_service = {
|
||||||
-- docker compose
|
-- docker compose
|
||||||
},
|
},
|
||||||
jsonls = {
|
jsonls = {
|
||||||
-- json
|
-- json
|
||||||
},
|
},
|
||||||
marksman = {
|
marksman = {
|
||||||
-- markdown
|
-- markdown
|
||||||
},
|
},
|
||||||
taplo = {
|
taplo = {
|
||||||
-- toml
|
-- toml
|
||||||
},
|
},
|
||||||
yamlls = {
|
yamlls = {
|
||||||
-- yaml
|
-- yaml
|
||||||
},
|
},
|
||||||
lemminx = {
|
lemminx = {
|
||||||
-- xml
|
-- xml
|
||||||
},
|
},
|
||||||
rnix = {
|
rnix = {
|
||||||
-- Nix
|
-- Nix
|
||||||
},
|
},
|
||||||
ansiblels = {
|
ansiblels = {
|
||||||
-- ansible
|
-- ansible
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- LSP config
|
-- LSP config
|
||||||
-- Took lots of inspiration from this kickstart lua file: https://github.com/hjr3/dotfiles/blob/main/.config/nvim/init.lua
|
-- Took lots of inspiration from this kickstart lua file: https://github.com/hjr3/dotfiles/blob/main/.config/nvim/init.lua
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
-- Autocompletion
|
-- Autocompletion
|
||||||
"hrsh7th/nvim-cmp",
|
"hrsh7th/nvim-cmp",
|
||||||
dependencies = { "hrsh7th/cmp-nvim-lsp", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip" },
|
dependencies = { "hrsh7th/cmp-nvim-lsp", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip" },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"williamboman/mason.nvim",
|
"williamboman/mason.nvim",
|
||||||
cmd = {
|
cmd = {
|
||||||
"Mason",
|
"Mason",
|
||||||
"MasonUpdate",
|
"MasonUpdate",
|
||||||
"MasonInstall",
|
"MasonInstall",
|
||||||
"MasonInstallAll",
|
"MasonInstallAll",
|
||||||
"MasonUninstall",
|
"MasonUninstall",
|
||||||
"MasonUninstallAll",
|
"MasonUninstallAll",
|
||||||
"MasonLog",
|
"MasonLog",
|
||||||
},
|
},
|
||||||
build = ":MasonUpdate",
|
build = ":MasonUpdate",
|
||||||
opts = {},
|
opts = {},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"williamboman/mason-lspconfig.nvim",
|
"williamboman/mason-lspconfig.nvim",
|
||||||
},
|
},
|
||||||
{ "folke/neodev.nvim", opts = {} },
|
{ "folke/neodev.nvim", opts = {} },
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
after = { "nvim-telescope/telescope.nvim" },
|
after = { "nvim-telescope/telescope.nvim" },
|
||||||
config = function()
|
config = function()
|
||||||
local config = require("lspconfig")
|
local config = require("lspconfig")
|
||||||
local util = require("lspconfig/util")
|
local util = require("lspconfig/util")
|
||||||
local mason_lspconfig = require("mason-lspconfig")
|
local mason_lspconfig = require("mason-lspconfig")
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
local luasnip = require("luasnip")
|
local luasnip = require("luasnip")
|
||||||
|
|
||||||
-- LSP
|
-- LSP
|
||||||
-- This function gets run when an LSP connects to a particular buffer.
|
-- This function gets run when an LSP connects to a particular buffer.
|
||||||
local on_attach = function(client, bufnr)
|
local on_attach = function(client, bufnr)
|
||||||
local nmap = function(keys, func, desc)
|
local nmap = function(keys, func, desc)
|
||||||
if desc then
|
if desc then
|
||||||
desc = "LSP: " .. desc
|
desc = "LSP: " .. desc
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc })
|
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc })
|
||||||
end
|
end
|
||||||
|
|
||||||
nmap("<leader>lr", vim.lsp.buf.rename, "[R]ename")
|
nmap("<leader>lr", vim.lsp.buf.rename, "[R]ename")
|
||||||
nmap("<leader>la", vim.lsp.buf.code_action, "Code [A]ction")
|
nmap("<leader>la", vim.lsp.buf.code_action, "Code [A]ction")
|
||||||
|
|
||||||
nmap("gd", vim.lsp.buf.definition, "[G]oto [D]efinition")
|
nmap("gd", vim.lsp.buf.definition, "[G]oto [D]efinition")
|
||||||
nmap("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
|
nmap("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
|
||||||
nmap("gI", vim.lsp.buf.implementation, "[G]oto [I]mplementation")
|
nmap("gI", vim.lsp.buf.implementation, "[G]oto [I]mplementation")
|
||||||
nmap("<leader>D", vim.lsp.buf.type_definition, "Type [D]efinition")
|
nmap("<leader>D", vim.lsp.buf.type_definition, "Type [D]efinition")
|
||||||
|
|
||||||
-- See `:help K` for why this keymap
|
-- See `:help K` for why this keymap
|
||||||
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
|
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
|
||||||
nmap("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation")
|
nmap("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation")
|
||||||
|
|
||||||
-- Lesser used LSP functionality
|
-- Lesser used LSP functionality
|
||||||
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
|
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
|
||||||
|
|
||||||
-- disable tsserver so it does not conflict with prettier
|
-- disable tsserver so it does not conflict with prettier
|
||||||
if client.name == "tsserver" then
|
if client.name == "tsserver" then
|
||||||
client.server_capabilities.document_formatting = false
|
client.server_capabilities.document_formatting = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
|
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
|
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
|
||||||
|
|
||||||
-- Install servers used
|
-- Install servers used
|
||||||
mason_lspconfig.setup({
|
mason_lspconfig.setup({
|
||||||
ensure_installed = vim.tbl_keys(servers),
|
ensure_installed = vim.tbl_keys(servers),
|
||||||
})
|
})
|
||||||
|
|
||||||
local flags = {
|
local flags = {
|
||||||
allow_incremental_sync = true,
|
allow_incremental_sync = true,
|
||||||
debounce_text_changes = 200,
|
debounce_text_changes = 200,
|
||||||
}
|
}
|
||||||
|
|
||||||
mason_lspconfig.setup_handlers({
|
mason_lspconfig.setup_handlers({
|
||||||
function(server_name)
|
function(server_name)
|
||||||
require("lspconfig")[server_name].setup({
|
require("lspconfig")[server_name].setup({
|
||||||
flags = flags,
|
flags = flags,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
settings = servers[server_name],
|
settings = servers[server_name],
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Completion
|
-- Completion
|
||||||
luasnip.config.setup({})
|
luasnip.config.setup({})
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
luasnip.lsp_expand(args.body)
|
luasnip.lsp_expand(args.body)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
["<C-Space>"] = cmp.mapping.complete({}),
|
["<C-Space>"] = cmp.mapping.complete({}),
|
||||||
["<CR>"] = cmp.mapping.confirm({
|
["<CR>"] = cmp.mapping.confirm({
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
select = true,
|
select = true,
|
||||||
}),
|
}),
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_next_item()
|
cmp.select_next_item()
|
||||||
elseif luasnip.expand_or_jumpable() then
|
elseif luasnip.expand_or_jumpable() then
|
||||||
luasnip.expand_or_jump()
|
luasnip.expand_or_jump()
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end, { "i", "s" }),
|
end, { "i", "s" }),
|
||||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_prev_item()
|
cmp.select_prev_item()
|
||||||
elseif luasnip.jumpable(-1) then
|
elseif luasnip.jumpable(-1) then
|
||||||
luasnip.jump(-1)
|
luasnip.jump(-1)
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end, { "i", "s" }),
|
end, { "i", "s" }),
|
||||||
}),
|
}),
|
||||||
sources = {
|
sources = {
|
||||||
{ name = "nvim_lsp" },
|
{ name = "nvim_lsp" },
|
||||||
{ name = "luasnip" },
|
{ name = "luasnip" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
return {
|
return {
|
||||||
"lnc3l0t/glow.nvim",
|
"lnc3l0t/glow.nvim",
|
||||||
branch = "advanced_window",
|
branch = "advanced_window",
|
||||||
config = {
|
config = {
|
||||||
default_type = "keep",
|
default_type = "keep",
|
||||||
},
|
},
|
||||||
cmd = "Glow",
|
cmd = "Glow",
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>m","<Nop>", desc = " Markdown" },
|
{ "<leader>m", "<Nop>", desc = " Markdown" },
|
||||||
{ "<leader>mp",":Glow <CR>", desc = "Markdown preview" },
|
{ "<leader>mp", ":Glow <CR>", desc = "Markdown preview" },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,11 @@ return {
|
||||||
"nvim-neo-tree/neo-tree.nvim",
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim", "nvim-tree/nvim-web-devicons" },
|
dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim", "nvim-tree/nvim-web-devicons" },
|
||||||
cmd = "Neotree",
|
cmd = "Neotree",
|
||||||
init = function() vim.g.neo_tree_remove_legacy_commands = true end,
|
init = function()
|
||||||
|
vim.g.neo_tree_remove_legacy_commands = true
|
||||||
|
end,
|
||||||
pin = true,
|
pin = true,
|
||||||
tag = '2.56',
|
tag = "2.56",
|
||||||
opts = {
|
opts = {
|
||||||
auto_clean_after_session_restore = true,
|
auto_clean_after_session_restore = true,
|
||||||
close_if_last_window = true,
|
close_if_last_window = true,
|
||||||
|
@ -30,13 +32,16 @@ return {
|
||||||
},
|
},
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>e", "<cmd>Neotree toggle<CR>", desc = "Toggle Explorer" },
|
{ "<leader>e", "<cmd>Neotree toggle<CR>", desc = "Toggle Explorer" },
|
||||||
{ "<leader>o",function()
|
{
|
||||||
if vim.bo.filetype == "neo-tree" then
|
"<leader>o",
|
||||||
vim.cmd.wincmd "p"
|
function()
|
||||||
else
|
if vim.bo.filetype == "neo-tree" then
|
||||||
vim.cmd.Neotree "focus"
|
vim.cmd.wincmd("p")
|
||||||
end
|
else
|
||||||
end , desc = "Toggle Explorer Focus" },
|
vim.cmd.Neotree("focus")
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
desc = "Toggle Explorer Focus",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ return {
|
||||||
"jose-elias-alvarez/null-ls.nvim",
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
after = { "williamboman/mason.nvim" },
|
after = { "williamboman/mason.nvim" },
|
||||||
opts = function(_, config)
|
opts = function(_, config)
|
||||||
|
|
||||||
-- config variable is the default definitions table for the setup function call
|
-- config variable is the default definitions table for the setup function call
|
||||||
local null_ls = require("null-ls")
|
local null_ls = require("null-ls")
|
||||||
|
|
||||||
|
@ -51,10 +50,10 @@ return {
|
||||||
return config
|
return config
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"jay-babu/mason-null-ls.nvim",
|
"jay-babu/mason-null-ls.nvim",
|
||||||
opts = {
|
opts = {
|
||||||
ensure_installed = { "rustfmt", "stylelua", "prettier", "black" }
|
ensure_installed = { "rustfmt", "stylelua", "prettier", "black" },
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
return {
|
return {
|
||||||
"Almo7aya/openingh.nvim",
|
"Almo7aya/openingh.nvim",
|
||||||
event = "BufEnter",
|
event = "BufEnter",
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>gf", ":OpenInGHFile <CR>", desc = "Open in git" }
|
{ "<leader>gf", ":OpenInGHFile <CR>", desc = "Open in git" },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,68 @@
|
||||||
return {
|
return {
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
tag = '0.1.1',
|
tag = "0.1.1",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{ "nvim-lua/plenary.nvim" },
|
{ "nvim-lua/plenary.nvim" },
|
||||||
{ "nvim-telescope/telescope-fzf-native.nvim", enabled = vim.fn.executable "make" == 1, build = "make" },
|
{ "nvim-telescope/telescope-fzf-native.nvim", enabled = vim.fn.executable("make") == 1, build = "make" },
|
||||||
},
|
},
|
||||||
cmd = "Telescope",
|
cmd = "Telescope",
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>f", "<Nop>", desc = "Find ..." },
|
{ "<leader>f", "<Nop>", desc = "Find ..." },
|
||||||
{ "<leader>ff", function() require('telescope.builtin').find_files() end, desc = "Find Files" },
|
{
|
||||||
{ "<leader>fg", function() require('telescope.builtin').git_files() end, desc = "Find Git only Files" },
|
"<leader>ff",
|
||||||
{ "<leader>fw", function() require('telescope.builtin').live_grep() end, desc = "Find Words" },
|
function()
|
||||||
{ "<leader>fc", function() require('telescope.builtin').commands() end, desc = "Find Commands" },
|
require("telescope.builtin").find_files()
|
||||||
{ "<leader>fk", function() require('telescope.builtin').keymaps() end, desc = "Find Commands" },
|
end,
|
||||||
{ "<leader>fb", function() require('telescope.builtin').buffers() end, desc = "Find Commands" },
|
desc = "Find Files",
|
||||||
},
|
},
|
||||||
opts = {
|
{
|
||||||
defaults = {
|
"<leader>fg",
|
||||||
vimgrep_arguments = {
|
function()
|
||||||
"rg",
|
require("telescope.builtin").git_files()
|
||||||
"-L",
|
end,
|
||||||
"--color=never",
|
desc = "Find Git only Files",
|
||||||
"--no-heading",
|
},
|
||||||
"--with-filename",
|
{
|
||||||
"--line-number",
|
"<leader>fw",
|
||||||
"--column",
|
function()
|
||||||
"--smart-case",
|
require("telescope.builtin").live_grep()
|
||||||
}
|
end,
|
||||||
}
|
desc = "Find Words",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"<leader>fc",
|
||||||
|
function()
|
||||||
|
require("telescope.builtin").commands()
|
||||||
|
end,
|
||||||
|
desc = "Find Commands",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>fk",
|
||||||
|
function()
|
||||||
|
require("telescope.builtin").keymaps()
|
||||||
|
end,
|
||||||
|
desc = "Find Commands",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>fb",
|
||||||
|
function()
|
||||||
|
require("telescope.builtin").buffers()
|
||||||
|
end,
|
||||||
|
desc = "Find Commands",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
defaults = {
|
||||||
|
vimgrep_arguments = {
|
||||||
|
"rg",
|
||||||
|
"-L",
|
||||||
|
"--color=never",
|
||||||
|
"--no-heading",
|
||||||
|
"--with-filename",
|
||||||
|
"--line-number",
|
||||||
|
"--column",
|
||||||
|
"--smart-case",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ return {
|
||||||
"marko-cerovac/material.nvim",
|
"marko-cerovac/material.nvim",
|
||||||
config = function()
|
config = function()
|
||||||
vim.g.material_style = "darker"
|
vim.g.material_style = "darker"
|
||||||
require("material").setup {
|
require("material").setup({
|
||||||
plugins = {
|
plugins = {
|
||||||
"dashboard",
|
"dashboard",
|
||||||
"gitsigns",
|
"gitsigns",
|
||||||
|
@ -11,8 +11,8 @@ return {
|
||||||
"which-key",
|
"which-key",
|
||||||
},
|
},
|
||||||
high_visibility = {
|
high_visibility = {
|
||||||
darker = true
|
darker = true,
|
||||||
}
|
},
|
||||||
}
|
})
|
||||||
end
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,87 +1,87 @@
|
||||||
local auto = true
|
local auto = true
|
||||||
local output = vim.fn.system({
|
local output = vim.fn.system({
|
||||||
"which",
|
"which",
|
||||||
"tree-sitter",
|
"tree-sitter",
|
||||||
})
|
})
|
||||||
if output == nil or output == "" then
|
if output == nil or output == "" then
|
||||||
auto = false
|
auto = false
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
dependencies = { "windwp/nvim-ts-autotag", "JoosepAlviste/nvim-ts-context-commentstring" },
|
dependencies = { "windwp/nvim-ts-autotag", "JoosepAlviste/nvim-ts-context-commentstring" },
|
||||||
build = ":TSUpdate",
|
build = ":TSUpdate",
|
||||||
event = "BufRead",
|
event = "BufRead",
|
||||||
cmd = {
|
cmd = {
|
||||||
"TSBufDisable",
|
"TSBufDisable",
|
||||||
"TSBufEnable",
|
"TSBufEnable",
|
||||||
"TSBufToggle",
|
"TSBufToggle",
|
||||||
"TSDisable",
|
"TSDisable",
|
||||||
"TSEnable",
|
"TSEnable",
|
||||||
"TSToggle",
|
"TSToggle",
|
||||||
"TSInstall",
|
"TSInstall",
|
||||||
"TSInstallInfo",
|
"TSInstallInfo",
|
||||||
"TSInstallSync",
|
"TSInstallSync",
|
||||||
"TSModuleInfo",
|
"TSModuleInfo",
|
||||||
"TSUninstall",
|
"TSUninstall",
|
||||||
"TSUpdate",
|
"TSUpdate",
|
||||||
"TSUpdateSync",
|
"TSUpdateSync",
|
||||||
},
|
},
|
||||||
opts = {
|
opts = {
|
||||||
-- ensure_installed = 'all',
|
-- ensure_installed = 'all',
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"lua",
|
"lua",
|
||||||
"http",
|
"http",
|
||||||
"json",
|
"json",
|
||||||
"bash",
|
"bash",
|
||||||
"css",
|
"css",
|
||||||
"diff",
|
"diff",
|
||||||
"dockerfile",
|
"dockerfile",
|
||||||
"dot",
|
"dot",
|
||||||
"git_rebase",
|
"git_rebase",
|
||||||
"gitattributes",
|
"gitattributes",
|
||||||
"html",
|
"html",
|
||||||
"java",
|
"java",
|
||||||
"javascript",
|
"javascript",
|
||||||
"jq",
|
"jq",
|
||||||
"jsdoc",
|
"jsdoc",
|
||||||
"json5",
|
"json5",
|
||||||
"kotlin",
|
"kotlin",
|
||||||
"latex",
|
"latex",
|
||||||
"make",
|
"make",
|
||||||
"markdown",
|
"markdown",
|
||||||
"markdown_inline",
|
"markdown_inline",
|
||||||
"nix",
|
"nix",
|
||||||
"python",
|
"python",
|
||||||
"regex",
|
"regex",
|
||||||
"rst",
|
"rst",
|
||||||
"rust",
|
"rust",
|
||||||
"scss",
|
"scss",
|
||||||
"sql",
|
"sql",
|
||||||
"terraform",
|
"terraform",
|
||||||
"toml",
|
"toml",
|
||||||
"tsx",
|
"tsx",
|
||||||
"jsx",
|
"jsx",
|
||||||
"typescript",
|
"typescript",
|
||||||
"vue",
|
"vue",
|
||||||
"yaml",
|
"yaml",
|
||||||
},
|
},
|
||||||
auto_install = auto,
|
auto_install = auto,
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
use_languagetree = true,
|
use_languagetree = true,
|
||||||
-- disable = function(_, bufnr) return vim.api.nvim_buf_line_count(bufnr) > 10000 end,
|
-- disable = function(_, bufnr) return vim.api.nvim_buf_line_count(bufnr) > 10000 end,
|
||||||
additional_vim_regex_highlighting = false,
|
additional_vim_regex_highlighting = false,
|
||||||
},
|
},
|
||||||
incremental_selection = { enable = true },
|
incremental_selection = { enable = true },
|
||||||
ident = { enable = true },
|
ident = { enable = true },
|
||||||
autotag = { enable = true },
|
autotag = { enable = true },
|
||||||
context_commentstring = { enable = true, enable_autocmd = false },
|
context_commentstring = { enable = true, enable_autocmd = false },
|
||||||
rainbow = {
|
rainbow = {
|
||||||
enable = true,
|
enable = true,
|
||||||
extended_mode = true,
|
extended_mode = true,
|
||||||
max_file_lines = nil,
|
max_file_lines = nil,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"nvim-treesitter/playground",
|
"nvim-treesitter/playground",
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
return {
|
return {
|
||||||
"mbbill/undotree",
|
"mbbill/undotree",
|
||||||
event = "BufEnter",
|
event = "BufEnter",
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>u", vim.cmd.UndotreeToggle, desc = "Undo Tree Toggle" },
|
{ "<leader>u", vim.cmd.UndotreeToggle, desc = "Undo Tree Toggle" },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
return {
|
return {
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,11 +35,9 @@ return {
|
||||||
{ "hrsh7th/cmp-nvim-lsp" },
|
{ "hrsh7th/cmp-nvim-lsp" },
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
|
|
||||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" })
|
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", "]d", vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" })
|
||||||
|
|
||||||
|
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
||||||
local lspkind_status_ok, lspkind = pcall(require, "lspkind")
|
local lspkind_status_ok, lspkind = pcall(require, "lspkind")
|
||||||
|
@ -131,8 +129,8 @@ return {
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"folke/neodev.nvim",
|
"folke/neodev.nvim",
|
||||||
opts = {}
|
opts = {},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ return {
|
||||||
"MasonLog",
|
"MasonLog",
|
||||||
},
|
},
|
||||||
build = ":MasonUpdate",
|
build = ":MasonUpdate",
|
||||||
event = "BufRead",
|
event = "BufRead",
|
||||||
},
|
},
|
||||||
{ "williamboman/mason-lspconfig.nvim" },
|
{ "williamboman/mason-lspconfig.nvim" },
|
||||||
-- Autocompletion
|
-- Autocompletion
|
||||||
|
@ -61,7 +61,6 @@ return {
|
||||||
local config = require("lspconfig")
|
local config = require("lspconfig")
|
||||||
local util = require("lspconfig/util")
|
local util = require("lspconfig/util")
|
||||||
|
|
||||||
|
|
||||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||||
capabilities = vim.tbl_deep_extend("keep", capabilities, vim.lsp.protocol.make_client_capabilities())
|
capabilities = vim.tbl_deep_extend("keep", capabilities, vim.lsp.protocol.make_client_capabilities())
|
||||||
capabilities.textDocument.completion.completionItem = {
|
capabilities.textDocument.completion.completionItem = {
|
||||||
|
@ -88,65 +87,67 @@ return {
|
||||||
|
|
||||||
lsp.default_keymaps({ buffer = bufnr })
|
lsp.default_keymaps({ buffer = bufnr })
|
||||||
|
|
||||||
local opts = { buffer = bufnr }
|
local opts = { buffer = bufnr }
|
||||||
local bind = function(map, cmd, mode) vim.keymap.set('n', map, cmd, opts) end
|
local bind = function(map, cmd, mode)
|
||||||
|
vim.keymap.set("n", map, cmd, opts)
|
||||||
|
end
|
||||||
|
|
||||||
-- diagnostics
|
-- diagnostics
|
||||||
bind("<leader>ld", "<cmd>lua vim.diagnostic.open_float()<CR>")
|
bind("<leader>ld", "<cmd>lua vim.diagnostic.open_float()<CR>")
|
||||||
bind("<leader>[d", "<cmd>lua vim.diagnostic.goto_prev()<CR>")
|
bind("<leader>[d", "<cmd>lua vim.diagnostic.goto_prev()<CR>")
|
||||||
bind("<leader>]d", "<cmd>lua vim.diagnostic.goto_next()<CR>")
|
bind("<leader>]d", "<cmd>lua vim.diagnostic.goto_next()<CR>")
|
||||||
|
|
||||||
bind("<leader>la", "<cmd>lua vim.lsp.buf.code_action()<CR>")
|
bind("<leader>la", "<cmd>lua vim.lsp.buf.code_action()<CR>")
|
||||||
end
|
end
|
||||||
|
|
||||||
lsp.on_attach(on_attach)
|
lsp.on_attach(on_attach)
|
||||||
local servers = {
|
local servers = {
|
||||||
-- -- https://github.com/williamboman/mason-lspconfig.nvim#available-lsp-servers
|
-- -- https://github.com/williamboman/mason-lspconfig.nvim#available-lsp-servers
|
||||||
-- lua
|
-- lua
|
||||||
"lua_ls",
|
"lua_ls",
|
||||||
-- rust
|
-- rust
|
||||||
"rust_analyzer",
|
"rust_analyzer",
|
||||||
-- ts/js | web
|
-- ts/js | web
|
||||||
"tsserver",
|
"tsserver",
|
||||||
"html",
|
"html",
|
||||||
"eslint",
|
"eslint",
|
||||||
"cssls",
|
"cssls",
|
||||||
"cssmodules_ls",
|
"cssmodules_ls",
|
||||||
|
|
||||||
-- python
|
-- python
|
||||||
"pyright",
|
"pyright",
|
||||||
|
|
||||||
-- docker
|
-- docker
|
||||||
"dockerls",
|
"dockerls",
|
||||||
"docker_compose_language_service",
|
"docker_compose_language_service",
|
||||||
}
|
}
|
||||||
lsp.ensure_installed(servers)
|
lsp.ensure_installed(servers)
|
||||||
|
|
||||||
local default = require('util').spread {
|
local default = require("util").spread({
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
}
|
})
|
||||||
|
|
||||||
config.lua_ls.setup(lsp.nvim_lua_ls())
|
config.lua_ls.setup(lsp.nvim_lua_ls())
|
||||||
|
|
||||||
config.rust_analyzer.setup(default {})
|
config.rust_analyzer.setup(default({}))
|
||||||
|
|
||||||
config.tsserver.setup(default {
|
config.tsserver.setup(default({
|
||||||
root_dir = util.root_pattern("tsconfig.json", ".git"),
|
root_dir = util.root_pattern("tsconfig.json", ".git"),
|
||||||
})
|
}))
|
||||||
config.html.setup(default {})
|
config.html.setup(default({}))
|
||||||
config.eslint.setup(default {})
|
config.eslint.setup(default({}))
|
||||||
config.cssls.setup(default {})
|
config.cssls.setup(default({}))
|
||||||
config.cssmodules_ls.setup(default {})
|
config.cssmodules_ls.setup(default({}))
|
||||||
|
|
||||||
config.pyright.setup(default {})
|
config.pyright.setup(default({}))
|
||||||
|
|
||||||
config.dockerls.setup(default {})
|
config.dockerls.setup(default({}))
|
||||||
config.docker_compose_language_service.setup(default {})
|
config.docker_compose_language_service.setup(default({}))
|
||||||
|
|
||||||
lsp.setup()
|
lsp.setup()
|
||||||
|
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
local cmp_action = require("lsp-zero").cmp_action()
|
local cmp_action = require("lsp-zero").cmp_action()
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
return {
|
return {
|
||||||
'tpope/vim-sleuth',
|
"tpope/vim-sleuth",
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
-- Autoload all files in this tools dir, minus this init again
|
-- Autoload all files in this tools dir, minus this init again
|
||||||
for _, file in ipairs(vim.fn.readdir(vim.fn.stdpath('config')..'/lua/tools', [[v:val =~ '\.lua$']])) do
|
for _, file in ipairs(vim.fn.readdir(vim.fn.stdpath("config") .. "/lua/tools", [[v:val =~ '\.lua$']])) do
|
||||||
if file ~= "init.lua" then
|
if file ~= "init.lua" then
|
||||||
local tool = string.sub(file, 0, -5)
|
local tool = string.sub(file, 0, -5)
|
||||||
require('tools.' .. tool)
|
require("tools." .. tool)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,37 +1,71 @@
|
||||||
-- Scratch files
|
-- Scratch files
|
||||||
local scratch = function(extension)
|
local scratch = function(extension)
|
||||||
os.execute "mkdir -p ~/dev/scratches/"
|
os.execute("mkdir -p ~/dev/scratches/")
|
||||||
local date = os.date "%Y-%m-%dT%H:%M:%S"
|
local date = os.date("%Y-%m-%dT%H:%M:%S")
|
||||||
local filepath = "~/dev/scratches/scratch_" .. date .. extension
|
local filepath = "~/dev/scratches/scratch_" .. date .. extension
|
||||||
vim.cmd("execute 'edit " .. filepath .. "'")
|
vim.cmd("execute 'edit " .. filepath .. "'")
|
||||||
end
|
end
|
||||||
|
|
||||||
require('util').keymaps({
|
require("util").keymaps({
|
||||||
n = {
|
n = {
|
||||||
["<leader>fsw"] = {
|
["<leader>fsw"] = {
|
||||||
function()
|
function()
|
||||||
require("telescope.builtin").live_grep {
|
require("telescope.builtin").live_grep({
|
||||||
search_dirs = { "~/dev/scratches/" },
|
search_dirs = { "~/dev/scratches/" },
|
||||||
}
|
})
|
||||||
end,
|
end,
|
||||||
desc = "Find Words in Scratches",
|
desc = "Find Words in Scratches",
|
||||||
},
|
},
|
||||||
["<leader>fsf"] = {
|
["<leader>fsf"] = {
|
||||||
function()
|
function()
|
||||||
require("telescope.builtin").find_files{
|
require("telescope.builtin").find_files({
|
||||||
search_dirs = { "~/dev/scratches/" },
|
search_dirs = { "~/dev/scratches/" },
|
||||||
}
|
})
|
||||||
end,
|
end,
|
||||||
desc = "Find Scratches",
|
desc = "Find Scratches",
|
||||||
},
|
},
|
||||||
["<leader>s"] = { "<Nop>", desc = "Scratch File" },
|
["<leader>s"] = { "<Nop>", desc = "Scratch File" },
|
||||||
["<leader>ss"] = { function() scratch ".txt" end, desc = "New text scratch file" },
|
["<leader>ss"] = {
|
||||||
["<leader>sn"] = { function() scratch ".json" end, desc = "New json scratch file" },
|
function()
|
||||||
["<leader>sm"] = { function() scratch ".md" end, desc = "New markdown scratch file" },
|
scratch(".txt")
|
||||||
["<leader>sq"] = { function() scratch ".sql" end, desc = "New sql scratch file" },
|
end,
|
||||||
["<leader>st"] = { function() scratch ".ts" end, desc = "New ts scratch file" },
|
desc = "New text scratch file",
|
||||||
["<leader>sb"] = { function() scratch ".sh" end, desc = "New shell scratch file" },
|
},
|
||||||
["<leader>sj"] = { function() scratch ".js" end, desc = "New js scratch file" },
|
["<leader>sn"] = {
|
||||||
}
|
function()
|
||||||
|
scratch(".json")
|
||||||
|
end,
|
||||||
|
desc = "New json scratch file",
|
||||||
|
},
|
||||||
|
["<leader>sm"] = {
|
||||||
|
function()
|
||||||
|
scratch(".md")
|
||||||
|
end,
|
||||||
|
desc = "New markdown scratch file",
|
||||||
|
},
|
||||||
|
["<leader>sq"] = {
|
||||||
|
function()
|
||||||
|
scratch(".sql")
|
||||||
|
end,
|
||||||
|
desc = "New sql scratch file",
|
||||||
|
},
|
||||||
|
["<leader>st"] = {
|
||||||
|
function()
|
||||||
|
scratch(".ts")
|
||||||
|
end,
|
||||||
|
desc = "New ts scratch file",
|
||||||
|
},
|
||||||
|
["<leader>sb"] = {
|
||||||
|
function()
|
||||||
|
scratch(".sh")
|
||||||
|
end,
|
||||||
|
desc = "New shell scratch file",
|
||||||
|
},
|
||||||
|
["<leader>sj"] = {
|
||||||
|
function()
|
||||||
|
scratch(".js")
|
||||||
|
end,
|
||||||
|
desc = "New js scratch file",
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
23
lua/util.lua
23
lua/util.lua
|
@ -1,4 +1,4 @@
|
||||||
local M = {};
|
local M = {}
|
||||||
|
|
||||||
function M.keymaps(mappings)
|
function M.keymaps(mappings)
|
||||||
for mode, maps in pairs(mappings) do
|
for mode, maps in pairs(mappings) do
|
||||||
|
@ -21,18 +21,17 @@ function M.keymaps(mappings)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.spread(template)
|
function M.spread(template)
|
||||||
local result = {}
|
local result = {}
|
||||||
for key, value in pairs(template) do
|
for key, value in pairs(template) do
|
||||||
result[key] = value
|
result[key] = value
|
||||||
end
|
end
|
||||||
|
|
||||||
return function(table)
|
return function(table)
|
||||||
for key, value in pairs(table) do
|
for key, value in pairs(table) do
|
||||||
result[key] = value
|
result[key] = value
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue