Skip to content

Commit a8e4704

Browse files
committed
Updated nvim config.
1 parent c7d0ad1 commit a8e4704

File tree

5 files changed

+232
-61
lines changed

5 files changed

+232
-61
lines changed

init.lua

Lines changed: 188 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ vim.opt.showmode = false
115115
-- Sync clipboard between OS and Neovim.
116116
-- Remove this option if you want your OS clipboard to remain independent.
117117
-- See `:help 'clipboard'`
118-
vim.opt.clipboard = 'unnamedplus'
118+
vim.schedule(function()
119+
vim.opt.clipboard = 'unnamedplus'
120+
end)
119121

120122
-- Enable break indent
121123
vim.opt.breakindent = true
@@ -198,8 +200,8 @@ vim.keymap.set('n', '<C-d>', '<C-d>zz', { desc = 'Center cursor after down half
198200
vim.keymap.set('n', '<C-u>', '<C-u>zz', { desc = 'Center cursor after down half up' })
199201

200202
-- buffers
201-
vim.keymap.set("n", "<S-h>", "<cmd>bprevious<cr>", { desc = "Prev Buffer" })
202-
vim.keymap.set("n", "<S-l>", "<cmd>bnext<cr>", { desc = "Next Buffer" })
203+
vim.keymap.set('n', '<S-h>', '<cmd>bprevious<cr>', { desc = 'Prev Buffer' })
204+
vim.keymap.set('n', '<S-l>', '<cmd>bnext<cr>', { desc = 'Next Buffer' })
203205

204206
-- [[ Basic Autocommands ]]
205207
-- See `:help lua-guide-autocommands`
@@ -273,41 +275,40 @@ require('lazy').setup({
273275

274276
{
275277
'tpope/vim-fugitive',
276-
config = function()
277-
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
278-
279-
local Sefcik_Fugitive = vim.api.nvim_create_augroup("Sefcik_Fugitive", {})
280-
281-
local autocmd = vim.api.nvim_create_autocmd
282-
autocmd("BufWinEnter", {
283-
group = Sefcik_Fugitive,
284-
pattern = "*",
285-
callback = function()
286-
if vim.bo.ft ~= "fugitive" then
287-
return
288-
end
289-
290-
local bufnr = vim.api.nvim_get_current_buf()
291-
local opts = {buffer = bufnr, remap = false}
292-
vim.keymap.set("n", "<leader>P", function()
293-
vim.cmd.Git('push')
294-
end, opts)
295-
296-
-- rebase always
297-
vim.keymap.set("n", "<leader>p", function()
298-
vim.cmd.Git({'pull', '--rebase'})
299-
end, opts)
300-
301-
-- NOTE: It allows me to easily set the branch i am pushing and any tracking
302-
-- needed if i did not set the branch up correctly
303-
vim.keymap.set("n", "<leader>t", ":Git push -u origin ", opts);
304-
end,
305-
})
278+
config = function()
279+
vim.keymap.set('n', '<leader>gs', vim.cmd.Git)
280+
281+
local Sefcik_Fugitive = vim.api.nvim_create_augroup('Sefcik_Fugitive', {})
282+
283+
local autocmd = vim.api.nvim_create_autocmd
284+
autocmd('BufWinEnter', {
285+
group = Sefcik_Fugitive,
286+
pattern = '*',
287+
callback = function()
288+
if vim.bo.ft ~= 'fugitive' then
289+
return
290+
end
291+
292+
local bufnr = vim.api.nvim_get_current_buf()
293+
local opts = { buffer = bufnr, remap = false }
294+
vim.keymap.set('n', '<leader>P', function()
295+
vim.cmd.Git 'push'
296+
end, opts)
306297

298+
-- rebase always
299+
vim.keymap.set('n', '<leader>p', function()
300+
vim.cmd.Git { 'pull', '--rebase' }
301+
end, opts)
307302

308-
vim.keymap.set("n", "gu", "<cmd>diffget //2<CR>")
309-
vim.keymap.set("n", "gh", "<cmd>diffget //3<CR>")
310-
end
303+
-- NOTE: It allows me to easily set the branch i am pushing and any tracking
304+
-- needed if i did not set the branch up correctly
305+
vim.keymap.set('n', '<leader>t', ':Git push -u origin ', opts)
306+
end,
307+
})
308+
309+
vim.keymap.set('n', 'gu', '<cmd>diffget //2<CR>')
310+
vim.keymap.set('n', 'gh', '<cmd>diffget //3<CR>')
311+
end,
311312
},
312313

313314
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
@@ -329,21 +330,78 @@ require('lazy').setup({
329330
'folke/which-key.nvim',
330331
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
331332
config = function() -- This is the function that runs, AFTER loading
332-
require('which-key').setup()
333+
local wk = require 'which-key'
334+
335+
wk.setup()
333336

334337
-- Document existing key chains
335-
require('which-key').register {
336-
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
337-
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
338-
['<leader>h'] = { name = '[H]arpoon', _ = 'which_key_ignore' },
339-
['<leader>l'] = { name = '[L]azy Git', _ = 'which_key_ignore' },
340-
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
341-
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
342-
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
338+
wk.add {
339+
{ '<leader>c', desc = '[C]ode' },
340+
{ '<leader>d', desc = '[D]ocument' },
341+
{ '<leader>h', desc = '[H]arpoon' },
342+
{ '<leader>l', desc = '[L]azy Git' },
343+
{ '<leader>r', desc = '[R]ename' },
344+
{ '<leader>s', desc = '[S]earch' },
345+
{ '<leader>w', desc = '[W]orkspace' },
343346
}
344347
end,
345348
},
346349

350+
{ -- Useful plugin to show you pending keybinds.
351+
'folke/which-key.nvim',
352+
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
353+
opts = {
354+
icons = {
355+
-- set icon mappings to true if you have a Nerd Font
356+
mappings = vim.g.have_nerd_font,
357+
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
358+
-- default whick-key.nvim defined Nerd Font icons, otherwise define a string table
359+
keys = vim.g.have_nerd_font and {} or {
360+
Up = '<Up> ',
361+
Down = '<Down> ',
362+
Left = '<Left> ',
363+
Right = '<Right> ',
364+
C = '<C-…> ',
365+
M = '<M-…> ',
366+
D = '<D-…> ',
367+
S = '<S-…> ',
368+
CR = '<CR> ',
369+
Esc = '<Esc> ',
370+
ScrollWheelDown = '<ScrollWheelDown> ',
371+
ScrollWheelUp = '<ScrollWheelUp> ',
372+
NL = '<NL> ',
373+
BS = '<BS> ',
374+
Space = '<Space> ',
375+
Tab = '<Tab> ',
376+
F1 = '<F1>',
377+
F2 = '<F2>',
378+
F3 = '<F3>',
379+
F4 = '<F4>',
380+
F5 = '<F5>',
381+
F6 = '<F6>',
382+
F7 = '<F7>',
383+
F8 = '<F8>',
384+
F9 = '<F9>',
385+
F10 = '<F10>',
386+
F11 = '<F11>',
387+
F12 = '<F12>',
388+
},
389+
},
390+
391+
-- Document existing key chains
392+
spec = {
393+
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
394+
{ '<leader>d', group = '[D]ocument' },
395+
{ '<leader>r', group = '[R]ename' },
396+
{ '<leader>s', group = '[S]earch' },
397+
{ '<leader>w', group = '[W]orkspace' },
398+
{ '<leader>t', group = '[T]oggle' },
399+
{ '<leader>h', group = '[H]arpoon' },
400+
{ '<leader>l', group = '[L]azy Git' },
401+
},
402+
},
403+
},
404+
347405
-- NOTE: Plugins can specify dependencies.
348406
--
349407
-- The dependencies are proper plugin specifications as well - anything
@@ -522,7 +580,7 @@ require('lazy').setup({
522580
'neovim/nvim-lspconfig',
523581
dependencies = {
524582
-- Automatically install LSPs and related tools to stdpath for Neovim
525-
'williamboman/mason.nvim',
583+
{ 'williamboman/mason.nvim', config = true },
526584
'williamboman/mason-lspconfig.nvim',
527585
'WhoIsSethDaniel/mason-tool-installer.nvim',
528586

@@ -889,9 +947,16 @@ require('lazy').setup({
889947
--
890948
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
891949
'catppuccin/nvim',
892-
name = 'catpuccin',
950+
name = 'catppuccin',
893951
priority = 1000, -- Make sure to load this before all the other start plugins.
894952
init = function()
953+
require('catppuccin').setup {
954+
integrations = {
955+
mini = {
956+
enabled = true,
957+
},
958+
},
959+
}
895960
-- require('rose-pine').setup {
896961
-- disable_background = true,
897962
-- styles = {
@@ -933,23 +998,48 @@ require('lazy').setup({
933998
-- Simple and easy statusline.
934999
-- You could remove this setup call if you don't like it,
9351000
-- and try some other statusline plugin
936-
local statusline = require 'mini.statusline'
1001+
-- local statusline = require 'mini.statusline'
9371002
-- set use_icons to true if you have a Nerd Font
938-
statusline.setup { use_icons = vim.g.have_nerd_font }
1003+
-- statusline.setup { use_icons = vim.g.have_nerd_font }
9391004

9401005
-- You can configure sections in the statusline by overriding their
9411006
-- default behavior. For example, here we set the section for
9421007
-- cursor location to LINE:COLUMN
9431008
---@diagnostic disable-next-line: duplicate-set-field
944-
statusline.section_location = function()
945-
return '%2l/%L:%-2v'
946-
end
1009+
-- statusline.section_location = function()
1010+
-- return '%2l/%L:%-2v'
1011+
-- end
9471012

9481013
-- ... and there is more!
9491014
-- Check out: https://github.com/echasnovski/mini.nvim
9501015
end,
9511016
},
9521017

1018+
{
1019+
'nvim-lualine/lualine.nvim',
1020+
init = function()
1021+
require('lualine').setup {
1022+
options = {
1023+
icons_enabled = true,
1024+
component_separators = '|',
1025+
section_separators = '',
1026+
},
1027+
sections = {
1028+
lualine_c = {
1029+
{
1030+
'filename',
1031+
path = 1, -- 0: Just the filename
1032+
-- 1: Relative path
1033+
-- 2: Absolute path
1034+
-- 3: Absolute path, with tilde as the home directory
1035+
-- 4: Filename and parent dir, with tilde as the home directory
1036+
},
1037+
},
1038+
},
1039+
}
1040+
end,
1041+
},
1042+
9531043
{ -- Highlight, edit, and navigate code
9541044
'nvim-treesitter/nvim-treesitter',
9551045
build = ':TSUpdate',
@@ -983,12 +1073,41 @@ require('lazy').setup({
9831073

9841074
{
9851075
'max397574/better-escape.nvim',
986-
opts = {
987-
mapping = { 'jk', 'kj' },
988-
timeout = vim.o.timeoutlen,
989-
clear_empty_lines = false,
990-
keys = '<Esc>',
991-
},
1076+
config = function()
1077+
require('better_escape').setup {
1078+
timeout = vim.o.timeoutlen,
1079+
mappings = {
1080+
i = {
1081+
j = {
1082+
k = '<Esc>',
1083+
j = '<Esc>',
1084+
},
1085+
},
1086+
c = {
1087+
j = {
1088+
k = '<Esc>',
1089+
j = '<Esc>',
1090+
},
1091+
},
1092+
t = {
1093+
j = {
1094+
k = '<Esc>',
1095+
j = '<Esc>',
1096+
},
1097+
},
1098+
v = {
1099+
j = {
1100+
k = '<Esc>',
1101+
},
1102+
},
1103+
s = {
1104+
j = {
1105+
k = '<Esc>',
1106+
},
1107+
},
1108+
},
1109+
}
1110+
end,
9921111
},
9931112

9941113
{
@@ -1021,8 +1140,12 @@ require('lazy').setup({
10211140
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
10221141
--
10231142
-- require 'kickstart.plugins.debug',
1024-
-- require 'kickstart.plugins.indent_line',
1143+
require 'kickstart.plugins.indent_line',
10251144
-- require 'kickstart.plugins.lint',
1145+
-- require 'kickstart.plugins.autopairs',
1146+
require 'kickstart.plugins.neo-tree',
1147+
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
1148+
require 'kickstart.plugins.bufferline'
10261149

10271150
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
10281151
-- This is the easiest way to modularize your config.
@@ -1050,6 +1173,12 @@ require('lazy').setup({
10501173
lazy = '💤 ',
10511174
},
10521175
},
1176+
checker = {
1177+
-- automatically check for plugin updates
1178+
enabled = true,
1179+
notify = true, -- get a notification when new updates are found
1180+
frequency = 3600, -- check for updates every hour
1181+
},
10531182
})
10541183

10551184
-- The line beneath this is called `modeline`. See `:help modeline`
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
return {
2+
'akinsho/bufferline.nvim',
3+
version = "*",
4+
dependencies = 'nvim-tree/nvim-web-devicons',
5+
config = function()
6+
require('bufferline').setup {
7+
options = {
8+
separator_style = 'slant',
9+
}
10+
}
11+
end,
12+
}

lua/kickstart/plugins/indent_line.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ return {
66
main = 'ibl',
77
opts = {},
88
},
9-
}
9+
}

lua/kickstart/plugins/lint.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ return {
4747
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
4848
group = lint_augroup,
4949
callback = function()
50-
require('lint').try_lint()
50+
-- Only run the linter in buffers that you can modify in order to
51+
-- avoid superfluous noise, notably within the handy LSP pop-ups that
52+
-- describe the hovered symbol using Markdown.
53+
if vim.opt_local.modifiable:get() then
54+
lint.try_lint()
55+
end
5156
end,
5257
})
5358
end,

0 commit comments

Comments
 (0)