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,9 +1,19 @@
return {
{
'windwp/nvim-autopairs',
event = 'InsertEnter',
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()
require('nvim-autopairs').setup {}
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
local cmp = require 'cmp'
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())

View file

@ -5,7 +5,7 @@ return {
cmd = { 'ConformInfo' },
keys = {
{
'<leader>f',
'<A-f>',
function()
require('conform').format { async = true, lsp_fallback = true }
end,
@ -25,7 +25,7 @@ return {
--[[ c = true, cpp = true ]]
}
return {
timeout_ms = 500,
timeout_ms = 3000,
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
}
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 {
{
'tzachar/highlight-undo.nvim',
config = function()
vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight when yanking (copying) text',
group = vim.api.nvim_create_augroup('highlight-yank', { clear = true }),
callback = function()
vim.highlight.on_yank { timeout = 200 }
end,
})
vim.api.nvim_set_hl(0, 'highlight-action', {
fg = '#dcd7ba',
bg = '#2d4f67',
default = true,
})
require('highlight-undo').setup {
duration = 200,
undo = {
lhs = 'u',
hlgroup = 'DiffAdd',
map = 'undo',
opts = {},
},
redo = {
lhs = '<C-r>',
hlgroup = 'DiffAdd',
map = 'redo',
opts = {},
},
}
end,
},
}
-- return {
-- {
-- 'tzachar/highlight-undo.nvim',
-- config = function()
-- vim.api.nvim_create_autocmd('TextYankPost', {
-- desc = 'Highlight when yanking (copying) text',
-- group = vim.api.nvim_create_augroup('highlight-yank', { clear = true }),
-- callback = function()
-- vim.highlight.on_yank { timeout = 200 }
-- end,
-- })
--
-- vim.api.nvim_set_hl(0, 'highlight-action', {
-- fg = '#dcd7ba',
-- bg = '#2d4f67',
-- default = true,
-- })
--
-- require('highlight-undo').setup {
-- duration = 200,
-- undo = {
-- lhs = 'u',
-- hlgroup = 'DiffAdd',
-- map = 'undo',
-- opts = {},
-- },
-- redo = {
-- lhs = '<C-r>',
-- hlgroup = 'DiffAdd',
-- map = 'redo',
-- opts = {},
-- },
-- }
-- end,
-- },
-- }
return {}

View file

@ -26,17 +26,55 @@ return {
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' },
{
'lukas-reineke/indent-blankline.nvim',
dependencies = { 'catppuccin/nvim' },
main = 'ibl',
opts = {
indent = vim.g.rainbow_delimiters,
exclude = {
filetypes = {
'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',
'WhoIsSethDaniel/mason-tool-installer.nvim',
'folke/lazydev.nvim',
'b0o/schemastore.nvim',
{ 'j-hui/fidget.nvim' },
},
config = function()
require('lazydev').setup {}
require('neoconf').setup {}
vim.diagnostic.config {
update_in_insert = true,
float = {
@ -21,6 +21,11 @@ return {
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
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
@ -48,6 +53,7 @@ return {
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.callHierarchy.dynamicRegistration = true
local lazyPlugins = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
local servers = {
@ -74,9 +80,39 @@ return {
},
},
},
jsonls = {},
yamlls = {},
jsonls = {
settings = {
json = {
schemas = require('schemastore').json.schemas(),
validate = {
enable = true,
},
},
},
},
yamlls = {
settings = {
yaml = {
schemas = require('schemastore').yaml.schemas(),
},
schemaStore = {
enable = true,
},
},
},
eslint_d = {},
pylsp = {
settings = {
pylsp = {
plugins = {
pycodestyle = {
ignore = { 'W391' },
maxLineLength = 120,
},
},
},
},
},
}
-- 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 {
{
'nvim-lualine/lualine.nvim',
@ -18,32 +43,41 @@ return {
component_separators = '',
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 = {
lualine_a = {
{
'mode',
separator = { left = '' },
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,
separator = { left = '', right = '' },
},
},
lualine_x = {
{
'lsp_progress',
display_components = { 'lsp_client_name', { 'title', 'percentage', 'message' } },
display_components = { 'lsp_client_name', 'spinner', { 'title', 'percentage', 'message' } },
colors = {
percentage = colors.gray,
title = colors.gray,
@ -52,35 +86,25 @@ return {
lsp_client_name = colors.purple,
use = true,
},
timer = {
progress_enddelay = 1500,
spinner = 1500,
lsp_client_enddelay = 2500,
},
},
},
lualine_z = {
{
'location',
separator = { right = '' },
left_padding = 2,
separator = { left = '', right = '' },
},
},
},
extensions = {
'oil',
get_oil_extension(),
'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,
},
}

View file

@ -30,6 +30,20 @@ return {
return MiniHipatterns.compute_hex_color_group(correct, 'bg')
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',
build = ':TSUpdate',
opts = {
ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' },
auto_install = true,
highlight = {

View file

@ -3,77 +3,33 @@ return {
dependencies = { 'nvim-tree/nvim-web-devicons' },
event = 'VimEnter',
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>',
mode = '',
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 = {
default_file_explorer = 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 = {
wrap = true,
signcolumn = 'yes',
-- signcolumn = '',
cursorcolumn = false,
foldcolumn = '0',
spell = false,
@ -88,29 +44,57 @@ return {
return name:match '.git'
end,
},
-- group = aug,
extensions = {
'oil',
},
},
config = function(_, opts)
local oil = require 'oil'
oil.setup(opts)
end,
init = function()
vim.api.nvim_create_autocmd('BufEnter', {
desc = 'Detect buffer and setup oil nnn flag',
-- group = aug,
pattern = '*',
nested = true,
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, {
pattern = 'oil://*',
callback = function(params)
local bufnr = params.buf
local _, filetype = pcall(vim.api.nvim_get_option_value, 'filetype', { buf = bufnr })
if filetype == 'oil' then
local val = require('fancyutil').get_oil_nnn(bufnr)
if val == nil then
vim.api.nvim_buf_set_var(bufnr, 'nnn', true)
end
if params.event == 'BufEnter' then
-- double Q to close window
vim.keymap.set('', 'qq', require('oil').close, { buffer = bufnr, desc = 'Close current window' })
-- toggle detailed list mode
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,
})

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' },
},
opts = {
enable = true,
enable = false,
options = {
-- If lualine is installed tabline will use separators configured in lualine by default.
-- 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_devicons = true, -- this shows devicons in buffer section
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,
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
show_tabs_only = false, -- this shows only tabs instead of tabs + buffers
},
extensions = {
'lazy',
},
},
config = function(_, opts)
require('tabline').setup(opts)

View file

@ -2,18 +2,11 @@ return {
{
'nvim-telescope/telescope.nvim',
event = 'VimEnter',
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim',
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
{
'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',
-- `cond` is a condition used to determine whether this plugin should be
-- installed and loaded.
cond = function()
return vim.fn.executable 'make' == 1
end,
@ -45,18 +38,21 @@ return {
-- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()`
require('telescope').setup {
-- You can put your default mappings / updates / etc. in here
-- All the info you're looking for is in `:help telescope.setup()`
--
-- defaults = {
-- mappings = {
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
-- },
-- },
-- pickers = {}
defaults = {
mappings = {
i = {
['<c-enter>'] = 'to_fuzzy_refine',
},
n = {
['qq'] = 'close',
},
},
dynamic_preview_title = true,
},
pickers = {},
extensions = {
['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, 'noice')
pcall(require('telescope').load_extension, 'undo')
pcall(require('telescope').load_extension, 'yank_history')
-- See `:help 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>fk', builtin.keymaps, { desc = '[F]ind [K]eymaps' })
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>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>f.', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' })
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
vim.keymap.set('n', '<leader>f.', builtin.oldfiles, { desc = '[F]ind Recent Files [.]' })
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
vim.keymap.set('n', '<leader>/', function()
-- 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,
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',
opts = {
modes = {
preview_float = {
test = {
mode = 'diagnostics',
preview = {
type = 'float',
relative = 'editor',
border = 'rounded',
title = 'Preview',
title_pos = 'center',
position = { 0, -2 },
size = { width = 0.3, height = 0.3 },
zindex = 200,
relative = 'win',
type = 'split',
position = 'right',
size = 0.3,
},
},
},

View file

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