diff --git a/after/plugin/keybinds.lua b/after/plugin/keybinds.lua index 4dc219c2..25e72bd3 100644 --- a/after/plugin/keybinds.lua +++ b/after/plugin/keybinds.lua @@ -1,9 +1,22 @@ -local map = vim.keymap.set +lcal map = vim.keymap.set -- The good 'ol keybinds -map('n', '', 'w', { noremap = true, silent = true, desc = 'File save' }) +map('n', '', 'ggVG', { noremap = true, silent = true }) +map('n', '', 'w', { noremap = true, desc = 'File save' }) map('n', '', '%y+', { desc = 'File copy whole' }) +-- Activate Ctrl+V as paste +map('c', '', 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' }, '', '"+p', { noremap = true, desc = 'Command paste' }) + -- Move between windows with arrows map('n', '', '', { desc = 'Move focus to the left window' }) map('n', '', '', { desc = 'Move focus to the right window' }) @@ -20,8 +33,12 @@ map('n', '', '', { desc = 'Move focus to the upper window' }) -- }) -- Keep cursor centered when PgUp & PgDown -map({ 'n', 'i', 'v' }, '', 'normal zz', { desc = 'Page up' }) -map({ 'n', 'i', 'v' }, '', 'normal zz', { desc = 'Page down' }) +map('n', '', '', { desc = 'Page down' }) +map('n', '', '', { desc = 'Page up' }) +map('n', '', 'zz', { desc = 'Half page down' }) +map('n', '', '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', '', 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' }, '', 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, }) diff --git a/doc/kickstart.txt b/doc/kickstart.txt index cb87ac3f..069f42bd 100644 --- a/doc/kickstart.txt +++ b/doc/kickstart.txt @@ -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: diff --git a/fancywrapper.ts b/fancywrapper.ts deleted file mode 100644 index cc3e560b..00000000 --- a/fancywrapper.ts +++ /dev/null @@ -1 +0,0 @@ -function FancyWrapper(ptr: NativePointer); diff --git a/init.lua b/init.lua index 1bd9f304..9bedbb35 100644 --- a/init.lua +++ b/init.lua @@ -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', '', 'nohlsearch') -- 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 diff --git a/lua/config/keybinds.lua b/lua/config/keybinds.lua new file mode 100644 index 00000000..91263fb1 --- /dev/null +++ b/lua/config/keybinds.lua @@ -0,0 +1,96 @@ +local map = vim.keymap.set + +-- The good 'ol keybinds +map('n', '', 'ggVG', { noremap = true, silent = true }) +map('n', '', 'w', { noremap = true, desc = 'File save' }) +map('n', '', '%y+', { desc = 'File copy whole' }) + +-- Activate Ctrl+V as paste +map('c', '', 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' }, '', '"+p', { noremap = true, desc = 'Command paste' }) + +-- Move between windows with arrows +map('n', '', '', { desc = 'Move focus to the left window' }) +map('n', '', '', { desc = 'Move focus to the right window' }) +map('n', '', '', { desc = 'Move focus to the lower window' }) +map('n', '', '', { desc = 'Move focus to the upper window' }) + +-- Double Q to close current window +--map('n', 'qq', 'q', { silent = true, desc = 'CLose window' }) +-- vim.api.nvim_create_autocmd('FileType', { +-- pattern = 'TelescopePrompt', +-- callback = function(params) +-- vim.keymap.set('', 'qq', '', { noremap = true, buffer = params.buf }) +-- end, +-- }) + +-- Keep cursor centered when PgUp & PgDown +map('n', '', '', { desc = 'Page down' }) +map('n', '', '', { desc = 'Page up' }) +map('n', '', 'zz', { desc = 'Half page down' }) +map('n', '', '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', '', 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' }, '', 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, +}) diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua index cc9a086f..0f213cd8 100644 --- a/lua/plugins/conform.lua +++ b/lua/plugins/conform.lua @@ -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 = { diff --git a/lua/plugins/cutlass.lua b/lua/plugins/cutlass.lua deleted file mode 100644 index d480e11b..00000000 --- a/lua/plugins/cutlass.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - { - 'gbprod/cutlass.nvim', - opts = { - cut_key = 'm', - }, - }, -} diff --git a/lua/plugins/git-signs.lua b/lua/plugins/git-signs.lua index e5269878..e9d81539 100644 --- a/lua/plugins/git-signs.lua +++ b/lua/plugins/git-signs.lua @@ -2,6 +2,7 @@ return { { 'lewis6991/gitsigns.nvim', opts = { + sign_priority = 1, signs = { add = { text = '+' }, change = { text = '~' }, diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index aba4fa3c..79c398a6 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -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, }, diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index b3386e4b..21cd6663 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -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 = { diff --git a/lua/plugins/lspsaga.lua b/lua/plugins/lspsaga.lua index 6b65605f..f95e0b31 100644 --- a/lua/plugins/lspsaga.lua +++ b/lua/plugins/lspsaga.lua @@ -1,5 +1,13 @@ return { { 'nvimdev/lspsaga.nvim', + after = 'nvim-lspconfig', + opts = {}, + config = function(_, opts) + opts = opts or {} + require 'lspconfig' + + print(opts) + end, }, } diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua index 668017e2..8b912133 100644 --- a/lua/plugins/lualine.lua +++ b/lua/plugins/lualine.lua @@ -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, diff --git a/lua/plugins/neogit.lua b/lua/plugins/neogit.lua new file mode 100644 index 00000000..83e802d6 --- /dev/null +++ b/lua/plugins/neogit.lua @@ -0,0 +1,11 @@ +return { + { + 'NeogitOrg/neogit', + dependencies = { + 'nvim-lua/plenary.nvim', + 'sindrets/diffview.nvim', + 'nvim-telescope/telescope.nvim', + }, + config = true, + }, +} diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua index c7ec8d1e..bdac0363 100644 --- a/lua/plugins/nvim-cmp.lua +++ b/lua/plugins/nvim-cmp.lua @@ -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, diff --git a/lua/plugins/nvim-notify.lua b/lua/plugins/nvim-notify.lua index 6cedbb69..62b7b978 100644 --- a/lua/plugins/nvim-notify.lua +++ b/lua/plugins/nvim-notify.lua @@ -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) diff --git a/lua/plugins/tabline.lua b/lua/plugins/tabline.lua deleted file mode 100644 index f1138648..00000000 --- a/lua/plugins/tabline.lua +++ /dev/null @@ -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, - }, -} diff --git a/lua/plugins/tiny-inline.lua b/lua/plugins/tiny-inline.lua new file mode 100644 index 00000000..0b11ec0d --- /dev/null +++ b/lua/plugins/tiny-inline.lua @@ -0,0 +1,9 @@ +return { + { + 'rachartier/tiny-inline-diagnostic.nvim', + event = 'VeryLazy', + config = function() + require('tiny-inline-diagnostic').setup() + end, + }, +} diff --git a/lua/plugins/trouble.lua b/lua/plugins/trouble.lua index d0888307..edce7b45 100644 --- a/lua/plugins/trouble.lua +++ b/lua/plugins/trouble.lua @@ -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', diff --git a/lua/plugins/wayland-noice.lua b/lua/plugins/wayland-noice.lua index 4082529e..88eda7ab 100644 --- a/lua/plugins/wayland-noice.lua +++ b/lua/plugins/wayland-noice.lua @@ -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', }, }, },