fix: disable auto format
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
vim.g.autoformat = false
|
||||||
|
|
||||||
vim.cmd('set iskeyword+=-') -- treat dash separated words as a word text object"
|
vim.cmd('set iskeyword+=-') -- treat dash separated words as a word text object"
|
||||||
vim.cmd('set shortmess+=c') -- Don't pass messages to |ins-completion-menu|.
|
vim.cmd('set shortmess+=c') -- Don't pass messages to |ins-completion-menu|.
|
||||||
vim.cmd('set inccommand=split') -- Make substitution work in realtime
|
vim.cmd('set inccommand=split') -- Make substitution work in realtime
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
vim.api.nvim_set_keymap('n', '<TAB>', ':BufferNext<CR>', { noremap = true, silent = true })
|
|
||||||
vim.api.nvim_set_keymap('n', '<S-TAB>', ':BufferPrevious<CR>', { noremap = true, silent = true })
|
|
||||||
vim.api.nvim_set_keymap('n', '<S-x>', ':BufferClose<CR>', { noremap = true, silent = true })
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
--[[
|
|
||||||
local dashboard = {
|
|
||||||
custom_header = {
|
|
||||||
' _..._ ',
|
|
||||||
' .\' (_`. _ __ ___ ',
|
|
||||||
' : . : | | _ _ _ __ __ _ _ _\\ \\ / (_)_ __ ___ ',
|
|
||||||
' :) () : | | | | | | \'_ \\ / _` | \'__\\ \\ / /| | \'_ ` _ \\ ',
|
|
||||||
' `. . .\' | |__| |_| | | | | (_| | | \\ V / | | | | | | |',
|
|
||||||
' `-...-\' |_____\\__,_|_| |_|\\__,_|_| \\_/ |_|_| |_| |_|',
|
|
||||||
},
|
|
||||||
footer= {'Laily'}
|
|
||||||
}
|
|
||||||
]]
|
|
||||||
|
|
||||||
local dashboard = {
|
|
||||||
custom_header = {
|
|
||||||
'███╗ ██╗██╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗',
|
|
||||||
'████╗ ██║██║ ██║██╔════╝██╔═══██╗██╔══██╗██╔════╝',
|
|
||||||
'██╔██╗ ██║██║ ██║██║ ██║ ██║██║ ██║█████╗',
|
|
||||||
'██║╚██╗██║╚██╗ ██╔╝██║ ██║ ██║██║ ██║██╔══╝',
|
|
||||||
'██║ ╚████║ ╚████╔╝ ╚██████╗╚██████╔╝██████╔╝███████╗',
|
|
||||||
'╚═╝ ╚═══╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝'
|
|
||||||
},
|
|
||||||
footer= {'Laily'},
|
|
||||||
}
|
|
||||||
-- vim.g.dashboard_custom_header = {
|
|
||||||
--
|
|
||||||
-- ' _..._ ',
|
|
||||||
-- ' .\' `. ██ ██ ██ ███ ██ █████ ██████ ██ ██ ██ ███ ███ ',
|
|
||||||
-- ' : : ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ████ ████ ',
|
|
||||||
-- ' : : ██ ██ ██ ██ ██ ██ ███████ ██████ ██ ██ ██ ██ ████ ██ ',
|
|
||||||
-- ' `. .\' ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ',
|
|
||||||
-- ' `-...-\' ███████ ██████ ██ ████ ██ ██ ██ ██ ████ ██ ██ ██ ',
|
|
||||||
--
|
|
||||||
-- }
|
|
||||||
|
|
||||||
vim.g.dashboard_custom_header = dashboard.custom_header
|
|
||||||
|
|
||||||
vim.g.dashboard_default_executive = 'telescope'
|
|
||||||
|
|
||||||
vim.g.dashboard_custom_section = {
|
|
||||||
a = {description = {' Find File '}, command = 'Telescope find_files'},
|
|
||||||
b = {description = {' Recently Used Files'}, command = 'Telescope oldfiles'},
|
|
||||||
c = {description = {' Load Last Session '}, command = 'SessionLoad'},
|
|
||||||
d = {description = {' Find Word '}, command = 'Telescope live_grep'},
|
|
||||||
e = {description = {' Settings '}, command = ':e '..CONFIG_PATH..'/lv-settings.lua'}
|
|
||||||
-- e = {description = {' Marks '}, command = 'Telescope marks'}
|
|
||||||
}
|
|
||||||
|
|
||||||
-- file_browser = {description = {' File Browser'}, command = 'Telescope find_files'},
|
|
||||||
|
|
||||||
-- vim.g.dashboard_custom_shortcut = {
|
|
||||||
-- a = 'f',
|
|
||||||
-- find_word = 'SPC f a',
|
|
||||||
-- last_session = 'SPC s l',
|
|
||||||
-- new_file = 'SPC c n',
|
|
||||||
-- book_marks = 'SPC f b'
|
|
||||||
-- }
|
|
||||||
-- find_history = 'SPC f h',
|
|
||||||
|
|
||||||
-- vim.g.dashboard_session_directory = CACHE_PATH..'/session'
|
|
||||||
vim.g.dashboard_custom_footer = dashboard.footer
|
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
require'fzf-lua'.setup {
|
|
||||||
fzf_opts = { ['--keep-right'] = ''},
|
|
||||||
fzf_cli_args = '--keep-right',
|
|
||||||
--[[
|
|
||||||
winopts = {
|
|
||||||
preview = {
|
|
||||||
layout = "vertical"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]]
|
|
||||||
}
|
|
||||||
@@ -1,220 +0,0 @@
|
|||||||
local gl = require('galaxyline')
|
|
||||||
-- get my theme in galaxyline repo
|
|
||||||
-- local colors = require('galaxyline.theme').default
|
|
||||||
local colors = {
|
|
||||||
-- bg = '#2E2E2E',
|
|
||||||
bg = '#292D38',
|
|
||||||
yellow = '#DCDCAA',
|
|
||||||
dark_yellow = '#D7BA7D',
|
|
||||||
cyan = '#4EC9B0',
|
|
||||||
green = '#608B4E',
|
|
||||||
light_green = '#B5CEA8',
|
|
||||||
string_orange = '#CE9178',
|
|
||||||
orange = '#FF8800',
|
|
||||||
purple = '#C586C0',
|
|
||||||
magenta = '#D16D9E',
|
|
||||||
grey = '#858585',
|
|
||||||
blue = '#569CD6',
|
|
||||||
vivid_blue = '#4FC1FF',
|
|
||||||
light_blue = '#9CDCFE',
|
|
||||||
red = '#D16969',
|
|
||||||
error_red = '#F44747',
|
|
||||||
info_yellow = '#FFCC66'
|
|
||||||
}
|
|
||||||
local condition = require('galaxyline.condition')
|
|
||||||
local gls = gl.section
|
|
||||||
gl.short_line_list = {'NvimTree', 'vista', 'dbui', 'packer'}
|
|
||||||
|
|
||||||
table.insert(gls.left, {
|
|
||||||
ViMode = {
|
|
||||||
provider = function()
|
|
||||||
-- auto change color according the vim mode
|
|
||||||
local mode_color = {
|
|
||||||
n = colors.blue,
|
|
||||||
i = colors.green,
|
|
||||||
v = colors.purple,
|
|
||||||
[''] = colors.purple,
|
|
||||||
V = colors.purple,
|
|
||||||
c = colors.magenta,
|
|
||||||
no = colors.blue,
|
|
||||||
s = colors.orange,
|
|
||||||
S = colors.orange,
|
|
||||||
[''] = colors.orange,
|
|
||||||
ic = colors.yellow,
|
|
||||||
R = colors.red,
|
|
||||||
Rv = colors.red,
|
|
||||||
cv = colors.blue,
|
|
||||||
ce = colors.blue,
|
|
||||||
r = colors.cyan,
|
|
||||||
rm = colors.cyan,
|
|
||||||
['r?'] = colors.cyan,
|
|
||||||
['!'] = colors.blue,
|
|
||||||
t = colors.blue
|
|
||||||
}
|
|
||||||
vim.api.nvim_command('hi GalaxyViMode guifg=' .. mode_color[vim.fn.mode()])
|
|
||||||
return '▊ '
|
|
||||||
end,
|
|
||||||
highlight = {colors.red, colors.bg}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
print(vim.fn.getbufvar(0, 'ts'))
|
|
||||||
vim.fn.getbufvar(0, 'ts')
|
|
||||||
|
|
||||||
table.insert(gls.left, {
|
|
||||||
GitIcon = {
|
|
||||||
provider = function()
|
|
||||||
return ' '
|
|
||||||
end,
|
|
||||||
condition = condition.check_git_workspace,
|
|
||||||
separator = ' ',
|
|
||||||
separator_highlight = {'NONE', colors.bg},
|
|
||||||
highlight = {colors.orange, colors.bg}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
table.insert(gls.left, {
|
|
||||||
GitBranch = {
|
|
||||||
provider = 'GitBranch',
|
|
||||||
condition = condition.check_git_workspace,
|
|
||||||
separator = ' ',
|
|
||||||
separator_highlight = {'NONE', colors.bg},
|
|
||||||
highlight = {colors.grey, colors.bg}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
table.insert(gls.left, {
|
|
||||||
DiffAdd = {
|
|
||||||
provider = 'DiffAdd',
|
|
||||||
condition = condition.hide_in_width,
|
|
||||||
icon = ' ',
|
|
||||||
highlight = {colors.green, colors.bg}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
table.insert(gls.left, {
|
|
||||||
DiffModified = {
|
|
||||||
provider = 'DiffModified',
|
|
||||||
condition = condition.hide_in_width,
|
|
||||||
icon = ' 柳',
|
|
||||||
highlight = {colors.blue, colors.bg}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
table.insert(gls.left, {
|
|
||||||
DiffRemove = {
|
|
||||||
provider = 'DiffRemove',
|
|
||||||
condition = condition.hide_in_width,
|
|
||||||
icon = ' ',
|
|
||||||
highlight = {colors.red, colors.bg}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
table.insert(gls.right, {
|
|
||||||
DiagnosticError = {provider = 'DiagnosticError', icon = ' ', highlight = {colors.error_red, colors.bg}}
|
|
||||||
})
|
|
||||||
table.insert(gls.right, {DiagnosticWarn = {provider = 'DiagnosticWarn', icon = ' ', highlight = {colors.orange, colors.bg}}})
|
|
||||||
|
|
||||||
table.insert(gls.right, {
|
|
||||||
DiagnosticHint = {provider = 'DiagnosticHint', icon = ' ', highlight = {colors.vivid_blue, colors.bg}}
|
|
||||||
})
|
|
||||||
|
|
||||||
table.insert(gls.right, {DiagnosticInfo = {provider = 'DiagnosticInfo', icon = ' ', highlight = {colors.info_yellow, colors.bg}}})
|
|
||||||
|
|
||||||
table.insert(gls.right, {
|
|
||||||
TreesitterIcon = {
|
|
||||||
provider = function()
|
|
||||||
if next(vim.treesitter.highlighter.active) ~= nil then return ' ' end
|
|
||||||
return ''
|
|
||||||
end,
|
|
||||||
separator = ' ',
|
|
||||||
separator_highlight = {'NONE', colors.bg},
|
|
||||||
highlight = {colors.green, colors.bg}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
table.insert(gls.right, {
|
|
||||||
ShowLspClient = {
|
|
||||||
provider = 'GetLspClient',
|
|
||||||
condition = function()
|
|
||||||
local tbl = {['dashboard'] = true, [' '] = true}
|
|
||||||
if tbl[vim.bo.filetype] then return false end
|
|
||||||
return true
|
|
||||||
end,
|
|
||||||
icon = ' ',
|
|
||||||
highlight = {colors.grey, colors.bg}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
table.insert(gls.right, {
|
|
||||||
LineInfo = {
|
|
||||||
provider = 'LineColumn',
|
|
||||||
separator = ' ',
|
|
||||||
separator_highlight = {'NONE', colors.bg},
|
|
||||||
highlight = {colors.grey, colors.bg}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
table.insert(gls.right, {
|
|
||||||
PerCent = {
|
|
||||||
provider = 'LinePercent',
|
|
||||||
separator = ' ',
|
|
||||||
separator_highlight = {'NONE', colors.bg},
|
|
||||||
highlight = {colors.grey, colors.bg}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
table.insert(gls.right, {
|
|
||||||
Tabstop = {
|
|
||||||
provider = function()
|
|
||||||
return "Spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth") .. " "
|
|
||||||
end,
|
|
||||||
condition = condition.hide_in_width,
|
|
||||||
separator = ' ',
|
|
||||||
separator_highlight = {'NONE', colors.bg},
|
|
||||||
highlight = {colors.grey, colors.bg}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
table.insert(gls.right, {
|
|
||||||
BufferType = {
|
|
||||||
provider = 'FileTypeName',
|
|
||||||
condition = condition.hide_in_width,
|
|
||||||
separator = ' ',
|
|
||||||
separator_highlight = {'NONE', colors.bg},
|
|
||||||
highlight = {colors.grey, colors.bg}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
table.insert(gls.right, {
|
|
||||||
FileEncode = {
|
|
||||||
provider = 'FileEncode',
|
|
||||||
condition = condition.hide_in_width,
|
|
||||||
separator = ' ',
|
|
||||||
separator_highlight = {'NONE', colors.bg},
|
|
||||||
highlight = {colors.grey, colors.bg}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
table.insert(gls.right, {
|
|
||||||
Space = {
|
|
||||||
provider = function()
|
|
||||||
return ' '
|
|
||||||
end,
|
|
||||||
separator = ' ',
|
|
||||||
separator_highlight = {'NONE', colors.bg},
|
|
||||||
highlight = {colors.orange, colors.bg}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
table.insert(gls.short_line_left, {
|
|
||||||
BufferType = {
|
|
||||||
provider = 'FileTypeName',
|
|
||||||
separator = ' ',
|
|
||||||
separator_highlight = {'NONE', colors.bg},
|
|
||||||
highlight = {colors.grey, colors.bg}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
table.insert(gls.short_line_left, {
|
|
||||||
SFileName = {provider = 'SFileName', condition = condition.buffer_not_empty, highlight = {colors.grey, colors.bg}}
|
|
||||||
})
|
|
||||||
|
|
||||||
--table.insert(gls.short_line_right[1] = {BufferIcon = {provider = 'BufferIcon', highlight = {colors.grey, colors.bg}}})
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
require('gitsigns').setup {
|
|
||||||
signs = {
|
|
||||||
-- TODO add hl to colorscheme
|
|
||||||
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'},
|
|
||||||
},
|
|
||||||
numhl = false,
|
|
||||||
linehl = false,
|
|
||||||
watch_gitdir = {
|
|
||||||
interval = 1000
|
|
||||||
},
|
|
||||||
sign_priority = 6,
|
|
||||||
update_debounce = 200,
|
|
||||||
status_formatter = nil, -- Use default
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
vim.api.nvim_set_keymap('n', 's', ":HopChar2<cr>", {silent = true})
|
|
||||||
vim.api.nvim_set_keymap('n', 'S', ":HopWord<cr>", {silent = true})
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
-- source plugin config
|
|
||||||
|
|
||||||
require('pluginconfig/barbar')
|
|
||||||
require('pluginconfig/dashboard-nvim')
|
|
||||||
require('pluginconfig/galaxyline')
|
|
||||||
require('pluginconfig/gitsigns')
|
|
||||||
require('pluginconfig/hop')
|
|
||||||
require('pluginconfig/mason')
|
|
||||||
require('pluginconfig/neodev') -- must before lspconfig
|
|
||||||
require('pluginconfig/mkdx')
|
|
||||||
require('pluginconfig/neotest')
|
|
||||||
require('pluginconfig/numb')
|
|
||||||
require('pluginconfig/nvim-autopairs')
|
|
||||||
require('pluginconfig/nvim-cmp')
|
|
||||||
require('pluginconfig/nvim-colorizer')
|
|
||||||
require('pluginconfig/nvim-lint')
|
|
||||||
require('pluginconfig/fzf-lua')
|
|
||||||
require('pluginconfig/nvim-tree') -- This plugin must be required somewhere before colorscheme. Placing it after will break navigation keymappings
|
|
||||||
require('pluginconfig/nvim-treesitter')
|
|
||||||
require('pluginconfig/rnvimr')
|
|
||||||
require('pluginconfig/symbols-outline')
|
|
||||||
require('pluginconfig/telescope')
|
|
||||||
require('pluginconfig/toggleterm')
|
|
||||||
require('pluginconfig/vim-matchup')
|
|
||||||
require('pluginconfig/which-key')
|
|
||||||
|
|
||||||
|
|
||||||
-- nvim_comment
|
|
||||||
require('nvim_comment').setup()
|
|
||||||
|
|
||||||
-- lsp-rooter
|
|
||||||
require("lsp-rooter").setup {
|
|
||||||
-- your configuration comes here
|
|
||||||
-- or leave it empty to use the default settings
|
|
||||||
-- refer to the configuration section below
|
|
||||||
}
|
|
||||||
|
|
||||||
-- lsp signature
|
|
||||||
require("lsp_signature").setup()
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
require("mason").setup()
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
vim.cmd([[
|
|
||||||
let g:mkdx#settings = { 'highlight': { 'enable': 1 },
|
|
||||||
\ 'enter': { 'shift': 1 },
|
|
||||||
\ 'links': { 'external': { 'enable': 1 } },
|
|
||||||
\ 'toc': { 'text': 'Table of Contents', 'update_on_write': 1 },
|
|
||||||
\ 'fold': { 'enable': 1 } }
|
|
||||||
]])
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
require("neodev").setup({
|
|
||||||
-- add any options here, or leave empty to use the default settings
|
|
||||||
})
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
require("neotest").setup({
|
|
||||||
adapters = {
|
|
||||||
require("neotest-go")({
|
|
||||||
experimental = {
|
|
||||||
test_table = true,
|
|
||||||
},
|
|
||||||
args = { "-gcflags=all=-l", "-count=1", "-timeout=60s" }
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
require('numb').setup{
|
|
||||||
show_numbers = true, -- Enable 'number' for the window while peeking
|
|
||||||
show_cursorline = true -- Enable 'cursorline' for the window while peeking
|
|
||||||
}
|
|
||||||
@@ -1,123 +0,0 @@
|
|||||||
-- require('nvim-autopairs').setup()
|
|
||||||
-- local npairs = require('nvim-autopairs')
|
|
||||||
|
|
||||||
-- local function imap(lhs, rhs, opts)
|
|
||||||
-- local options = {noremap = false}
|
|
||||||
-- if opts then options = vim.tbl_extend('force', options, opts) end
|
|
||||||
-- vim.api.nvim_set_keymap('i', lhs, rhs, options)
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- _G.MUtils = {}
|
|
||||||
|
|
||||||
-- -- TEST
|
|
||||||
-- vim.g.completion_confirm_key = ""
|
|
||||||
-- MUtils.completion_confirm = function()
|
|
||||||
-- if vim.fn.pumvisible() ~= 0 then
|
|
||||||
-- if vim.fn.complete_info()["selected"] ~= -1 then
|
|
||||||
-- vim.fn["compe#confirm"]()
|
|
||||||
-- -- return npairs.esc("<c-y>")
|
|
||||||
-- return npairs.esc("")
|
|
||||||
-- else
|
|
||||||
-- vim.defer_fn(function()
|
|
||||||
-- vim.fn["compe#confirm"]("<cr>")
|
|
||||||
-- end, 20)
|
|
||||||
-- return npairs.esc("<c-n>")
|
|
||||||
-- end
|
|
||||||
-- else
|
|
||||||
-- return npairs.check_break_line_char()
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- -- TEST
|
|
||||||
|
|
||||||
-- MUtils.completion_confirm = function()
|
|
||||||
-- if vim.fn.pumvisible() ~= 0 then
|
|
||||||
-- if vim.fn.complete_info()["selected"] ~= -1 then
|
|
||||||
-- vim.fn["compe#confirm"]()
|
|
||||||
-- return npairs.esc("")
|
|
||||||
-- else
|
|
||||||
-- vim.api.nvim_select_popupmenu_item(0, false, false, {})
|
|
||||||
-- vim.fn["compe#confirm"]()
|
|
||||||
-- return npairs.esc("<c-n>")
|
|
||||||
-- end
|
|
||||||
-- else
|
|
||||||
-- return npairs.check_break_line_char()
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- MUtils.tab = function()
|
|
||||||
-- if vim.fn.pumvisible() ~= 0 then
|
|
||||||
-- return npairs.esc("<C-n>")
|
|
||||||
-- else
|
|
||||||
-- if vim.fn["vsnip#available"](1) ~= 0 then
|
|
||||||
-- vim.fn.feedkeys(string.format('%c%c%c(vsnip-expand-or-jump)', 0x80, 253, 83))
|
|
||||||
-- return npairs.esc("")
|
|
||||||
-- else
|
|
||||||
-- return npairs.esc("<Tab>")
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- MUtils.s_tab = function()
|
|
||||||
-- if vim.fn.pumvisible() ~= 0 then
|
|
||||||
-- return npairs.esc("<C-p>")
|
|
||||||
-- else
|
|
||||||
-- if vim.fn["vsnip#jumpable"](-1) ~= 0 then
|
|
||||||
-- vim.fn.feedkeys(string.format('%c%c%c(vsnip-jump-prev)', 0x80, 253, 83))
|
|
||||||
-- return npairs.esc("")
|
|
||||||
-- else
|
|
||||||
-- return npairs.esc("<C-h>")
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- -- Autocompletion and snippets
|
|
||||||
-- vim.api.nvim_set_keymap('i', '<CR>', 'v:lua.MUtils.completion_confirm()', {expr = true, noremap = true})
|
|
||||||
-- -- imap("<CR>", "v:lua.MUtils.completion_confirm()", {expr = true, noremap = true})
|
|
||||||
-- imap("<Tab>", "v:lua.MUtils.tab()", {expr = true, noremap = true})
|
|
||||||
-- imap("<S-Tab>", "v:lua.MUtils.s_tab()", {expr = true, noremap = true})
|
|
||||||
|
|
||||||
local remap = vim.api.nvim_set_keymap
|
|
||||||
local npairs = require('nvim-autopairs')
|
|
||||||
local Rule = require('nvim-autopairs.rule')
|
|
||||||
|
|
||||||
-- skip it, if you use another global object
|
|
||||||
_G.MUtils= {}
|
|
||||||
|
|
||||||
vim.g.completion_confirm_key = ""
|
|
||||||
MUtils.completion_confirm=function()
|
|
||||||
if vim.fn.pumvisible() ~= 0 then
|
|
||||||
if vim.fn.complete_info()["selected"] ~= -1 then
|
|
||||||
return vim.fn["compe#confirm"](npairs.esc("<cr>"))
|
|
||||||
else
|
|
||||||
return npairs.esc("<cr>")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
return npairs.autopairs_cr()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
remap('i' , '<CR>','v:lua.MUtils.completion_confirm()', {expr = true , noremap = true})
|
|
||||||
|
|
||||||
npairs.setup({
|
|
||||||
check_ts = true,
|
|
||||||
ts_config = {
|
|
||||||
lua = {'string'},-- it will not add pair on that treesitter node
|
|
||||||
javascript = {'template_string'},
|
|
||||||
java = false,-- don't check treesitter on java
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
require('nvim-treesitter.configs').setup {
|
|
||||||
autopairs = {enable = true}
|
|
||||||
}
|
|
||||||
|
|
||||||
local ts_conds = require('nvim-autopairs.ts-conds')
|
|
||||||
|
|
||||||
-- press % => %% is only inside comment or string
|
|
||||||
npairs.add_rules({
|
|
||||||
Rule("%", "%", "lua")
|
|
||||||
:with_pair(ts_conds.is_ts_node({'string','comment'})),
|
|
||||||
Rule("$", "$", "lua")
|
|
||||||
:with_pair(ts_conds.is_not_ts_node({'function'}))
|
|
||||||
})
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
local lspkind = require('lspkind')
|
|
||||||
local cmp = require 'cmp'
|
|
||||||
|
|
||||||
local function keymapping(cmp)
|
|
||||||
return {
|
|
||||||
-- 上一个
|
|
||||||
['<C-k>'] = cmp.mapping.select_prev_item(),
|
|
||||||
-- 下一个
|
|
||||||
['<C-j>'] = cmp.mapping.select_next_item(),
|
|
||||||
-- 出现补全
|
|
||||||
['<A-.>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
|
||||||
-- 取消
|
|
||||||
['<A-,>'] = cmp.mapping({
|
|
||||||
i = cmp.mapping.abort(),
|
|
||||||
c = cmp.mapping.close(),
|
|
||||||
}),
|
|
||||||
-- 确认
|
|
||||||
-- Accept currently selected item. If none selected, `select` first item.
|
|
||||||
-- Set `select` to `false` to only confirm explicitly selected items.
|
|
||||||
['<CR>'] = cmp.mapping.confirm({
|
|
||||||
select = true,
|
|
||||||
behavior = cmp.ConfirmBehavior.Replace
|
|
||||||
}),
|
|
||||||
-- ['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
|
||||||
['<C-u>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
|
||||||
['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
cmp.setup {
|
|
||||||
-- 指定 snippet 引擎
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
-- For `vsnip` users.
|
|
||||||
vim.fn["vsnip#anonymous"](args.body)
|
|
||||||
|
|
||||||
-- For `luasnip` users.
|
|
||||||
-- require('luasnip').lsp_expand(args.body)
|
|
||||||
|
|
||||||
-- For `ultisnips` users.
|
|
||||||
-- vim.fn["UltiSnips#Anon"](args.body)
|
|
||||||
|
|
||||||
-- For `snippy` users.
|
|
||||||
-- require'snippy'.expand_snippet(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
-- 来源
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'nvim_lsp' },
|
|
||||||
-- For vsnip users.
|
|
||||||
{ name = 'vsnip' },
|
|
||||||
-- For luasnip users.
|
|
||||||
-- { name = 'luasnip' },
|
|
||||||
--For ultisnips users.
|
|
||||||
-- { name = 'ultisnips' },
|
|
||||||
-- -- For snippy users.
|
|
||||||
-- { name = 'snippy' },
|
|
||||||
}, { { name = 'buffer' },
|
|
||||||
{ name = 'path' }
|
|
||||||
}),
|
|
||||||
|
|
||||||
-- 快捷键
|
|
||||||
mapping = keymapping(cmp),
|
|
||||||
-- 使用lspkind-nvim显示类型图标
|
|
||||||
formatting = {
|
|
||||||
format = lspkind.cmp_format({
|
|
||||||
with_text = true, -- do not show text alongside icons
|
|
||||||
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
|
|
||||||
before = function(entry, vim_item)
|
|
||||||
-- Source 显示提示来源
|
|
||||||
vim_item.menu = "[" .. string.upper(entry.source.name) .. "]"
|
|
||||||
return vim_item
|
|
||||||
end
|
|
||||||
})
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Use buffer source for `/`.
|
|
||||||
cmp.setup.cmdline('/', {
|
|
||||||
sources = {
|
|
||||||
{ name = 'buffer' }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Use cmdline & path source for ':'.
|
|
||||||
cmp.setup.cmdline(':', {
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'path' }
|
|
||||||
}, {
|
|
||||||
{ name = 'cmdline' }
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
require'colorizer'.setup(
|
|
||||||
{'*';},
|
|
||||||
{
|
|
||||||
RGB = true; -- #RGB hex codes
|
|
||||||
RRGGBB = true; -- #RRGGBB hex codes
|
|
||||||
RRGGBBAA = true; -- #RRGGBBAA hex codes
|
|
||||||
rgb_fn = true; -- CSS rgb() and rgba() functions
|
|
||||||
hsl_fn = true; -- CSS hsl() and hsla() functions
|
|
||||||
css = true; -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
|
|
||||||
css_fn = true; -- Enable all CSS *functions*: rgb_fn, hsl_fn
|
|
||||||
})
|
|
||||||
-- names = true; -- "Name" codes like Blue
|
|
||||||
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
local lint_lib = require('lint')
|
|
||||||
|
|
||||||
lint_lib.linters_by_ft = {
|
|
||||||
go = {'golangcilint'}
|
|
||||||
}
|
|
||||||
|
|
||||||
local golangcilint = lint_lib.linters.golangcilint
|
|
||||||
golangcilint.args = {
|
|
||||||
'run',
|
|
||||||
'--config',
|
|
||||||
'~/.dotfile/.golangci_strict.yml',
|
|
||||||
'--out-format',
|
|
||||||
'json',
|
|
||||||
}
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
|
||||||
callback = function()
|
|
||||||
require("lint").try_lint()
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
local function my_on_attach(bufnr)
|
|
||||||
local api = require "nvim-tree.api"
|
|
||||||
|
|
||||||
local function opts(desc)
|
|
||||||
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
|
||||||
end
|
|
||||||
|
|
||||||
-- default mappings
|
|
||||||
api.config.mappings.default_on_attach(bufnr)
|
|
||||||
|
|
||||||
-- custom mappings
|
|
||||||
vim.keymap.set('n', '<C-t>', api.tree.change_root_to_parent, opts('Up'))
|
|
||||||
vim.keymap.set('n', '?', api.tree.toggle_help, opts('Help'))
|
|
||||||
vim.keymap.set('n', 'l', api.node.open.edit, opts('Edit'))
|
|
||||||
vim.keymap.set('n', 'h', api.node.navigate.parent_close, opts('Parent Close'))
|
|
||||||
vim.keymap.set('n', 's', api.node.open.horizontal, opts('Horizontal Split'))
|
|
||||||
vim.keymap.set('n', 'v', api.node.open.vertical, opts('Vertical Split'))
|
|
||||||
end
|
|
||||||
|
|
||||||
require'nvim-tree'.setup {
|
|
||||||
on_attach = my_on_attach,
|
|
||||||
disable_netrw = true,
|
|
||||||
hijack_netrw = true,
|
|
||||||
--auto_close = false,
|
|
||||||
filters = {
|
|
||||||
dotfiles = false,
|
|
||||||
custom = {}
|
|
||||||
},
|
|
||||||
git = {
|
|
||||||
enable = true,
|
|
||||||
ignore = false,
|
|
||||||
timeout = 500,
|
|
||||||
},
|
|
||||||
update_focused_file = {
|
|
||||||
-- enables the feature
|
|
||||||
enable = true,
|
|
||||||
-- update the root directory of the tree to the one of the folder containing the file if the file is not under the current root directory
|
|
||||||
-- only relevant when `update_focused_file.enable` is true
|
|
||||||
update_cwd = false,
|
|
||||||
-- list of buffer names / filetypes that will not update the cwd if the file isn't found under the current root directory
|
|
||||||
-- only relevant when `update_focused_file.update_cwd` is true and `update_focused_file.enable` is true
|
|
||||||
ignore_list = {}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
vim.g.nvim_tree_indent_markers = 1 -- "0 by default, this option shows indent markers when folders are open
|
|
||||||
vim.g.nvim_tree_auto_ignore_ft = 'startify' --empty by default, don't auto open tree on specific filetypes.
|
|
||||||
|
|
||||||
vim.g.nvim_tree_icons = {
|
|
||||||
default = '',
|
|
||||||
symlink = '',
|
|
||||||
git = {unstaged = "", staged = "✓", unmerged = "", renamed = "➜", untracked = ""},
|
|
||||||
folder = {default = "", open = "", empty = "", empty_open = "", symlink = ""}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
local treesitter = {
|
|
||||||
ensure_installed = "all",
|
|
||||||
highlight = { enabled = true },
|
|
||||||
playground = { enabled = true },
|
|
||||||
rainbow = { enabled = false },
|
|
||||||
}
|
|
||||||
|
|
||||||
require 'nvim-treesitter.configs'.setup {
|
|
||||||
ensure_installed = treesitter.ensure_installed, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
|
||||||
ignore_install = { "haskell", "markdown", "swift" },
|
|
||||||
matchup = {
|
|
||||||
enable = true, -- mandatory, false will disable the whole extension
|
|
||||||
-- disable = { "c", "ruby" }, -- optional, list of language that will be disabled
|
|
||||||
},
|
|
||||||
highlight = {
|
|
||||||
enable = true, -- false will disable the whole extension
|
|
||||||
disable = { "markdown" },
|
|
||||||
},
|
|
||||||
context_commentstring = {
|
|
||||||
enable = true,
|
|
||||||
config = {
|
|
||||||
css = '// %s'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
-- indent = {enable = true, disable = {"python", "html", "javascript"}},
|
|
||||||
-- TODO seems to be broken
|
|
||||||
indent = { enable = { "javascriptreact" } },
|
|
||||||
autotag = { enable = true },
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
-- Make Ranger replace netrw and be the file explorer
|
|
||||||
-- vim.g.rnvimr_ex_enable = 1
|
|
||||||
vim.g.rnvimr_draw_border = 1
|
|
||||||
vim.g.rnvimr_pick_enable = 1
|
|
||||||
vim.g.rnvimr_bw_enable = 1
|
|
||||||
vim.api.nvim_set_keymap('n', '-', ':RnvimrToggle<CR>', {noremap = true, silent = true})
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
require("symbols-outline").setup()
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
local actions = require('telescope.actions')
|
|
||||||
local trouble = require("trouble.providers.telescope")
|
|
||||||
-- Global remapping
|
|
||||||
------------------------------
|
|
||||||
-- '--color=never',
|
|
||||||
require('telescope').setup {
|
|
||||||
defaults = {
|
|
||||||
--find_command = {'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case'},
|
|
||||||
vimgrep_arguments = { 'rg', '--color=never', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case' },
|
|
||||||
-- prompt_prefix = " ",
|
|
||||||
prompt_prefix = " ",
|
|
||||||
selection_caret = " ",
|
|
||||||
entry_prefix = " ",
|
|
||||||
initial_mode = "insert",
|
|
||||||
-- initial_mode = "insert",
|
|
||||||
selection_strategy = "reset",
|
|
||||||
sorting_strategy = "descending",
|
|
||||||
layout_strategy = "horizontal",
|
|
||||||
layout_config= {horizontal = {mirror = false}, vertical = {mirror = false}, width = 0.75,prompt_position = "bottom", preview_cutoff = 120},
|
|
||||||
file_sorter = require'telescope.sorters'.get_fzy_sorter,
|
|
||||||
file_ignore_patterns = {},
|
|
||||||
generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter,
|
|
||||||
-- shorten_path = true,
|
|
||||||
path_display = {shroten = 2},
|
|
||||||
winblend = 0,
|
|
||||||
border = {},
|
|
||||||
borderchars = {'─', '│', '─', '│', '╭', '╮', '╯', '╰'},
|
|
||||||
color_devicons = true,
|
|
||||||
use_less = true,
|
|
||||||
set_env = {['COLORTERM'] = 'truecolor'}, -- default = nil,
|
|
||||||
file_previewer = require'telescope.previewers'.vim_buffer_cat.new,
|
|
||||||
grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new,
|
|
||||||
qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new,
|
|
||||||
|
|
||||||
-- Developer configurations: Not meant for general override
|
|
||||||
buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker,
|
|
||||||
mappings = {
|
|
||||||
i = {
|
|
||||||
["<C-c>"] = actions.close,
|
|
||||||
["<ESC>"] = actions.close,
|
|
||||||
["<C-j>"] = actions.move_selection_next,
|
|
||||||
["<C-k>"] = actions.move_selection_previous,
|
|
||||||
["<c-t>"] = trouble.open_with_trouble,
|
|
||||||
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
|
|
||||||
-- To disable a keymap, put [map] = false
|
|
||||||
-- So, to not map "<C-n>", just put
|
|
||||||
-- ["<c-x>"] = false,
|
|
||||||
-- ["<esc>"] = actions.close,
|
|
||||||
|
|
||||||
-- Otherwise, just set the mapping to the function that you want it to be.
|
|
||||||
-- ["<C-i>"] = actions.select_horizontal,
|
|
||||||
|
|
||||||
-- Add up multiple actions
|
|
||||||
["<CR>"] = actions.select_default + actions.center
|
|
||||||
|
|
||||||
-- You can perform as many actions in a row as you like
|
|
||||||
-- ["<CR>"] = actions.select_default + actions.center + my_cool_custom_action,
|
|
||||||
},
|
|
||||||
n = {
|
|
||||||
["<C-j>"] = actions.move_selection_next,
|
|
||||||
["<C-k>"] = actions.move_selection_previous,
|
|
||||||
["<c-t>"] = trouble.open_with_trouble,
|
|
||||||
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist
|
|
||||||
-- ["<C-i>"] = my_cool_custom_action,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
extensions = {
|
|
||||||
fzf = {
|
|
||||||
fuzzy = true, -- false will only do exact matching
|
|
||||||
override_generic_sorter = true, -- override the generic sorter
|
|
||||||
override_file_sorter = true, -- override the file sorter
|
|
||||||
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
|
||||||
-- the default case_mode is "smart_case"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
--require('telescope').load_extension('fzf')
|
|
||||||
require'telescope'.load_extension('project')
|
|
||||||
require("telescope").load_extension "file_browser"
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
require("toggleterm").setup {
|
|
||||||
-- size can be a number or function which is passed the current terminal
|
|
||||||
size = function(term)
|
|
||||||
if term.direction == "horizontal" then
|
|
||||||
return 15
|
|
||||||
elseif term.direction == "vertical" then
|
|
||||||
return vim.o.columns * 0.4
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
open_mapping = [[<c-\>]],
|
|
||||||
hide_numbers = true, -- hide the number column in toggleterm buffers
|
|
||||||
shade_filetypes = {},
|
|
||||||
shade_terminals = true,
|
|
||||||
shading_factor = '1', -- the degree by which to darken to terminal colour, default: 1 for dark backgrounds, 3 for light
|
|
||||||
start_in_insert = true,
|
|
||||||
insert_mappings = true, -- whether or not the open mapping applies in insert mode
|
|
||||||
persist_size = true,
|
|
||||||
-- direction = 'vertical' | 'horizontal' | 'window' | 'float',
|
|
||||||
direction = 'float',
|
|
||||||
close_on_exit = true, -- close the terminal window when the process exits
|
|
||||||
shell = vim.o.shell, -- change the default shell
|
|
||||||
-- This field is only relevant if direction is set to 'float'
|
|
||||||
float_opts = {
|
|
||||||
-- The border key is *almost* the same as 'nvim_open_win'
|
|
||||||
-- see :h nvim_open_win for details on borders however
|
|
||||||
-- the 'curved' border is a custom border type
|
|
||||||
-- not natively supported but implemented in this plugin.
|
|
||||||
-- border = 'single' | 'double' | 'shadow' | 'curved' -- ... other options supported by win open
|
|
||||||
border = 'single',
|
|
||||||
-- width = <value>,
|
|
||||||
-- height = <value>,
|
|
||||||
winblend = 3,
|
|
||||||
highlights = {
|
|
||||||
border = "Normal",
|
|
||||||
background = "Normal",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-- function _G.set_terminal_keymaps()
|
|
||||||
-- local opts = {noremap = true}
|
|
||||||
-- vim.api.nvim_buf_set_keymap(0, 't', '<esc>', [[<C-\><C-n>]], 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.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
vim.g.matchup_matchparen_offscreen = {method = 'popup'}
|
|
||||||
|
|
||||||
@@ -1,250 +0,0 @@
|
|||||||
require("which-key").setup {
|
|
||||||
plugins = {
|
|
||||||
marks = true, -- shows a list of your marks on ' and `
|
|
||||||
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
|
|
||||||
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
|
|
||||||
-- No actual key bindings are created
|
|
||||||
presets = {
|
|
||||||
operators = false, -- adds help for operators like d, y, ...
|
|
||||||
motions = false, -- adds help for motions
|
|
||||||
text_objects = false, -- help for text objects triggered after entering an operator
|
|
||||||
windows = true, -- default bindings on <c-w>
|
|
||||||
nav = true, -- misc bindings to work with windows
|
|
||||||
z = true, -- bindings for folds, spelling and others prefixed with z
|
|
||||||
g = true -- bindings for prefixed with g
|
|
||||||
}
|
|
||||||
},
|
|
||||||
icons = {
|
|
||||||
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
|
|
||||||
separator = "➜", -- symbol used between a key and it's label
|
|
||||||
group = "+" -- symbol prepended to a group
|
|
||||||
},
|
|
||||||
window = {
|
|
||||||
border = "single", -- none, single, double, shadow
|
|
||||||
position = "bottom", -- bottom, top
|
|
||||||
margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
|
|
||||||
padding = { 2, 2, 2, 2 } -- extra window padding [top, right, bottom, left]
|
|
||||||
},
|
|
||||||
layout = {
|
|
||||||
height = { min = 4, max = 25 }, -- min and max height of the columns
|
|
||||||
width = { min = 20, max = 50 }, -- min and max width of the columns
|
|
||||||
spacing = 3 -- spacing between columns
|
|
||||||
},
|
|
||||||
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate
|
|
||||||
show_help = true -- show help message on the command line when the popup is visible
|
|
||||||
}
|
|
||||||
|
|
||||||
local opts = {
|
|
||||||
mode = "n", -- NORMAL mode
|
|
||||||
prefix = "<leader>",
|
|
||||||
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
|
|
||||||
silent = true, -- use `silent` when creating keymaps
|
|
||||||
noremap = true, -- use `noremap` when creating keymaps
|
|
||||||
nowait = false -- use `nowait` when creating keymaps
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Set leader
|
|
||||||
vim.api.nvim_set_keymap('n', '<Space>', '<NOP>', { noremap = true, silent = true })
|
|
||||||
vim.g.mapleader = ' '
|
|
||||||
|
|
||||||
-- no hl
|
|
||||||
vim.api.nvim_set_keymap('n', '<Leader>h', ':set hlsearch!<CR>', { noremap = true, silent = true })
|
|
||||||
|
|
||||||
-- explorer
|
|
||||||
vim.api.nvim_set_keymap('n', '<Leader>e', ':NvimTreeToggle<CR>', { noremap = true, silent = true })
|
|
||||||
|
|
||||||
-- telescope
|
|
||||||
--vim.api.nvim_set_keymap('n', '<C-p>', ":lua require 'telescope'.extensions.file_browser.file_browser()<CR>", {noremap = true, silent = true})
|
|
||||||
-- vim.api.nvim_set_keymap('n', '<C-p>', ":lua require'telescope.builtin'.find_files()<CR>", {noremap = true, silent = true})
|
|
||||||
vim.api.nvim_set_keymap('n', '<C-p>', ":FzfLua files<CR>", { noremap = true, silent = true })
|
|
||||||
|
|
||||||
-- dashboard
|
|
||||||
vim.api.nvim_set_keymap('n', '<Leader>;', ':Dashboard<CR>', { noremap = true, silent = true })
|
|
||||||
|
|
||||||
-- Comments
|
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>b/", ":CommentToggle<CR>", { noremap = true, silent = true })
|
|
||||||
vim.api.nvim_set_keymap("v", "<Leader>b/", ":CommentToggle<CR>", { noremap = true, silent = true })
|
|
||||||
|
|
||||||
-- close buffer
|
|
||||||
vim.api.nvim_set_keymap("n", "<leader>c", ":BufferClose<CR>", { noremap = true, silent = true })
|
|
||||||
|
|
||||||
-- open projects
|
|
||||||
--vim.api.nvim_set_keymap('n', '<leader>p', ":lua require'telescope'.extensions.project.project{}<CR>", {noremap = true, silent = true})
|
|
||||||
-- vim.api.nvim_set_keymap('n', '<leader>p', ":lua require 'telescope'.extensions.file_browser.file_browser()<CR>", {noremap = true, silent = true})
|
|
||||||
-- TODO create entire treesitter section
|
|
||||||
|
|
||||||
local mappings = {
|
|
||||||
-- ["/"] = "Comment",
|
|
||||||
-- ["c"] = "Close Buffer",
|
|
||||||
["e"] = "Explorer",
|
|
||||||
-- ["f"] = "Find File",
|
|
||||||
["h"] = "No Highlight",
|
|
||||||
a = {
|
|
||||||
name = "+Action",
|
|
||||||
a = { "<cmd>@:<cr>", "execute last command again" }
|
|
||||||
},
|
|
||||||
b = {
|
|
||||||
name = "+Buffer",
|
|
||||||
n = { "<cmd>BufferNext<cr>", "next buffer" },
|
|
||||||
p = { "<cmd>BufferPrevious<cr>", "previous buffer" },
|
|
||||||
q = { "<cmd>q<cr>", "quit" },
|
|
||||||
s = { "<cmd>w<cr>", "save" },
|
|
||||||
r = { "<cmd>e!<cr>", "reload" },
|
|
||||||
d = { "<cmd>BufferClose<cr>", "close buffer" },
|
|
||||||
z = { "<cmd>CommentToggle<CR>", "toggle comment" },
|
|
||||||
},
|
|
||||||
D = {
|
|
||||||
name = "+Diagnostics",
|
|
||||||
t = { "<cmd>TroubleToggle<cr>", "trouble" },
|
|
||||||
w = { "<cmd>TroubleToggle lsp_workspace_diagnostics<cr>", "workspace" },
|
|
||||||
d = { "<cmd>TroubleToggle lsp_document_diagnostics<cr>", "document" },
|
|
||||||
q = { "<cmd>TroubleToggle quickfix<cr>", "quickfix" },
|
|
||||||
l = { "<cmd>TroubleToggle loclist<cr>", "loclist" },
|
|
||||||
r = { "<cmd>TroubleToggle lsp_references<cr>", "references" },
|
|
||||||
},
|
|
||||||
d = {
|
|
||||||
name = "+Debug",
|
|
||||||
-- b = {"<cmd>DebugToggleBreakpoint<cr>", "Toggle Breakpoint"},
|
|
||||||
-- c = {"<cmd>DebugContinue<cr>", "Continue"},
|
|
||||||
-- i = {"<cmd>DebugStepInto<cr>", "Step Into"},
|
|
||||||
-- o = {"<cmd>DebugStepOver<cr>", "Step Over"},
|
|
||||||
-- r = {"<cmd>DebugToggleRepl<cr>", "Toggle Repl"},
|
|
||||||
-- s = {"<cmd>DebugStart<cr>", "Start"}
|
|
||||||
d = { "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<cr>", "show diagnostics" },
|
|
||||||
|
|
||||||
c = { "<cmd>lua require'dap'.continue()<cr>", "continue" },
|
|
||||||
b = { ':lua require"dap".toggle_breakpoint()<CR>', "Toggle Breadpoint" },
|
|
||||||
j = { ':lua require"dap".step_over()<CR>', "step over" },
|
|
||||||
k = { ':lua require"dap".step_out()<CR>', "step out" },
|
|
||||||
l = { ':lua require"dap".step_into()<CR>', "step into" },
|
|
||||||
--<c-h>', ':lua require"dap".continue()<CR>')
|
|
||||||
u = { ':lua require"dap".up()<CR>', "up" },
|
|
||||||
-- d = {':lua require"dap".down()<CR>', "down"},
|
|
||||||
_ = { ':lua require"dap".disconnect();require"dap".stop();require"dap".run_last()<CR>', "disconnect" },
|
|
||||||
--r = {':lua require"dap".repl.open({}, "vsplit")<CR><C-w>l', "repl open"},
|
|
||||||
i = { ':lua require"dap.ui.variables".visual_hover()<CR>', "visual_hover" },
|
|
||||||
--? = {':lua require"dap.ui.variables".scopes()<CR>',"scopes"},
|
|
||||||
-- e = {':lua require"dap".set_exception_breakpoints({"all"})<CR>',"esception bp"},
|
|
||||||
-- a = {':lua require"debugHelper".attach()<CR>',"attach"},
|
|
||||||
-- A = {':lua require"debugHelper".attachToRemote()<CR>',"attach to remote"},
|
|
||||||
s = { ':lua local widgets=require"dap.ui.widgets";widgets.centered_float(widgets.scopes)<CR>', "centered_float" },
|
|
||||||
},
|
|
||||||
f = {
|
|
||||||
name = "+File",
|
|
||||||
m = { "<cmd>lua require'utils'.open_md()<cr>", "open a markdown file in vscode" },
|
|
||||||
s = { "<cmd>w<cr>", "save file" },
|
|
||||||
t = { "<cmd>NvimTreeToggle<cr>", "toggle nvim tree" },
|
|
||||||
r = { "<cmd>RnvimrToggle<cr>", "toggle rnvimr" },
|
|
||||||
y = { "<cmd>lua require'utils'.yank_filepath()<cr>", "copy the file path" },
|
|
||||||
d = { "<cmd>lua require'utils'.yank_file_dir()<cr>", "copy the file path" },
|
|
||||||
l = { "<cmd>NvimTreeFindFile<CR>", "find file" },
|
|
||||||
-- T = {"<cmd>let @+ = 'go test -v -run='+expand('<cword>')<cr>", "get current word in go test"},
|
|
||||||
},
|
|
||||||
g = {
|
|
||||||
name = "+Git",
|
|
||||||
m = {"<cmd>Gvdiff master:%<cr>", "Diff with master"},
|
|
||||||
j = { "<cmd>lua require 'gitsigns'.next_hunk()<cr>", "Next Hunk" },
|
|
||||||
k = { "<cmd>lua require 'gitsigns'.prev_hunk()<cr>", "Prev Hunk" },
|
|
||||||
l = { "<cmd>lua require 'gitsigns'.blame_line()<cr>", "Blame" },
|
|
||||||
p = { "<cmd>lua require 'gitsigns'.preview_hunk()<cr>", "Preview Hunk" },
|
|
||||||
r = { "<cmd>lua require 'gitsigns'.reset_hunk()<cr>", "Reset Hunk" },
|
|
||||||
R = { "<cmd>lua require 'gitsigns'.reset_buffer()<cr>", "Reset Buffer" },
|
|
||||||
s = { "<cmd>lua require 'gitsigns'.stage_hunk()<cr>", "Stage Hunk" },
|
|
||||||
S = { "<cmd>lua require 'gitsigns'.stage_buffer()<cr>", "Stage Buffer" },
|
|
||||||
u = {
|
|
||||||
"<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>",
|
|
||||||
"Undo Stage Hunk",
|
|
||||||
},
|
|
||||||
o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
|
|
||||||
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
|
|
||||||
c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" },
|
|
||||||
C = {
|
|
||||||
"<cmd>Telescope git_bcommits<cr>",
|
|
||||||
"Checkout commit(for current file)",
|
|
||||||
},
|
|
||||||
d = {
|
|
||||||
"<cmd>Gitsigns diffthis HEAD<cr>",
|
|
||||||
"Git Diff",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
l = {
|
|
||||||
name = "+Language",
|
|
||||||
a = { "<cmd>Lspsaga code_action<cr>", "Code Action" },
|
|
||||||
A = { "<cmd>Lspsaga range_code_action<cr>", "Selected Action" },
|
|
||||||
d = { "<cmd>Telescope lsp_document_diagnostics<cr>", "Document Diagnostics" },
|
|
||||||
D = { "<cmd>Telescope lsp_workspace_diagnostics<cr>", "Workspace Diagnostics" },
|
|
||||||
f = { "<cmd>LspFormatting<cr>", "Format" },
|
|
||||||
F = { "<cmd>Lspsaga lsp_finder<cr>", "LSP Finder" },
|
|
||||||
-- i = {"<cmd>Telescope lsp_implementations<cr>", "implement"},
|
|
||||||
i = { "<cmd>lua vim.lsp.buf.implementation()<cr>", "implement" },
|
|
||||||
l = { "<cmd>lua vim.lsp.buf.hover()<cr>", "hover" },
|
|
||||||
L = { "<cmd>Lspsaga show_line_diagnostics<cr>", "Line Diagnostics" },
|
|
||||||
k = { "<cmd>: LspRestart<cr>", "restart lsp server" },
|
|
||||||
n = { "<cmd>lua vim.lsp.diagnostic.goto_next()<cr>", "next diagnostic" },
|
|
||||||
o = { "<cmd>: SymbolsOutline<cr>", "symbols outline" },
|
|
||||||
p = { "<cmd>lua vim.lsp.diagnostic.goto_prev()<cr>", "prev diagnostic" },
|
|
||||||
P = { "<cmd>Lspsaga preview_definition<cr>", "Preview Definition" },
|
|
||||||
q = { "<cmd>Telescope quickfix<cr>", "Quickfix" },
|
|
||||||
r = { "<cmd>lua vim.lsp.buf.references()<cr>", "references" },
|
|
||||||
R = { "<cmd>Lspsaga rename<cr>", "Rename" },
|
|
||||||
t = { "<cmd>LspTypeDefinition<cr>", "Type Definition" },
|
|
||||||
x = { "<cmd>cclose<cr>", "Close Quickfix" },
|
|
||||||
s = { "<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols" },
|
|
||||||
S = { "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>", "Workspace Symbols" },
|
|
||||||
z = { "<cmd>LspInfo<cr>", "Info" },
|
|
||||||
[","] = { "<cmd>LspInstallInfo<cr>", "LSP servers" }
|
|
||||||
},
|
|
||||||
p = {
|
|
||||||
name = "Packer",
|
|
||||||
c = { "<cmd>PackerCompile<cr>", "Compile" },
|
|
||||||
i = { "<cmd>PackerInstall<cr>", "Install" },
|
|
||||||
s = { "<cmd>PackerSync<cr>", "Sync" },
|
|
||||||
S = { "<cmd>PackerStatus<cr>", "Status" },
|
|
||||||
u = { "<cmd>PackerUpdate<cr>", "Update" },
|
|
||||||
},
|
|
||||||
q = {
|
|
||||||
name = "quit",
|
|
||||||
q = { "<cmd>qall<cr>", "quit" },
|
|
||||||
},
|
|
||||||
s = {
|
|
||||||
name = "+Search",
|
|
||||||
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
|
|
||||||
-- c = {"<cmd>Telescope colorscheme<cr>", "Colorscheme"},
|
|
||||||
c = { "<cmd>:nohl<cr>", "no highlight" },
|
|
||||||
d = { "<cmd>Telescope lsp_document_diagnostics<cr>", "Document Diagnostics" },
|
|
||||||
D = { "<cmd>Telescope lsp_workspace_diagnostics<cr>", "Workspace Diagnostics" },
|
|
||||||
f = { "<cmd>Fzflua files<cr>", "Find File" },
|
|
||||||
m = { "<cmd>Telescope marks<cr>", "Marks" },
|
|
||||||
M = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
|
|
||||||
r = { "<cmd>FzfLua oldfiles<cr>", "Open Recent File" },
|
|
||||||
R = { "<cmd>Telescope registers<cr>", "Registers" },
|
|
||||||
t = { "<cmd>FzfLua live_grep<cr>", "Text" },
|
|
||||||
["#"] = { "<cmd>FzfLua grep_cword<cr>", "Search word under cursor" },
|
|
||||||
},
|
|
||||||
S = {
|
|
||||||
name = "+Session",
|
|
||||||
s = { "<cmd>SessionSave<cr>", "Save Session" },
|
|
||||||
l = { "<cmd>SessionLoad<cr>", "Load Session" },
|
|
||||||
},
|
|
||||||
t = {
|
|
||||||
name = "+Test",
|
|
||||||
a = { "<cmd>TestSuite -v -cover<cr>", "TestSuite" },
|
|
||||||
t = { "<cmd>lua require('neotest').run.run() <cr>", "TestNearest" },
|
|
||||||
f = { '<cmd>lua require("neotest").run.run(vim.fn.expand("%"))<cr>', "TestFile" },
|
|
||||||
c = { "<cmd>GoCover<cr>", "go coverage" },
|
|
||||||
C = { "<cmd>GoCoverClear<cr>", "go coverage clear" },
|
|
||||||
b = { "<cmd>lua require'dap'.toggle_breakpoint()<cr>", "set break point" },
|
|
||||||
r = { "<cmd>lua require'dap'.continue()<cr>", "continue" },
|
|
||||||
},
|
|
||||||
|
|
||||||
-- extras
|
|
||||||
z = {
|
|
||||||
name = "+Zen",
|
|
||||||
s = { "<cmd>TZBottom<cr>", "toggle status line" },
|
|
||||||
t = { "<cmd>TZTop<cr>", "toggle tab bar" },
|
|
||||||
z = { "<cmd>TZAtaraxis<cr>", "toggle zen" },
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
local wk = require("which-key")
|
|
||||||
wk.register(mappings, opts)
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
|
-- tabline
|
||||||
'romgrk/barbar.nvim',
|
'romgrk/barbar.nvim',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status
|
'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
return {
|
return {
|
||||||
|
-- for format
|
||||||
{
|
{
|
||||||
"stevearc/conform.nvim",
|
"stevearc/conform.nvim",
|
||||||
opts = {
|
opts = {
|
||||||
|
|||||||
@@ -76,7 +76,8 @@ end
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"nvim-cmp",
|
"nvim-cmp",
|
||||||
dependencies = {
|
enable = false,
|
||||||
|
dependencies = {
|
||||||
"hrsh7th/cmp-emoji",
|
"hrsh7th/cmp-emoji",
|
||||||
'hrsh7th/vim-vsnip',
|
'hrsh7th/vim-vsnip',
|
||||||
'hrsh7th/vim-vsnip-integ',
|
'hrsh7th/vim-vsnip-integ',
|
||||||
|
|||||||
Reference in New Issue
Block a user