some variety on macbook

This commit is contained in:
Iwaniuk Krzysztof 2024-07-01 01:36:56 +02:00
parent 1bbc50e3a9
commit 63e44654f1
19 changed files with 229 additions and 99 deletions

96
lua/config/keybinds.lua Normal file
View file

@ -0,0 +1,96 @@
local map = vim.keymap.set
-- The good 'ol keybinds
map('n', '<C-a>', 'ggVG', { noremap = true, silent = true })
map('n', '<C-s>', '<cmd>w<CR>', { noremap = true, desc = 'File save' })
map('n', '<C-c>', '<cmd>%y+<CR>', { desc = 'File copy whole' })
-- Activate Ctrl+V as paste
map('c', '<C-v>', function()
local pos = vim.fn.getcmdpos()
local text = vim.fn.getcmdline()
local lt = text:sub(1, pos - 1)
local rt = text:sub(pos)
local clip = vim.fn.getreg '+'
vim.fn.setcmdline(lt .. clip .. rt, pos + clip:len())
vim.cmd [[echo '' | redraw]]
end, { silent = true, noremap = true, desc = 'Command paste' })
map({ 'i', 'n' }, '<C-v>', '"+p', { noremap = true, desc = 'Command paste' })
-- Move between windows with arrows
map('n', '<C-Left>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
map('n', '<C-Right>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
map('n', '<C-Down>', '<C-w><C-j>', { desc = 'Move focus to the lower 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
map('n', '<PgDown>', '<C-d><C-d>', { desc = 'Page down' })
map('n', '<PgUp>', '<C-u><C-u>', { desc = 'Page up' })
map('n', '<C-d>', '<C-d>zz', { desc = 'Half page down' })
map('n', '<C-u>', '<C-u>zz', { desc = 'Half page up' })
map('n', 'n', 'nzzzv', { desc = 'so and so...' })
map('n', 'N', 'Nzzzv', { desc = 'so and so...' })
-- Redirect command output and allow edit
map('c', '<S-CR>', function()
require('noice').redirect(vim.fn.getcmdline())
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')
vim.keymap.set({ 'n', 'i' }, '<A-k>', vim.lsp.buf.hover, { noremap = true })
end,
})
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(event)
local gitsigns = require 'gitsigns'
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map('n', ']c', function()
if vim.wo.diff then
vim.cmd.normal { ']c', bang = true }
else
gitsigns.nav_hunk 'next'
end
end, { desc = 'Jump to next git [C]hange' })
map('n', '[c', function()
if vim.wo.diff then
vim.cmd.normal { '[c', bang = true }
else
gitsigns.nav_hunk 'prev'
end
end, { desc = 'Jump to previous git [C]hange' })
end,
})

View file

@ -17,8 +17,8 @@ return {
notify_on_error = true,
formatters_by_ft = {
lua = { 'stylua' },
javascript = { 'prettier' },
typescript = { 'prettier' },
javascript = { 'biome' },
typescript = { 'biome' },
},
format_on_save = function(bufnr)
local disable_filetypes = {

View file

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

View file

@ -2,6 +2,7 @@ return {
{
'lewis6991/gitsigns.nvim',
opts = {
sign_priority = 1,
signs = {
add = { text = '+' },
change = { text = '~' },

View file

@ -14,6 +14,14 @@ return {
gitsigns = true,
treesitter = true,
notify = true,
noice = true,
neogit = true,
lsp_saga = true,
native_lsp = {
enabled = true,
hints = { 'italic' },
},
rainbow_delimiters = true,
mini = {
enabled = true,
},
@ -55,6 +63,8 @@ return {
},
},
config = function(_, opts)
require('ibl').setup(opts)
local hooks = require 'ibl.hooks'
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
for name, value in pairs(vim.g.rainbow_delimiters) do
@ -62,18 +72,6 @@ return {
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

@ -19,13 +19,9 @@ return {
signs = true,
underline = true,
virtual_text = false,
severity_sort = true,
}
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 }),
@ -57,16 +53,24 @@ return {
local lazyPlugins = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
local servers = {
biome = {},
biome = {
settings = {
biome = {
single_file_support = true,
},
},
},
tsserver = {},
lua_ls = {
settings = {
Lua = {
runtime = {
version = 'LuaJIT',
pathStrict = true,
path = { '?.lua', '?/init.lua' },
},
workspace = {
checkthirdparty = { lazyPlugins },
checkThirdParty = false,
library = vim.tbl_extend('force', vim.api.nvim_get_runtime_file('', true), { vim.env.VIMRUNTIME }),
},
completion = {

View file

@ -1,5 +1,13 @@
return {
{
'nvimdev/lspsaga.nvim',
after = 'nvim-lspconfig',
opts = {},
config = function(_, opts)
opts = opts or {}
require 'lspconfig'
print(opts)
end,
},
}

View file

@ -1,5 +1,6 @@
local function get_oil_extension()
local oil_ext = vim.deepcopy(require 'lualine.extensions.oil')
oil_ext.sections.lualine_b = { { 'pwd' } }
oil_ext.sections.lualine_z = {
{
'mode',
@ -47,7 +48,7 @@ return {
lualine_a = {},
lualine_b = {},
lualine_c = {
'%=',
-- '%=',
{
'filename',
file_status = true,

11
lua/plugins/neogit.lua Normal file
View file

@ -0,0 +1,11 @@
return {
{
'NeogitOrg/neogit',
dependencies = {
'nvim-lua/plenary.nvim',
'sindrets/diffview.nvim',
'nvim-telescope/telescope.nvim',
},
config = true,
},
}

View file

@ -95,6 +95,11 @@ return {
{ name = 'nvim_lua' },
}, {
{ name = 'buffer' },
{ name = 'hrsh7th/nvim-cmp' },
{ name = 'hrsh7th/cmp-buffer' },
{ name = 'hrsh7th/cmp-path' },
{ name = 'hrsh7th/cmp-nvim-lsp' },
{ name = 'hrsh7th/cmp-nvim-lua' },
}),
}
end,

View file

@ -52,7 +52,7 @@ return {
notification = '%T',
notification_history = '%FT%T',
},
timeout = 5000,
timeout = 2500,
top_down = true,
max_height = function()
return math.floor(vim.o.lines * 0.75)

View file

@ -1,38 +0,0 @@
return {
{
'kdheepak/tabline.nvim',
dependencies = {
{ 'nvim-lualine/lualine.nvim' },
{ 'nvim-tree/nvim-web-devicons' },
},
opts = {
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.
component_separators = { '', '' },
section_separators = { '', '' },
max_bufferline_percent = 66, -- set to nil by default, and it uses vim.o.columns * 2/3
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 = 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 = '*', -- 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)
vim.cmd [[
set guioptions-=e " Use showtabline in gui vim
set sessionoptions+=tabpages,globals " store tabpages and globals in session
]]
end,
},
}

View file

@ -0,0 +1,9 @@
return {
{
'rachartier/tiny-inline-diagnostic.nvim',
event = 'VeryLazy',
config = function()
require('tiny-inline-diagnostic').setup()
end,
},
}

View file

@ -2,6 +2,15 @@ return {
{
'folke/trouble.nvim',
opts = {
use_diagnostic_signs = true,
signs = {
-- icons / text used for a diagnostic
error = '',
warning = '',
hint = '',
information = '',
other = '',
},
modes = {
test = {
mode = 'diagnostics',

View file

@ -20,7 +20,7 @@ return {
presets = {
bottom_search = true,
command_palette = true,
lsp_doc_border = false,
lsp_doc_border = true,
long_message_to_split = true,
inc_rename = true,
},
@ -81,13 +81,7 @@ return {
},
notify = {
enabled = true,
view = 'notify',
},
commands = {
search = {
view = 'popup',
filter = { kind = 'search' },
},
view = 'mini',
},
},
},