Skip to content

Commit a90ea1f

Browse files
remaster
1 parent 1b949bd commit a90ea1f

File tree

18 files changed

+1374
-1223
lines changed

18 files changed

+1374
-1223
lines changed

init.lua

Lines changed: 6 additions & 1042 deletions
Large diffs are not rendered by default.

lua/config/autocmds.lua

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
-- Autocommands
2+
3+
-- Highlight on yank
4+
vim.api.nvim_create_autocmd('TextYankPost', {
5+
desc = 'Highlight when yanking (copying) text',
6+
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
7+
callback = function()
8+
vim.highlight.on_yank()
9+
end,
10+
})
11+
12+
-- Set indentation for specific languages
13+
vim.api.nvim_create_autocmd('FileType', {
14+
pattern = { 'cs', 'go', 'rust' },
15+
callback = function()
16+
vim.opt_local.expandtab = true
17+
vim.opt_local.shiftwidth = 4
18+
vim.opt_local.tabstop = 4
19+
end,
20+
})

lua/config/keymaps.lua

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
-- Keymaps
2+
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
3+
vim.keymap.set('n', '<leader>w', '<cmd>:w<CR>', { desc = 'Save File' })
4+
vim.keymap.set('n', '<leader>pv', '<cmd>:Ex<CR>', { desc = 'Go back to Dir' })
5+
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
6+
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
7+
8+
-- Disable arrow keys
9+
vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
10+
vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
11+
vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
12+
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
13+
14+
-- Window navigation
15+
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
16+
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
17+
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
18+
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
19+
20+
-- Auto-close brackets
21+
vim.keymap.set('i', '(', '()<Left>')
22+
vim.keymap.set('i', '[', '[]<Left>')
23+
vim.keymap.set('i', '{', '{}<Left>')
24+
vim.keymap.set('i', '"', '""<Left>')
25+
vim.keymap.set('i', "'", "''<Left>")
26+
27+
-- Smart enter for brackets
28+
vim.keymap.set('i', '<CR>', function()
29+
local line = vim.api.nvim_get_current_line()
30+
local col = vim.api.nvim_win_get_cursor(0)[2]
31+
local before = line:sub(col, col)
32+
local after = line:sub(col + 1, col + 1)
33+
34+
if (before == '{' and after == '}') or
35+
(before == '[' and after == ']') or
36+
(before == '(' and after == ')') then
37+
return '<CR><CR><Up><Tab>'
38+
else
39+
return '<CR>'
40+
end
41+
end, { expr = true })

lua/config/lazy.lua

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
-- Bootstrap lazy.nvim
2+
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
3+
if not (vim.uv or vim.loop).fs_stat(lazypath) then
4+
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
5+
local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
6+
if vim.v.shell_error ~= 0 then
7+
error('Error cloning lazy.nvim:\n' .. out)
8+
end
9+
end
10+
vim.opt.rtp:prepend(lazypath)
11+
12+
-- Setup lazy.nvim
13+
require('lazy').setup('plugins', {
14+
ui = {
15+
icons = vim.g.have_nerd_font and {} or {
16+
cmd = '',
17+
config = '🛠',
18+
event = '📅',
19+
ft = '📂',
20+
init = '',
21+
keys = '🗝',
22+
plugin = '🔌',
23+
runtime = '💻',
24+
require = '🌙',
25+
source = '📄',
26+
start = '🚀',
27+
task = '📌',
28+
lazy = '💤 ',
29+
},
30+
},
31+
})

lua/config/options.lua

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
-- Options
2+
vim.opt.number = true
3+
vim.opt.relativenumber = true
4+
vim.opt.mouse = ''
5+
vim.opt.showmode = false
6+
7+
vim.schedule(function()
8+
vim.opt.clipboard = 'unnamedplus'
9+
end)
10+
11+
vim.opt.breakindent = true
12+
vim.opt.undofile = true
13+
vim.opt.ignorecase = true
14+
vim.opt.smartcase = true
15+
vim.opt.signcolumn = 'yes'
16+
vim.opt.updatetime = 250
17+
vim.opt.timeoutlen = 300
18+
19+
-- Enable inline diagnostics
20+
vim.diagnostic.config({
21+
virtual_text = {
22+
prefix = '',
23+
source = 'always',
24+
},
25+
signs = true,
26+
underline = true,
27+
update_in_insert = false,
28+
severity_sort = true,
29+
})
30+
31+
vim.opt.splitright = true
32+
vim.opt.splitbelow = true
33+
vim.opt.list = false
34+
vim.opt.inccommand = 'split'
35+
vim.opt.cursorline = true
36+
vim.opt.scrolloff = 10

lua/kickstart/plugins/indent_line.lua

Lines changed: 0 additions & 9 deletions
This file was deleted.

lua/plugins/completion.lua

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
-- Autocompletion
2+
return {
3+
'hrsh7th/nvim-cmp',
4+
event = 'InsertEnter',
5+
dependencies = {
6+
{
7+
'L3MON4D3/LuaSnip',
8+
build = (function()
9+
if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then
10+
return
11+
end
12+
return 'make install_jsregexp'
13+
end)(),
14+
config = function()
15+
require('luasnip.loaders.from_lua').load { paths = { '~/.config/nvim/snippets/' } }
16+
end,
17+
},
18+
'saadparwaiz1/cmp_luasnip',
19+
'hrsh7th/cmp-nvim-lsp',
20+
'hrsh7th/cmp-path',
21+
},
22+
config = function()
23+
local cmp = require 'cmp'
24+
local luasnip = require 'luasnip'
25+
luasnip.config.setup {}
26+
27+
cmp.setup {
28+
snippet = {
29+
expand = function(args)
30+
luasnip.lsp_expand(args.body)
31+
end,
32+
},
33+
completion = { completeopt = 'menu,menuone,noinsert' },
34+
preselect = require('cmp').PreselectMode.None,
35+
mapping = cmp.mapping.preset.insert {
36+
['<C-n>'] = cmp.mapping.select_next_item(),
37+
['<C-p>'] = cmp.mapping.select_prev_item(),
38+
['<C-j>'] = cmp.mapping.select_next_item(),
39+
['<C-k>'] = cmp.mapping.select_prev_item(),
40+
['<C-b>'] = cmp.mapping.scroll_docs(-4),
41+
['<C-f>'] = cmp.mapping.scroll_docs(4),
42+
['<Tab>'] = cmp.mapping(function(fallback)
43+
if cmp.visible() then
44+
cmp.confirm({ select = true })
45+
elseif luasnip.expand_or_locally_jumpable() then
46+
luasnip.expand_or_jump()
47+
else
48+
fallback()
49+
end
50+
end, { 'i', 's' }),
51+
['<C-Space>'] = cmp.mapping.complete {},
52+
['<C-l>'] = cmp.mapping(function()
53+
if luasnip.expand_or_locally_jumpable() then
54+
luasnip.expand_or_jump()
55+
end
56+
end, { 'i', 's' }),
57+
['<C-h>'] = cmp.mapping(function()
58+
if luasnip.locally_jumpable(-1) then
59+
luasnip.jump(-1)
60+
end
61+
end, { 'i', 's' }),
62+
},
63+
sources = {
64+
{
65+
name = 'lazydev',
66+
group_index = 0,
67+
},
68+
{ name = 'luasnip', priority = 1000 },
69+
{ name = 'nvim_lsp', priority = 800 },
70+
{ name = 'path', priority = 300 },
71+
},
72+
}
73+
end,
74+
}

lua/plugins/core.lua

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-- Core plugins
2+
return {
3+
'tpope/vim-sleuth',
4+
5+
{
6+
'lewis6991/gitsigns.nvim',
7+
opts = {
8+
signs = {
9+
add = { text = '+' },
10+
change = { text = '~' },
11+
delete = { text = '_' },
12+
topdelete = { text = '' },
13+
changedelete = { text = '~' },
14+
},
15+
},
16+
},
17+
18+
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
19+
}

lua/plugins/formatting.lua

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
-- Code formatting
2+
return {
3+
'stevearc/conform.nvim',
4+
event = { 'BufWritePre' },
5+
cmd = { 'ConformInfo' },
6+
keys = {
7+
{
8+
'<leader>f',
9+
function()
10+
require('conform').format { async = true, lsp_format = 'fallback' }
11+
end,
12+
mode = '',
13+
desc = '[F]ormat buffer',
14+
},
15+
},
16+
opts = {
17+
notify_on_error = false,
18+
formatters = {
19+
csharpier = {
20+
command = 'csharpier',
21+
args = { 'format', '$FILENAME' },
22+
stdin = false,
23+
tmpfile_format = '.cs',
24+
},
25+
},
26+
format_on_save = function(bufnr)
27+
local disable_filetypes = { c = true, cpp = true }
28+
local lsp_format_opt
29+
if disable_filetypes[vim.bo[bufnr].filetype] then
30+
lsp_format_opt = 'never'
31+
else
32+
lsp_format_opt = 'fallback'
33+
end
34+
return {
35+
timeout_ms = 500,
36+
lsp_format = lsp_format_opt,
37+
}
38+
end,
39+
formatters_by_ft = {
40+
lua = { 'stylua' },
41+
-- cs = { 'csharpier' },
42+
},
43+
},
44+
}

lua/plugins/harpoon.lua

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
-- Harpoon for quick file navigation
2+
return {
3+
'ThePrimeagen/harpoon',
4+
branch = 'harpoon2',
5+
dependencies = { 'nvim-lua/plenary.nvim' },
6+
config = function()
7+
local harpoon = require 'harpoon'
8+
harpoon:setup()
9+
10+
vim.keymap.set('n', '<leader>A', function()
11+
harpoon:list():add()
12+
end, { desc = 'Add a file to harpoon' })
13+
vim.keymap.set('n', '<leader>a', function()
14+
harpoon.ui:toggle_quick_menu(harpoon:list())
15+
end, { desc = 'Open harpoon nav' })
16+
17+
vim.keymap.set('n', '<leader>1', function()
18+
harpoon:list():select(1)
19+
end, { desc = 'Go to file 1' })
20+
vim.keymap.set('n', '<leader>2', function()
21+
harpoon:list():select(2)
22+
end, { desc = 'Go to file 2' })
23+
vim.keymap.set('n', '<leader>3', function()
24+
harpoon:list():select(3)
25+
end, { desc = 'Go to file 3' })
26+
vim.keymap.set('n', '<leader>4', function()
27+
harpoon:list():select(4)
28+
end, { desc = 'Go to file 4' })
29+
vim.keymap.set('n', '<leader>5', function()
30+
harpoon:list():select(5)
31+
end, { desc = 'Go to file 5' })
32+
33+
vim.keymap.set('n', '<C-S-P>', function()
34+
harpoon:list():prev()
35+
end)
36+
vim.keymap.set('n', '<C-S-N>', function()
37+
harpoon:list():next()
38+
end)
39+
40+
local conf = require('telescope.config').values
41+
local function toggle_telescope(harpoon_files)
42+
local file_paths = {}
43+
for _, item in ipairs(harpoon_files.items) do
44+
table.insert(file_paths, item.value)
45+
end
46+
47+
require('telescope.pickers')
48+
.new({}, {
49+
prompt_title = 'Harpoon',
50+
finder = require('telescope.finders').new_table {
51+
results = file_paths,
52+
},
53+
previewer = conf.file_previewer {},
54+
sorter = conf.generic_sorter {},
55+
})
56+
:find()
57+
end
58+
59+
vim.keymap.set('n', '<leader>z', function()
60+
toggle_telescope(harpoon:list())
61+
end, { desc = 'Open harpoon window in telescope' })
62+
end,
63+
}

0 commit comments

Comments
 (0)