another day

This commit is contained in:
Iwaniuk Krzysztof 2024-06-19 00:41:29 +02:00
parent feb59d91c5
commit 1bbc50e3a9
27 changed files with 419 additions and 246 deletions

View File

@ -1,14 +1,48 @@
local map = vim.keymap.set
-- The good 'ol keybinds
map('n', '<C-s>', '<cmd>w<CR>', { noremap = true, silent = true, desc = 'File save' })
map('n', '<C-c>', '<cmd>%y+<CR>', { desc = 'File copy whole' })
-- Move between windows with arrows -- Move between windows with arrows
vim.keymap.set('n', '<C-Left>', '<C-w><C-h>', { desc = 'Move focus to the left window' }) map('n', '<C-Left>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
vim.keymap.set('n', '<C-Right>', '<C-w><C-l>', { desc = 'Move focus to the right window' }) map('n', '<C-Right>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
vim.keymap.set('n', '<C-Down>', '<C-w><C-j>', { desc = 'Move focus to the lower window' }) map('n', '<C-Down>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-Up>', '<C-w><C-k>', { desc = 'Move focus to the upper window' }) map('n', '<C-Up>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
-- Double Q to close current window
--map('n', 'qq', '<CMD>q<CR>', { silent = true, desc = 'CLose window' })
-- vim.api.nvim_create_autocmd('FileType', {
-- pattern = 'TelescopePrompt',
-- callback = function(params)
-- vim.keymap.set('', 'qq', '<Esc>', { noremap = true, buffer = params.buf })
-- end,
-- })
-- Keep cursor centered when PgUp & PgDown -- Keep cursor centered when PgUp & PgDown
vim.keymap.set({ 'n', 'i', 'v' }, '<PageUp>', '<PageUp>zz', { desc = 'Page up' }) map({ 'n', 'i', 'v' }, '<PageUp>', '<PageUp><CMD>normal zz<CR>', { desc = 'Page up' })
vim.keymap.set({ 'n', 'i', 'v' }, '<PageDown>', '<PageDown>zz', { desc = 'Page down' }) map({ 'n', 'i', 'v' }, '<PageDown>', '<PageDown><CMD>normal zz<CR>', { desc = 'Page down' })
-- Redirect command output and allow edit -- Redirect command output and allow edit
vim.keymap.set('c', '<S-CR>', function() map('c', '<S-CR>', function()
require('noice').redirect(vim.fn.getcmdline()) require('noice').redirect(vim.fn.getcmdline())
end, { desc = 'Redirect Cmdline' }) end, { desc = 'Redirect Cmdline' })
-- LSP specific mappings
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
callback = function(event)
local map = function(keys, fn, desc)
vim.keymap.set('n', keys, fn, { buffer = event.buf, desc = 'LSP: ' .. desc })
end
local builtin = require 'telescope.builtin'
map('gd', builtin.lsp_definitions, '[G]oto [D]efinition')
map('gr', builtin.lsp_references, '[G]oto [R]eferences')
map('gi', builtin.lsp_implementations, '[G]oto [I]mplementation')
map('gt', builtin.lsp_type_definitions, '[G]oto [T]ype Definition')
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclarations')
map('gic', builtin.lsp_incoming_calls, '[G]oto [I]ncoming [C]alls')
map('goc', builtin.lsp_outgoing_calls, '[G]oto [O]utgoing [C]alls')
end,
})

1
fancywrapper.ts Normal file
View File

@ -0,0 +1 @@
function FancyWrapper(ptr: NativePointer);

View File

@ -81,7 +81,7 @@ vim.opt.smartcase = true
vim.opt.signcolumn = 'yes' vim.opt.signcolumn = 'yes'
-- Decrease update time -- Decrease update time
vim.opt.updatetime = 125 vim.opt.updatetime = 250
-- Decrease mapped sequence wait time -- Decrease mapped sequence wait time
-- Displays which-key popup sooner -- Displays which-key popup sooner
@ -113,11 +113,14 @@ vim.opt.scrolloff = 10
vim.opt.hlsearch = true vim.opt.hlsearch = true
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>') vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
-- Diagnostic keymaps -- Add padding to Neovide only
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' }) if vim.g.neovide then
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' }) vim.g.neovide_padding_top = 4
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' }) vim.g.neovide_padding_bottom = 6
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) vim.g.neovide_padding_right = 12
vim.g.neovide_padding_left = 12
end
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier -- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which -- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
-- is not what someone will guess without a bit more experience. -- is not what someone will guess without a bit more experience.
@ -191,7 +194,7 @@ local opts = {
}, },
} }
require 'autocommand' require 'commands'
require 'fancyutil' require 'fancyutil'
require('lazy').setup('plugins', opts) require('lazy').setup('plugins', opts)
-- The line beneath this is called `modeline`. See `:help modeline` -- The line beneath this is called `modeline`. See `:help modeline`

View File

@ -1,11 +1,11 @@
-- init module -- init module
local _M = {} local _M = {}
--- @param bufnr integer | nil --- @param winnr integer | nil
--- @return true | false | nil --- @return true | false | nil
function _M.get_oil_nnn(bufnr) function _M.get_oil_nnn(winnr)
bufnr = bufnr or 0 winnr = winnr or 0
local ok, value = pcall(vim.api.nvim_buf_get_var, bufnr, 'nnn') local ok, value = pcall(vim.api.nvim_win_get_var, winnr, 'nnn')
if not ok then if not ok then
return nil return nil
end end
@ -14,6 +14,12 @@ function _M.get_oil_nnn(bufnr)
end end
return false return false
end end
vim.fn.get_oil_nnn = _M.get_oil_nnn
--- @param val boolean
--- @param winnr integer | nil
function _M.set_oil_nnn(val, winnr)
winnr = winnr or 0
vim.api.nvim_win_set_var(winnr, 'nnn', val)
end
return _M return _M

View File

@ -1,16 +1,15 @@
-- autopairs
-- https://github.com/windwp/nvim-autopairs
return { return {
'windwp/nvim-autopairs', {
event = 'InsertEnter', 'windwp/nvim-autopairs',
-- Optional dependency event = 'InsertEnter',
dependencies = { 'hrsh7th/nvim-cmp' }, -- Optional dependency
config = function() dependencies = { 'hrsh7th/nvim-cmp' },
require('nvim-autopairs').setup {} config = function()
-- If you want to automatically add `(` after selecting a function or method require('nvim-autopairs').setup {}
local cmp_autopairs = require 'nvim-autopairs.completion.cmp' -- If you want to automatically add `(` after selecting a function or method
local cmp = require 'cmp' local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) local cmp = require 'cmp'
end, cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
end,
},
} }

View File

@ -1,9 +1,19 @@
return { return {
{ {
'windwp/nvim-autopairs', 'windwp/nvim-autopairs',
event = 'InsertEnter',
dependencies = { 'hrsh7th/nvim-cmp' }, dependencies = { 'hrsh7th/nvim-cmp' },
opts = {
check_ts = true,
ts_config = {
lua = { 'string' }, -- it will not add a pair on that treesitter node
javascript = { 'template_string' },
java = false, -- don't check treesitter on java
},
enable_check_bracket_line = true,
},
config = function() config = function()
require('nvim-autopairs').setup {}
local cmp_autopairs = require 'nvim-autopairs.completion.cmp' local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
local cmp = require 'cmp' local cmp = require 'cmp'
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())

View File

@ -5,7 +5,7 @@ return {
cmd = { 'ConformInfo' }, cmd = { 'ConformInfo' },
keys = { keys = {
{ {
'<leader>f', '<A-f>',
function() function()
require('conform').format { async = true, lsp_fallback = true } require('conform').format { async = true, lsp_fallback = true }
end, end,
@ -25,7 +25,7 @@ return {
--[[ c = true, cpp = true ]] --[[ c = true, cpp = true ]]
} }
return { return {
timeout_ms = 500, timeout_ms = 3000,
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
} }
end, end,

8
lua/plugins/cutlass.lua Normal file
View File

@ -0,0 +1,8 @@
return {
{
'gbprod/cutlass.nvim',
opts = {
cut_key = 'm',
},
},
}

View File

@ -1,36 +1,37 @@
return { -- return {
{ -- {
'tzachar/highlight-undo.nvim', -- 'tzachar/highlight-undo.nvim',
config = function() -- config = function()
vim.api.nvim_create_autocmd('TextYankPost', { -- vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight when yanking (copying) text', -- desc = 'Highlight when yanking (copying) text',
group = vim.api.nvim_create_augroup('highlight-yank', { clear = true }), -- group = vim.api.nvim_create_augroup('highlight-yank', { clear = true }),
callback = function() -- callback = function()
vim.highlight.on_yank { timeout = 200 } -- vim.highlight.on_yank { timeout = 200 }
end, -- end,
}) -- })
--
vim.api.nvim_set_hl(0, 'highlight-action', { -- vim.api.nvim_set_hl(0, 'highlight-action', {
fg = '#dcd7ba', -- fg = '#dcd7ba',
bg = '#2d4f67', -- bg = '#2d4f67',
default = true, -- default = true,
}) -- })
--
require('highlight-undo').setup { -- require('highlight-undo').setup {
duration = 200, -- duration = 200,
undo = { -- undo = {
lhs = 'u', -- lhs = 'u',
hlgroup = 'DiffAdd', -- hlgroup = 'DiffAdd',
map = 'undo', -- map = 'undo',
opts = {}, -- opts = {},
}, -- },
redo = { -- redo = {
lhs = '<C-r>', -- lhs = '<C-r>',
hlgroup = 'DiffAdd', -- hlgroup = 'DiffAdd',
map = 'redo', -- map = 'redo',
opts = {}, -- opts = {},
}, -- },
} -- }
end, -- end,
}, -- },
} -- }
return {}

View File

@ -26,17 +26,55 @@ return {
which_key = true, which_key = true,
}, },
}, },
config = function(_, opts)
require('catppuccin').setup(opts)
local theme = require 'catppuccin.palettes.mocha'
local highlight = {
RainbowRed = theme.red,
RainbowYellow = theme.yellow,
RainbowBlue = theme.blue,
RainbowOrange = theme.peach,
RainbowGreen = theme.green,
RainbowViolet = theme.maroon,
RainbowCyan = theme.teal,
}
vim.g.rainbow_delimiters = { highlight = highlight }
end,
}, },
{ 'tpope/vim-sleuth' }, { 'tpope/vim-sleuth' },
{ {
'lukas-reineke/indent-blankline.nvim', 'lukas-reineke/indent-blankline.nvim',
dependencies = { 'catppuccin/nvim' },
main = 'ibl', main = 'ibl',
opts = { opts = {
indent = vim.g.rainbow_delimiters,
exclude = { exclude = {
filetypes = { filetypes = {
'dashboard', 'dashboard',
}, },
}, },
}, },
config = function(_, opts)
local hooks = require 'ibl.hooks'
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
for name, value in pairs(vim.g.rainbow_delimiters) do
vim.api.nvim_set_hl(0, name, { fg = value })
end
end)
opts.scope = {
highlight = {
'RainbowDelimiterRed',
'RainbowDelimiterYellow',
'RainbowDelimiterBlue',
'RainbowDelimiterOrange',
'RainbowDelimiterGreen',
'RainbowDelimiterViolet',
'RainbowDelimiterCyan',
},
}
-- require('ibl').setup(opts)
hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark)
end,
}, },
} }

View File

@ -6,11 +6,11 @@ return {
'williamboman/mason-lspconfig.nvim', 'williamboman/mason-lspconfig.nvim',
'WhoIsSethDaniel/mason-tool-installer.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim',
'folke/lazydev.nvim', 'folke/lazydev.nvim',
'b0o/schemastore.nvim',
{ 'j-hui/fidget.nvim' }, { 'j-hui/fidget.nvim' },
}, },
config = function() config = function()
require('lazydev').setup {} require('lazydev').setup {}
require('neoconf').setup {}
vim.diagnostic.config { vim.diagnostic.config {
update_in_insert = true, update_in_insert = true,
float = { float = {
@ -21,6 +21,11 @@ return {
virtual_text = false, virtual_text = false,
} }
vim.fn.sign_define('DiagnosticSignError', { text = '', texthl = 'DiagnosticSignError' })
vim.fn.sign_define('DiagnosticSignWarn', { text = '', texthl = 'DiagnosticSignWarn' })
vim.fn.sign_define('DiagnosticSignInfo', { text = '', texthl = 'DiagnosticSignInfo' })
vim.fn.sign_define('DiagnosticSignHint', { text = '', texthl = 'DiagnosticSignHint' })
-- function will be executed to configure the current buffer -- function will be executed to configure the current buffer
vim.api.nvim_create_autocmd('LspAttach', { vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
@ -48,6 +53,7 @@ return {
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
capabilities.textDocument.completion.completionItem.snippetSupport = true capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.callHierarchy.dynamicRegistration = true
local lazyPlugins = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' local lazyPlugins = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
local servers = { local servers = {
@ -74,9 +80,39 @@ return {
}, },
}, },
}, },
jsonls = {}, jsonls = {
yamlls = {}, settings = {
json = {
schemas = require('schemastore').json.schemas(),
validate = {
enable = true,
},
},
},
},
yamlls = {
settings = {
yaml = {
schemas = require('schemastore').yaml.schemas(),
},
schemaStore = {
enable = true,
},
},
},
eslint_d = {}, eslint_d = {},
pylsp = {
settings = {
pylsp = {
plugins = {
pycodestyle = {
ignore = { 'W391' },
maxLineLength = 120,
},
},
},
},
},
} }
-- You can press `g?` for help in this menu. -- You can press `g?` for help in this menu.

5
lua/plugins/lspsaga.lua Normal file
View File

@ -0,0 +1,5 @@
return {
{
'nvimdev/lspsaga.nvim',
},
}

View File

@ -1,3 +1,28 @@
local function get_oil_extension()
local oil_ext = vim.deepcopy(require 'lualine.extensions.oil')
oil_ext.sections.lualine_z = {
{
'mode',
separator = { left = '', right = '' },
fmt = function(mode, context)
local winnr = vim.fn.tabpagewinnr(context.tabnr)
local val = require('fancyutil').get_oil_nnn(winnr)
if val then
return 'nnn'
end
return mode
end,
color = function()
local val = require('fancyutil').get_oil_nnn()
if val then
return { fg = '#054fca', bg = '#ff98dd' }
end
end,
},
}
return oil_ext
end
return { return {
{ {
'nvim-lualine/lualine.nvim', 'nvim-lualine/lualine.nvim',
@ -18,32 +43,41 @@ return {
component_separators = '', component_separators = '',
section_separators = { left = '', right = '' }, section_separators = { left = '', right = '' },
}, },
tabline = {
lualine_a = {},
lualine_b = {},
lualine_c = {
'%=',
{
'filename',
file_status = true,
path = 3,
symbols = {
modified = '', -- Text to show when the file is modified.
readonly = '󰌾', -- Text to show when the file is non-modifiable or readonly.
unnamed = '[No Name]', -- Text to show for unnamed buffers.
newfile = '[New]', -- Text to show for newly created file before first write
},
},
},
lualine_x = {
{ 'filetype' },
{ 'fileformat' },
},
lualine_y = {},
lualine_z = {},
},
sections = { sections = {
lualine_a = { lualine_a = {
{ {
'mode', 'mode',
separator = { left = '' }, separator = { left = '', right = '' },
fmt = function(_, _)
-- local winnr = vim.fn.tab (context.tabnr)
-- vim.fn.winbufnr(winnr)
local val = require('fancyutil').get_oil_nnn()
if val then
return 'nnn'
end
end,
color = function(_)
local val = require('fancyutil').get_oil_nnn()
if val == true then
return { fg = '#054fca' }
end
return {}
end,
}, },
}, },
lualine_x = { lualine_x = {
{ {
'lsp_progress', 'lsp_progress',
display_components = { 'lsp_client_name', { 'title', 'percentage', 'message' } }, display_components = { 'lsp_client_name', 'spinner', { 'title', 'percentage', 'message' } },
colors = { colors = {
percentage = colors.gray, percentage = colors.gray,
title = colors.gray, title = colors.gray,
@ -52,35 +86,25 @@ return {
lsp_client_name = colors.purple, lsp_client_name = colors.purple,
use = true, use = true,
}, },
timer = {
progress_enddelay = 1500,
spinner = 1500,
lsp_client_enddelay = 2500,
},
}, },
}, },
lualine_z = { lualine_z = {
{ {
'location', 'location',
separator = { right = '' }, separator = { left = '', right = '' },
left_padding = 2,
}, },
}, },
}, },
extensions = { extensions = {
'oil', get_oil_extension(),
'lazy', 'lazy',
}, },
} }
-- vim.api.nvim_create_autocmd({ 'BufEnter' }, {
-- callback = function(ev)
-- local filetype = vim.api.nvim_get_option_value('filetype', { buf = ev.buf })
--
-- print(string.format('event fired: %s', filetype))
-- if filetype == 'oil' then
-- local ok, value = pcall(vim.api.nvim_buf_get_var, ev.buf, 'nnn')
-- if not ok then
-- vim.api.nvim_buf_set_var(ev.buf, 'nnn', true)
-- end
-- end
-- end,
-- })
end, end,
}, },
} }

View File

@ -30,6 +30,20 @@ return {
return MiniHipatterns.compute_hex_color_group(correct, 'bg') return MiniHipatterns.compute_hex_color_group(correct, 'bg')
end, end,
}, },
rgb = {
pattern = '()Rgb%(%s*%d+,%s*%d+,%s*%d+%s*%)()',
group = function(_, _, data)
local _, _, r, g, b = data.full_match:find 'Rgb%(%s*(%d+),%s*(%d+),%s*(%d+)%s*%)'
local correct = string.format('#%02x%02x%02x', r, g, b)
if correct:len() ~= 7 then
return
end
return MiniHipatterns.compute_hex_color_group(correct, 'bg')
end,
extmark_opts = {
priority = 210,
},
},
}, },
} }

View File

@ -1,6 +0,0 @@
return {
{
'folke/neoconf.nvim',
opts = {},
},
}

View File

@ -3,7 +3,6 @@ return {
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate', build = ':TSUpdate',
opts = { opts = {
ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' }, ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' },
auto_install = true, auto_install = true,
highlight = { highlight = {

View File

@ -3,77 +3,33 @@ return {
dependencies = { 'nvim-tree/nvim-web-devicons' }, dependencies = { 'nvim-tree/nvim-web-devicons' },
event = 'VimEnter', event = 'VimEnter',
keys = { keys = {
{
'qq',
function()
require('oil').close()
end,
mode = '',
desc = 'Close current window',
},
{
'<leader>tn',
function()
local val = require('fancyutil').get_oil_nnn()
if val == true then
vim.api.nvim_buf_set_var(bufnr, 'nnn', false)
elseif val == false then
vim.api.nvim_buf_set_var(bufnr, 'nnn', true)
end
end,
mode = '',
desc = '[T]oggle [n]nn Mode',
},
{ {
'~', '~',
'<CMD>Oil<CR>', '<CMD>Oil<CR>',
mode = '', mode = '',
desc = 'Open parent directory', desc = 'Open parent directory',
}, },
{
'<Left>',
function()
if require('oil.util').is_oil_bufnr(0) and require('fancyutil').get_oil_nnn() then
local oil = require 'oil'
local bufname = vim.api.nvim_buf_get_name(0)
local parent = oil.get_buffer_parent_url(bufname, true)
return oil.open(parent)
end
-- fallback to sending page up key
local keys = vim.api.nvim_replace_termcodes('<Left>', true, false, true)
vim.api.nvim_feedkeys(keys, 'n', false)
end,
mode = '',
desc = 'Move up the file tree',
},
{
'<Right>',
function()
local oil = require 'oil'
local entry = oil.get_cursor_entry()
local dir = oil.get_current_dir()
if entry and dir and require('fancyutil').get_oil_nnn() then
local path = dir .. entry.name
local stat = vim.loop.fs_stat(path)
if stat and stat.type == 'directory' then
return oil.open(path)
end
end
-- fallback to sending arrow key
local keys = vim.api.nvim_replace_termcodes('<Right>', true, false, true)
vim.api.nvim_feedkeys(keys, 'n', false)
end,
mode = '',
desc = 'Move down the file tree',
},
}, },
opts = { opts = {
default_file_explorer = true, default_file_explorer = true,
restore_window_options = true, restore_window_options = true,
keymaps = {
['gd'] = {
desc = 'Toggle file detail view',
callback = function()
vim.g.detail = not vim.g.detail
if vim.g.detail then
require('oil').set_columns { 'icon', 'permissions', 'size', 'mtime' }
else
require('oil').set_columns { 'icon' }
end
end,
},
},
win_options = { win_options = {
wrap = true, wrap = true,
signcolumn = 'yes', -- signcolumn = '',
cursorcolumn = false, cursorcolumn = false,
foldcolumn = '0', foldcolumn = '0',
spell = false, spell = false,
@ -88,29 +44,57 @@ return {
return name:match '.git' return name:match '.git'
end, end,
}, },
-- group = aug,
extensions = {
'oil',
},
}, },
config = function(_, opts)
local oil = require 'oil'
oil.setup(opts)
end,
init = function() init = function()
vim.api.nvim_create_autocmd('BufEnter', { vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, {
desc = 'Detect buffer and setup oil nnn flag', pattern = 'oil://*',
-- group = aug,
pattern = '*',
nested = true,
callback = function(params) callback = function(params)
local bufnr = params.buf local bufnr = params.buf
local _, filetype = pcall(vim.api.nvim_get_option_value, 'filetype', { buf = bufnr }) if params.event == 'BufEnter' then
if filetype == 'oil' then -- double Q to close window
local val = require('fancyutil').get_oil_nnn(bufnr) vim.keymap.set('', 'qq', require('oil').close, { buffer = bufnr, desc = 'Close current window' })
if val == nil then
vim.api.nvim_buf_set_var(bufnr, 'nnn', true) -- toggle detailed list mode
end vim.keymap.set('', '<leader>tnnn', function()
local fu = require 'fancyutil'
local winnr = 0
local val = fu.get_oil_nnn(winnr)
fu.set_oil_nnn(val ~= true, winnr)
end, { buffer = bufnr, desc = '[T]oggle [nnn] Mode' })
--- nnn move up file tree
vim.keymap.set('', '<Left>', function()
if require('oil.util').is_oil_bufnr(bufnr) and require('fancyutil').get_oil_nnn() then
local oil = require 'oil'
local bufname = vim.api.nvim_buf_get_name(bufnr)
local parent = oil.get_buffer_parent_url(bufname, true)
return oil.open(parent)
end
local keys = vim.api.nvim_replace_termcodes('<Left>', true, false, true)
vim.api.nvim_feedkeys(keys, 'n', false) -- send consumed keys
end, { buffer = bufnr, desc = 'Move up the file tree' })
-- nnn move down file tree
vim.keymap.set('', '<Right>', function()
local oil = require 'oil'
local entry = oil.get_cursor_entry()
local dir = oil.get_current_dir()
if entry and dir and require('fancyutil').get_oil_nnn(0) then
local path = dir .. entry.name
local stat = vim.loop.fs_stat(path)
if stat and stat.type == 'directory' then
return oil.open(path)
end
end
local keys = vim.api.nvim_replace_termcodes('<Right>', true, false, true)
vim.api.nvim_feedkeys(keys, 'n', false) -- send consumed keys
end, { buffer = bufnr, desc = 'Move down the file tree' })
return
end
local winnr = vim.fn.bufwinid(bufnr)
local val = require('fancyutil').get_oil_nnn(winnr)
if val == nil then
require('fancyutil').set_oil_nnn(true, winnr)
end end
end, end,
}) })

8
lua/plugins/rainbow.lua Normal file
View File

@ -0,0 +1,8 @@
return {
{
'HiPhish/rainbow-delimiters.nvim',
config = function(_, opts)
require('rainbow-delimiters.setup').setup {}
end,
},
}

6
lua/plugins/repeat.lua Normal file
View File

@ -0,0 +1,6 @@
return {
{
'tpope/vim-repeat',
event = 'VeryLazy',
},
}

View File

@ -6,7 +6,7 @@ return {
{ 'nvim-tree/nvim-web-devicons' }, { 'nvim-tree/nvim-web-devicons' },
}, },
opts = { opts = {
enable = true, enable = false,
options = { options = {
-- If lualine is installed tabline will use separators configured in lualine by default. -- If lualine is installed tabline will use separators configured in lualine by default.
-- These options can be used to override those settings. -- These options can be used to override those settings.
@ -16,13 +16,16 @@ return {
show_tabs_always = true, -- this shows tabs only when there are more than one tab or if the first tab is named show_tabs_always = true, -- this shows tabs only when there are more than one tab or if the first tab is named
show_devicons = true, -- this shows devicons in buffer section show_devicons = true, -- this shows devicons in buffer section
colored = true, colored = true,
show_bufnr = true, -- this appends [bufnr] to buffer section, show_bufnr = false, -- this appends [bufnr] to buffer section,
tabline_show_last_separator = true, tabline_show_last_separator = true,
show_filename_only = true, -- shows base filename only instead of relative path in filename show_filename_only = true, -- shows base filename only instead of relative path in filename
modified_icon = 'single', -- change the default modified icon modified_icon = '*', -- change the default modified icon
modified_italic = true, -- set to true by default; this determines whether the filename turns italic if modified modified_italic = true, -- set to true by default; this determines whether the filename turns italic if modified
show_tabs_only = false, -- this shows only tabs instead of tabs + buffers show_tabs_only = false, -- this shows only tabs instead of tabs + buffers
}, },
extensions = {
'lazy',
},
}, },
config = function(_, opts) config = function(_, opts)
require('tabline').setup(opts) require('tabline').setup(opts)

View File

@ -2,18 +2,11 @@ return {
{ {
'nvim-telescope/telescope.nvim', 'nvim-telescope/telescope.nvim',
event = 'VimEnter', event = 'VimEnter',
branch = '0.1.x',
dependencies = { dependencies = {
'nvim-lua/plenary.nvim', 'nvim-lua/plenary.nvim',
{ -- If encountering errors, see telescope-fzf-native README for installation instructions {
'nvim-telescope/telescope-fzf-native.nvim', 'nvim-telescope/telescope-fzf-native.nvim',
-- `build` is used to run some command when the plugin is installed/updated.
-- This is only run then, not every time Neovim starts up.
build = 'make', build = 'make',
-- `cond` is a condition used to determine whether this plugin should be
-- installed and loaded.
cond = function() cond = function()
return vim.fn.executable 'make' == 1 return vim.fn.executable 'make' == 1
end, end,
@ -45,18 +38,21 @@ return {
-- [[ Configure Telescope ]] -- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()` -- See `:help telescope` and `:help telescope.setup()`
require('telescope').setup { require('telescope').setup {
-- You can put your default mappings / updates / etc. in here defaults = {
-- All the info you're looking for is in `:help telescope.setup()` mappings = {
-- i = {
-- defaults = { ['<c-enter>'] = 'to_fuzzy_refine',
-- mappings = { },
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' }, n = {
-- }, ['qq'] = 'close',
-- }, },
-- pickers = {} },
dynamic_preview_title = true,
},
pickers = {},
extensions = { extensions = {
['ui-select'] = { ['ui-select'] = {
require('telescope.themes').get_dropdown(), require('telescope.themes').get_ivy(),
}, },
}, },
} }
@ -66,9 +62,12 @@ return {
pcall(require('telescope').load_extension, 'ui-select') pcall(require('telescope').load_extension, 'ui-select')
pcall(require('telescope').load_extension, 'noice') pcall(require('telescope').load_extension, 'noice')
pcall(require('telescope').load_extension, 'undo') pcall(require('telescope').load_extension, 'undo')
pcall(require('telescope').load_extension, 'yank_history')
-- See `:help telescope.builtin` -- See `:help telescope.builtin`
local builtin = require 'telescope.builtin' local builtin = require 'telescope.builtin'
local extensions = require('telescope').extensions
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = '[F]ind [H]elp' }) vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = '[F]ind [H]elp' })
vim.keymap.set('n', '<leader>fk', builtin.keymaps, { desc = '[F]ind [K]eymaps' }) vim.keymap.set('n', '<leader>fk', builtin.keymaps, { desc = '[F]ind [K]eymaps' })
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = '[F]ind [F]iles' }) vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = '[F]ind [F]iles' })
@ -77,13 +76,13 @@ return {
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = '[F]ind by [G]rep' }) vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = '[F]ind by [G]rep' })
vim.keymap.set('n', '<leader>fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' }) vim.keymap.set('n', '<leader>fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' })
vim.keymap.set('n', '<leader>fr', builtin.resume, { desc = '[F]ind [R]esume' }) vim.keymap.set('n', '<leader>fr', builtin.resume, { desc = '[F]ind [R]esume' })
vim.keymap.set('n', '<leader>f.', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' }) vim.keymap.set('n', '<leader>f.', builtin.oldfiles, { desc = '[F]ind Recent Files [.]' })
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' }) vim.keymap.set('n', '<leader>fy', extensions.yank_history.yank_history, { desc = '[F]ind [Y]ank History' })
-- Slightly advanced example of overriding default behavior and theme -- Slightly advanced example of overriding default behavior and theme
vim.keymap.set('n', '<leader>/', function() vim.keymap.set('n', '<leader>/', function()
-- You can pass additional configuration to Telescope to change the theme, layout, etc. -- You can pass additional configuration to Telescope to change the theme, layout, etc.
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { builtin.current_buffer_fuzzy_find(require('telescope.themes').get_ivy {
winblend = 10, winblend = 10,
previewer = false, previewer = false,
}) })

View File

@ -0,0 +1,20 @@
return {
{
'akinsho/toggleterm.nvim',
version = '*',
opts = {
size = 24,
open_mapping = [[<c-t>]],
},
init = function()
vim.api.nvim_create_autocmd('BufWinEnter', {
desc = 'Detect buffer and setup oil nnn flag',
pattern = 'term://*',
callback = function(params)
local winnr = vim.fn.bufwinid(params.buf)
vim.api.nvim_set_option_value('cursorline', false, { win = winnr })
end,
})
end,
},
}

View File

@ -3,17 +3,13 @@ return {
'folke/trouble.nvim', 'folke/trouble.nvim',
opts = { opts = {
modes = { modes = {
preview_float = { test = {
mode = 'diagnostics', mode = 'diagnostics',
preview = { preview = {
type = 'float', relative = 'win',
relative = 'editor', type = 'split',
border = 'rounded', position = 'right',
title = 'Preview', size = 0.3,
title_pos = 'center',
position = { 0, -2 },
size = { width = 0.3, height = 0.3 },
zindex = 200,
}, },
}, },
}, },

View File

@ -2,7 +2,7 @@ return {
{ {
'gbprod/yanky.nvim', 'gbprod/yanky.nvim',
opts = { opts = {
ystem_clipboard = { system_clipboard = {
sync_with_ring = true, sync_with_ring = true,
clipboard_register = nil, clipboard_register = nil,
}, },
@ -11,6 +11,9 @@ return {
on_yank = true, on_yank = true,
timer = 500, timer = 500,
}, },
preserve_cursor_position = {
enabled = true,
},
}, },
}, },
} }

View File

@ -17,7 +17,7 @@
commit_author: Some(Rgb(116, 199, 236)), commit_author: Some(Rgb(116, 199, 236)),
danger_fg: Some(Rgb(243, 139, 168)), danger_fg: Some(Rgb(243, 139, 168)),
push_gauge_bg: Some(Rgb(137, 180, 250)), push_gauge_bg: Some(Rgb(137, 180, 250)),
push_gauge_fg: some(Rgb(30, 30, 46)), push_gauge_fg: Some(Rgb(30, 30, 46)),
tag_fg: Some(Rgb(245, 224, 220)), tag_fg: Some(Rgb(245, 224, 220)),
branch_fg: Some(Rgb(148, 226, 213)) branch_fg: Some(Rgb(148, 226, 213))
) )

View File

@ -1,18 +0,0 @@
{
"neodev": {
"library": {
"enabled": true,
"plugins": ["neoconf.nvim", "nvim-lspconfig"]
}
},
"neoconf": {
"plugins": {
"lua_ls": {
"enabled": true
}
}
},
"lspconfig": {
"sumneko_lua": {}
}
}