nvim/lua/frame/setup.lua
2022-05-15 15:15:27 +08:00

154 lines
5.0 KiB
Lua

local tree_cb = require 'nvim-tree.config'.nvim_tree_callback -- following options are the default
-- r rename
-- d delete
-- s open item in system tool
-- a add file/dir
require 'nvim-tree'.setup {
open_on_setup = true;
open_on_setup_file = false,
git = {
enable = true,
ignore = true,
timeout = 400,
},
filters = {
dotfiles = true,
custom = {},
exclude = {},
},
system_open = {
cmd = nil,
args = {},
},
view = {
width = 24,
mappings = {
custom_only = true,
list = {
{ key = "<BS>", cb = tree_cb("dir_up") },
{ key = { "q", "<Esc>" }, cb = tree_cb("close") },
{ key = { "<2-RightMouse>", "<CR>" }, cb = tree_cb("cd") },
{ key = "<Tab>", cb = tree_cb("preview") },
{ key = "R", cb = tree_cb("refresh") },
{ key = "h", cb = tree_cb("close_node") },
{ key = { "o", "<CR>", "<2-RightMouse>" }, cb = tree_cb("edit") },
{ key = "a", cb = tree_cb("create") },
{ key = "d", cb = tree_cb("remove") },
{ key = "r", cb = tree_cb("rename") },
{ key = "x", cb = tree_cb("cut") },
{ key = "c", cb = tree_cb("copy") },
{ key = "p", cb = tree_cb("paste") },
{ key = "G", cb = tree_cb("prev_git_item") },
{ key = "g", cb = tree_cb("next_git_item") },
{ key = "?", cb = tree_cb("toggle_help") },
{ key = "<", cb = tree_cb("prev_sibling") },
{ key = ">", cb = tree_cb("next_sibling") },
{ key = "P", cb = tree_cb("parent_node") },
{ key = "K", cb = tree_cb("first_sibling") },
{ key = "J", cb = tree_cb("last_sibling") },
{ key = "I", cb = tree_cb("toggle_ignored") },
{ key = "H", cb = tree_cb("toggle_dotfiles") },
{ key = "<C-r>", cb = tree_cb("full_rename") },
{ key = "y", cb = tree_cb("copy_name") },
{ key = "Y", cb = tree_cb("copy_path") },
{ key = "gy", cb = tree_cb("copy_absolute_path") },
{ key = "S", cb = tree_cb("system_open") },
}
}
}
}
vim.opt.background = "dark" -- or "light" for light mode
vim.cmd([[colorscheme gruvbox]])
vim.opt.termguicolors = true
require("bufferline").setup {
options = {
sort_by = 'id',
numbers = 'ordinal',
-- 左侧让出 nvim-tree 的位置
diagnostics = "nvim_lsp";
offsets = { {
filetype = "NvimTree",
text = "veypi.com",
highlight = "Directory",
text_align = "center"
} }
}
}
vim.g.gitblame_display_virtual_text = 0 -- Disable virtual text
vim.g.gitblame_date_format = "%r"
local git_blame = require('gitblame')
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '', right = '' },
section_separators = { left = '', right = '' },
disabled_filetypes = {},
always_divide_middle = true,
globalstatus = false,
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff', 'diagnostics' },
lualine_c = {
{ git_blame.get_current_blame_text, cond = git_blame.is_blame_text_available },
'filename'
},
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' },
lualine_z = { 'location' }
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { 'filename' },
lualine_x = { 'location' },
lualine_y = {},
lualine_z = {}
},
tabline = {},
extensions = {}
}
require 'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all"
ensure_installed = { "c", "lua", "rust", "go", "javascript", "html", "json", "python", "typescript", "vue", "css" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- List of parsers to ignore installing (for "all")
ignore_install = { "" },
highlight = {
-- `false` will disable the whole extension
enable = true,
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
-- the name of the parser)
-- list of language that will be disabled
disable = {},
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
}