uff
This commit is contained in:
parent
7ba32f03f5
commit
041b6cd367
@ -38,6 +38,7 @@
|
||||
autoload -Uz is-at-least && is-at-least 5.1 || return
|
||||
|
||||
# Prompt colors.
|
||||
local main='242'
|
||||
local grey='242'
|
||||
local red='1'
|
||||
local yellow='3'
|
||||
@ -76,7 +77,7 @@
|
||||
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=false
|
||||
|
||||
# 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.
|
||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red
|
||||
# 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")
|
||||
|
||||
if u.has_plugin("cmp") then
|
||||
vim.g.did_load_filetypes = 150
|
||||
|
||||
-- Global options
|
||||
o.number = true -- show line number
|
||||
o.showmatch = true -- show matching brackets
|
||||
@ -28,6 +26,7 @@ if u.has_plugin("cmp") then
|
||||
g.hidden = true -- unload buffers when hidden
|
||||
g.filetype = true -- execute autocommands based on filetype
|
||||
o.autoread = true
|
||||
opt.termguicolors = true
|
||||
|
||||
-- Search
|
||||
o.inccommand = "nosplit" -- show substitutions incrementally
|
||||
@ -68,6 +67,31 @@ if u.has_plugin("cmp") then
|
||||
|
||||
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
|
||||
o.syntax = "enable"
|
||||
o.termguicolors = true
|
||||
@ -82,10 +106,12 @@ if u.has_plugin("cmp") then
|
||||
}
|
||||
)
|
||||
|
||||
require("transparent").setup({
|
||||
enable = true,
|
||||
extra_groups = "All"
|
||||
})
|
||||
require("transparent").setup(
|
||||
{
|
||||
enable = true,
|
||||
extra_groups = "All"
|
||||
}
|
||||
)
|
||||
|
||||
-- Remove background color
|
||||
cmd("highlight Normal guibg=none")
|
||||
@ -169,6 +195,8 @@ if u.has_plugin("cmp") then
|
||||
-- KeyBindings
|
||||
require "keymappings"
|
||||
|
||||
require "overlays"
|
||||
|
||||
require "nvim-tmux-navigation".setup {
|
||||
keybindings = {
|
||||
left = "<C-h>",
|
||||
|
@ -1,4 +1,4 @@
|
||||
local cmd = vim.cmd;
|
||||
local cmd = vim.cmd
|
||||
|
||||
cmd [[
|
||||
augroup highlight_yank
|
||||
@ -6,3 +6,8 @@ cmd [[
|
||||
au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 150 }
|
||||
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
|
||||
local cmd = vim.cmd;
|
||||
local cmd = vim.cmd
|
||||
local luasnip = require "luasnip"
|
||||
local lspkind = require "lspkind"
|
||||
local cmp = require "cmp"
|
||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
|
||||
cmp.setup {
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({with_text = true, menu = ({
|
||||
buffer = "[Buffer]",
|
||||
nvim_lsp = "[LSP]",
|
||||
luasnip = "[LuaSnip]",
|
||||
nvim_lua = "[Lua]",
|
||||
latex_symbols = "[Latex]",
|
||||
})}),
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
},
|
||||
completion = {
|
||||
completeopt = "menu,menuone",
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end
|
||||
},
|
||||
mapping = {
|
||||
['<C-Leader>'] = cmp.mapping.complete(),
|
||||
["<Tab>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<S-Tab>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
['<CR>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
},
|
||||
sources = {
|
||||
{name = "nvim-lua"},
|
||||
{name = "nvim_lsp"},
|
||||
{name = "luasnip"},
|
||||
{name = "path"},
|
||||
{name = "buffer"},
|
||||
{name = "calc"}
|
||||
}
|
||||
formatting = {
|
||||
format = lspkind.cmp_format(
|
||||
{
|
||||
with_text = true,
|
||||
menu = ({
|
||||
buffer = "[Buffer]",
|
||||
nvim_lsp = "[LSP]",
|
||||
luasnip = "[LuaSnip]",
|
||||
nvim_lua = "[Lua]",
|
||||
latex_symbols = "[Latex]"
|
||||
})
|
||||
}
|
||||
)
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = true
|
||||
},
|
||||
completion = {
|
||||
completeopt = "menu,menuone"
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end
|
||||
},
|
||||
mapping = {
|
||||
["<C-Leader>"] = cmp.mapping.complete(),
|
||||
["<Tab>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<S-Tab>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
["<CR>"] = cmp.mapping.confirm(
|
||||
{
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true
|
||||
}
|
||||
)
|
||||
},
|
||||
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).
|
||||
cmp.setup.cmdline('/', {
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
cmp.setup.cmdline(
|
||||
"/",
|
||||
{
|
||||
sources = {
|
||||
{name = "buffer"}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
||||
|
||||
cmp.setup.cmdline(
|
||||
":",
|
||||
{
|
||||
sources = cmp.config.sources(
|
||||
{
|
||||
{name = "path"}
|
||||
},
|
||||
{
|
||||
{name = "cmdline"}
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
|
||||
-- Setup lspconfig.
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
require'lspconfig'.html.setup {
|
||||
capabilities = capabilities
|
||||
local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
require "lspconfig".html.setup {
|
||||
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 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 [[
|
||||
augroup auto_format
|
||||
au!
|
||||
au BufWritePre * Neoformat
|
||||
au BufWritePre * lua FormattingSync()
|
||||
augroup END
|
||||
]]
|
||||
|
@ -1,6 +1,6 @@
|
||||
local map = vim.api.nvim_set_keymap
|
||||
local g = vim.g
|
||||
local cmd = vim.cmd;
|
||||
local cmd = vim.cmd
|
||||
|
||||
local options = {noremap = true}
|
||||
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>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-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_next()<CR>", options)
|
||||
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", "Y", "yy", options)
|
||||
map("n", "<Leader>k", "{",options)
|
||||
map("n", "<Leader>j", "}",options)
|
||||
map("n", "<Leader>k", "{", options)
|
||||
map("n", "<Leader>j", "}", options)
|
||||
|
||||
-- Move lines vscode style
|
||||
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("v", "<A-j>", ":m '>+1<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-j>", "Yp", options);
|
||||
map("n", "<A-S-k>", "YP", options)
|
||||
map("n", "<A-S-j>", "Yp", options)
|
||||
|
||||
-- Faster git merge
|
||||
map("n", "<Leader>gd", ":Gvdiffsplit!<CR>", options)
|
||||
|
@ -13,7 +13,6 @@ end
|
||||
-- function to attach completion when setting up lsp
|
||||
local function on_attach()
|
||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
|
||||
vim.cmd("command! LspOrganize lua lsp_organize_imports()")
|
||||
vim.api.nvim_buf_map(bufnr, "n", "gs", ":LspOrganize<CR>", {silent = true})
|
||||
end
|
||||
@ -21,13 +20,13 @@ end
|
||||
local system_name = ""
|
||||
-- Lua Language Server
|
||||
if vim.fn.has("mac") == 1 then
|
||||
system_name = "macOS"
|
||||
system_name = "macOS"
|
||||
elseif vim.fn.has("unix") == 1 then
|
||||
system_name = "Linux"
|
||||
system_name = "Linux"
|
||||
elseif vim.fn.has("win32") == 1 then
|
||||
system_name = "Windows"
|
||||
system_name = "Windows"
|
||||
else
|
||||
print("Unsupported system for sumneko")
|
||||
print("Unsupported system for sumneko")
|
||||
end
|
||||
|
||||
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")
|
||||
|
||||
lsp.sumneko_lua.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = lsp_status.capabilities,
|
||||
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
-- Setup your lua path
|
||||
path = runtime_path
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = {"vim", "bufnr", "use"}
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true)
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false
|
||||
}
|
||||
}
|
||||
}
|
||||
on_attach = on_attach,
|
||||
capabilities = lsp_status.capabilities,
|
||||
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
-- Setup your lua path
|
||||
path = runtime_path
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = {"vim", "bufnr", "use"}
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true)
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- Ltex Language Server
|
||||
@ -70,120 +69,126 @@ lsp.ltex.setup {}
|
||||
|
||||
-- Go Language Server
|
||||
lsp.gopls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = lsp_status.capabilities
|
||||
on_attach = on_attach,
|
||||
capabilities = lsp_status.capabilities
|
||||
}
|
||||
|
||||
-- Html Setup
|
||||
lsp.html.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = lsp_status.capabilities,
|
||||
filetypes = {"html"}
|
||||
on_attach = on_attach,
|
||||
capabilities = lsp_status.capabilities,
|
||||
filetypes = {"html"}
|
||||
}
|
||||
|
||||
-- Svelte Language Server
|
||||
lsp.svelte.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = lsp_status.capabilities
|
||||
on_attach = on_attach,
|
||||
capabilities = lsp_status.capabilities
|
||||
}
|
||||
|
||||
-- Typescript Language Server
|
||||
lsp.tsserver.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = lsp_status.capabilities,
|
||||
on_attach = on_attach,
|
||||
capabilities = lsp_status.capabilities,
|
||||
commands = {
|
||||
OrganizeImports = {
|
||||
organize_imports,
|
||||
description = "Organize Imports"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- JSON ls setup
|
||||
lsp.jsonls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = lsp_status.capabilities
|
||||
on_attach = on_attach,
|
||||
capabilities = lsp_status.capabilities
|
||||
}
|
||||
|
||||
-- Setup diagnostics formaters and linters for non LSP provided files
|
||||
lsp.diagnosticls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = lsp_status.capabilities,
|
||||
cmd = {"diagnostic-languageserver", "--stdio"},
|
||||
filetypes = {
|
||||
"sh",
|
||||
"markdown",
|
||||
"yaml",
|
||||
"toml"
|
||||
},
|
||||
init_options = {
|
||||
linters = {
|
||||
shellcheck = {
|
||||
command = "shellcheck",
|
||||
debounce = 100,
|
||||
args = {"--format", "json", "-"},
|
||||
sourceName = "shellcheck",
|
||||
parseJson = {
|
||||
line = "line",
|
||||
column = "column",
|
||||
endLine = "endLine",
|
||||
endColumn = "endColumn",
|
||||
message = "${message} [${code}]",
|
||||
security = "level"
|
||||
},
|
||||
securities = {
|
||||
error = "error",
|
||||
warning = "warning",
|
||||
info = "info",
|
||||
style = "hint"
|
||||
}
|
||||
},
|
||||
markdownlint = {
|
||||
command = "markdownlint",
|
||||
isStderr = true,
|
||||
debounce = 100,
|
||||
args = {"--stdin"},
|
||||
offsetLine = 0,
|
||||
offsetColumn = 0,
|
||||
sourceName = "markdownlint",
|
||||
formatLines = 1,
|
||||
formatPattern = {
|
||||
"^.*?:\\s?(\\d+)(:(\\d+)?)?\\s(MD\\d{3}\\/[A-Za-z0-9-/]+)\\s(.*)$",
|
||||
{
|
||||
line = 1,
|
||||
column = 3,
|
||||
message = {4}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
filetypes = {
|
||||
sh = "shellcheck",
|
||||
markdown = "markdownlint"
|
||||
},
|
||||
formatters = {
|
||||
shfmt = {
|
||||
command = "shfmt",
|
||||
args = {"-i", "2", "-bn", "-ci", "-sr"}
|
||||
},
|
||||
prettier = {
|
||||
command = "prettier",
|
||||
args = {"--stdin-filepath", "%filepath"}
|
||||
}
|
||||
},
|
||||
formatFiletypes = {
|
||||
sh = "shfmt",
|
||||
json = "prettier",
|
||||
yaml = "prettier",
|
||||
toml = "prettier",
|
||||
markdown = "prettier",
|
||||
lua = "prettier"
|
||||
}
|
||||
}
|
||||
on_attach = on_attach,
|
||||
capabilities = lsp_status.capabilities,
|
||||
cmd = {"diagnostic-languageserver", "--stdio"},
|
||||
filetypes = {
|
||||
"sh",
|
||||
"markdown",
|
||||
"yaml",
|
||||
"toml"
|
||||
},
|
||||
init_options = {
|
||||
linters = {
|
||||
shellcheck = {
|
||||
command = "shellcheck",
|
||||
debounce = 100,
|
||||
args = {"--format", "json", "-"},
|
||||
sourceName = "shellcheck",
|
||||
parseJson = {
|
||||
line = "line",
|
||||
column = "column",
|
||||
endLine = "endLine",
|
||||
endColumn = "endColumn",
|
||||
message = "${message} [${code}]",
|
||||
security = "level"
|
||||
},
|
||||
securities = {
|
||||
error = "error",
|
||||
warning = "warning",
|
||||
info = "info",
|
||||
style = "hint"
|
||||
}
|
||||
},
|
||||
markdownlint = {
|
||||
command = "markdownlint",
|
||||
isStderr = true,
|
||||
debounce = 100,
|
||||
args = {"--stdin"},
|
||||
offsetLine = 0,
|
||||
offsetColumn = 0,
|
||||
sourceName = "markdownlint",
|
||||
formatLines = 1,
|
||||
formatPattern = {
|
||||
"^.*?:\\s?(\\d+)(:(\\d+)?)?\\s(MD\\d{3}\\/[A-Za-z0-9-/]+)\\s(.*)$",
|
||||
{
|
||||
line = 1,
|
||||
column = 3,
|
||||
message = {4}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
filetypes = {
|
||||
sh = "shellcheck",
|
||||
markdown = "markdownlint"
|
||||
},
|
||||
formatters = {
|
||||
shfmt = {
|
||||
command = "shfmt",
|
||||
args = {"-i", "2", "-bn", "-ci", "-sr"}
|
||||
},
|
||||
prettier = {
|
||||
command = "prettier",
|
||||
args = {"--stdin-filepath", "%filepath"}
|
||||
}
|
||||
},
|
||||
formatFiletypes = {
|
||||
sh = "shfmt",
|
||||
json = "prettier",
|
||||
yaml = "prettier",
|
||||
toml = "prettier",
|
||||
markdown = "prettier",
|
||||
lua = "prettier"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- Enable diagnostics
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] =
|
||||
vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics,
|
||||
{
|
||||
underline = true,
|
||||
virtual_text = false,
|
||||
signs = true,
|
||||
update_in_insert = true
|
||||
}
|
||||
vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics,
|
||||
{
|
||||
underline = true,
|
||||
virtual_text = false,
|
||||
signs = true,
|
||||
update_in_insert = true
|
||||
}
|
||||
)
|
||||
|
@ -1,68 +1,82 @@
|
||||
local Terminal = require("toggleterm.terminal").Terminal
|
||||
local u = require("utils")
|
||||
local lazygit =
|
||||
Terminal:new(
|
||||
{
|
||||
cmd = "lazygit",
|
||||
dir = "git_dir",
|
||||
direction = "float",
|
||||
float_opts = {
|
||||
winblend = 0,
|
||||
border = "shadow"
|
||||
},
|
||||
on_open = function(term)
|
||||
vim.cmd("startinsert!")
|
||||
vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", {noremap = true, silent = true})
|
||||
end,
|
||||
on_close = function(term)
|
||||
Terminal:close()
|
||||
end
|
||||
}
|
||||
Terminal:new(
|
||||
{
|
||||
cmd = "lazygit",
|
||||
dir = "git_dir",
|
||||
direction = "float",
|
||||
float_opts = {
|
||||
winblend = 0,
|
||||
border = "shadow"
|
||||
},
|
||||
on_open = function(term)
|
||||
vim.cmd("startinsert!")
|
||||
vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", {noremap = true, silent = true})
|
||||
end,
|
||||
on_close = function(term)
|
||||
Terminal:close()
|
||||
end
|
||||
}
|
||||
)
|
||||
|
||||
function _lazygit_toggle()
|
||||
lazygit:toggle()
|
||||
lazygit:toggle()
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<C-g>", "<cmd>lua _lazygit_toggle()<CR>", {noremap = true, silent = true})
|
||||
|
||||
local pnpm =
|
||||
Terminal:new(
|
||||
{
|
||||
cmd = "pnpm dev",
|
||||
dir = "git_dir",
|
||||
size = 5,
|
||||
direction = "vertical",
|
||||
on_close = function(term)
|
||||
Terminal:close()
|
||||
end
|
||||
}
|
||||
Terminal:new(
|
||||
{
|
||||
cmd = "pnpm dev",
|
||||
dir = "git_dir",
|
||||
size = 5,
|
||||
direction = "vertical",
|
||||
on_close = function(term)
|
||||
Terminal:close()
|
||||
end
|
||||
}
|
||||
)
|
||||
|
||||
function _pnpm_toggle()
|
||||
pnpm:toggle()
|
||||
pnpm:toggle()
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<Leader>d", "<cmd>lua _pnpm_toggle()<CR>", {noremap = true, silent = true})
|
||||
|
||||
local nvimConfig =
|
||||
Terminal:new(
|
||||
{
|
||||
cmd = "cd $HOME/.dotfiles && nvim configs/init.lua && cd -",
|
||||
direction = "float",
|
||||
on_close = function()
|
||||
Terminal:close()
|
||||
u.ReloadConfig()
|
||||
end
|
||||
}
|
||||
Terminal:new(
|
||||
{
|
||||
cmd = "cd $HOME/.dotfiles && nvim configs/init.lua && cd -",
|
||||
direction = "float",
|
||||
on_close = function()
|
||||
Terminal:close()
|
||||
u.ReloadConfig()
|
||||
end
|
||||
}
|
||||
)
|
||||
|
||||
function _nvimConfig_toggle()
|
||||
nvimConfig:toggle()
|
||||
nvimConfig:toggle()
|
||||
end
|
||||
|
||||
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 {
|
||||
shade_terminals = true
|
||||
shade_terminals = true
|
||||
}
|
||||
|
@ -10,8 +10,6 @@ return require("packer").startup(
|
||||
use "nathom/filetype.nvim"
|
||||
use "alexghergh/nvim-tmux-navigation"
|
||||
|
||||
use "lervag/vimtex"
|
||||
|
||||
-- Theming Section
|
||||
-- use 'folke/tokyonight.nvim'
|
||||
use "EdenEast/nightfox.nvim"
|
||||
@ -22,12 +20,11 @@ return require("packer").startup(
|
||||
use "kyazdani42/nvim-tree.lua"
|
||||
use "nvim-lua/popup.nvim"
|
||||
use "mhinz/vim-startify"
|
||||
use "karb94/neoscroll.nvim"
|
||||
|
||||
use "tpope/vim-fugitive"
|
||||
use "tpope/vim-commentary"
|
||||
use "tpope/vim-surround"
|
||||
use "lambdalisue/suda.vim"
|
||||
use "editorconfig/editorconfig-vim"
|
||||
use "windwp/nvim-autopairs"
|
||||
|
||||
-- Code Navigation
|
||||
use "dense-analysis/ale"
|
||||
@ -35,14 +32,14 @@ return require("packer").startup(
|
||||
use "junegunn/fzf"
|
||||
use "nvim-telescope/telescope.nvim"
|
||||
|
||||
use "sakhnik/nvim-gdb"
|
||||
|
||||
-- Postman like features
|
||||
use "NTBBloodbath/rest.nvim"
|
||||
|
||||
-- Obsidian / Roam like features
|
||||
-- use "lervag/wiki.vim"
|
||||
|
||||
use "rcarriga/nvim-notify"
|
||||
|
||||
-- Lsp Errors
|
||||
use "folke/lsp-colors.nvim"
|
||||
use "onsails/lspkind-nvim"
|
||||
@ -56,7 +53,6 @@ return require("packer").startup(
|
||||
|
||||
-- Syntax / Autocomplete
|
||||
use "neovim/nvim-lspconfig"
|
||||
-- use "github/copilot.vim"
|
||||
use "hrsh7th/nvim-cmp"
|
||||
use "hrsh7th/cmp-nvim-lsp"
|
||||
use "hrsh7th/cmp-nvim-lua"
|
||||
@ -67,22 +63,17 @@ return require("packer").startup(
|
||||
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"
|
||||
-- Language Supports
|
||||
use "beyondmarc/glsl.vim" -- GLSL
|
||||
use "ellisonleao/glow.nvim" -- MARKDOWN
|
||||
|
||||
-- Autoformat
|
||||
use "sbdchd/neoformat"
|
||||
|
@ -1,34 +1,35 @@
|
||||
local parser_configs = require("nvim-treesitter.parsers").get_parser_configs()
|
||||
|
||||
parser_configs.http = {
|
||||
install_info = {
|
||||
url = "https://github.com/NTBBloodbath/tree-sitter-http",
|
||||
files = {"src/parser.c"},
|
||||
branch = "main"
|
||||
}
|
||||
}
|
||||
parser_configs.http = {
|
||||
install_info = {
|
||||
url = "https://github.com/NTBBloodbath/tree-sitter-http",
|
||||
files = {"src/parser.c"},
|
||||
branch = "main"
|
||||
}
|
||||
}
|
||||
|
||||
parser_configs.glsl = {
|
||||
parser_configs.glsl = {
|
||||
filetype = "vert",
|
||||
filetypes = {"vert","frag"}
|
||||
}
|
||||
filetypes = {"vert", "frag"}
|
||||
}
|
||||
|
||||
require "nvim-treesitter.configs".setup {
|
||||
indent = {
|
||||
enable = true
|
||||
require "nvim-treesitter.configs".setup {
|
||||
indent = {
|
||||
enable = true
|
||||
},
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"yaml",
|
||||
"http",
|
||||
"svelte",
|
||||
"css",
|
||||
"svelte",
|
||||
"typescript",
|
||||
"javascript",
|
||||
"go",
|
||||
"lua",
|
||||
"yaml"
|
||||
},
|
||||
highlight = {enable = true}
|
||||
}
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"yaml",
|
||||
"http",
|
||||
"svelte",
|
||||
"css",
|
||||
"svelte",
|
||||
"typescript",
|
||||
"javascript",
|
||||
"go",
|
||||
"lua",
|
||||
"yaml",
|
||||
"prisma"
|
||||
},
|
||||
highlight = {enable = true}
|
||||
}
|
||||
|
@ -35,6 +35,8 @@ local function dump(o)
|
||||
end
|
||||
end
|
||||
|
||||
M.dump = dump
|
||||
|
||||
function M.has_plugin(pluginName)
|
||||
local status = pcall(require, pluginName)
|
||||
return status
|
||||
|
@ -7,3 +7,4 @@ source $(dirname "$0")/functions/rn.zsh;
|
||||
source $(dirname "$0")/functions/sum.zsh;
|
||||
source $(dirname "$0")/functions/mke.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