mirror of
https://github.com/d0zingcat/dotfiles.git
synced 2026-05-13 23:16:44 +00:00
init
This commit is contained in:
0
nvim/lua/config/copilot.lua
Normal file
0
nvim/lua/config/copilot.lua
Normal file
33
nvim/lua/config/gitsigns.lua
Normal file
33
nvim/lua/config/gitsigns.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
require('gitsigns').setup({
|
||||
signs = {
|
||||
add = { hl = 'GitSignsAdd', text = '┋', numhl = 'GitSignsAddNr', linehl = 'GitSignsAddLn' },
|
||||
change = { hl = 'GitSignsChange', text = '┋', numhl = 'GitSignsChangeNr', linehl = 'GitSignsChangeLn' },
|
||||
delete = { hl = 'GitSignsDelete', text = '⇉', numhl = 'GitSignsDeleteNr', linehl = 'GitSignsDeleteLn' },
|
||||
topdelete = { hl = 'GitSignsDelete', text = '⇊', numhl = 'GitSignsDeleteNr', linehl = 'GitSignsDeleteLn' },
|
||||
changedelete = { hl = 'GitSignsChange', text = '~', numhl = 'GitSignsChangeNr', linehl = 'GitSignsChangeLn' },
|
||||
},
|
||||
keymaps = {
|
||||
-- Default keymap options
|
||||
noremap = true,
|
||||
|
||||
['n ]c'] = { expr = true, "&diff ? ']c' : '<cmd>lua require\"gitsigns.actions\".next_hunk()<CR>'" },
|
||||
['n [c'] = { expr = true, "&diff ? '[c' : '<cmd>lua require\"gitsigns.actions\".prev_hunk()<CR>'" },
|
||||
},
|
||||
word_diff = false,
|
||||
current_line_blame = true,
|
||||
linehl = true,
|
||||
numhl = true,
|
||||
sign_priority = 6,
|
||||
count_chars = {
|
||||
[1] = '1', -- '₁',
|
||||
[2] = '2', -- '₂',
|
||||
[3] = '3', -- '₃',
|
||||
[4] = '4', -- '₄',
|
||||
[5] = '5', -- '₅',
|
||||
[6] = '6', -- '₆',
|
||||
[7] = '7', -- '₇',
|
||||
[8] = '8', -- '₈',
|
||||
[9] = '9', -- '₉',
|
||||
['+'] = '', -- '₊',
|
||||
},
|
||||
})
|
||||
11
nvim/lua/config/lsp_servers/yamlls.lua
Normal file
11
nvim/lua/config/lsp_servers/yamlls.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
return {
|
||||
filetypes = { 'yaml', 'yml' },
|
||||
settings = {
|
||||
yaml = {
|
||||
schemas = {
|
||||
['https://json.schemastore.org/github-workflow.json'] = '/.github/workflows/*',
|
||||
Kubernetes = '/*k8s.yaml',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
125
nvim/lua/config/lspconfig.lua
Normal file
125
nvim/lua/config/lspconfig.lua
Normal file
@@ -0,0 +1,125 @@
|
||||
local lsp = vim.lsp
|
||||
local api = vim.api
|
||||
local cmd = vim.cmd
|
||||
|
||||
local lsp_installer = require('nvim-lsp-installer')
|
||||
local lsp_installer_servers = require('nvim-lsp-installer.servers')
|
||||
|
||||
-- lspconfig && lspinstaller
|
||||
local on_attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...)
|
||||
api.nvim_buf_set_keymap(bufnr, ...)
|
||||
end
|
||||
local function buf_set_option(...)
|
||||
api.nvim_buf_set_option(bufnr, ...)
|
||||
end
|
||||
--require "lsp_signature".on_attach()
|
||||
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
buf_set_keymap('n', '<C-y>', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||
buf_set_keymap('n', 'gr', '<cmd>Telescope lsp_references<CR>', opts)
|
||||
buf_set_keymap('n', 'gd', '<cmd>Telescope lsp_definitions<CR>', opts)
|
||||
buf_set_keymap('n', 'go', '<cmd>Telescope lsp_document_symbols<CR>', opts)
|
||||
buf_set_keymap('n', 'gO', '<cmd>Telescope lsp_workspace_symbols<CR>', opts)
|
||||
--buf_set_keymap("n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
|
||||
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
||||
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||
buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
vim.cmd([[
|
||||
augroup Format
|
||||
au! * <buffer>
|
||||
au BufWritePre <buffer> lua vim.lsp.buf.formatting_sync(nil, 1000)
|
||||
augroup END
|
||||
]])
|
||||
end
|
||||
end
|
||||
|
||||
local capabilities = lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
|
||||
|
||||
-- Register a handler that will be called for all installed servers.
|
||||
-- Alternatively, you may also register handlers on specific server instances instead (see example below).
|
||||
lsp_installer.on_server_ready(function(server)
|
||||
local opts = {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
flags = {
|
||||
debounce_text_changes = 150,
|
||||
},
|
||||
}
|
||||
|
||||
if server.name == 'sumneko_lua' then
|
||||
local luadev = require('lua-dev').setup({
|
||||
lspconfig = {
|
||||
settings = {
|
||||
Lua = {
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
opts = vim.tbl_deep_extend('force', opts, luadev)
|
||||
end
|
||||
|
||||
if server.name == 'yamlls' then
|
||||
--local yamlls_opts = {
|
||||
--settings = {
|
||||
--yaml = {
|
||||
--filetypes = { 'yaml', 'yml' },
|
||||
--schemaStore = {
|
||||
--enable = true,
|
||||
--url = 'https://www.schemastore.org/api/json/catalog.json',
|
||||
--},
|
||||
--validate = false,
|
||||
--schemas = {
|
||||
--['https://json.schemastore.org/github-workflow.json'] = '/.github/workflows/*',
|
||||
--kubernetes = '/*.k8s.yaml',
|
||||
--},
|
||||
--},
|
||||
--},
|
||||
--}
|
||||
local conf = require(string.format('config.lsp_servers.%s', server.name))
|
||||
opts = vim.tbl_deep_extend('force', opts, conf)
|
||||
end
|
||||
-- (optional) Customize the options passed to the server
|
||||
-- if server.name == "tsserver" then
|
||||
-- opts.root_dir = function() ... end
|
||||
-- end
|
||||
|
||||
-- This setup() function is exactly the same as lspconfig's setup function.
|
||||
-- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||
server:setup(opts)
|
||||
end)
|
||||
|
||||
local null_ls = require('null-ls')
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.formatting.stylua.with({
|
||||
extra_args = { '--config-path', vim.fn.expand('~/.config/stylua.toml') },
|
||||
}),
|
||||
null_ls.builtins.formatting.shfmt,
|
||||
},
|
||||
on_attach = on_attach,
|
||||
})
|
||||
106
nvim/lua/config/lualine.lua
Normal file
106
nvim/lua/config/lualine.lua
Normal file
@@ -0,0 +1,106 @@
|
||||
require('lualine').setup({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'auto',
|
||||
component_separators = { left = '', right = '' },
|
||||
section_separators = { left = '', right = '' },
|
||||
disabled_filetypes = {},
|
||||
always_divide_middle = true,
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = { 'branch', 'diff', 'diagnostics' },
|
||||
lualine_c = { 'filename', 'lsp_progress' },
|
||||
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 = {},
|
||||
})
|
||||
|
||||
local colors = {
|
||||
yellow = '#ECBE7B',
|
||||
cyan = '#008080',
|
||||
darkblue = '#081633',
|
||||
green = '#98be65',
|
||||
orange = '#FF8800',
|
||||
violet = '#a9a1e1',
|
||||
magenta = '#c678dd',
|
||||
blue = '#51afef',
|
||||
red = '#ec5f67',
|
||||
}
|
||||
|
||||
local config = {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'gruvbox',
|
||||
component_separators = { '', '' },
|
||||
section_separators = { '', '' },
|
||||
disabled_filetypes = {},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = { 'filename' },
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = { 'encoding', 'fileformat', 'filetype' },
|
||||
lualine_z = { 'branch' },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { 'filename' },
|
||||
lualine_x = { 'location' },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {},
|
||||
extensions = {},
|
||||
}
|
||||
|
||||
-- Inserts a component in lualine_c at left section
|
||||
local function ins_left(component)
|
||||
table.insert(config.sections.lualine_c, component)
|
||||
end
|
||||
|
||||
-- Inserts a component in lualine_x ot right section
|
||||
local function ins_right(component)
|
||||
table.insert(config.sections.lualine_x, component)
|
||||
end
|
||||
|
||||
--ins_left {
|
||||
--'lsp_progress',
|
||||
--display_components = { 'lsp_client_name', { 'title', 'percentage', 'message' }},
|
||||
---- With spinner
|
||||
---- display_components = { 'lsp_client_name', 'spinner', { 'title', 'percentage', 'message' }},
|
||||
--colors = {
|
||||
--percentage = colors.cyan,
|
||||
--title = colors.cyan,
|
||||
--message = colors.cyan,
|
||||
--spinner = colors.cyan,
|
||||
--lsp_client_name = colors.magenta,
|
||||
--use = true,
|
||||
--},
|
||||
--separators = {
|
||||
--component = ' ',
|
||||
--progress = ' | ',
|
||||
--message = { pre = '(', post = ')'},
|
||||
--percentage = { pre = '', post = '%% ' },
|
||||
--title = { pre = '', post = ': ' },
|
||||
--lsp_client_name = { pre = '[', post = ']' },
|
||||
--spinner = { pre = '', post = '' },
|
||||
--message = { commenced = 'In Progress', completed = 'Completed' },
|
||||
--},
|
||||
--display_components = { 'lsp_client_name', 'spinner', { 'title', 'percentage', 'message' } },
|
||||
--timer = { progress_enddelay = 500, spinner = 1000, lsp_client_name_enddelay = 1000 },
|
||||
--spinner_symbols = { '🌑 ', '🌒 ', '🌓 ', '🌔 ', '🌕 ', '🌖 ', '🌗 ', '🌘 ' },
|
||||
--}
|
||||
72
nvim/lua/config/nvim-tree.lua
Normal file
72
nvim/lua/config/nvim-tree.lua
Normal file
@@ -0,0 +1,72 @@
|
||||
local g = vim.g
|
||||
local map = require('utils').map
|
||||
|
||||
g.nvim_tree_highlight_opened_files = 1
|
||||
g.nvim_tree_icons = {
|
||||
symlink = '',
|
||||
git = {
|
||||
untracked = '?',
|
||||
},
|
||||
folder = {
|
||||
arrow_open = '',
|
||||
arrow_closed = '',
|
||||
default = '',
|
||||
open = '',
|
||||
},
|
||||
}
|
||||
g.nvim_tree_show_icons = {
|
||||
git = 1,
|
||||
folders = 1,
|
||||
files = 1,
|
||||
folder_arrows = 1,
|
||||
}
|
||||
|
||||
local tree_cb = require('nvim-tree.config').nvim_tree_callback
|
||||
require('nvim-tree').setup({
|
||||
view = {
|
||||
width = 35,
|
||||
side = 'left',
|
||||
mappings = {
|
||||
list = {
|
||||
{ key = '<C-v>', cb = tree_cb('vsplit') },
|
||||
{ key = '<C-s>', cb = tree_cb('split') },
|
||||
{ key = 'v', cb = tree_cb('vsplit') },
|
||||
{ key = 's', cb = tree_cb('split') },
|
||||
{ key = '-', cb = '<Plug>(choosewin)' },
|
||||
{ key = '<C-t>', cb = ':ToggleTerm<cr>' },
|
||||
},
|
||||
},
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
icons = {
|
||||
error = '',
|
||||
warning = '',
|
||||
info = '',
|
||||
hint = '',
|
||||
},
|
||||
},
|
||||
update_to_buf_dir = {
|
||||
enable = true,
|
||||
auto_update = true,
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
},
|
||||
filters = {
|
||||
custom = { '.git' }, -- ignore .git
|
||||
},
|
||||
auto_close = true,
|
||||
hijack_netrw = true,
|
||||
update_cwd = true,
|
||||
focus_tree = false,
|
||||
open_on_setup = true,
|
||||
})
|
||||
|
||||
map('n', '<leader>te', ':NvimTreeToggle<CR>')
|
||||
|
||||
vim.cmd([[
|
||||
augroup nvimtree
|
||||
autocmd VimEnter * lua require('nvim-tree').toggle(false, true)
|
||||
augroup END
|
||||
]])
|
||||
18
nvim/lua/config/nvim_bookmarks.lua
Normal file
18
nvim/lua/config/nvim_bookmarks.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
local cmd = vim.cmd
|
||||
local g = vim.g
|
||||
local map = require('utils').map
|
||||
|
||||
-- vim-bookmarks
|
||||
require('telescope').load_extension('vim_bookmarks')
|
||||
|
||||
g['bookmark_sign'] = '⚑'
|
||||
g['bookmark_highlight_lines'] = 1
|
||||
g['bookmark_no_default_key_mappings'] = 1
|
||||
|
||||
cmd([[highlight BookmarkSign ctermbg=NONE ctermfg=160]])
|
||||
cmd([[highlight BookmarkLine ctermbg=194 ctermfg=NONE]])
|
||||
|
||||
map('n', 'mm', ':BookmarkToggle<CR>')
|
||||
map('n', 'mA', ':Telescope vim_bookmarks all<CR>')
|
||||
map('n', 'ma', ':Telescope vim_bookmarks current_file<CR>')
|
||||
-- map("n", "ma", ":BookmarkShowAll<CR>")
|
||||
42
nvim/lua/config/nvim_cmp.lua
Normal file
42
nvim/lua/config/nvim_cmp.lua
Normal file
@@ -0,0 +1,42 @@
|
||||
local fn = vim.fn
|
||||
|
||||
-- nvim-cmp
|
||||
local cmp = require('cmp')
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
fn['vsnip#anonymous'](args.body)
|
||||
end,
|
||||
},
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
-- set a name for each source
|
||||
vim_item.menu = ({
|
||||
buffer = '[Buf]',
|
||||
nvim_lsp = '[LSP]',
|
||||
luasnip = '[Snip]',
|
||||
nvim_lua = '[Lua]',
|
||||
latex_symbols = '[Latex]',
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
--["<C-e>"] = cmp.mapping.close(),
|
||||
['<C-e>'] = function(fallback)
|
||||
fallback()
|
||||
end,
|
||||
['<CR>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
},
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'buffer' },
|
||||
},
|
||||
})
|
||||
14
nvim/lua/config/nvim_floaterm.lua
Normal file
14
nvim/lua/config/nvim_floaterm.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
local g = vim.g
|
||||
local map = require('utils').map
|
||||
|
||||
-- floaterm
|
||||
g['floaterm_keymap_new'] = '<F7>'
|
||||
g['floaterm_keymap_next'] = '<F8>'
|
||||
g['floaterm_keymap_prev'] = '<F9>'
|
||||
g['floaterm_keymap_toggle'] = '<F10>'
|
||||
g['floaterm_position'] = 'bottomright'
|
||||
map('t', '<Esc>', '<c-\\><c-n>')
|
||||
map('n', '<leader>t', 'V:FloatermSend<CR>:FloatermToggle<CR>')
|
||||
map('v', '<leader>t', ':FloatermSend<CR>:FloatermToggle<CR>')
|
||||
map('n', '<leader>r', 'V:FloatermSend<CR>:FloatermToggle<CR>')
|
||||
map('v', '<leader>r', ':FloatermSend<CR>:FloatermToggle<CR>')
|
||||
16
nvim/lua/config/nvim_hop.lua
Normal file
16
nvim/lua/config/nvim_hop.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
local map = require('utils').map
|
||||
|
||||
-- hopworld
|
||||
require('hop').setup({ keys = 'etovxqpdygfblzhckisuran' })
|
||||
|
||||
map('n', '<leader>w', '<cmd>HopWordAC<cr>')
|
||||
map('n', '<leader>fw', '<cmd>HopWord<cr>')
|
||||
map('n', '<leader>s', '<cmd>HopChar1<cr>')
|
||||
map('n', '<leader>k', '<cmd>HopLineStartBC<cr>')
|
||||
map('n', '<leader>j', '<cmd>HopLineStartAC<cr>')
|
||||
map('v', '<leader>k', '<cmd>HopLineStartBC<cr>')
|
||||
map('v', '<leader>j', '<cmd>HopLineStartAC<cr>')
|
||||
map('n', '<leader>h', '<cmd>HopWordBC<cr>')
|
||||
map('n', '<leader>l', '<cmd>HopWordAC<cr>')
|
||||
map('v', '<leader>h', '<cmd>HopWordBC<cr>')
|
||||
map('v', '<leader>l', '<cmd>HopWordAC<cr>')
|
||||
8
nvim/lua/config/nvim_nerdcommenter.lua
Normal file
8
nvim/lua/config/nvim_nerdcommenter.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
local map = require('utils').map
|
||||
local g = vim.g
|
||||
|
||||
-- nerdcommenter
|
||||
map('', '<leader>cc', 'V}:call NERDComment("x", "toggle")<CR>')
|
||||
map('', '<leader>cu', 'V{:call NERDComment("x", "toggle")<CR>')
|
||||
g['NERDTrimTrailingWhitespace'] = 1
|
||||
g['NERDSpaceDelims'] = 1
|
||||
30
nvim/lua/config/nvim_telescope.lua
Normal file
30
nvim/lua/config/nvim_telescope.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
local map = require('utils').map
|
||||
|
||||
-- telescope
|
||||
local actions = require('telescope.actions')
|
||||
require('telescope').setup({
|
||||
defaults = {
|
||||
layout_config = {
|
||||
horizontal = {
|
||||
width = 0.75,
|
||||
height = 0.6,
|
||||
},
|
||||
},
|
||||
mappings = {
|
||||
i = {
|
||||
['<esc>'] = actions.close,
|
||||
['<C-j>'] = actions.move_selection_previous,
|
||||
['<C-k>'] = actions.move_selection_next,
|
||||
['<C-l>'] = { '<Right>', type = 'command' },
|
||||
['<C-h>'] = { '<Left>', type = 'command' },
|
||||
['<C-f>'] = actions.preview_scrolling_down,
|
||||
['<C-b>'] = actions.preview_scrolling_up,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
map('n', '<leader>ff', '<cmd>Telescope find_files<cr>')
|
||||
map('n', '<leader>fg', '<cmd>Telescope live_grep<cr>')
|
||||
map('n', '<leader>fb', '<cmd>Telescope buffers<cr>')
|
||||
map('n', '<leader>;', '<cmd>Telescope commands<cr>')
|
||||
14
nvim/lua/config/nvim_treesitter.lua
Normal file
14
nvim/lua/config/nvim_treesitter.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
-- treesitter
|
||||
require('nvim-treesitter.configs').setup({
|
||||
ensure_installed = 'maintained', -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||
ignore_install = { 'javascript' }, -- List of parsers to ignore installing
|
||||
highlight = {
|
||||
enable = true, -- false will disable the whole extension
|
||||
disable = {}, -- list of language that will be disabled
|
||||
-- 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,
|
||||
},
|
||||
})
|
||||
21
nvim/lua/config/nvim_vimgo.lua
Normal file
21
nvim/lua/config/nvim_vimgo.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
local g = vim.g
|
||||
|
||||
-- vim-go
|
||||
-- let g:go_code_completion_enabled = 1 -- Enable Autocompletion
|
||||
--g['go_fmt_command'] = 'goimports' -- 格式化将默认的 gofmt 替换
|
||||
g['go_autodetect_gopath'] = 1
|
||||
g['go_list_type'] = 'quickfix'
|
||||
g['go_version_warning'] = 1
|
||||
g['go_highlight_types'] = 1
|
||||
g['go_highlight_fields'] = 1
|
||||
g['go_highlight_functions'] = 1
|
||||
g['go_highlight_function_calls'] = 1
|
||||
g['go_highlight_operators'] = 1
|
||||
g['go_highlight_extra_types'] = 1
|
||||
g['go_highlight_methods'] = 1
|
||||
g['go_highlight_generate_tags'] = 1
|
||||
g['godef_split'] = 2
|
||||
--g['go_fmt_command'] = 'goimports' " Run goimports along gofmt on each save
|
||||
g['go_imports_mode'] = 'goimports'
|
||||
g['go_imports_autosave'] = 0 -- do not auto import
|
||||
g['go_auto_type_info'] = 1 -- automatically get signature/type info for object under cursor
|
||||
0
nvim/lua/config/tagbar.lua
Normal file
0
nvim/lua/config/tagbar.lua
Normal file
46
nvim/lua/config/toggleterm.lua
Normal file
46
nvim/lua/config/toggleterm.lua
Normal file
@@ -0,0 +1,46 @@
|
||||
local g = vim.g
|
||||
local map = require('utils').map
|
||||
|
||||
local Terminal = require('toggleterm.terminal').Terminal
|
||||
local lazygit = Terminal:new({
|
||||
cmd = 'lazygit',
|
||||
dir = 'git_dir',
|
||||
close_on_exit = true,
|
||||
direction = 'float',
|
||||
float_opts = {
|
||||
border = 'double',
|
||||
},
|
||||
hidden = true,
|
||||
-- function to run on opening the terminal
|
||||
--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,
|
||||
-- function to run on closing the terminal
|
||||
--on_close = function(term)
|
||||
--vim.cmd("Closing terminal")
|
||||
--end,
|
||||
})
|
||||
|
||||
function _lazygit_toggle()
|
||||
lazygit:toggle()
|
||||
end
|
||||
|
||||
function _G.set_terminal_keymaps()
|
||||
local opts = { noremap = true }
|
||||
vim.api.nvim_buf_set_keymap(0, 't', '<C-o>', [[<C-\><C-n><C-w>]], opts)
|
||||
--vim.api.nvim_buf_set_keymap(0, 't', 'jk', [[<C-\><C-n>]], opts)
|
||||
--vim.api.nvim_buf_set_keymap(0, 't', '<C-h>', [[<C-\><C-n><C-W>h]], opts)
|
||||
--vim.api.nvim_buf_set_keymap(0, 't', '<C-j>', [[<C-\><C-n><C-W>j]], opts)
|
||||
--vim.api.nvim_buf_set_keymap(0, 't', '<C-k>', [[<C-\><C-n><C-W>k]], opts)
|
||||
--vim.api.nvim_buf_set_keymap(0, 't', '<C-l>', [[<C-\><C-n><C-W>l]], opts)
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap('n', '<leader>g', '<cmd>lua _lazygit_toggle()<CR>', { noremap = true, silent = true })
|
||||
|
||||
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
|
||||
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
|
||||
|
||||
map('n', '<leader>tm', ':ToggleTerm size=15 direction=horizontal<CR>')
|
||||
|
||||
require('toggleterm').setup({})
|
||||
15
nvim/lua/config/vista.lua
Normal file
15
nvim/lua/config/vista.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
local api = vim.api
|
||||
|
||||
api.nvim_exec(
|
||||
[[
|
||||
" Ensure you have installed some decent font to show these pretty symbols, then you can enable icon for the kind.
|
||||
let g:vista#renderer#enable_icon = 1
|
||||
|
||||
" The default icons can't be suitable for all the filetypes, you can extend it as you wish.
|
||||
let g:vista#renderer#icons = {
|
||||
\ "function": "\uf794",
|
||||
\ "variable": "\uf71b",
|
||||
\ }
|
||||
]],
|
||||
false
|
||||
)
|
||||
Reference in New Issue
Block a user