init
This commit is contained in:
26
lua/plugins/colorscheme.lua
Normal file
26
lua/plugins/colorscheme.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
return {
|
||||
'triimdev/invero.nvim',
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
dev = true,
|
||||
config = function()
|
||||
vim.api.nvim_create_user_command('ReloadInvero', function()
|
||||
require('invero').invalidate_cache()
|
||||
vim.cmd('Lazy reload invero.nvim')
|
||||
end, {})
|
||||
|
||||
require('invero').setup({
|
||||
highlights = function(c, tool)
|
||||
c.bg_float = tool(152)
|
||||
return {
|
||||
WinSeparator = { fg = c.outline, bg = c.base },
|
||||
StatusLine = { fg = c.outline, bg = c.base },
|
||||
StatusLineNC = { fg = c.text, bg = c.base, bold = true },
|
||||
}
|
||||
end,
|
||||
})
|
||||
|
||||
vim.o.background = 'light'
|
||||
vim.cmd.colorscheme('invero')
|
||||
end,
|
||||
}
|
||||
148
lua/plugins/filetree.lua
Normal file
148
lua/plugins/filetree.lua
Normal file
@@ -0,0 +1,148 @@
|
||||
local function my_on_attach(bufnr)
|
||||
local api = require('nvim-tree.api')
|
||||
local opts = { buffer = bufnr }
|
||||
|
||||
-- basics: copy/cut/paste/create/rename/remove
|
||||
vim.keymap.set('n', 'c', api.fs.copy.node, opts)
|
||||
vim.keymap.set('n', 'x', api.fs.cut, opts)
|
||||
vim.keymap.set('n', 'p', api.fs.paste, opts)
|
||||
vim.keymap.set('n', 'a', api.fs.create, opts)
|
||||
vim.keymap.set('n', 'r', api.fs.rename, opts)
|
||||
vim.keymap.set('n', 'R', api.fs.rename_basename, opts)
|
||||
vim.keymap.set('n', 'd', api.fs.remove, opts)
|
||||
|
||||
-- bulk mark and delete/move
|
||||
vim.keymap.set('n', 's', api.marks.toggle, opts)
|
||||
vim.keymap.set('n', 'S', api.marks.clear, opts)
|
||||
vim.keymap.set('n', 'bd', api.marks.bulk.delete, opts)
|
||||
vim.keymap.set('n', 'bm', api.marks.bulk.move, opts)
|
||||
|
||||
-- copy filename/path
|
||||
vim.keymap.set('n', 'y', api.fs.copy.filename, opts)
|
||||
vim.keymap.set('n', 'Y', api.fs.copy.relative_path, opts)
|
||||
vim.keymap.set('n', 'gy', api.fs.copy.absolute_path, opts)
|
||||
vim.keymap.set('n', 'ge', api.fs.copy.basename, opts)
|
||||
|
||||
-- expand/collapse
|
||||
vim.keymap.set('n', 'e', api.tree.expand_all, opts)
|
||||
vim.keymap.set('n', 'E', api.tree.collapse_all, opts)
|
||||
|
||||
-- filter
|
||||
vim.keymap.set('n', 'f', api.live_filter.start, opts)
|
||||
vim.keymap.set('n', 'F', api.live_filter.clear, opts)
|
||||
|
||||
-- navigate
|
||||
vim.keymap.set('n', 'J', api.node.navigate.sibling.last, opts)
|
||||
vim.keymap.set('n', 'K', api.node.navigate.sibling.first, opts)
|
||||
vim.keymap.set('n', 'P', api.node.navigate.parent, opts)
|
||||
|
||||
-- open
|
||||
vim.keymap.set('n', '<CR>', api.node.open.edit, opts)
|
||||
vim.keymap.set('n', 'o', api.node.open.edit, opts)
|
||||
vim.keymap.set('n', 'O', api.node.open.no_window_picker, opts)
|
||||
|
||||
-- miscellaneous
|
||||
vim.keymap.set('n', 'K', api.node.show_info_popup, opts)
|
||||
vim.keymap.set('n', 'U', api.tree.reload, opts)
|
||||
end
|
||||
|
||||
return {
|
||||
'nvim-tree/nvim-tree.lua',
|
||||
version = '*',
|
||||
dev = true,
|
||||
opts = {
|
||||
on_attach = my_on_attach,
|
||||
view = { signcolumn = 'no' },
|
||||
actions = { file_popup = { open_win_config = { border = 'rounded' } } },
|
||||
renderer = {
|
||||
root_folder_label = false,
|
||||
-- root_folder_label = function(path)
|
||||
-- return '-- ' .. vim.fn.fnamemodify(path, ':t') .. ' --'
|
||||
-- end,
|
||||
special_files = {},
|
||||
|
||||
highlight_hidden = 'all',
|
||||
highlight_clipboard = 'all',
|
||||
|
||||
indent_markers = {
|
||||
enable = true,
|
||||
inline_arrows = false,
|
||||
icons = { corner = '│', none = '│', bottom = ' ' },
|
||||
},
|
||||
icons = {
|
||||
bookmarks_placement = 'after',
|
||||
git_placement = 'after',
|
||||
show = {
|
||||
file = false,
|
||||
folder = false,
|
||||
folder_arrow = false, -- KEEP FALSE
|
||||
git = true,
|
||||
modified = false,
|
||||
hidden = false,
|
||||
diagnostics = false,
|
||||
bookmarks = true,
|
||||
},
|
||||
glyphs = {
|
||||
-- default = '•',
|
||||
default = ' ',
|
||||
symlink = '',
|
||||
bookmark = '',
|
||||
modified = '●',
|
||||
hidden = '',
|
||||
folder = {
|
||||
arrow_closed = '',
|
||||
arrow_open = '',
|
||||
default = '▸',
|
||||
open = '▾',
|
||||
empty = '',
|
||||
empty_open = '',
|
||||
symlink = '',
|
||||
symlink_open = '',
|
||||
},
|
||||
|
||||
git = {
|
||||
unstaged = '◇', -- '✗',
|
||||
staged = '',
|
||||
unmerged = '',
|
||||
renamed = '',
|
||||
untracked = '',
|
||||
deleted = '', -- '',
|
||||
ignored = '',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
hijack_cursor = true,
|
||||
prefer_startup_root = true,
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_root = { enable = true, ignore_list = {} },
|
||||
exclude = false,
|
||||
},
|
||||
modified = { enable = true, show_on_dirs = true, show_on_open_dirs = true },
|
||||
filters = {
|
||||
enable = true,
|
||||
git_ignored = true,
|
||||
dotfiles = false,
|
||||
git_clean = false,
|
||||
no_buffer = false,
|
||||
no_bookmark = false,
|
||||
custom = {},
|
||||
exclude = {},
|
||||
},
|
||||
filesystem_watchers = {
|
||||
enable = true,
|
||||
debounce_delay = 50,
|
||||
ignore_dirs = {
|
||||
'/.git',
|
||||
'/.DS_Store',
|
||||
'/build',
|
||||
'/dist',
|
||||
'/public',
|
||||
'/node_modules',
|
||||
'/target',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
128
lua/plugins/syntax.lua
Normal file
128
lua/plugins/syntax.lua
Normal file
@@ -0,0 +1,128 @@
|
||||
vim.keymap.set('n', '<leader>d', vim.diagnostic.open_float, { noremap = true, silent = true })
|
||||
|
||||
vim.diagnostic.config({
|
||||
update_in_insert = false,
|
||||
virtual_text = {
|
||||
prefix = '', -- remove annoying ▎ etc
|
||||
format = function(diagnostic)
|
||||
if diagnostic.source then
|
||||
return string.format('[%s] %s', diagnostic.source, diagnostic.message)
|
||||
end
|
||||
return diagnostic.message
|
||||
end,
|
||||
},
|
||||
float = {
|
||||
border = 'rounded',
|
||||
source = true, -- show source in floating window too
|
||||
},
|
||||
severity_sort = true,
|
||||
})
|
||||
|
||||
vim.lsp.enable({ 'lua_ls' })
|
||||
vim.lsp.enable({ 'json_ls' })
|
||||
|
||||
return {
|
||||
{ 'mason-org/mason.nvim', config = true },
|
||||
{ 'windwp/nvim-ts-autotag', config = true },
|
||||
{ 'windwp/nvim-autopairs', event = 'InsertEnter', config = true },
|
||||
|
||||
-- { 'saghen/blink.cmp', version = '1.*' },
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
main = 'nvim-treesitter.configs',
|
||||
opts = {
|
||||
highlight = { enable = true },
|
||||
incremental_selection = { enable = true },
|
||||
textobjects = { enable = true },
|
||||
ensure_installed = {
|
||||
-- Documentation
|
||||
'vim',
|
||||
'vimdoc',
|
||||
'markdown',
|
||||
'markdown_inline',
|
||||
-- Data
|
||||
'gitcommit',
|
||||
'gitignore',
|
||||
'dockerfile',
|
||||
'diff',
|
||||
'json',
|
||||
'jsonc',
|
||||
-- Scripting
|
||||
'bash',
|
||||
'lua',
|
||||
'sql',
|
||||
-- Programming
|
||||
'c',
|
||||
'cpp',
|
||||
'go',
|
||||
'rust',
|
||||
'python',
|
||||
-- Web
|
||||
'html',
|
||||
'css',
|
||||
'javascript',
|
||||
'typescript',
|
||||
'tsx',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'mfussenegger/nvim-lint',
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
opts = {
|
||||
linters_by_ft = {
|
||||
lua = { 'luacheck' },
|
||||
python = { 'ruff' },
|
||||
javascript = { 'eslint_d' },
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local lint = require('lint')
|
||||
lint.linters_by_ft = opts.linters_by_ft
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
||||
group = vim.api.nvim_create_augroup('lint_autocmd', { clear = true }),
|
||||
callback = function()
|
||||
lint.try_lint()
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
'stevearc/conform.nvim',
|
||||
event = { 'BufWritePre' },
|
||||
opts = {
|
||||
-- Automatically format on save
|
||||
format_on_save = {
|
||||
timeout_ms = 500,
|
||||
lsp_format = 'fallback', -- Use LSP when no formatter is configured
|
||||
},
|
||||
|
||||
-- Formatters per filetype
|
||||
default_format_opts = { stop_after_first = true },
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
sh = { 'shfmt' },
|
||||
swift = { 'swift_format' },
|
||||
python = { 'isort', 'black' },
|
||||
json = { 'jq' },
|
||||
javascript = { 'prettierd', 'prettier' },
|
||||
javascriptreact = { 'prettierd', 'prettier' },
|
||||
typescript = { 'prettierd', 'prettier' },
|
||||
typescriptreact = { 'prettierd', 'prettier' },
|
||||
},
|
||||
},
|
||||
|
||||
config = function(_, opts)
|
||||
require('conform').setup(opts)
|
||||
|
||||
-- Create a command to format manually
|
||||
vim.api.nvim_create_user_command('Format', function()
|
||||
require('conform').format({
|
||||
async = true,
|
||||
lsp_format = 'fallback',
|
||||
})
|
||||
end, { desc = 'Format current buffer' })
|
||||
end,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user