This commit is contained in:
sankalp committed 2024-10-26 13:37:00 +05:45
1 parent dd4e5e0cc4
commit bd932cf5e1
21 files changed
+7107 -55

No files matched your search

+1
View File
@@ -1,6 +1,7 @@
--Coding related
return {
{
'max397574/better-escape.nvim',
event = 'InsertEnter',
+94
View File
@@ -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,
})
+61 -4
View File
@@ -1,13 +1,17 @@
-- Define nvim-lspconfig LSP servers here
local lsp_servers = {
'basedpyright',
-- 'basedpyright',
'pyright',
'pylsp',
'lua_ls',
'tsserver',
'ts_ls',
'tailwindcss',
'emmet_ls',
'bashls',
'jdtls',
'clangd',
'html',
'cssls',
}
local lspconfig = require('lspconfig')
@@ -115,20 +119,54 @@ mason_lspconfig.setup({
},
})
end,
['basedpyright'] = function()
['pyright'] = function()
-- configure pyright server (with special settings)
lspconfig['basedpyright'].setup({
lspconfig['pyright'].setup({
capabilities = capabilities,
settings = {
python = {
hint = { enable = true },
analysis = {
ignore = { '*' },
autoImportCompletions = false,
},
},
-- pyright = {
-- -- Using Ruff's import organizer
-- disableOrganizeImports = true,
-- },
},
handlers = {
['textDocument/publishDiagnostics'] = function() end,
},
})
end,
-- ['pylsp'] = function()
-- lspconfig['pylsp'].setup({
-- capabilities = capabilities,
-- settings = {
-- pylsp = {
-- plugins = {
-- autopep8 = {
-- enabled = true,
-- },
-- pycodestyle = {
-- enabled = true,
-- ignore = { 'E501', 'E231', 'W503' },
-- maxLineLength = 79,
-- },
-- pylint = {
-- enabled = true,
-- executable = 'pylint',
-- args = {
-- '--enable=W0611,W0614',
-- },
-- },
-- },
-- },
-- },
-- })
-- end,
['emmet_ls'] = function()
-- configure emmet language server
lspconfig['emmet_ls'].setup({
@@ -144,5 +182,24 @@ mason_lspconfig.setup({
},
})
end,
['cssls'] = function()
lspconfig.cssls.setup({
capabilities = capabilities,
settings = {
css = {
validate = true,
lint = {
unknownAtRules = 'ignore',
},
},
scss = {
validate = true,
lint = {
unknownAtRules = 'ignore',
},
},
},
})
end,
},
})
+6 -1
View File
@@ -86,7 +86,7 @@ local n_mappings = {
{ '<leader>ea', '<cmd>b#<cr>', desc = 'Alternate File' },
{ '<leader>ec', '<cmd>e $MYVIMRC<cr>', desc = 'Config' },
{
'<leader>ed',
'<leader>eC',
'<cmd>lua require("telescope.builtin").find_files({cwd = vim.fn.stdpath("config")})<cr>',
desc = 'Config Dir',
},
@@ -95,6 +95,10 @@ local n_mappings = {
{ '<leader>ef', '<cmd>Telescope file_browser<cr>', desc = 'File Browser' },
{ '<leader>em', '<cmd>e README.md<cr>', desc = 'Readme' },
{ '<leader>en', '<cmd>new<cr>', desc = 'New File' },
{ '<leader>ex', '<Cmd>!chmod +x %<CR>', desc = 'Make Current File Executable' },
{ '<leader>es', '<Cmd>w<CR>', desc = 'Save File' },
{ '<leader>ed', '<Cmd>!rm %<CR>', desc = 'Delete File' },
{ '<leader>eD', '<Cmd>!rm %<CR><Cmd>bdelete<CR>', desc = 'Delete File and Buffer' },
{ '<leader>f', group = ' Find' },
{ '<leader>ff', '<cmd>Telescope find_files<cr>', desc = 'Find Files (CWD)' },
@@ -318,6 +322,7 @@ local n_mappings = {
{ '<leader>t2', '<cmd>2ToggleTerm<cr>', desc = 'Toggle Terminal' },
{ '<leader>th', '<cmd>Sterm<cr>', desc = 'Horizontal Terminal' },
{ '<leader>tv', '<cmd>Vterm<cr>', desc = 'Vertical Terminal' },
{ '<leader>tc', '<Cmd>close<CR>', desc = 'Hide Terminal' },
{ '<leader>u', group = ' Test' },
{ '<leader>uc', '<cmd>lua require("neotest").run.run()<cr>', desc = 'Run Current Test' },
+4
View File
@@ -1,4 +1,8 @@
return {
{
'lambdalisue/suda.vim',
cmd = { 'SudaRead', 'SudaWrite' },
},
{
'nvim-neo-tree/neo-tree.nvim',
cmd = { 'Neotree' },
+7
View File
@@ -1,4 +1,11 @@
return {
{
'ggandor/leap.nvim',
-- event = { "BufAdd", "BufNewFile", "BufRead" },
config = function()
require('leap').add_default_mappings()
end,
},
{
'ThePrimeagen/refactoring.nvim',
config = function()
+22 -2
View File
@@ -9,6 +9,8 @@ local formatting_servers = {
'php-cs-fixer',
'google-java-formatter',
'codespell',
'autoflake',
'djlint',
}
return {
@@ -38,6 +40,7 @@ return {
lua = { 'stylua' },
python = { 'isort', 'black' },
php = { 'php-cs-fixer' },
htmldjango = { 'djlint' },
java = { 'google-java-formatter' },
graphql = { 'prettier' },
liquid = { 'prettier' },
@@ -46,6 +49,23 @@ return {
['*'] = { 'codespell' },
['_'] = { 'trim_whitespace' },
},
formatters = {
prettier = {
javascript = {
args = { '--single-quote' },
},
},
isort = {
python = {
args = { '--profile', 'black' },
},
},
black = {
python = {
args = { '--fast', '--line-length', '80' },
},
},
},
format_on_save = function(bufnr)
-- Disable with a global or buffer-local variable
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
@@ -54,7 +74,7 @@ return {
return {
lsp_fallback = true,
async = false,
timeout_ms = 500,
timeout_ms = 2500,
}
end,
})
@@ -63,7 +83,7 @@ return {
conform.format({
lsp_fallback = true,
async = true,
timeout_ms = 1000,
timeout_ms = 2500,
})
end, { desc = 'Format file or range (in visual mode)' })
+1
View File
@@ -7,6 +7,7 @@ local linting_servers = {
'trivy',
'phpcs',
'markdownlint',
'pylint',
}
return {