some stuff
This commit is contained in:
parent
4fb9a7aaf4
commit
abbbab08e5
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.pnpm-debug.log
|
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"0 debug pnpm:scope": {
|
|
||||||
"selected": 1
|
|
||||||
},
|
|
||||||
"1 error pnpm": {
|
|
||||||
"code": "ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND",
|
|
||||||
"err": {
|
|
||||||
"name": "pnpm",
|
|
||||||
"message": "No package.json (or package.yaml, or package.json5) was found in \"/home/jim/.dotfiles\".",
|
|
||||||
"code": "ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND",
|
|
||||||
"stack": "pnpm: No package.json (or package.yaml, or package.json5) was found in \"/home/jim/.dotfiles\".\n at readProjectManifest (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:40641:13)\n at async Object.readProjectManifestOnly (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:40645:28)\n at async Object.readProjectManifestOnly (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:40864:24)\n at async Object.handler (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:129763:24)\n at async /home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:133951:20\n at async run (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:133926:34)\n at async runPnpm (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:134137:5)\n at async /home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:134129:7"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
46
configs/lua/autoformat.lua
Normal file
46
configs/lua/autoformat.lua
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
require "format".setup {
|
||||||
|
["*"] = {
|
||||||
|
{cmd = {"sed -i 's/[ \t]*$//'"}} -- remove trailing whitespace
|
||||||
|
},
|
||||||
|
vim = {
|
||||||
|
{
|
||||||
|
cmd = {"luafmt -w replace"},
|
||||||
|
start_pattern = "^lua << EOF$",
|
||||||
|
end_pattern = "^EOF$"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
vimwiki = {
|
||||||
|
{
|
||||||
|
cmd = {"prettier -w --parser babel"},
|
||||||
|
start_pattern = "^{{{javascript$",
|
||||||
|
end_pattern = "^}}}$"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lua = {
|
||||||
|
{
|
||||||
|
cmd = {
|
||||||
|
function(file)
|
||||||
|
return string.format("luafmt -l %s -w replace %s", vim.bo.textwidth, file)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
go = {
|
||||||
|
{
|
||||||
|
cmd = {"gofmt -w", "goimports -w"},
|
||||||
|
tempfile_postfix = ".tmp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
javascript = {
|
||||||
|
{cmd = {"prettier -w", "./node_modules/.bin/eslint --fix"}}
|
||||||
|
},
|
||||||
|
markdown = {
|
||||||
|
{cmd = {"prettier -w"}},
|
||||||
|
{
|
||||||
|
cmd = {"black"},
|
||||||
|
start_pattern = "^```python$",
|
||||||
|
end_pattern = "^```$",
|
||||||
|
target = "current"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
configs/nvim/.gitignore
vendored
Normal file
1
configs/nvim/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
plugin
|
@ -10,23 +10,37 @@ local opt = vim.opt
|
|||||||
require ("plugins")
|
require ("plugins")
|
||||||
|
|
||||||
if u.has_plugin("cmp") then
|
if u.has_plugin("cmp") then
|
||||||
-- Global options
|
|
||||||
o.number = true -- show line number
|
vim.g.did_load_filetypes = 1
|
||||||
o.tabstop = 2
|
|
||||||
o.shiftwidth = 2 -- Indents will have a width of 4
|
-- Global options
|
||||||
o.softtabstop = 2 -- Sets the number of columns for a TAB
|
o.number = true -- show line number
|
||||||
o.expandtab = true -- Dont expand TABs to spaces
|
|
||||||
o.autoindent = true
|
|
||||||
o.showmatch = true -- show matching brackets
|
o.showmatch = true -- show matching brackets
|
||||||
o.swapfile = false
|
o.swapfile = false
|
||||||
|
|
||||||
|
-- Indentation options
|
||||||
|
vim.cmd [[
|
||||||
|
set autoindent
|
||||||
|
set expandtab
|
||||||
|
set shiftwidth=2
|
||||||
|
set softtabstop=2
|
||||||
|
set tabstop=2
|
||||||
|
]]
|
||||||
|
|
||||||
|
-- Debug indentations
|
||||||
|
if false then
|
||||||
|
vim.cmd [[
|
||||||
|
set list
|
||||||
|
set listchars=eol:⏎,tab:->,trail:_,nbsp:⎵
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
g.hidden = true --unload buffers when hidden
|
||||||
|
g.filetype = true -- execute autocommands based on filetype
|
||||||
o.autoread = true
|
o.autoread = true
|
||||||
|
|
||||||
o.lazyredraw = true
|
o.lazyredraw = true
|
||||||
|
|
||||||
g.hidden = true --unload buffers when hidden
|
|
||||||
g.filetype = true -- execute autocommands based on filetype
|
|
||||||
|
|
||||||
-- Search
|
-- Search
|
||||||
o.inccommand = 'nosplit' -- show substitutions incrementally
|
o.inccommand = 'nosplit' -- show substitutions incrementally
|
||||||
o.ignorecase = true
|
o.ignorecase = true
|
||||||
@ -50,107 +64,119 @@ if u.has_plugin("cmp") then
|
|||||||
g.loaded_zip = 1
|
g.loaded_zip = 1
|
||||||
|
|
||||||
cmd [[set mouse=a]] -- enable mouse interaction
|
cmd [[set mouse=a]] -- enable mouse interaction
|
||||||
cmd [[set undofile]]
|
cmd [[set undofile]]
|
||||||
cmd [[set fcs=eob:\ ]] --disable showing ~ in empty lines
|
cmd [[set fcs=eob:\ ]] --disable showing ~ in empty lines
|
||||||
|
|
||||||
|
cmd [[command Format :lua vim.lsp.buf.formatting()]]
|
||||||
|
cmd [[command FormatSync :lua vim.lsp.buf.formatting_sync()]]
|
||||||
|
|
||||||
|
cmd [[set noshowmode]] --to get rid of thing like --INSERT--
|
||||||
|
cmd [[set noshowcmd]] --to get rid of display of last command
|
||||||
|
cmd [[set shortmess+=F]] --to get rid of the file name displayed in the command line bar
|
||||||
|
|
||||||
cmd [[set noshowmode]] --to get rid of thing like --INSERT--
|
|
||||||
cmd [[set noshowcmd]] --to get rid of display of last command
|
|
||||||
cmd [[set noruler]]
|
cmd [[set noruler]]
|
||||||
|
|
||||||
g.ale_fixers = {"prettier", "eslint"}
|
g.ale_fixers = {"prettier", "eslint"}
|
||||||
|
|
||||||
-- Enable Theming / Syntax
|
-- Enable Theming / Syntax
|
||||||
o.syntax = "enable"
|
o.syntax = "enable"
|
||||||
o.termguicolors = true
|
o.termguicolors = true
|
||||||
cmd("colorscheme material")
|
cmd("colorscheme material")
|
||||||
g.material_terminal_italics = 1
|
g.material_terminal_italics = 1
|
||||||
g.material_theme_style = "darker"
|
g.material_theme_style = "darker"
|
||||||
-- Remove background color
|
|
||||||
require("transparent").setup({enable = true})
|
-- Remove background color
|
||||||
cmd("highlight Normal guibg=none")
|
require("transparent").setup({enable = true})
|
||||||
cmd("highlight NonText guibg=none")
|
cmd("highlight Normal guibg=none")
|
||||||
|
cmd("highlight NonText guibg=none")
|
||||||
|
|
||||||
require('neoscroll').setup()
|
require('neoscroll').setup()
|
||||||
|
|
||||||
-- Configure nvim-tree
|
-- Configure nvim-tree
|
||||||
g.nvim_tree_special_files = {}
|
g.nvim_tree_special_files = {}
|
||||||
g.nvim_tree_icons = {
|
g.nvim_tree_icons = {
|
||||||
default = "",
|
default = "",
|
||||||
symlink = "",
|
symlink = "",
|
||||||
git = {
|
git = {
|
||||||
unstaged = "*",
|
unstaged = "*",
|
||||||
staged = "✓",
|
staged = "✓",
|
||||||
unmerged = "",
|
unmerged = "",
|
||||||
renamed = "➜",
|
renamed = "➜",
|
||||||
untracked = "★",
|
untracked = "★",
|
||||||
deleted = "",
|
deleted = "",
|
||||||
ignored = "◌"
|
ignored = "◌"
|
||||||
},
|
},
|
||||||
folder = {
|
folder = {
|
||||||
arrow_open = " ",
|
arrow_open = " ",
|
||||||
arrow_closed = " ",
|
arrow_closed = " ",
|
||||||
default = "",
|
default = "",
|
||||||
open = "",
|
open = "",
|
||||||
empty = "",
|
empty = "",
|
||||||
empty_open = "",
|
empty_open = "",
|
||||||
symlink = "",
|
symlink = "",
|
||||||
symlink_open = ""
|
symlink_open = ""
|
||||||
},
|
},
|
||||||
lsp = {
|
lsp = {
|
||||||
hint = "",
|
hint = "",
|
||||||
info = "",
|
info = "",
|
||||||
warning = "",
|
warning = "",
|
||||||
error = ""
|
error = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
require("nvim-tree").setup {
|
require("nvim-tree").setup {
|
||||||
auto_open = 1,
|
auto_open = 1,
|
||||||
gitignore = 1,
|
gitignore = 1,
|
||||||
group_empty = 1,
|
group_empty = 1,
|
||||||
hijack_cursor = 1,
|
hijack_cursor = 1,
|
||||||
update_focused_file = {
|
update_focused_file = {
|
||||||
enable = false,
|
enable = false,
|
||||||
},
|
},
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
enable = true
|
enable = true
|
||||||
},
|
},
|
||||||
view = {
|
view = {
|
||||||
auto_resize = true,
|
auto_resize = true,
|
||||||
hide_root_folder = true,
|
hide_root_folder = true,
|
||||||
winopts = {
|
winopts = {
|
||||||
signcolumn = "no"
|
signcolumn = "no"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
require('nvim-tree.view').View.winopts.signcolumn = 'no'
|
require('nvim-tree.view').View.winopts.signcolumn = 'no'
|
||||||
|
|
||||||
-- Configure Wiki
|
-- Configure Wiki
|
||||||
g.wiki_root = "~/Notes"
|
g.wiki_root = "~/Notes"
|
||||||
g.wiki_filetypes = {"md"}
|
g.wiki_filetypes = {"md"}
|
||||||
g.wiki_link_extension = ".md"
|
g.wiki_link_extension = ".md"
|
||||||
|
|
||||||
-- KeyBindings
|
|
||||||
g.mapleader = " "
|
|
||||||
require "keymappings"
|
|
||||||
|
|
||||||
require "nvim-tmux-navigation".setup {
|
-- KeyBindings
|
||||||
keybindings = {
|
g.mapleader = " "
|
||||||
left = "<C-h>",
|
require "keymappings"
|
||||||
down = "<C-j>",
|
|
||||||
up = "<C-k>",
|
|
||||||
right = "<C-l>",
|
|
||||||
last_active = "<C-\\>",
|
|
||||||
next = "<C-Space>"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
require'nvim-autopairs'.setup()
|
require "nvim-tmux-navigation".setup {
|
||||||
|
keybindings = {
|
||||||
|
left = "<C-h>",
|
||||||
|
down = "<C-j>",
|
||||||
|
up = "<C-k>",
|
||||||
|
right = "<C-l>",
|
||||||
|
last_active = "<C-\\>",
|
||||||
|
next = "<C-Space>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
-- Treesitter config
|
require'nvim-autopairs'.setup()
|
||||||
require "treesitter-conf"
|
|
||||||
|
|
||||||
-- Toggleterm / Lazygit setup
|
-- Treesitter config
|
||||||
|
require "treesitter-conf"
|
||||||
|
|
||||||
|
-- Autocompletion Setup
|
||||||
|
o.completeopt = "menuone,noselect,noinsert"
|
||||||
|
require "autocomplete"
|
||||||
|
require "snippets"
|
||||||
|
|
||||||
|
-- LSP Config
|
||||||
|
require "lspinstaller-conf"
|
||||||
require "lazy-git"
|
require "lazy-git"
|
||||||
|
|
||||||
require "autocommands"
|
require "autocommands"
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"0 debug pnpm:scope": {
|
|
||||||
"selected": 1
|
|
||||||
},
|
|
||||||
"1 error pnpm": {
|
|
||||||
"code": "ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND",
|
|
||||||
"err": {
|
|
||||||
"name": "pnpm",
|
|
||||||
"message": "No package.json (or package.yaml, or package.json5) was found in \"/home/jim/.dotfiles/configs/nvim/lua\".",
|
|
||||||
"code": "ERR_PNPM_NO_IMPORTER_MANIFEST_FOUND",
|
|
||||||
"stack": "pnpm: No package.json (or package.yaml, or package.json5) was found in \"/home/jim/.dotfiles/configs/nvim/lua\".\n at readProjectManifest (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:40641:13)\n at async Object.readProjectManifestOnly (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:40645:28)\n at async Object.readProjectManifestOnly (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:40864:24)\n at async Object.handler (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:129763:24)\n at async /home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:133951:20\n at async run (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:133926:34)\n at async runPnpm (/home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:134137:5)\n at async /home/jim/.asdf/installs/nodejs/16.11.0/pnpm-global/5/node_modules/.pnpm/pnpm@6.17.2/node_modules/pnpm/dist/pnpm.cjs:134129:7"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,7 +3,7 @@ local cmd = vim.cmd;
|
|||||||
cmd [[
|
cmd [[
|
||||||
augroup auto_format
|
augroup auto_format
|
||||||
au!
|
au!
|
||||||
au BufWritePre * silent! lua vim.lsp.buf.formatting_sync(nil, 300)<CR>
|
au BufWritePre * silent! FormatSync<CR>
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup highlight_yank
|
augroup highlight_yank
|
||||||
|
@ -5,15 +5,11 @@ local cmd = vim.cmd;
|
|||||||
local options = {noremap = true}
|
local options = {noremap = true}
|
||||||
local remap = {noremap = false}
|
local remap = {noremap = false}
|
||||||
|
|
||||||
--map("n", "<Space>", "<Nop>", remap)
|
|
||||||
--map("n", " ", "<Nop>", remap)
|
|
||||||
g.mapleader = " "
|
g.mapleader = " "
|
||||||
|
|
||||||
map("n", "<C-p>", ":Telescope find_files<CR>", options)
|
map("n", "<C-p>", ":Telescope find_files<CR>", options)
|
||||||
--map("n", "<C-f>", ":Telescope grep_string<CR>", options)
|
|
||||||
map("n", "<C-f>", ":Telescope live_grep<CR>", options)
|
map("n", "<C-f>", ":Telescope live_grep<CR>", options)
|
||||||
|
|
||||||
|
|
||||||
-- LSP Functionality
|
-- LSP Functionality
|
||||||
map("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", options)
|
map("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", options)
|
||||||
map("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", options)
|
map("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", options)
|
||||||
@ -23,7 +19,7 @@ map("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", options)
|
|||||||
map("n", "<Leader>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", options)
|
map("n", "<Leader>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<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>", "<cmd>lua vim.lsp.buf.formatting()<CR>", options)
|
map("n", "<Leader><C-f>", ":Format<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)
|
||||||
|
|
||||||
@ -69,6 +65,3 @@ map("i", "<C-s>", "<Esc>:w<CR>i", options)
|
|||||||
|
|
||||||
-- Update vim config
|
-- Update vim config
|
||||||
map("n", "<C-u>", "<Esc>:source $MYVIMRC<CR>", options)
|
map("n", "<C-u>", "<Esc>:source $MYVIMRC<CR>", options)
|
||||||
|
|
||||||
-- Y yank until the end of line
|
|
||||||
map("n", "Y", "y$", {noremap = true})
|
|
||||||
|
@ -4,53 +4,51 @@ local utils = require("utils")
|
|||||||
|
|
||||||
-- function to attach completion when setting up lsp
|
-- function to attach completion when setting up lsp
|
||||||
local function on_attach(client)
|
local function on_attach(client)
|
||||||
local function buf_set_keymap(...)
|
local function buf_set_keymap(...)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||||
end
|
end
|
||||||
local function buf_set_option(...)
|
local function buf_set_option(...)
|
||||||
vim.api.nvim_buf_set_option(bufnr, ...)
|
vim.api.nvim_buf_set_option(bufnr, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
|
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||||
|
|
||||||
-- Mappings.
|
-- Mappings.
|
||||||
local opts = {noremap = true, silent = true}
|
local opts = {noremap = true, silent = true}
|
||||||
|
|
||||||
-- Set some keybinds conditional on server capabilities
|
-- Set some keybinds conditional on server capabilities
|
||||||
if client.resolved_capabilities.document_formatting then
|
if client.resolved_capabilities.document_formatting then
|
||||||
vim.cmd [[command Format :lua vim.lsp.buf.formatting()<CR>]]
|
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
elseif client.resolved_capabilities.document_range_formatting then
|
||||||
elseif client.resolved_capabilities.document_range_formatting then
|
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
|
||||||
vim.cmd [[command Format :lua vim.lsp.buf.range_formatting()<CR>]]
|
end
|
||||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Set autocommands conditional on server_capabilities
|
-- Set autocommands conditional on server_capabilities
|
||||||
if client.resolved_capabilities.document_highlight then
|
if client.resolved_capabilities.document_highlight then
|
||||||
vim.api.nvim_exec(
|
vim.api.nvim_exec(
|
||||||
[[
|
[[
|
||||||
augroup lsp_document_highlight
|
augroup lsp_document_highlight
|
||||||
autocmd! * <buffer>
|
autocmd! * <buffer>
|
||||||
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
||||||
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
|
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
|
||||||
autocmd CursorHold *.* :lua vim.lsp.diagnostic.show_line_diagnostics()
|
autocmd CursorHold *.* :lua vim.lsp.diagnostic.show_line_diagnostics()
|
||||||
augroup END
|
augroup END
|
||||||
]],
|
]],
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
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"
|
||||||
@ -61,164 +59,164 @@ table.insert(runtime_path, "lua/?.lua")
|
|||||||
table.insert(runtime_path, "lua/?/init.lua")
|
table.insert(runtime_path, "lua/?/init.lua")
|
||||||
|
|
||||||
nvim_lsp.sumneko_lua.setup {
|
nvim_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"}
|
globals = {"vim"}
|
||||||
},
|
},
|
||||||
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Go Language Server
|
-- Go Language Server
|
||||||
|
|
||||||
nvim_lsp.gopls.setup {
|
nvim_lsp.gopls.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = lsp_status.capabilities
|
capabilities = lsp_status.capabilities
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Html Setup
|
-- Html Setup
|
||||||
nvim_lsp.html.setup {
|
nvim_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
|
||||||
|
|
||||||
nvim_lsp.svelte.setup {
|
nvim_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
|
||||||
|
|
||||||
local function organize_imports()
|
local function organize_imports()
|
||||||
local params = {
|
local params = {
|
||||||
command = "_typescript.organizeImports",
|
command = "_typescript.organizeImports",
|
||||||
arguments = {vim.api.nvim_buf_get_name(0)},
|
arguments = {vim.api.nvim_buf_get_name(0)},
|
||||||
title = ""
|
title = ""
|
||||||
}
|
}
|
||||||
vim.lsp.buf.execute_command(params)
|
vim.lsp.buf.execute_command(params)
|
||||||
end
|
end
|
||||||
|
|
||||||
nvim_lsp.tsserver.setup {
|
nvim_lsp.tsserver.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = lsp_status.capabilities,
|
capabilities = lsp_status.capabilities,
|
||||||
commands = {
|
commands = {
|
||||||
OrganizeImports = {
|
OrganizeImports = {
|
||||||
organize_imports,
|
organize_imports,
|
||||||
description = "Organize Imports"
|
description = "Organize Imports"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Setup diagnostics formaters and linters for non LSP provided files
|
-- Setup diagnostics formaters and linters for non LSP provided files
|
||||||
nvim_lsp.diagnosticls.setup {
|
nvim_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 = {
|
||||||
"lua",
|
"lua",
|
||||||
"sh",
|
"sh",
|
||||||
"markdown",
|
"markdown",
|
||||||
"json",
|
"json",
|
||||||
"jsonc",
|
"jsonc",
|
||||||
"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,14 +1,14 @@
|
|||||||
local lsp_installer = require("nvim-lsp-installer")
|
local lsp_installer = require("nvim-lsp-installer")
|
||||||
|
|
||||||
lsp_installer.on_server_ready(function(server)
|
lsp_installer.on_server_ready(function(server)
|
||||||
local opts = {}
|
local opts = {}
|
||||||
|
|
||||||
-- (optional) Customize the options passed to the server
|
-- (optional) Customize the options passed to the server
|
||||||
-- if server.name == "tsserver" then
|
-- if server.name == "tsserver" then
|
||||||
-- opts.root_dir = function() ... end
|
-- opts.root_dir = function() ... end
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
-- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart)
|
-- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart)
|
||||||
server:setup(opts)
|
server:setup(opts)
|
||||||
vim.cmd [[ do User LspAttachBuffers ]]
|
vim.cmd [[ do User LspAttachBuffers ]]
|
||||||
end)
|
end)
|
||||||
|
@ -1,68 +1,68 @@
|
|||||||
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(term)
|
on_close = function(term)
|
||||||
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})
|
||||||
|
|
||||||
require("toggleterm").setup {
|
require("toggleterm").setup {
|
||||||
shade_terminals = true
|
shade_terminals = true
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,10 @@ return require("packer").startup(function()
|
|||||||
|
|
||||||
-- General Helper Functions
|
-- General Helper Functions
|
||||||
use "nvim-lua/plenary.nvim"
|
use "nvim-lua/plenary.nvim"
|
||||||
|
|
||||||
|
-- Faster Filetype Detection
|
||||||
|
use "nathom/filetype.nvim"
|
||||||
|
|
||||||
use "alexghergh/nvim-tmux-navigation"
|
use "alexghergh/nvim-tmux-navigation"
|
||||||
|
|
||||||
-- Theming Section
|
-- Theming Section
|
||||||
@ -17,10 +20,12 @@ return require("packer").startup(function()
|
|||||||
use "kyazdani42/nvim-tree.lua"
|
use "kyazdani42/nvim-tree.lua"
|
||||||
use "nvim-lua/popup.nvim"
|
use "nvim-lua/popup.nvim"
|
||||||
use "mhinz/vim-startify"
|
use "mhinz/vim-startify"
|
||||||
use "lukas-reineke/indent-blankline.nvim"
|
--use "lukas-reineke/indent-blankline.nvim"
|
||||||
use "karb94/neoscroll.nvim"
|
use "karb94/neoscroll.nvim"
|
||||||
|
|
||||||
use "tpope/vim-fugitive"
|
use "tpope/vim-fugitive"
|
||||||
|
use "tpope/vim-surround"
|
||||||
|
use "editorconfig/editorconfig-vim"
|
||||||
|
|
||||||
-- Code Navigation
|
-- Code Navigation
|
||||||
use "dense-analysis/ale"
|
use "dense-analysis/ale"
|
||||||
@ -35,20 +40,26 @@ return require("packer").startup(function()
|
|||||||
-- use "lervag/wiki.vim"
|
-- use "lervag/wiki.vim"
|
||||||
|
|
||||||
-- Syntax / Autocomplete
|
-- Syntax / Autocomplete
|
||||||
use "preservim/nerdcommenter"
|
|
||||||
use "neovim/nvim-lspconfig"
|
use "neovim/nvim-lspconfig"
|
||||||
use "williamboman/nvim-lsp-installer"
|
use "hrsh7th/nvim-cmp"
|
||||||
use "nvim-lua/lsp-status.nvim"
|
|
||||||
use "hrsh7th/nvim-cmp"
|
|
||||||
use "hrsh7th/cmp-nvim-lsp"
|
use "hrsh7th/cmp-nvim-lsp"
|
||||||
use "hrsh7th/cmp-path"
|
use "hrsh7th/cmp-path"
|
||||||
use "weilbith/nvim-code-action-menu" -- Need to find better alternative
|
use "hrsh7th/cmp-buffer"
|
||||||
|
use "hrsh7th/cmp-cmdline"
|
||||||
|
use "L3MON4D3/LuaSnip"
|
||||||
|
use "saadparwaiz1/cmp_luasnip"
|
||||||
|
use "rafamadriz/friendly-snippets"
|
||||||
|
|
||||||
|
use "tpope/vim-commentary"
|
||||||
|
|
||||||
|
use "williamboman/nvim-lsp-installer"
|
||||||
|
use "nvim-lua/lsp-status.nvim"
|
||||||
use "L3MON4D3/LuaSnip"
|
use "L3MON4D3/LuaSnip"
|
||||||
use "windwp/nvim-autopairs"
|
use "windwp/nvim-autopairs"
|
||||||
use "neoclide/jsonc.vim"
|
use "neoclide/jsonc.vim"
|
||||||
use {
|
use {
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
run = ':TSUpdate'
|
run = ':TSUpdate'
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Preview Markdown
|
-- Preview Markdown
|
||||||
@ -56,6 +67,7 @@ return require("packer").startup(function()
|
|||||||
|
|
||||||
-- Autoformat
|
-- Autoformat
|
||||||
--use "sbdchd/neoformat"
|
--use "sbdchd/neoformat"
|
||||||
|
-- use "lukas-reineke/format.nvim"
|
||||||
|
|
||||||
-- General Popup Window
|
-- General Popup Window
|
||||||
use "akinsho/nvim-toggleterm.lua"
|
use "akinsho/nvim-toggleterm.lua"
|
||||||
|
45
configs/nvim/lua/snippets.lua
Normal file
45
configs/nvim/lua/snippets.lua
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
local ls = require("luasnip")
|
||||||
|
|
||||||
|
-- some shorthands...
|
||||||
|
local s = ls.snippet
|
||||||
|
local sn = ls.snippet_node
|
||||||
|
local t = ls.text_node
|
||||||
|
local i = ls.insert_node
|
||||||
|
local f = ls.function_node
|
||||||
|
local c = ls.choice_node
|
||||||
|
local d = ls.dynamic_node
|
||||||
|
|
||||||
|
local types = require("luasnip.util.types")
|
||||||
|
|
||||||
|
-- Every unspecified option will be set to the default.
|
||||||
|
ls.config.set_config({
|
||||||
|
history = true,
|
||||||
|
-- Update more often, :h events for more info.
|
||||||
|
updateevents = "TextChanged,TextChangedI",
|
||||||
|
ext_opts = {
|
||||||
|
[types.choiceNode] = {
|
||||||
|
active = {
|
||||||
|
virt_text = { { "choiceNode", "Comment" } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- treesitter-hl has 100, use something higher (default is 200).
|
||||||
|
ext_base_prio = 300,
|
||||||
|
-- minimal increase in priority.
|
||||||
|
ext_prio_increase = 1,
|
||||||
|
enable_autosnippets = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
ls.snippets = {
|
||||||
|
all = {
|
||||||
|
|
||||||
|
},
|
||||||
|
svelte = {
|
||||||
|
s("slt", {
|
||||||
|
t('<script lang="ts">'),
|
||||||
|
i(0),
|
||||||
|
t('</script>'),
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
@ -1,26 +1,24 @@
|
|||||||
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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
require "nvim-treesitter.configs".setup {
|
require "nvim-treesitter.configs".setup {
|
||||||
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"
|
||||||
},
|
},
|
||||||
highlight = {enable = true}
|
highlight = {enable = true}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,40 +2,40 @@ local M = {}
|
|||||||
local cmd = vim.cmd
|
local cmd = vim.cmd
|
||||||
|
|
||||||
function M.create_augroup(autocmds, name)
|
function M.create_augroup(autocmds, name)
|
||||||
cmd('augroup ' .. name)
|
cmd('augroup ' .. name)
|
||||||
cmd('autocmd!')
|
cmd('autocmd!')
|
||||||
for _, autocmd in ipairs(autocmds) do
|
for _, autocmd in ipairs(autocmds) do
|
||||||
cmd('autocmd ' .. table.concat(autocmd, ' '))
|
cmd('autocmd ' .. table.concat(autocmd, ' '))
|
||||||
end
|
end
|
||||||
cmd('augroup END')
|
cmd('augroup END')
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.ReloadConfig()
|
function M.ReloadConfig()
|
||||||
for name,_ in pairs(package.loaded) do
|
for name,_ in pairs(package.loaded) do
|
||||||
if name:match('^cnull') then
|
if name:match('^cnull') then
|
||||||
package.loaded[name] = nil
|
package.loaded[name] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
dofile(vim.env.MYVIMRC)
|
dofile(vim.env.MYVIMRC)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function dump(o)
|
local function dump(o)
|
||||||
if type(o) == 'table' then
|
if type(o) == 'table' then
|
||||||
local s = '{ '
|
local s = '{ '
|
||||||
for k,v in pairs(o) do
|
for k,v in pairs(o) do
|
||||||
if type(k) ~= 'number' then k = '"'..k..'"' end
|
if type(k) ~= 'number' then k = '"'..k..'"' end
|
||||||
s = s .. '['..k..'] = ' .. dump(v) .. ','
|
s = s .. '['..k..'] = ' .. dump(v) .. ','
|
||||||
end
|
end
|
||||||
return s .. '} '
|
return s .. '} '
|
||||||
else
|
else
|
||||||
return tostring(o)
|
return tostring(o)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.has_plugin(pluginName)
|
function M.has_plugin(pluginName)
|
||||||
local status = pcall(require, pluginName);
|
local status = pcall(require, pluginName);
|
||||||
return status
|
return status
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
@ -27,6 +27,7 @@ alias D="pnpm dev"
|
|||||||
alias B="pnpm build"
|
alias B="pnpm build"
|
||||||
alias T="pnpm test"
|
alias T="pnpm test"
|
||||||
alias P="git push"
|
alias P="git push"
|
||||||
|
alias p="git pull"
|
||||||
|
|
||||||
alias lt="tree -L 2 --filelimit 150 --dirsfirst"
|
alias lt="tree -L 2 --filelimit 150 --dirsfirst"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user