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

View File

@ -1,9 +1,22 @@
local map = vim.keymap.set
lcal 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-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' })
@ -20,8 +33,12 @@ map('n', '<C-Up>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
-- })
-- Keep cursor centered when PgUp & PgDown
map({ 'n', 'i', 'v' }, '<PageUp>', '<PageUp><CMD>normal zz<CR>', { desc = 'Page up' })
map({ 'n', 'i', 'v' }, '<PageDown>', '<PageDown><CMD>normal zz<CR>', { desc = 'Page down' })
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()
@ -44,5 +61,36 @@ vim.api.nvim_create_autocmd('LspAttach', {
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

@ -8,17 +8,4 @@ It is not:
- Complete framework for every plugin under the sun
- Place to add every plugin that could ever be useful
*kickstart-is*
It is:
- Somewhere that has a good start for the most common "IDE" type features:
- autocompletion
- goto-definition
- find references
- fuzzy finding
- and hinting at what more can be done :)
- A place to _kickstart_ your journey.
- You should fork this project and use/modify it so that it matches your
style and preferences. If you don't want to do that, there are probably
other projects that would fit much better for you (and that's great!)!
vim:tw=78:ts=8:ft=help:norl:

View File

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

View File

@ -91,6 +91,14 @@ vim.opt.timeoutlen = 300
vim.opt.splitright = true
vim.opt.splitbelow = true
-- Setup folding
vim.o.foldcolumn = '0'
vim.o.foldlevel = 99
vim.o.foldlevelstart = 99
vim.o.foldenable = true
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
vim.o.foldcolumn = '1'
-- Sets how neovim will display certain whitespace characters in the editor.
-- See `:help 'list'`
-- and `:help 'listchars'`
@ -115,10 +123,7 @@ vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
-- Add padding to Neovide only
if vim.g.neovide then
vim.g.neovide_padding_top = 4
vim.g.neovide_padding_bottom = 6
vim.g.neovide_padding_right = 12
vim.g.neovide_padding_left = 12
-- print
end
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
@ -196,6 +201,7 @@ local opts = {
require 'commands'
require 'fancyutil'
require 'config.keybinds'
require('lazy').setup('plugins', opts)
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

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',
},
},
},