uff
This commit is contained in:
parent
3d32043a89
commit
b54da97755
@ -38,6 +38,7 @@
|
|||||||
autoload -Uz is-at-least && is-at-least 5.1 || return
|
autoload -Uz is-at-least && is-at-least 5.1 || return
|
||||||
|
|
||||||
# Prompt colors.
|
# Prompt colors.
|
||||||
|
local main='242'
|
||||||
local grey='242'
|
local grey='242'
|
||||||
local red='1'
|
local red='1'
|
||||||
local yellow='3'
|
local yellow='3'
|
||||||
@ -76,7 +77,7 @@
|
|||||||
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=false
|
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=false
|
||||||
|
|
||||||
# Magenta prompt symbol if the last command succeeded.
|
# Magenta prompt symbol if the last command succeeded.
|
||||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=$grey
|
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=$main
|
||||||
# Red prompt symbol if the last command failed.
|
# Red prompt symbol if the last command failed.
|
||||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red
|
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red
|
||||||
# Default prompt symbol.
|
# Default prompt symbol.
|
||||||
|
0
configs/init.lua
Normal file
0
configs/init.lua
Normal file
@ -10,8 +10,6 @@ local opt = vim.opt
|
|||||||
require("plugins")
|
require("plugins")
|
||||||
|
|
||||||
if u.has_plugin("cmp") then
|
if u.has_plugin("cmp") then
|
||||||
vim.g.did_load_filetypes = 150
|
|
||||||
|
|
||||||
-- Global options
|
-- Global options
|
||||||
o.number = true -- show line number
|
o.number = true -- show line number
|
||||||
o.showmatch = true -- show matching brackets
|
o.showmatch = true -- show matching brackets
|
||||||
@ -28,6 +26,7 @@ if u.has_plugin("cmp") then
|
|||||||
g.hidden = true -- unload buffers when hidden
|
g.hidden = true -- unload buffers when hidden
|
||||||
g.filetype = true -- execute autocommands based on filetype
|
g.filetype = true -- execute autocommands based on filetype
|
||||||
o.autoread = true
|
o.autoread = true
|
||||||
|
opt.termguicolors = true
|
||||||
|
|
||||||
-- Search
|
-- Search
|
||||||
o.inccommand = "nosplit" -- show substitutions incrementally
|
o.inccommand = "nosplit" -- show substitutions incrementally
|
||||||
@ -68,6 +67,31 @@ if u.has_plugin("cmp") then
|
|||||||
|
|
||||||
g.ale_fixers = {"prettier", "eslint"}
|
g.ale_fixers = {"prettier", "eslint"}
|
||||||
|
|
||||||
|
vim.notify = require("notify")
|
||||||
|
|
||||||
|
require("notify").setup(
|
||||||
|
{
|
||||||
|
stages = "fade_in_slide_out",
|
||||||
|
render = "minimal",
|
||||||
|
background_colour = "#000000",
|
||||||
|
icons = {
|
||||||
|
ERROR = "",
|
||||||
|
WARN = "",
|
||||||
|
INFO = "",
|
||||||
|
DEBUG = "",
|
||||||
|
TRACE = "✎"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
require("telescope").setup {
|
||||||
|
pickers = {
|
||||||
|
find_files = {
|
||||||
|
hidden = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
-- Enable Theming / Syntax
|
-- Enable Theming / Syntax
|
||||||
o.syntax = "enable"
|
o.syntax = "enable"
|
||||||
o.termguicolors = true
|
o.termguicolors = true
|
||||||
@ -82,10 +106,12 @@ if u.has_plugin("cmp") then
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
require("transparent").setup({
|
require("transparent").setup(
|
||||||
enable = true,
|
{
|
||||||
extra_groups = "All"
|
enable = true,
|
||||||
})
|
extra_groups = "All"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
-- Remove background color
|
-- Remove background color
|
||||||
cmd("highlight Normal guibg=none")
|
cmd("highlight Normal guibg=none")
|
||||||
@ -169,6 +195,8 @@ if u.has_plugin("cmp") then
|
|||||||
-- KeyBindings
|
-- KeyBindings
|
||||||
require "keymappings"
|
require "keymappings"
|
||||||
|
|
||||||
|
require "overlays"
|
||||||
|
|
||||||
require "nvim-tmux-navigation".setup {
|
require "nvim-tmux-navigation".setup {
|
||||||
keybindings = {
|
keybindings = {
|
||||||
left = "<C-h>",
|
left = "<C-h>",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
local cmd = vim.cmd;
|
local cmd = vim.cmd
|
||||||
|
|
||||||
cmd [[
|
cmd [[
|
||||||
augroup highlight_yank
|
augroup highlight_yank
|
||||||
@ -6,3 +6,8 @@ cmd [[
|
|||||||
au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 150 }
|
au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 150 }
|
||||||
augroup END
|
augroup END
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
cmd [[
|
||||||
|
au ColorScheme * hi Normal ctermbg=none guibg=none
|
||||||
|
au ColorScheme myspecialcolors hi Normal ctermbg=red guibg=red
|
||||||
|
]]
|
||||||
|
@ -1,84 +1,99 @@
|
|||||||
-- luasnip setup
|
-- luasnip setup
|
||||||
local cmd = vim.cmd;
|
local cmd = vim.cmd
|
||||||
local luasnip = require "luasnip"
|
local luasnip = require "luasnip"
|
||||||
local lspkind = require "lspkind"
|
local lspkind = require "lspkind"
|
||||||
local cmp = require "cmp"
|
local cmp = require "cmp"
|
||||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||||
|
|
||||||
cmp.setup {
|
cmp.setup {
|
||||||
formatting = {
|
formatting = {
|
||||||
format = lspkind.cmp_format({with_text = true, menu = ({
|
format = lspkind.cmp_format(
|
||||||
buffer = "[Buffer]",
|
{
|
||||||
nvim_lsp = "[LSP]",
|
with_text = true,
|
||||||
luasnip = "[LuaSnip]",
|
menu = ({
|
||||||
nvim_lua = "[Lua]",
|
buffer = "[Buffer]",
|
||||||
latex_symbols = "[Latex]",
|
nvim_lsp = "[LSP]",
|
||||||
})}),
|
luasnip = "[LuaSnip]",
|
||||||
},
|
nvim_lua = "[Lua]",
|
||||||
experimental = {
|
latex_symbols = "[Latex]"
|
||||||
ghost_text = true,
|
})
|
||||||
},
|
}
|
||||||
completion = {
|
)
|
||||||
completeopt = "menu,menuone",
|
},
|
||||||
},
|
experimental = {
|
||||||
snippet = {
|
ghost_text = true
|
||||||
expand = function(args)
|
},
|
||||||
luasnip.lsp_expand(args.body)
|
completion = {
|
||||||
end
|
completeopt = "menu,menuone"
|
||||||
},
|
},
|
||||||
mapping = {
|
snippet = {
|
||||||
['<C-Leader>'] = cmp.mapping.complete(),
|
expand = function(args)
|
||||||
["<Tab>"] = function(fallback)
|
luasnip.lsp_expand(args.body)
|
||||||
if cmp.visible() then
|
end
|
||||||
cmp.select_next_item()
|
},
|
||||||
else
|
mapping = {
|
||||||
fallback()
|
["<C-Leader>"] = cmp.mapping.complete(),
|
||||||
end
|
["<Tab>"] = function(fallback)
|
||||||
end,
|
if cmp.visible() then
|
||||||
["<S-Tab>"] = function(fallback)
|
cmp.select_next_item()
|
||||||
if cmp.visible() then
|
else
|
||||||
cmp.select_prev_item()
|
fallback()
|
||||||
else
|
end
|
||||||
fallback()
|
end,
|
||||||
end
|
["<S-Tab>"] = function(fallback)
|
||||||
end,
|
if cmp.visible() then
|
||||||
['<CR>'] = cmp.mapping.confirm({
|
cmp.select_prev_item()
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
else
|
||||||
select = true,
|
fallback()
|
||||||
}),
|
end
|
||||||
},
|
end,
|
||||||
sources = {
|
["<CR>"] = cmp.mapping.confirm(
|
||||||
{name = "nvim-lua"},
|
{
|
||||||
{name = "nvim_lsp"},
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
{name = "luasnip"},
|
select = true
|
||||||
{name = "path"},
|
}
|
||||||
{name = "buffer"},
|
)
|
||||||
{name = "calc"}
|
},
|
||||||
}
|
sources = {
|
||||||
|
{name = "nvim_lua"},
|
||||||
|
{name = "nvim_lsp"},
|
||||||
|
{name = "luasnip"},
|
||||||
|
{name = "path"},
|
||||||
|
{name = "buffer"},
|
||||||
|
{name = "calc"}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||||
cmp.setup.cmdline('/', {
|
cmp.setup.cmdline(
|
||||||
sources = {
|
"/",
|
||||||
{ name = 'buffer' }
|
{
|
||||||
}
|
sources = {
|
||||||
})
|
{name = "buffer"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||||
cmp.setup.cmdline(':', {
|
cmp.setup.cmdline(
|
||||||
sources = cmp.config.sources({
|
":",
|
||||||
{ name = 'path' }
|
{
|
||||||
}, {
|
sources = cmp.config.sources(
|
||||||
{ name = 'cmdline' }
|
{
|
||||||
})
|
{name = "path"}
|
||||||
})
|
},
|
||||||
|
{
|
||||||
|
{name = "cmdline"}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
|
-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
|
||||||
-- Setup lspconfig.
|
-- Setup lspconfig.
|
||||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
require'lspconfig'.html.setup {
|
require "lspconfig".html.setup {
|
||||||
capabilities = capabilities
|
capabilities = capabilities
|
||||||
}
|
}
|
||||||
|
|
||||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } }))
|
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({map_char = {tex = ""}}))
|
||||||
|
@ -1,8 +1,59 @@
|
|||||||
local cmd = vim.cmd
|
local cmd = vim.cmd
|
||||||
|
local util = require "vim.lsp.util"
|
||||||
|
local utils = require("utils")
|
||||||
|
|
||||||
|
function tablelength(T)
|
||||||
|
local count = 0
|
||||||
|
for _ in pairs(T) do
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
|
return count
|
||||||
|
end
|
||||||
|
|
||||||
|
local function select_client(method)
|
||||||
|
local all_clients = vim.tbl_values(vim.lsp.buf_get_clients())
|
||||||
|
|
||||||
|
local supported_client
|
||||||
|
local found_client = false
|
||||||
|
for _, client in ipairs(all_clients) do
|
||||||
|
local supports = client.supports_method(method)
|
||||||
|
if supports then
|
||||||
|
found_client = true
|
||||||
|
supported_client = client
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not found_client then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
return supported_client
|
||||||
|
end
|
||||||
|
|
||||||
|
function FormattingSync()
|
||||||
|
vim.cmd("Neoformat")
|
||||||
|
|
||||||
|
-- local client = select_client("textDocument/formatting")
|
||||||
|
-- if client == nil then
|
||||||
|
-- vim.notify("No LSP Client with formatting connected")
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- vim.notify("Formatting with LSP")
|
||||||
|
|
||||||
|
-- local params = util.make_formatting_params({})
|
||||||
|
-- local result, err = client.request_sync("textDocument/formatting", params, 500, vim.api.nvim_get_current_buf())
|
||||||
|
-- if result and result.result then
|
||||||
|
-- util.apply_text_edits(result.result)
|
||||||
|
-- elseif err then
|
||||||
|
-- vim.notify("vim.lsp.buf.formatting_sync: " .. err, vim.log.levels.WARN)
|
||||||
|
-- end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.cmd [[command! Format lua FormattingSync()]]
|
||||||
|
|
||||||
cmd [[
|
cmd [[
|
||||||
augroup auto_format
|
augroup auto_format
|
||||||
au!
|
au!
|
||||||
au BufWritePre * Neoformat
|
au BufWritePre * lua FormattingSync()
|
||||||
augroup END
|
augroup END
|
||||||
]]
|
]]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
local map = vim.api.nvim_set_keymap
|
local map = vim.api.nvim_set_keymap
|
||||||
local g = vim.g
|
local g = vim.g
|
||||||
local cmd = vim.cmd;
|
local cmd = vim.cmd
|
||||||
|
|
||||||
local options = {noremap = true}
|
local options = {noremap = true}
|
||||||
local remap = {noremap = false}
|
local remap = {noremap = false}
|
||||||
@ -19,7 +19,7 @@ map("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", options)
|
|||||||
map("n", "<Leader>e", "<cmd>lua vim.diagnostic.open_float()<CR>", options)
|
map("n", "<Leader>e", "<cmd>lua vim.diagnostic.open_float()<CR>", options)
|
||||||
map("n", "<Leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", options)
|
map("n", "<Leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", options)
|
||||||
map("n", "<Leader>c", "<cmd>lua vim.lsp.buf.code_action()<CR>", options)
|
map("n", "<Leader>c", "<cmd>lua vim.lsp.buf.code_action()<CR>", options)
|
||||||
map("n", "<Leader><C-f>", ":Format<CR>", options)
|
map("n", "<Leader><C-f>", ":Neoformat<CR>", options)
|
||||||
map("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", options)
|
map("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", options)
|
||||||
map("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", options)
|
map("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", options)
|
||||||
map("n", "<leader>t", ":TroubleToggle<CR>", remap)
|
map("n", "<leader>t", ":TroubleToggle<CR>", remap)
|
||||||
@ -31,8 +31,8 @@ map("n", "<C-k>", "<C-w>k", options)
|
|||||||
map("n", "<C-l>", "<C-w>l", options)
|
map("n", "<C-l>", "<C-w>l", options)
|
||||||
|
|
||||||
map("n", "Y", "yy", options)
|
map("n", "Y", "yy", options)
|
||||||
map("n", "<Leader>k", "{",options)
|
map("n", "<Leader>k", "{", options)
|
||||||
map("n", "<Leader>j", "}",options)
|
map("n", "<Leader>j", "}", options)
|
||||||
|
|
||||||
-- Move lines vscode style
|
-- Move lines vscode style
|
||||||
map("n", "<A-j>", "<cmd>move +1<CR>", options)
|
map("n", "<A-j>", "<cmd>move +1<CR>", options)
|
||||||
@ -41,8 +41,8 @@ map("i", "<A-j>", "<cmd>move +1<CR>", options)
|
|||||||
map("i", "<A-k>", "<cmd>move -2<CR>", options)
|
map("i", "<A-k>", "<cmd>move -2<CR>", options)
|
||||||
map("v", "<A-j>", ":m '>+1<CR>gv=gv", options)
|
map("v", "<A-j>", ":m '>+1<CR>gv=gv", options)
|
||||||
map("v", "<A-k>", ":m '<-2<CR>gv=gv", options)
|
map("v", "<A-k>", ":m '<-2<CR>gv=gv", options)
|
||||||
map("n", "<A-S-k>", "YP", options);
|
map("n", "<A-S-k>", "YP", options)
|
||||||
map("n", "<A-S-j>", "Yp", options);
|
map("n", "<A-S-j>", "Yp", options)
|
||||||
|
|
||||||
-- Faster git merge
|
-- Faster git merge
|
||||||
map("n", "<Leader>gd", ":Gvdiffsplit!<CR>", options)
|
map("n", "<Leader>gd", ":Gvdiffsplit!<CR>", options)
|
||||||
|
@ -13,7 +13,6 @@ end
|
|||||||
-- function to attach completion when setting up lsp
|
-- function to attach completion when setting up lsp
|
||||||
local function on_attach()
|
local function on_attach()
|
||||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||||
|
|
||||||
vim.cmd("command! LspOrganize lua lsp_organize_imports()")
|
vim.cmd("command! LspOrganize lua lsp_organize_imports()")
|
||||||
vim.api.nvim_buf_map(bufnr, "n", "gs", ":LspOrganize<CR>", {silent = true})
|
vim.api.nvim_buf_map(bufnr, "n", "gs", ":LspOrganize<CR>", {silent = true})
|
||||||
end
|
end
|
||||||
@ -21,13 +20,13 @@ end
|
|||||||
local system_name = ""
|
local system_name = ""
|
||||||
-- Lua Language Server
|
-- Lua Language Server
|
||||||
if vim.fn.has("mac") == 1 then
|
if vim.fn.has("mac") == 1 then
|
||||||
system_name = "macOS"
|
system_name = "macOS"
|
||||||
elseif vim.fn.has("unix") == 1 then
|
elseif vim.fn.has("unix") == 1 then
|
||||||
system_name = "Linux"
|
system_name = "Linux"
|
||||||
elseif vim.fn.has("win32") == 1 then
|
elseif vim.fn.has("win32") == 1 then
|
||||||
system_name = "Windows"
|
system_name = "Windows"
|
||||||
else
|
else
|
||||||
print("Unsupported system for sumneko")
|
print("Unsupported system for sumneko")
|
||||||
end
|
end
|
||||||
|
|
||||||
local sumneko_root_path = "/home/jim/.local/share/lua-language-server"
|
local sumneko_root_path = "/home/jim/.local/share/lua-language-server"
|
||||||
@ -38,31 +37,31 @@ table.insert(runtime_path, "lua/?.lua")
|
|||||||
table.insert(runtime_path, "lua/?/init.lua")
|
table.insert(runtime_path, "lua/?/init.lua")
|
||||||
|
|
||||||
lsp.sumneko_lua.setup {
|
lsp.sumneko_lua.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = lsp_status.capabilities,
|
capabilities = lsp_status.capabilities,
|
||||||
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
|
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
runtime = {
|
runtime = {
|
||||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||||
version = "LuaJIT",
|
version = "LuaJIT",
|
||||||
-- Setup your lua path
|
-- Setup your lua path
|
||||||
path = runtime_path
|
path = runtime_path
|
||||||
},
|
},
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
-- Get the language server to recognize the `vim` global
|
-- Get the language server to recognize the `vim` global
|
||||||
globals = {"vim", "bufnr", "use"}
|
globals = {"vim", "bufnr", "use"}
|
||||||
},
|
},
|
||||||
workspace = {
|
workspace = {
|
||||||
-- Make the server aware of Neovim runtime files
|
-- Make the server aware of Neovim runtime files
|
||||||
library = vim.api.nvim_get_runtime_file("", true)
|
library = vim.api.nvim_get_runtime_file("", true)
|
||||||
},
|
},
|
||||||
-- Do not send telemetry data containing a randomized but unique identifier
|
-- Do not send telemetry data containing a randomized but unique identifier
|
||||||
telemetry = {
|
telemetry = {
|
||||||
enable = false
|
enable = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Ltex Language Server
|
-- Ltex Language Server
|
||||||
@ -70,120 +69,126 @@ lsp.ltex.setup {}
|
|||||||
|
|
||||||
-- Go Language Server
|
-- Go Language Server
|
||||||
lsp.gopls.setup {
|
lsp.gopls.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = lsp_status.capabilities
|
capabilities = lsp_status.capabilities
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Html Setup
|
-- Html Setup
|
||||||
lsp.html.setup {
|
lsp.html.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = lsp_status.capabilities,
|
capabilities = lsp_status.capabilities,
|
||||||
filetypes = {"html"}
|
filetypes = {"html"}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Svelte Language Server
|
-- Svelte Language Server
|
||||||
lsp.svelte.setup {
|
lsp.svelte.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = lsp_status.capabilities
|
capabilities = lsp_status.capabilities
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Typescript Language Server
|
-- Typescript Language Server
|
||||||
lsp.tsserver.setup {
|
lsp.tsserver.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = lsp_status.capabilities,
|
capabilities = lsp_status.capabilities,
|
||||||
|
commands = {
|
||||||
|
OrganizeImports = {
|
||||||
|
organize_imports,
|
||||||
|
description = "Organize Imports"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- JSON ls setup
|
-- JSON ls setup
|
||||||
lsp.jsonls.setup {
|
lsp.jsonls.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = lsp_status.capabilities
|
capabilities = lsp_status.capabilities
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Setup diagnostics formaters and linters for non LSP provided files
|
-- Setup diagnostics formaters and linters for non LSP provided files
|
||||||
lsp.diagnosticls.setup {
|
lsp.diagnosticls.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = lsp_status.capabilities,
|
capabilities = lsp_status.capabilities,
|
||||||
cmd = {"diagnostic-languageserver", "--stdio"},
|
cmd = {"diagnostic-languageserver", "--stdio"},
|
||||||
filetypes = {
|
filetypes = {
|
||||||
"sh",
|
"sh",
|
||||||
"markdown",
|
"markdown",
|
||||||
"yaml",
|
"yaml",
|
||||||
"toml"
|
"toml"
|
||||||
},
|
},
|
||||||
init_options = {
|
init_options = {
|
||||||
linters = {
|
linters = {
|
||||||
shellcheck = {
|
shellcheck = {
|
||||||
command = "shellcheck",
|
command = "shellcheck",
|
||||||
debounce = 100,
|
debounce = 100,
|
||||||
args = {"--format", "json", "-"},
|
args = {"--format", "json", "-"},
|
||||||
sourceName = "shellcheck",
|
sourceName = "shellcheck",
|
||||||
parseJson = {
|
parseJson = {
|
||||||
line = "line",
|
line = "line",
|
||||||
column = "column",
|
column = "column",
|
||||||
endLine = "endLine",
|
endLine = "endLine",
|
||||||
endColumn = "endColumn",
|
endColumn = "endColumn",
|
||||||
message = "${message} [${code}]",
|
message = "${message} [${code}]",
|
||||||
security = "level"
|
security = "level"
|
||||||
},
|
},
|
||||||
securities = {
|
securities = {
|
||||||
error = "error",
|
error = "error",
|
||||||
warning = "warning",
|
warning = "warning",
|
||||||
info = "info",
|
info = "info",
|
||||||
style = "hint"
|
style = "hint"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
markdownlint = {
|
markdownlint = {
|
||||||
command = "markdownlint",
|
command = "markdownlint",
|
||||||
isStderr = true,
|
isStderr = true,
|
||||||
debounce = 100,
|
debounce = 100,
|
||||||
args = {"--stdin"},
|
args = {"--stdin"},
|
||||||
offsetLine = 0,
|
offsetLine = 0,
|
||||||
offsetColumn = 0,
|
offsetColumn = 0,
|
||||||
sourceName = "markdownlint",
|
sourceName = "markdownlint",
|
||||||
formatLines = 1,
|
formatLines = 1,
|
||||||
formatPattern = {
|
formatPattern = {
|
||||||
"^.*?:\\s?(\\d+)(:(\\d+)?)?\\s(MD\\d{3}\\/[A-Za-z0-9-/]+)\\s(.*)$",
|
"^.*?:\\s?(\\d+)(:(\\d+)?)?\\s(MD\\d{3}\\/[A-Za-z0-9-/]+)\\s(.*)$",
|
||||||
{
|
{
|
||||||
line = 1,
|
line = 1,
|
||||||
column = 3,
|
column = 3,
|
||||||
message = {4}
|
message = {4}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
filetypes = {
|
filetypes = {
|
||||||
sh = "shellcheck",
|
sh = "shellcheck",
|
||||||
markdown = "markdownlint"
|
markdown = "markdownlint"
|
||||||
},
|
},
|
||||||
formatters = {
|
formatters = {
|
||||||
shfmt = {
|
shfmt = {
|
||||||
command = "shfmt",
|
command = "shfmt",
|
||||||
args = {"-i", "2", "-bn", "-ci", "-sr"}
|
args = {"-i", "2", "-bn", "-ci", "-sr"}
|
||||||
},
|
},
|
||||||
prettier = {
|
prettier = {
|
||||||
command = "prettier",
|
command = "prettier",
|
||||||
args = {"--stdin-filepath", "%filepath"}
|
args = {"--stdin-filepath", "%filepath"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
formatFiletypes = {
|
formatFiletypes = {
|
||||||
sh = "shfmt",
|
sh = "shfmt",
|
||||||
json = "prettier",
|
json = "prettier",
|
||||||
yaml = "prettier",
|
yaml = "prettier",
|
||||||
toml = "prettier",
|
toml = "prettier",
|
||||||
markdown = "prettier",
|
markdown = "prettier",
|
||||||
lua = "prettier"
|
lua = "prettier"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Enable diagnostics
|
-- Enable diagnostics
|
||||||
vim.lsp.handlers["textDocument/publishDiagnostics"] =
|
vim.lsp.handlers["textDocument/publishDiagnostics"] =
|
||||||
vim.lsp.with(
|
vim.lsp.with(
|
||||||
vim.lsp.diagnostic.on_publish_diagnostics,
|
vim.lsp.diagnostic.on_publish_diagnostics,
|
||||||
{
|
{
|
||||||
underline = true,
|
underline = true,
|
||||||
virtual_text = false,
|
virtual_text = false,
|
||||||
signs = true,
|
signs = true,
|
||||||
update_in_insert = true
|
update_in_insert = true
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -1,68 +1,82 @@
|
|||||||
local Terminal = require("toggleterm.terminal").Terminal
|
local Terminal = require("toggleterm.terminal").Terminal
|
||||||
local u = require("utils")
|
local u = require("utils")
|
||||||
local lazygit =
|
local lazygit =
|
||||||
Terminal:new(
|
Terminal:new(
|
||||||
{
|
{
|
||||||
cmd = "lazygit",
|
cmd = "lazygit",
|
||||||
dir = "git_dir",
|
dir = "git_dir",
|
||||||
direction = "float",
|
direction = "float",
|
||||||
float_opts = {
|
float_opts = {
|
||||||
winblend = 0,
|
winblend = 0,
|
||||||
border = "shadow"
|
border = "shadow"
|
||||||
},
|
},
|
||||||
on_open = function(term)
|
on_open = function(term)
|
||||||
vim.cmd("startinsert!")
|
vim.cmd("startinsert!")
|
||||||
vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", {noremap = true, silent = true})
|
vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", {noremap = true, silent = true})
|
||||||
end,
|
end,
|
||||||
on_close = function(term)
|
on_close = function(term)
|
||||||
Terminal:close()
|
Terminal:close()
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
function _lazygit_toggle()
|
function _lazygit_toggle()
|
||||||
lazygit:toggle()
|
lazygit:toggle()
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.api.nvim_set_keymap("n", "<C-g>", "<cmd>lua _lazygit_toggle()<CR>", {noremap = true, silent = true})
|
vim.api.nvim_set_keymap("n", "<C-g>", "<cmd>lua _lazygit_toggle()<CR>", {noremap = true, silent = true})
|
||||||
|
|
||||||
local pnpm =
|
local pnpm =
|
||||||
Terminal:new(
|
Terminal:new(
|
||||||
{
|
{
|
||||||
cmd = "pnpm dev",
|
cmd = "pnpm dev",
|
||||||
dir = "git_dir",
|
dir = "git_dir",
|
||||||
size = 5,
|
size = 5,
|
||||||
direction = "vertical",
|
direction = "vertical",
|
||||||
on_close = function(term)
|
on_close = function(term)
|
||||||
Terminal:close()
|
Terminal:close()
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
function _pnpm_toggle()
|
function _pnpm_toggle()
|
||||||
pnpm:toggle()
|
pnpm:toggle()
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>d", "<cmd>lua _pnpm_toggle()<CR>", {noremap = true, silent = true})
|
vim.api.nvim_set_keymap("n", "<Leader>d", "<cmd>lua _pnpm_toggle()<CR>", {noremap = true, silent = true})
|
||||||
|
|
||||||
local nvimConfig =
|
local nvimConfig =
|
||||||
Terminal:new(
|
Terminal:new(
|
||||||
{
|
{
|
||||||
cmd = "cd $HOME/.dotfiles && nvim configs/init.lua && cd -",
|
cmd = "cd $HOME/.dotfiles && nvim configs/init.lua && cd -",
|
||||||
direction = "float",
|
direction = "float",
|
||||||
on_close = function()
|
on_close = function()
|
||||||
Terminal:close()
|
Terminal:close()
|
||||||
u.ReloadConfig()
|
u.ReloadConfig()
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
function _nvimConfig_toggle()
|
function _nvimConfig_toggle()
|
||||||
nvimConfig:toggle()
|
nvimConfig:toggle()
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.api.nvim_set_keymap("n", "<Leader><C-i>", "<cmd>lua _nvimConfig_toggle()<CR>", {noremap = true, silent = true})
|
vim.api.nvim_set_keymap("n", "<Leader><C-i>", "<cmd>lua _nvimConfig_toggle()<CR>", {noremap = true, silent = true})
|
||||||
|
|
||||||
|
local chtConfig =
|
||||||
|
Terminal:new(
|
||||||
|
{
|
||||||
|
cmd = "cht",
|
||||||
|
direction = "float"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
function _chtConfig_toggle()
|
||||||
|
chtConfig:toggle()
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader><C-l>", "<cmd>lua _chtConfig_toggle()<CR>", {noremap = true, silent = true})
|
||||||
|
|
||||||
require("toggleterm").setup {
|
require("toggleterm").setup {
|
||||||
shade_terminals = true
|
shade_terminals = true
|
||||||
}
|
}
|
||||||
|
@ -1,96 +1,89 @@
|
|||||||
return require("packer").startup(function()
|
return require("packer").startup(
|
||||||
|
function()
|
||||||
|
-- Let packer manage itself
|
||||||
|
use "wbthomason/packer.nvim"
|
||||||
|
|
||||||
-- Let packer manage itself
|
-- General Helper Functions
|
||||||
use "wbthomason/packer.nvim"
|
use "nvim-lua/plenary.nvim"
|
||||||
|
|
||||||
-- General Helper Functions
|
-- Faster Filetype Detection
|
||||||
use "nvim-lua/plenary.nvim"
|
use "nathom/filetype.nvim"
|
||||||
|
use "alexghergh/nvim-tmux-navigation"
|
||||||
|
|
||||||
-- Faster Filetype Detection
|
-- Theming Section
|
||||||
use "nathom/filetype.nvim"
|
-- use 'folke/tokyonight.nvim'
|
||||||
use "alexghergh/nvim-tmux-navigation"
|
use "EdenEast/nightfox.nvim"
|
||||||
|
use "xiyaowong/nvim-transparent"
|
||||||
|
|
||||||
use 'lervag/vimtex'
|
-- Layout Plugins
|
||||||
|
use "kyazdani42/nvim-web-devicons"
|
||||||
|
use "kyazdani42/nvim-tree.lua"
|
||||||
|
use "nvim-lua/popup.nvim"
|
||||||
|
use "mhinz/vim-startify"
|
||||||
|
use "tpope/vim-fugitive"
|
||||||
|
use "tpope/vim-commentary"
|
||||||
|
use "tpope/vim-surround"
|
||||||
|
use "lambdalisue/suda.vim"
|
||||||
|
use "windwp/nvim-autopairs"
|
||||||
|
|
||||||
-- Theming Section
|
-- Code Navigation
|
||||||
-- use 'folke/tokyonight.nvim'
|
use "dense-analysis/ale"
|
||||||
use 'EdenEast/nightfox.nvim'
|
use "nathanmsmith/nvim-ale-diagnostic"
|
||||||
use "xiyaowong/nvim-transparent"
|
use "junegunn/fzf"
|
||||||
|
use "nvim-telescope/telescope.nvim"
|
||||||
|
|
||||||
-- Layout Plugins
|
-- Postman like features
|
||||||
use "kyazdani42/nvim-web-devicons"
|
use "NTBBloodbath/rest.nvim"
|
||||||
use "kyazdani42/nvim-tree.lua"
|
|
||||||
use "nvim-lua/popup.nvim"
|
|
||||||
use "mhinz/vim-startify"
|
|
||||||
use "karb94/neoscroll.nvim"
|
|
||||||
|
|
||||||
use "tpope/vim-fugitive"
|
-- Obsidian / Roam like features
|
||||||
use "tpope/vim-surround"
|
-- use "lervag/wiki.vim"
|
||||||
use "lambdalisue/suda.vim"
|
|
||||||
use "editorconfig/editorconfig-vim"
|
|
||||||
|
|
||||||
-- Code Navigation
|
use "rcarriga/nvim-notify"
|
||||||
use "dense-analysis/ale"
|
|
||||||
use "nathanmsmith/nvim-ale-diagnostic"
|
|
||||||
use "junegunn/fzf"
|
|
||||||
use "nvim-telescope/telescope.nvim"
|
|
||||||
|
|
||||||
-- Postman like features
|
-- Lsp Errors
|
||||||
use "NTBBloodbath/rest.nvim"
|
use "folke/lsp-colors.nvim"
|
||||||
|
use "onsails/lspkind-nvim"
|
||||||
|
use {
|
||||||
|
"folke/trouble.nvim",
|
||||||
|
requires = "kyazdani42/nvim-web-devicons",
|
||||||
|
config = function()
|
||||||
|
require("trouble").setup()
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
-- Obsidian / Roam like features
|
-- Syntax / Autocomplete
|
||||||
-- use "lervag/wiki.vim"
|
use "neovim/nvim-lspconfig"
|
||||||
|
use "hrsh7th/nvim-cmp"
|
||||||
|
use "hrsh7th/cmp-nvim-lsp"
|
||||||
|
use "hrsh7th/cmp-nvim-lua"
|
||||||
|
use "hrsh7th/cmp-path"
|
||||||
|
use "hrsh7th/cmp-calc"
|
||||||
|
use "hrsh7th/cmp-buffer"
|
||||||
|
use "hrsh7th/cmp-cmdline"
|
||||||
|
use "L3MON4D3/LuaSnip"
|
||||||
|
use "saadparwaiz1/cmp_luasnip"
|
||||||
|
use "rafamadriz/friendly-snippets"
|
||||||
|
use "williamboman/nvim-lsp-installer"
|
||||||
|
use "nvim-lua/lsp-status.nvim"
|
||||||
|
use "neoclide/jsonc.vim"
|
||||||
|
use {
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
run = ":TSUpdate"
|
||||||
|
}
|
||||||
|
|
||||||
-- Lsp Errors
|
-- Language Supports
|
||||||
use "folke/lsp-colors.nvim"
|
use "beyondmarc/glsl.vim" -- GLSL
|
||||||
use "onsails/lspkind-nvim"
|
use "ellisonleao/glow.nvim" -- MARKDOWN
|
||||||
use {
|
|
||||||
"folke/trouble.nvim",
|
-- Autoformat
|
||||||
requires = "kyazdani42/nvim-web-devicons",
|
use "sbdchd/neoformat"
|
||||||
config = function()
|
-- use "lukas-reineke/format.nvim"
|
||||||
require("trouble").setup()
|
|
||||||
|
-- General Popup Window
|
||||||
|
use "akinsho/nvim-toggleterm.lua"
|
||||||
|
|
||||||
|
-- Database Feature
|
||||||
|
use "tpope/vim-dadbod"
|
||||||
|
use "kristijanhusak/vim-dadbod-ui"
|
||||||
end
|
end
|
||||||
}
|
)
|
||||||
|
|
||||||
-- Syntax / Autocomplete
|
|
||||||
use "neovim/nvim-lspconfig"
|
|
||||||
-- use "github/copilot.vim"
|
|
||||||
use "hrsh7th/nvim-cmp"
|
|
||||||
use "hrsh7th/cmp-nvim-lsp"
|
|
||||||
use "hrsh7th/cmp-nvim-lua"
|
|
||||||
use "hrsh7th/cmp-path"
|
|
||||||
use "hrsh7th/cmp-calc"
|
|
||||||
use "hrsh7th/cmp-buffer"
|
|
||||||
use "hrsh7th/cmp-cmdline"
|
|
||||||
use "L3MON4D3/LuaSnip"
|
|
||||||
use "saadparwaiz1/cmp_luasnip"
|
|
||||||
use "rafamadriz/friendly-snippets"
|
|
||||||
|
|
||||||
use "beyondmarc/glsl.vim"
|
|
||||||
|
|
||||||
use "tpope/vim-commentary"
|
|
||||||
|
|
||||||
use "williamboman/nvim-lsp-installer"
|
|
||||||
use "nvim-lua/lsp-status.nvim"
|
|
||||||
use "windwp/nvim-autopairs"
|
|
||||||
use "neoclide/jsonc.vim"
|
|
||||||
use {
|
|
||||||
'nvim-treesitter/nvim-treesitter',
|
|
||||||
run = ':TSUpdate'
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Preview Markdown
|
|
||||||
use "ellisonleao/glow.nvim"
|
|
||||||
|
|
||||||
-- Autoformat
|
|
||||||
use "sbdchd/neoformat"
|
|
||||||
-- use "lukas-reineke/format.nvim"
|
|
||||||
|
|
||||||
-- General Popup Window
|
|
||||||
use "akinsho/nvim-toggleterm.lua"
|
|
||||||
|
|
||||||
-- Database Feature
|
|
||||||
use "tpope/vim-dadbod"
|
|
||||||
use "kristijanhusak/vim-dadbod-ui"
|
|
||||||
|
|
||||||
end)
|
|
||||||
|
@ -1,34 +1,35 @@
|
|||||||
local parser_configs = require("nvim-treesitter.parsers").get_parser_configs()
|
local parser_configs = require("nvim-treesitter.parsers").get_parser_configs()
|
||||||
|
|
||||||
parser_configs.http = {
|
parser_configs.http = {
|
||||||
install_info = {
|
install_info = {
|
||||||
url = "https://github.com/NTBBloodbath/tree-sitter-http",
|
url = "https://github.com/NTBBloodbath/tree-sitter-http",
|
||||||
files = {"src/parser.c"},
|
files = {"src/parser.c"},
|
||||||
branch = "main"
|
branch = "main"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parser_configs.glsl = {
|
parser_configs.glsl = {
|
||||||
filetype = "vert",
|
filetype = "vert",
|
||||||
filetypes = {"vert","frag"}
|
filetypes = {"vert", "frag"}
|
||||||
}
|
}
|
||||||
|
|
||||||
require "nvim-treesitter.configs".setup {
|
require "nvim-treesitter.configs".setup {
|
||||||
indent = {
|
indent = {
|
||||||
enable = true
|
enable = true
|
||||||
},
|
},
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"bash",
|
"bash",
|
||||||
"yaml",
|
"yaml",
|
||||||
"http",
|
"http",
|
||||||
"svelte",
|
"svelte",
|
||||||
"css",
|
"css",
|
||||||
"svelte",
|
"svelte",
|
||||||
"typescript",
|
"typescript",
|
||||||
"javascript",
|
"javascript",
|
||||||
"go",
|
"go",
|
||||||
"lua",
|
"lua",
|
||||||
"yaml"
|
"yaml",
|
||||||
},
|
"prisma"
|
||||||
highlight = {enable = true}
|
},
|
||||||
}
|
highlight = {enable = true}
|
||||||
|
}
|
||||||
|
@ -35,6 +35,8 @@ local function dump(o)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.dump = dump
|
||||||
|
|
||||||
function M.has_plugin(pluginName)
|
function M.has_plugin(pluginName)
|
||||||
local status = pcall(require, pluginName)
|
local status = pcall(require, pluginName)
|
||||||
return status
|
return status
|
||||||
|
@ -7,3 +7,4 @@ source $(dirname "$0")/functions/rn.zsh;
|
|||||||
source $(dirname "$0")/functions/sum.zsh;
|
source $(dirname "$0")/functions/sum.zsh;
|
||||||
source $(dirname "$0")/functions/mke.zsh;
|
source $(dirname "$0")/functions/mke.zsh;
|
||||||
source $(dirname "$0")/functions/myip.zsh;
|
source $(dirname "$0")/functions/myip.zsh;
|
||||||
|
source $(dirname "$0")/functions/cht.zsh;
|
||||||
|
13
configs/zsh/functions/cht.zsh
Normal file
13
configs/zsh/functions/cht.zsh
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
languages=`echo "golang lua cpp c typescript nodejs" | tr ' ' '\n'`
|
||||||
|
core_utils=`echo "xargs find mv sed awk" | tr ' ' '\n'`
|
||||||
|
|
||||||
|
function cht(){
|
||||||
|
selected=`printf "$languages\n$core_utils" | fzf`
|
||||||
|
read query\?"query:"
|
||||||
|
|
||||||
|
if printf $languages | grep -qs $selected; then
|
||||||
|
curl cht.sh/$selected/`echo $query | tr ' ' '+'`
|
||||||
|
else
|
||||||
|
curl cht.sh/$selected~$query
|
||||||
|
fi
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user