wip
This commit is contained in:
1 parent
0499c3bc85
commit
f775a1ee88
10 files changed
+174
-17
No files matched your search
@@ -141,6 +141,11 @@ return {
|
||||
vim.keymap.set('n', '<leader>cI', '<cmd>CodeiumToggle<cr>', { desc = 'Toggle IA (Codeium)' })
|
||||
end,
|
||||
},
|
||||
{ -- Alternate
|
||||
'ton/vim-alternate',
|
||||
lazy = true,
|
||||
ft = { 'cpp', 'h', 'hpp', 'c' },
|
||||
},
|
||||
{
|
||||
'nacro90/numb.nvim',
|
||||
event = 'CmdlineEnter',
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
local alpha = require('alpha')
|
||||
local dashboard = require('alpha.themes.dashboard')
|
||||
|
||||
dashboard.section.header.val = {
|
||||
[[ ]],
|
||||
[[ ]],
|
||||
[[ ████ ██████ █████ ██ ]],
|
||||
[[ ███████████ █████ ]],
|
||||
[[ █████████ ███████████████████ ███ ███████████ ]],
|
||||
[[ █████████ ███ █████████████ █████ ██████████████ ]],
|
||||
[[ █████████ ██████████ █████████ █████ █████ ████ █████ ]],
|
||||
[[ ███████████ ███ ███ █████████ █████ █████ ████ █████ ]],
|
||||
[[ ██████ █████████████████████ ████ █████ █████ ████ ██████ ]],
|
||||
[[ ]],
|
||||
}
|
||||
dashboard.section.header.opts.hl = 'AlphaHeader'
|
||||
|
||||
local function button(sc, txt, leader_txt, keybind, keybind_opts)
|
||||
local sc_after = sc:gsub('%s', ''):gsub(leader_txt, '<leader>')
|
||||
|
||||
local opts = {
|
||||
position = 'center',
|
||||
shortcut = sc,
|
||||
cursor = 5,
|
||||
width = 36,
|
||||
align_shortcut = 'right',
|
||||
hl_shortcut = 'AlphaShortcut',
|
||||
}
|
||||
|
||||
if nil == keybind then
|
||||
keybind = sc_after
|
||||
end
|
||||
|
||||
keybind_opts = vim.F.if_nil(keybind_opts, { noremap = true, silent = true, nowait = true })
|
||||
opts.keymap = { 'n', sc_after, keybind, keybind_opts }
|
||||
|
||||
local function on_press()
|
||||
local key = vim.api.nvim_replace_termcodes(sc_after .. '<Ignore>', true, false, true)
|
||||
vim.api.nvim_feedkeys(key, 't', false)
|
||||
end
|
||||
|
||||
return {
|
||||
type = 'button',
|
||||
val = txt,
|
||||
on_press = on_press,
|
||||
opts = opts,
|
||||
}
|
||||
end
|
||||
|
||||
local leader = ' '
|
||||
dashboard.section.buttons.val = {
|
||||
button('space f f', ' Find File ', leader, ':Telescope find_files<CR>'),
|
||||
button('space f h', ' Find Hidden File ', leader, ':Telescope find_files hidden=true no_ignore=true<CR>'),
|
||||
button('space f o', ' Recent File ', leader, ':Telescope oldfiles<CR>'),
|
||||
button('space f w', ' Find Word ', leader, ':Telescope live_grep<CR>'),
|
||||
button('space f n', ' New File ', leader, ':ene <BAR> startinsert <CR>'),
|
||||
button('space n', ' Settings', leader, ':e $MYVIMRC | :cd %:p:h <CR>'),
|
||||
button('space l', ' Lazy', leader, ':Lazy<CR>'),
|
||||
button('space q', ' Quit', leader, ':qa<CR>'),
|
||||
}
|
||||
dashboard.section.buttons.opts.hl = 'String'
|
||||
|
||||
local function footer()
|
||||
local stats = require('lazy').stats()
|
||||
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
|
||||
return ' Have fun with Neovim' .. ' Neovim loaded ' .. stats.count .. ' plugins in ' .. ms .. 'ms'
|
||||
end
|
||||
|
||||
dashboard.section.footer.val = footer()
|
||||
dashboard.section.footer.opts.hl = 'AlphaFooter'
|
||||
|
||||
local head_butt_padding = 2
|
||||
local occu_height = #dashboard.section.header.val + 2 * #dashboard.section.buttons.val + head_butt_padding
|
||||
local header_padding = math.max(0, math.ceil((vim.fn.winheight('$') - occu_height) * 0.40))
|
||||
local foot_butt_padding = 1
|
||||
|
||||
dashboard.config.layout = {
|
||||
{ type = 'padding', val = header_padding },
|
||||
dashboard.section.header,
|
||||
{ type = 'padding', val = head_butt_padding },
|
||||
dashboard.section.buttons,
|
||||
{ type = 'padding', val = foot_butt_padding },
|
||||
dashboard.section.footer,
|
||||
}
|
||||
|
||||
alpha.setup(dashboard.opts)
|
||||
|
||||
vim.api.nvim_create_autocmd('User', {
|
||||
pattern = 'LazyVimStarted',
|
||||
callback = function()
|
||||
dashboard.section.footer.val = footer()
|
||||
pcall(vim.cmd.AlphaRedraw)
|
||||
end,
|
||||
})
|
||||
@@ -14,7 +14,6 @@ dashboard.setup({
|
||||
config = {
|
||||
week_header = {
|
||||
enable = true,
|
||||
append = { '', icons.ui.Circle .. ' Learn, Make, Explore! ' .. icons.ui.Circle },
|
||||
},
|
||||
packages = { enable = true },
|
||||
project = { enable = true, limit = 8 },
|
||||
|
||||
@@ -18,7 +18,7 @@ local cmp_nvim_lsp = require('cmp_nvim_lsp')
|
||||
-- import mason_lspconfig plugin
|
||||
local mason_lspconfig = require('mason-lspconfig')
|
||||
|
||||
local keymap = vim.keymap -- for conciseness
|
||||
-- local keymap = vim.keymap -- for conciseness
|
||||
|
||||
-- vim.api.nvim_create_autocmd('LspAttach', {
|
||||
-- group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||
@@ -102,10 +102,15 @@ mason_lspconfig.setup({
|
||||
diagnostics = {
|
||||
globals = { 'vim' },
|
||||
},
|
||||
hint = { enable = true },
|
||||
completion = {
|
||||
callSnippet = 'Replace',
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand('$VIMRUNTIME/lua')] = true,
|
||||
[vim.fn.stdpath('config') .. '/lua'] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -173,7 +173,7 @@ lualine.setup({
|
||||
-- section_separators = '',
|
||||
theme = 'onedark',
|
||||
disabled_filetypes = {
|
||||
'dashboard',
|
||||
statusline = { 'neo-tree', 'alpha', 'dashboard', 'lspsagaoutline' },
|
||||
},
|
||||
},
|
||||
-- extensions = { 'quickfix', 'man', 'mason', 'lazy', 'toggleterm', 'nvim-tree' },
|
||||
|
||||
@@ -53,6 +53,7 @@ local n_mappings = {
|
||||
{ '<leader>bx', '<cmd>DapTerminate<cr>', desc = 'Exit' },
|
||||
|
||||
{ '<leader>c', group = ' Code' },
|
||||
{ '<leader>a', '<cmd>Alternate<cr>', desc = 'Toggle Alternate' },
|
||||
{ '<leader>cF', '<cmd>retab<cr>', desc = 'Fix Tabs' },
|
||||
{ '<leader>cP', '<cmd>CccConvert<cr>', desc = 'Convert Color' },
|
||||
{ '<leader>cR', '<cmd>ReloadConfig<cr>', desc = 'Reload Configs' },
|
||||
@@ -217,6 +218,17 @@ local n_mappings = {
|
||||
{ '<leader>on', '<cmd>set relativenumber!<cr>', desc = 'Relative Numbers' },
|
||||
{ '<leader>oo', '<cmd>Telescope vim_options<cr>', desc = 'All Options' },
|
||||
|
||||
{ '<leader>p', group = ' ScreenShot' },
|
||||
{ '<leader>py', '<cmd>CodeSnap<cr>', mode = 'x', desc = 'Save selected code snapshot into clipboard' },
|
||||
{ '<leader>ps', '<cmd>CodeSnapSave<cr>', mode = 'x', desc = 'Save selected code snapshot in ~/Pictures' },
|
||||
{
|
||||
'<leaderp>h',
|
||||
'<cmd>CodeSnapHighlight<cr>',
|
||||
mode = 'x',
|
||||
desc = 'Highlight and snapshot selected code into clipboard',
|
||||
},
|
||||
{ '<leader>pi', '<cmd>CodeSnapASCII<cr>', mode = 'x', desc = 'Save ASCII code snapshot into clipboard' },
|
||||
|
||||
{ '<leader>q', group = ' Quit' },
|
||||
{ '<leader>qa', '<cmd>qall<cr>', desc = 'Quit All' },
|
||||
{ '<leader>qc', '<cmd>bw<cr>', desc = 'Close Buffer' },
|
||||
@@ -228,6 +240,30 @@ local n_mappings = {
|
||||
{ '<leader>qw', '<cmd>wq<cr>', desc = 'Write and Quit' },
|
||||
|
||||
{ '<leader>r', group = ' Refactor' },
|
||||
{
|
||||
'<leader>rc',
|
||||
function()
|
||||
local file_name = vim.api.nvim_buf_get_name(0)
|
||||
local file_type = vim.bo.filetype
|
||||
|
||||
if file_type == 'c' then
|
||||
vim.cmd(':terminal gcc ' .. file_name .. '; ./a.out ')
|
||||
elseif file_type == 'python' then
|
||||
vim.cmd(':terminal python ' .. file_name)
|
||||
elseif file_type == 'java' then
|
||||
vim.cmd(':terminal javac ' .. file_name .. '; java ' .. file_name)
|
||||
elseif file_type == 'lua' then
|
||||
vim.cmd(':terminal lua ' .. file_name)
|
||||
-- elseif file_type == 'js' then
|
||||
-- vim.cmd(':terminal node ' .. file_name)
|
||||
-- elseif file_type == 'rust' then
|
||||
-- vim.cmd(':terminal rustc ' .. file_name .. '; ./a.out ')
|
||||
-- elseif file_type == 'ts' then
|
||||
-- vim.cmd(':terminal tsc ' .. file_name .. '; node ' .. file_name)
|
||||
end
|
||||
end,
|
||||
desc = 'Code Runner',
|
||||
},
|
||||
{
|
||||
'<leader>rR',
|
||||
"<Esc><cmd>lua require('telescope').extensions.refactoring.refactors()<CR>",
|
||||
|
||||
@@ -113,6 +113,21 @@ return {
|
||||
event = { 'VimEnter' },
|
||||
lazy = false,
|
||||
},
|
||||
{ -- Codesnap
|
||||
'mistricky/codesnap.nvim',
|
||||
lazy = true,
|
||||
build = 'make',
|
||||
opts = {
|
||||
save_path = '~/Pictures/screenshots/code',
|
||||
has_breadcrumbs = false,
|
||||
show_workspace = false,
|
||||
bg_theme = 'default',
|
||||
watermark = 'S4NKALP',
|
||||
code_font_family = 'Iosevka NF',
|
||||
code_font_size = 12,
|
||||
},
|
||||
cmd = { 'CodeSnap', 'CodeSnapSave', 'CodeSnapHighlight', 'CodeSnapASCII' },
|
||||
},
|
||||
{
|
||||
'mvllow/modes.nvim',
|
||||
event = { 'BufReadPost', 'BufNewFile' },
|
||||
|
||||
Reference in new issue
Block a user