formatting

This commit is contained in:
RingOfStorms (Joshua Bell) 2023-07-05 10:06:18 -05:00
parent 3c84ec54bf
commit 452abf2029
25 changed files with 635 additions and 536 deletions

View file

@ -1,29 +1,28 @@
require "options"
require "keymaps"
require("options")
require("keymaps")
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
local output = vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
if vim.api.nvim_get_vvar "shell_error" ~= 0 then
vim.api.nvim_err_writeln("Error cloning lazy.nvim repository...\n\n" .. output)
end
local output = vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
if vim.api.nvim_get_vvar("shell_error") ~= 0 then
vim.api.nvim_err_writeln("Error cloning lazy.nvim repository...\n\n" .. output)
end
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup("plugins", {
change_detection = {
enabled = false,
}
},
})
vim.cmd 'colorscheme material'
require "tools"
require "autocommands"
vim.cmd("colorscheme material")
require("tools")
require("autocommands")

View file

@ -1,5 +1,7 @@
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
--vim.api.nvim_create_autocmd({ "VimEnter" }, {
@ -10,25 +12,25 @@ end
-- end
--})
vim.api.nvim_create_autocmd('BufRead', {
pattern = ".env*",
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", {
pattern = ".env*",
command = "set filetype=sh",
})
vim.api.nvim_create_autocmd("BufRead", {
callback = function()
vim.cmd.CccHighlighterEnable()
end,
pattern = ".*rc",
command = "set filetype=sh",
})
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', {

View file

@ -11,63 +11,78 @@ vim.g.maplocalleader = " "
-- term_mode = "t",
-- command_mode = "c",
require('util').keymaps({
n = {
[";"] = { ":", desc = "No shift command mode" },
["n"] = { "nzzzv", desc = "Next search result centered" },
["N"] = { "Nzzzv", desc = "Previous search result centered" },
["<esc>"] = { ":noh<CR><esc>", desc = "Clear search on escape" },
["<return>"] = {":noh<CR><return>", desc = "Clear search on return" },
["<leader>w"] = { "<cmd>w<cr>", desc = "Save" },
["<leader>q"] = { "<cmd>confirm q<cr>", desc = "Quit" },
["|"] = { "<cmd>vsplit<cr>", desc = "Vertical Split" },
["\\"] = { "<cmd>split<cr>", desc = "Horizontal Split" },
["<C-d>"] = { "<C-d>zz", desc = "Vertical half page down and center cursor" },
["<C-u>"] = { "<C-u>zz", desc = "Vertical half page up and center cursor" },
["<leader>y"] = { '"*y', desc = "Copy to system clipboard" },
["<Leader>p"] = { '"*p', desc = "Paste from system clipboard" },
["<leader>Q"] = { ":qa<CR>", desc = "Quit all" },
["J"] = { "mzJ`z", desc = "Move line below onto this line" },
-- window navigation
["<C-h>"] = { "<C-w>h", desc = "Move window left current" },
["<C-j>"] = { "<C-w>j", desc = "Move window below current" },
["<C-k>"] = { "<C-w>k", desc = "Move window above current" },
["<C-l>"] = { "<C-w>l", desc = "Move window right current" },
-- reformat LSP
["<leader>lf"] = { function() vim.lsp.buf.format() end, desc = "Reformat file" },
["<leader>ld"] = { function() vim.diagnostic.open_float() end, desc = "Show diagnostic message"},
["<leader>ll"] = { function() vim.diagnostic.setloclist() end, desc = "Show diagnostic list"},
["<leader>lz"] = { ":LspRestart<CR>", desc = "Restart LSP Server" },
},
v = {
["y"] = { '"*y', desc = "Copy to system clipboard" },
["p"] = { '"*p', desc = "Paste from system clipboard" },
["J"] = { ":m '>+1<CR>gv=gv", desc = "Visually move block down"},
["K"] = { ":m '<-2<CR>gv=gv", desc = "Visually move block up"},
},
i = {
["<C-k>"] = { "<Up>", desc = "Up" },
["<C-j>"] = { "<Down>", desc = "Down" },
["<C-h>"] = { "<Left>", desc = "Left" },
["<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" },
},
require("util").keymaps({
n = {
[";"] = { ":", desc = "No shift command mode" },
["n"] = { "nzzzv", desc = "Next search result centered" },
["N"] = { "Nzzzv", desc = "Previous search result centered" },
["<esc>"] = { ":noh<CR><esc>", desc = "Clear search on escape" },
["<return>"] = { ":noh<CR><return>", desc = "Clear search on return" },
["<leader>a"] = { "ggVG", desc = "Select all" },
["<leader>w"] = { "<cmd>w<cr>", desc = "Save" },
["<leader>q"] = { "<cmd>confirm q<cr>", desc = "Quit" },
["<leader>cq"] = { "<cmd>bd<cr>", desc = "Close current buffer" },
["|"] = { "<cmd>vsplit<cr>", desc = "Vertical Split" },
["\\"] = { "<cmd>split<cr>", desc = "Horizontal Split" },
["<C-d>"] = { "<C-d>zz", desc = "Vertical half page down and center cursor" },
["<C-u>"] = { "<C-u>zz", desc = "Vertical half page up and center cursor" },
["<leader>y"] = { '"*y', desc = "Copy to system clipboard" },
["<Leader>p"] = { '"*p', desc = "Paste from system clipboard" },
["<leader>Q"] = { ":qa<CR>", desc = "Quit all" },
["J"] = { "mzJ`z", desc = "Move line below onto this line" },
-- window navigation
["<C-h>"] = { "<C-w>h", desc = "Move window left current" },
["<C-j>"] = { "<C-w>j", desc = "Move window below current" },
["<C-k>"] = { "<C-w>k", desc = "Move window above current" },
["<C-l>"] = { "<C-w>l", desc = "Move window right current" },
-- reformat LSP
["<leader>lf"] = {
function()
vim.lsp.buf.format()
end,
desc = "Reformat file",
},
["<leader>ld"] = {
function()
vim.diagnostic.open_float()
end,
desc = "Show diagnostic message",
},
["<leader>ll"] = {
function()
vim.diagnostic.setloclist()
end,
desc = "Show diagnostic list",
},
["<leader>lz"] = { ":LspRestart<CR>", desc = "Restart LSP Server" },
},
v = {
["y"] = { '"*y', desc = "Copy to system clipboard" },
["p"] = { '"*p', desc = "Paste from system clipboard" },
["J"] = { ":m '>+1<CR>gv=gv", desc = "Visually move block down" },
["K"] = { ":m '<-2<CR>gv=gv", desc = "Visually move block up" },
},
i = {
["<C-k>"] = { "<Up>", desc = "Up" },
["<C-j>"] = { "<Down>", desc = "Down" },
["<C-h>"] = { "<Left>", desc = "Left" },
["<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" },
},
})

View file

@ -43,6 +43,6 @@ vim.opt.splitright = true
-- Set completeopt to have a better completion experience
vim.o.completeopt = "menuone,noselect"
vim.diagnostic.config{
float={border="single"}
}
vim.diagnostic.config({
float = { border = "single" },
})

View file

@ -1,4 +1,5 @@
# Plugins to look into
- https://github.com/lvimuser/lsp-inlayhints.nvim/tree/anticonceal
- https://github.com/theHamsta/nvim-dap-virtual-text/tree/inline-text
- https://github.com/andythigpen/nvim-coverage
@ -6,13 +7,13 @@
- https://github.com/johmsalas/text-case.nvim
- gitsigns?
- casing plugins?
["<leader>,"] = { name = " Misc Tools" },
["<leader>,c"] = { name = " Casing" },
["<leader>,cs"] = { ":Snek<CR>", desc = "To Snek Case" },
["<leader>,cc"] = { ":Camel<CR>", desc = "To Camel Case" },
["<leader>,cp"] = { ":CamelB<CR>", desc = "To Pascal Case" },
["<leader>,ck"] = { ":Kebab<CR>", desc = "To Kebab Case" },
["<leader>,ce"] = { ":Screm<CR>", desc = "To Screm Case" },
["<leader>,"] = { name = " Misc Tools" },
["<leader>,c"] = { name = " Casing" },
["<leader>,cs"] = { ":Snek<CR>", desc = "To Snek Case" },
["<leader>,cc"] = { ":Camel<CR>", desc = "To Camel Case" },
["<leader>,cp"] = { ":CamelB<CR>", desc = "To Pascal Case" },
["<leader>,ck"] = { ":Kebab<CR>", desc = "To Kebab Case" },
["<leader>,ce"] = { ":Screm<CR>", desc = "To Screm Case" },
- https://github.com/tpope/vim-fugitive
- https://github.com/folke/noice.nvim
- 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/windwp/nvim-autopairs
- https://github.com/lukas-reineke/indent-blankline.nvim

View file

@ -1,15 +1,18 @@
return {
"Pocco81/auto-save.nvim",
event = "BufEnter",
opts = {
trigger_events = { "InsertLeave", "TextChanged", "TextChangedI", "BufLeave" },
condition = function (buf)
local disallowed_filetypes = {"TelescopePrompt"}
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
return true
end
return false
end
}
"Pocco81/auto-save.nvim",
event = "BufEnter",
opts = {
trigger_events = { "InsertLeave", "TextChanged", "TextChangedI", "BufLeave" },
condition = function(buf)
local disallowed_filetypes = { "TelescopePrompt" }
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
return true
end
return false
end,
},
}

View file

@ -1,7 +1,7 @@
return {
"uga-rosa/ccc.nvim",
event = "BufRead",
keys = {
{ "<leader>cp", ":CccPick <CR>", desc = "Color Picker" }
"uga-rosa/ccc.nvim",
event = "BufRead",
keys = {
{ "<leader>cp", ":CccPick <CR>", desc = "Color Picker" },
},
}

View file

@ -1,10 +1,15 @@
vim.g.NERDCreateDefaultMappings = 0
vim.cmd('filetype plugin on')
vim.cmd("filetype plugin on")
return {
"preservim/nerdcommenter",
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", mode = "v" },
},
"preservim/nerdcommenter",
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",
mode = "v",
},
},
}

View file

@ -1,8 +1,14 @@
return {
"rest-nvim/rest.nvim",
event = "BufEnter *.http",
requires = { "nvim-lua/plenary.nvim" },
"rest-nvim/rest.nvim",
event = "BufEnter *.http",
requires = { "nvim-lua/plenary.nvim" },
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",
},
},
}

View file

@ -1,206 +1,206 @@
local servers = {
rust_analyzer = {
-- rust
-- to enable rust-analyzer settings visit:
-- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc
["rust-analyzer"] = {
cargo = {
allFeatures = true,
},
checkOnSave = {
allFeatures = true,
command = "clippy",
},
},
},
tsserver = {
-- typescript/javascript
},
pyright = {
-- python
},
lua_ls = {
-- lua
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
},
},
bashls = {
-- bash
},
cssls = {
-- css
},
cssmodules_ls = {
-- css modules
},
dockerls = {
-- docker
},
docker_compose_language_service = {
-- docker compose
},
jsonls = {
-- json
},
marksman = {
-- markdown
},
taplo = {
-- toml
},
yamlls = {
-- yaml
},
lemminx = {
-- xml
},
rnix = {
-- Nix
},
ansiblels = {
-- ansible
},
rust_analyzer = {
-- rust
-- to enable rust-analyzer settings visit:
-- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc
["rust-analyzer"] = {
cargo = {
allFeatures = true,
},
checkOnSave = {
allFeatures = true,
command = "clippy",
},
},
},
tsserver = {
-- typescript/javascript
},
pyright = {
-- python
},
lua_ls = {
-- lua
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
},
},
bashls = {
-- bash
},
cssls = {
-- css
},
cssmodules_ls = {
-- css modules
},
dockerls = {
-- docker
},
docker_compose_language_service = {
-- docker compose
},
jsonls = {
-- json
},
marksman = {
-- markdown
},
taplo = {
-- toml
},
yamlls = {
-- yaml
},
lemminx = {
-- xml
},
rnix = {
-- Nix
},
ansiblels = {
-- ansible
},
}
-- LSP config
-- Took lots of inspiration from this kickstart lua file: https://github.com/hjr3/dotfiles/blob/main/.config/nvim/init.lua
return {
{
-- Autocompletion
"hrsh7th/nvim-cmp",
dependencies = { "hrsh7th/cmp-nvim-lsp", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip" },
},
{
"williamboman/mason.nvim",
cmd = {
"Mason",
"MasonUpdate",
"MasonInstall",
"MasonInstallAll",
"MasonUninstall",
"MasonUninstallAll",
"MasonLog",
},
build = ":MasonUpdate",
opts = {},
},
{
"williamboman/mason-lspconfig.nvim",
},
{ "folke/neodev.nvim", opts = {} },
{
"neovim/nvim-lspconfig",
after = { "nvim-telescope/telescope.nvim" },
config = function()
local config = require("lspconfig")
local util = require("lspconfig/util")
local mason_lspconfig = require("mason-lspconfig")
local cmp = require("cmp")
local luasnip = require("luasnip")
{
-- Autocompletion
"hrsh7th/nvim-cmp",
dependencies = { "hrsh7th/cmp-nvim-lsp", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip" },
},
{
"williamboman/mason.nvim",
cmd = {
"Mason",
"MasonUpdate",
"MasonInstall",
"MasonInstallAll",
"MasonUninstall",
"MasonUninstallAll",
"MasonLog",
},
build = ":MasonUpdate",
opts = {},
},
{
"williamboman/mason-lspconfig.nvim",
},
{ "folke/neodev.nvim", opts = {} },
{
"neovim/nvim-lspconfig",
after = { "nvim-telescope/telescope.nvim" },
config = function()
local config = require("lspconfig")
local util = require("lspconfig/util")
local mason_lspconfig = require("mason-lspconfig")
local cmp = require("cmp")
local luasnip = require("luasnip")
-- LSP
-- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(client, bufnr)
local nmap = function(keys, func, desc)
if desc then
desc = "LSP: " .. desc
end
-- LSP
-- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(client, bufnr)
local nmap = function(keys, func, desc)
if desc then
desc = "LSP: " .. desc
end
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc })
end
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc })
end
nmap("<leader>lr", vim.lsp.buf.rename, "[R]ename")
nmap("<leader>la", vim.lsp.buf.code_action, "Code [A]ction")
nmap("<leader>lr", vim.lsp.buf.rename, "[R]ename")
nmap("<leader>la", vim.lsp.buf.code_action, "Code [A]ction")
nmap("gd", vim.lsp.buf.definition, "[G]oto [D]efinition")
nmap("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
nmap("gI", vim.lsp.buf.implementation, "[G]oto [I]mplementation")
nmap("<leader>D", vim.lsp.buf.type_definition, "Type [D]efinition")
nmap("gd", vim.lsp.buf.definition, "[G]oto [D]efinition")
nmap("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
nmap("gI", vim.lsp.buf.implementation, "[G]oto [I]mplementation")
nmap("<leader>D", vim.lsp.buf.type_definition, "Type [D]efinition")
-- See `:help K` for why this keymap
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
nmap("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation")
-- See `:help K` for why this keymap
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
nmap("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation")
-- Lesser used LSP functionality
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
-- Lesser used LSP functionality
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
-- disable tsserver so it does not conflict with prettier
if client.name == "tsserver" then
client.server_capabilities.document_formatting = false
end
end
-- disable tsserver so it does not conflict with prettier
if client.name == "tsserver" then
client.server_capabilities.document_formatting = false
end
end
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
-- Install servers used
mason_lspconfig.setup({
ensure_installed = vim.tbl_keys(servers),
})
-- Install servers used
mason_lspconfig.setup({
ensure_installed = vim.tbl_keys(servers),
})
local flags = {
allow_incremental_sync = true,
debounce_text_changes = 200,
}
local flags = {
allow_incremental_sync = true,
debounce_text_changes = 200,
}
mason_lspconfig.setup_handlers({
function(server_name)
require("lspconfig")[server_name].setup({
flags = flags,
capabilities = capabilities,
on_attach = on_attach,
settings = servers[server_name],
})
end,
})
mason_lspconfig.setup_handlers({
function(server_name)
require("lspconfig")[server_name].setup({
flags = flags,
capabilities = capabilities,
on_attach = on_attach,
settings = servers[server_name],
})
end,
})
-- Completion
luasnip.config.setup({})
-- Completion
luasnip.config.setup({})
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete({}),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_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.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
},
})
end,
},
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete({}),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_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.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
},
})
end,
},
}

View file

@ -1,12 +1,12 @@
return {
"lnc3l0t/glow.nvim",
branch = "advanced_window",
config = {
default_type = "keep",
},
cmd = "Glow",
"lnc3l0t/glow.nvim",
branch = "advanced_window",
config = {
default_type = "keep",
},
cmd = "Glow",
keys = {
{ "<leader>m","<Nop>", desc = " Markdown" },
{ "<leader>mp",":Glow <CR>", desc = "Markdown preview" },
{ "<leader>m", "<Nop>", desc = " Markdown" },
{ "<leader>mp", ":Glow <CR>", desc = "Markdown preview" },
},
}

View file

@ -2,9 +2,11 @@ return {
"nvim-neo-tree/neo-tree.nvim",
dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim", "nvim-tree/nvim-web-devicons" },
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,
tag = '2.56',
tag = "2.56",
opts = {
auto_clean_after_session_restore = true,
close_if_last_window = true,
@ -30,13 +32,16 @@ return {
},
keys = {
{ "<leader>e", "<cmd>Neotree toggle<CR>", desc = "Toggle Explorer" },
{ "<leader>o",function()
if vim.bo.filetype == "neo-tree" then
vim.cmd.wincmd "p"
else
vim.cmd.Neotree "focus"
end
end , desc = "Toggle Explorer Focus" },
{
"<leader>o",
function()
if vim.bo.filetype == "neo-tree" then
vim.cmd.wincmd("p")
else
vim.cmd.Neotree("focus")
end
end,
desc = "Toggle Explorer Focus",
},
},
}

View file

@ -19,7 +19,6 @@ return {
"jose-elias-alvarez/null-ls.nvim",
after = { "williamboman/mason.nvim" },
opts = function(_, config)
-- config variable is the default definitions table for the setup function call
local null_ls = require("null-ls")
@ -51,10 +50,10 @@ return {
return config
end,
},
{
"jay-babu/mason-null-ls.nvim",
opts = {
ensure_installed = { "rustfmt", "stylelua", "prettier", "black" }
}
}
{
"jay-babu/mason-null-ls.nvim",
opts = {
ensure_installed = { "rustfmt", "stylelua", "prettier", "black" },
},
},
}

View file

@ -1,7 +1,7 @@
return {
"Almo7aya/openingh.nvim",
event = "BufEnter",
"Almo7aya/openingh.nvim",
event = "BufEnter",
keys = {
{ "<leader>gf", ":OpenInGHFile <CR>", desc = "Open in git" }
{ "<leader>gf", ":OpenInGHFile <CR>", desc = "Open in git" },
},
}

View file

@ -1,32 +1,68 @@
return {
"nvim-telescope/telescope.nvim",
tag = '0.1.1',
dependencies = {
{ "nvim-lua/plenary.nvim" },
{ "nvim-telescope/telescope-fzf-native.nvim", enabled = vim.fn.executable "make" == 1, build = "make" },
},
cmd = "Telescope",
keys = {
{ "<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>fw", function() 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",
}
}
},
"nvim-telescope/telescope.nvim",
tag = "0.1.1",
dependencies = {
{ "nvim-lua/plenary.nvim" },
{ "nvim-telescope/telescope-fzf-native.nvim", enabled = vim.fn.executable("make") == 1, build = "make" },
},
cmd = "Telescope",
keys = {
{ "<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>fw",
function()
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",
},
},
},
}

View file

@ -2,7 +2,7 @@ return {
"marko-cerovac/material.nvim",
config = function()
vim.g.material_style = "darker"
require("material").setup {
require("material").setup({
plugins = {
"dashboard",
"gitsigns",
@ -11,8 +11,8 @@ return {
"which-key",
},
high_visibility = {
darker = true
}
}
end
darker = true,
},
})
end,
}

View file

@ -1,87 +1,87 @@
local auto = true
local output = vim.fn.system({
"which",
"tree-sitter",
"which",
"tree-sitter",
})
if output == nil or output == "" then
auto = false
auto = false
end
return {
"nvim-treesitter/nvim-treesitter",
dependencies = { "windwp/nvim-ts-autotag", "JoosepAlviste/nvim-ts-context-commentstring" },
build = ":TSUpdate",
event = "BufRead",
cmd = {
"TSBufDisable",
"TSBufEnable",
"TSBufToggle",
"TSDisable",
"TSEnable",
"TSToggle",
"TSInstall",
"TSInstallInfo",
"TSInstallSync",
"TSModuleInfo",
"TSUninstall",
"TSUpdate",
"TSUpdateSync",
},
opts = {
-- ensure_installed = 'all',
ensure_installed = {
"lua",
"http",
"json",
"bash",
"css",
"diff",
"dockerfile",
"dot",
"git_rebase",
"gitattributes",
"html",
"java",
"javascript",
"jq",
"jsdoc",
"json5",
"kotlin",
"latex",
"make",
"markdown",
"markdown_inline",
"nix",
"python",
"regex",
"rst",
"rust",
"scss",
"sql",
"terraform",
"toml",
"tsx",
"jsx",
"typescript",
"vue",
"yaml",
},
auto_install = auto,
highlight = {
enable = true,
use_languagetree = true,
-- disable = function(_, bufnr) return vim.api.nvim_buf_line_count(bufnr) > 10000 end,
additional_vim_regex_highlighting = false,
},
incremental_selection = { enable = true },
ident = { enable = true },
autotag = { enable = true },
context_commentstring = { enable = true, enable_autocmd = false },
rainbow = {
enable = true,
extended_mode = true,
max_file_lines = nil,
},
},
"nvim-treesitter/playground",
"nvim-treesitter/nvim-treesitter",
dependencies = { "windwp/nvim-ts-autotag", "JoosepAlviste/nvim-ts-context-commentstring" },
build = ":TSUpdate",
event = "BufRead",
cmd = {
"TSBufDisable",
"TSBufEnable",
"TSBufToggle",
"TSDisable",
"TSEnable",
"TSToggle",
"TSInstall",
"TSInstallInfo",
"TSInstallSync",
"TSModuleInfo",
"TSUninstall",
"TSUpdate",
"TSUpdateSync",
},
opts = {
-- ensure_installed = 'all',
ensure_installed = {
"lua",
"http",
"json",
"bash",
"css",
"diff",
"dockerfile",
"dot",
"git_rebase",
"gitattributes",
"html",
"java",
"javascript",
"jq",
"jsdoc",
"json5",
"kotlin",
"latex",
"make",
"markdown",
"markdown_inline",
"nix",
"python",
"regex",
"rst",
"rust",
"scss",
"sql",
"terraform",
"toml",
"tsx",
"jsx",
"typescript",
"vue",
"yaml",
},
auto_install = auto,
highlight = {
enable = true,
use_languagetree = true,
-- disable = function(_, bufnr) return vim.api.nvim_buf_line_count(bufnr) > 10000 end,
additional_vim_regex_highlighting = false,
},
incremental_selection = { enable = true },
ident = { enable = true },
autotag = { enable = true },
context_commentstring = { enable = true, enable_autocmd = false },
rainbow = {
enable = true,
extended_mode = true,
max_file_lines = nil,
},
},
"nvim-treesitter/playground",
}

View file

@ -1,8 +1,7 @@
return {
"mbbill/undotree",
"mbbill/undotree",
event = "BufEnter",
keys = {
{ "<leader>u", vim.cmd.UndotreeToggle, desc = "Undo Tree Toggle" },
},
}

View file

@ -1,4 +1,3 @@
return {
"nvim-lua/plenary.nvim",
}

View file

@ -35,11 +35,9 @@ return {
{ "hrsh7th/cmp-nvim-lsp" },
},
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_next, { desc = "Go to next diagnostic message" })
local cmp = require("cmp")
local snip_status_ok, luasnip = pcall(require, "luasnip")
local lspkind_status_ok, lspkind = pcall(require, "lspkind")
@ -131,8 +129,8 @@ return {
})
end,
},
{
"folke/neodev.nvim",
opts = {}
}
{
"folke/neodev.nvim",
opts = {},
},
}

View file

@ -16,7 +16,7 @@ return {
"MasonLog",
},
build = ":MasonUpdate",
event = "BufRead",
event = "BufRead",
},
{ "williamboman/mason-lspconfig.nvim" },
-- Autocompletion
@ -61,7 +61,6 @@ return {
local config = require("lspconfig")
local util = require("lspconfig/util")
local capabilities = require("cmp_nvim_lsp").default_capabilities()
capabilities = vim.tbl_deep_extend("keep", capabilities, vim.lsp.protocol.make_client_capabilities())
capabilities.textDocument.completion.completionItem = {
@ -88,65 +87,67 @@ return {
lsp.default_keymaps({ buffer = bufnr })
local opts = { buffer = bufnr }
local bind = function(map, cmd, mode) vim.keymap.set('n', map, cmd, opts) end
local opts = { buffer = bufnr }
local bind = function(map, cmd, mode)
vim.keymap.set("n", map, cmd, opts)
end
-- diagnostics
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_next()<CR>")
-- diagnostics
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_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
lsp.on_attach(on_attach)
local servers = {
local servers = {
-- -- https://github.com/williamboman/mason-lspconfig.nvim#available-lsp-servers
-- lua
-- lua
"lua_ls",
-- rust
-- rust
"rust_analyzer",
-- ts/js | web
-- ts/js | web
"tsserver",
"html",
"html",
"eslint",
"cssls",
"cssmodules_ls",
-- python
-- python
"pyright",
-- docker
-- docker
"dockerls",
"docker_compose_language_service",
}
lsp.ensure_installed(servers)
local default = require('util').spread {
on_attach = on_attach,
local default = require("util").spread({
on_attach = on_attach,
capabilities = capabilities,
}
})
config.lua_ls.setup(lsp.nvim_lua_ls())
config.rust_analyzer.setup(default {})
config.rust_analyzer.setup(default({}))
config.tsserver.setup(default {
root_dir = util.root_pattern("tsconfig.json", ".git"),
})
config.html.setup(default {})
config.eslint.setup(default {})
config.cssls.setup(default {})
config.cssmodules_ls.setup(default {})
config.tsserver.setup(default({
root_dir = util.root_pattern("tsconfig.json", ".git"),
}))
config.html.setup(default({}))
config.eslint.setup(default({}))
config.cssls.setup(default({}))
config.cssmodules_ls.setup(default({}))
config.pyright.setup(default {})
config.pyright.setup(default({}))
config.dockerls.setup(default {})
config.docker_compose_language_service.setup(default {})
config.dockerls.setup(default({}))
config.docker_compose_language_service.setup(default({}))
lsp.setup()
local cmp = require("cmp")
local cmp = require("cmp")
local cmp_action = require("lsp-zero").cmp_action()
cmp.setup({

View file

@ -1,3 +1,3 @@
return {
'tpope/vim-sleuth',
"tpope/vim-sleuth",
}

View file

@ -1,8 +1,7 @@
-- 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
local tool = string.sub(file, 0, -5)
require('tools.' .. tool)
require("tools." .. tool)
end
end

View file

@ -1,37 +1,71 @@
-- Scratch files
local scratch = function(extension)
os.execute "mkdir -p ~/dev/scratches/"
local date = os.date "%Y-%m-%dT%H:%M:%S"
local filepath = "~/dev/scratches/scratch_" .. date .. extension
vim.cmd("execute 'edit " .. filepath .. "'")
os.execute("mkdir -p ~/dev/scratches/")
local date = os.date("%Y-%m-%dT%H:%M:%S")
local filepath = "~/dev/scratches/scratch_" .. date .. extension
vim.cmd("execute 'edit " .. filepath .. "'")
end
require('util').keymaps({
require("util").keymaps({
n = {
["<leader>fsw"] = {
["<leader>fsw"] = {
function()
require("telescope.builtin").live_grep {
require("telescope.builtin").live_grep({
search_dirs = { "~/dev/scratches/" },
}
})
end,
desc = "Find Words in Scratches",
},
["<leader>fsf"] = {
["<leader>fsf"] = {
function()
require("telescope.builtin").find_files{
require("telescope.builtin").find_files({
search_dirs = { "~/dev/scratches/" },
}
})
end,
desc = "Find Scratches",
},
["<leader>s"] = { "<Nop>", desc = "Scratch File" },
["<leader>ss"] = { function() scratch ".txt" end, desc = "New text 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" },
}
["<leader>ss"] = {
function()
scratch(".txt")
end,
desc = "New text 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",
},
},
})

View file

@ -1,4 +1,4 @@
local M = {};
local M = {}
function M.keymaps(mappings)
for mode, maps in pairs(mappings) do
@ -21,18 +21,17 @@ function M.keymaps(mappings)
end
function M.spread(template)
local result = {}
for key, value in pairs(template) do
result[key] = value
end
local result = {}
for key, value in pairs(template) do
result[key] = value
end
return function(table)
for key, value in pairs(table) do
result[key] = value
end
return result
end
return function(table)
for key, value in pairs(table) do
result[key] = value
end
return result
end
end
return M