Skip to content
Closed

titke #1424

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
440 changes: 90 additions & 350 deletions init.lua

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions lua/custom/basic-autocommands.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- [[ Basic Autocommands ]]
--
-- See `:help lua-guide-autocommands`

-- Highlight when yanking (copying) text
-- Try it with `yap` in normal mode
-- See `:help vim.highlight.on_yank()`
vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight when yanking (copying) text',
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})
2 changes: 2 additions & 0 deletions lua/custom/colors.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vim.cmd [[ colorscheme rose-pine-main ]]
-- vim.cmd [[ colorscheme tokyonight ]]
45 changes: 45 additions & 0 deletions lua/custom/keymaps.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
vim.keymap.set('n', '<leader>h', '<cmd>nohlsearch<CR>')
vim.keymap.set('i', 'jj', '<Esc>')

-- Normal --
-- Better window navigation
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })

-- Navigate buffers
vim.keymap.set('n', '<S-l>', '<cmd>bnext<CR>', { desc = 'Next buffer' })
vim.keymap.set('n', '<S-h>', '<cmd>bprevious<CR>', { desc = 'Previous buffer' })

-- diagnostics
vim.keymap.set('n', '<leader>d', '<cmd>lua vim.diagnostic.open_float()<CR>', { desc = 'Show diagnostic float' })

-- Files
vim.keymap.set('n', '<leader>q', '<cmd>q!<cr>', { desc = '[Q]uit' })
vim.keymap.set('n', '<leader>w', '<cmd>w!<cr>', { desc = '[W]rite file' })
vim.keymap.set('n', '<leader>.', '<cmd>luafile %<CR>', { desc = 'Source Lua file' })
vim.keymap.set('n', '<leader>/', '<Plug>(comment_toggle_linewise_current)', { desc = 'Toggle comment line' })
vim.keymap.set('v', '<leader>/', '<Plug>(comment_toggle_linewise_visual)', { desc = 'Toggle comment for selection' })

-- delete single character without copying into register
vim.keymap.set('n', 'x', '"_x', { desc = 'Delete character without yanking' })

-- Visual --
-- Stay in indent mode
vim.keymap.set('v', '<', '<gv', { desc = 'Indent left and stay in visual mode' })
vim.keymap.set('v', '>', '>gv', { desc = 'Indent right and stay in visual mode' })

-- buffers
vim.keymap.set('n', '<leader>bh', '<cmd>BufferLineCloseLeft<cr>', { desc = 'Close buffers to the left' })
vim.keymap.set('n', '<leader>bl', '<cmd>BufferLineCloseRight<cr>', { desc = 'Close buffers to the right' })
vim.keymap.set('n', '<leader>bf', '<cmd>Telescope buffers<cr>', { desc = 'Find buffers' })
vim.keymap.set('n', '<leader>c', '<cmd>Bdelete!<CR>', { desc = 'Close buffer' })

--- lsp
vim.keymap.set('n', '<leader>la', '<cmd>lua vim.lsp.buf.code_action()<cr>', { desc = 'Code actions' })
vim.keymap.set('n', '<leader>lj', '<cmd>lua vim.diagnostic.goto_next()<cr>', { desc = 'Next diagnostic' })
vim.keymap.set('n', '<leader>lk', '<cmd>lua vim.diagnostic.goto_prev()<cr>', { desc = 'Previous diagnostic' })
vim.keymap.set('n', '<leader>lf', '<cmd>lua vim.lsp.buf.format{async = true}<cr>', { desc = 'Format buffer' })
vim.keymap.set('n', '<leader>lr', '<cmd>lua vim.lsp.buf.rename()<cr>', { desc = 'Rename symbol' })
2 changes: 2 additions & 0 deletions lua/custom/macros.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- console.log("cursor: , cursor)
vim.fn.setreg('l', 'yiwoconsole.log("jjpa:" , jjpa);jj')
89 changes: 89 additions & 0 deletions lua/custom/options.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
-- [[ Setting options ]]
-- See `:help vim.opt`
-- NOTE: You can change these options as you wish!
-- For more options, you can see `:help option-list`

-- Make line numbers default
vim.opt.number = true
-- You can also add relative line numbers, to help with jumping.
-- Experiment for yourself to see if you like it!
-- vim.opt.relativenumber = true

-- Enable mouse mode, can be useful for resizing splits for example!
vim.opt.mouse = 'a'

-- Don't show the mode, since it's already in the status line
vim.opt.showmode = false

-- Sync clipboard between OS and Neovim.
-- Schedule the setting after `UiEnter` because it can increase startup-time.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
vim.schedule(function()
vim.opt.clipboard = 'unnamedplus'
end)

-- Enable break indent
vim.opt.breakindent = true

-- Save undo history
vim.opt.undofile = true

-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
vim.opt.ignorecase = true
vim.opt.smartcase = true

-- Keep signcolumn on by default
vim.opt.signcolumn = 'yes'

-- Decrease update time
vim.opt.updatetime = 50

-- Decrease mapped sequence wait time
vim.opt.timeoutlen = 300

-- Configure how new splits should be opened
vim.opt.splitright = true
vim.opt.splitbelow = true

-- Sets how neovim will display certain whitespace characters in the editor.
-- See `:help 'list'`
-- and `:help 'listchars'`
vim.opt.list = true
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }

-- Preview substitutions live, as you type!
vim.opt.inccommand = 'split'

-- Show which line your cursor is on
vim.opt.cursorline = true

-- Minimal number of screen lines to keep above and below the cursor.
vim.opt.scrolloff = 10

-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
-- instead raise a dialog asking if you wish to save the current file(s)
-- See `:help 'confirm'`
vim.opt.confirm = true

vim.opt.relativenumber = true

-- set to 0 becouse of empty line
vim.opt.cmdheight = 0

-- set cmd height when entering command mode
vim.api.nvim_command 'autocmd CmdlineEnter * set cmdheight=1'
vim.api.nvim_command 'autocmd CmdlineLeave * set cmdheight=0'
vim.api.nvim_command 'autocmd RecordingEnter * set cmdheight=1'
vim.api.nvim_command 'autocmd RecordingLeave * set cmdheight=0'

-- auto resize screen
-- Create an autocommand group for auto resizing
vim.api.nvim_create_augroup('autoequalize', { clear = true })

vim.api.nvim_create_autocmd({ 'VimEnter', 'VimResized' }, {
callback = function()
vim.cmd 'wincmd ='
end,
group = 'autoequalize',
})
59 changes: 59 additions & 0 deletions lua/custom/plugins/avante.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
return {
'yetone/avante.nvim',
event = 'VeryLazy',
version = false, -- Never set this value to "*"! Never!
opts = {
-- add any opts here
-- for example
provider = 'openai',
openai = {
endpoint = 'https://api.openai.com/v1',
model = 'gpt-4o', -- your desired model (or use gpt-4o, etc.)
timeout = 30000, -- Timeout in milliseconds, increase this for reasoning models
temperature = 0,
max_completion_tokens = 8192, -- Increase this to include reasoning tokens (for reasoning models)
--reasoning_effort = "medium", -- low|medium|high, only used for reasoning models
},
},
-- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
build = 'make',
-- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
dependencies = {
'nvim-treesitter/nvim-treesitter',
'stevearc/dressing.nvim',
'nvim-lua/plenary.nvim',
'MunifTanjim/nui.nvim',
--- The below dependencies are optional,
'echasnovski/mini.pick', -- for file_selector provider mini.pick
'nvim-telescope/telescope.nvim', -- for file_selector provider telescope
'hrsh7th/nvim-cmp', -- autocompletion for avante commands and mentions
'ibhagwan/fzf-lua', -- for file_selector provider fzf
'nvim-tree/nvim-web-devicons', -- or echasnovski/mini.icons
'zbirenbaum/copilot.lua', -- for providers='copilot'
{
-- support for image pasting
'HakonHarnes/img-clip.nvim',
event = 'VeryLazy',
opts = {
-- recommended settings
default = {
embed_image_as_base64 = false,
prompt_for_file_name = false,
drag_and_drop = {
insert_mode = true,
},
-- required for Windows users
use_absolute_path = true,
},
},
},
{
-- Make sure to set this up properly if you have lazy=true
'MeanderingProgrammer/render-markdown.nvim',
opts = {
file_types = { 'markdown', 'Avante' },
},
ft = { 'markdown', 'Avante' },
},
},
}
45 changes: 45 additions & 0 deletions lua/custom/plugins/harpoon.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
return {
'ThePrimeagen/harpoon',
branch = 'harpoon2',
dependencies = { 'nvim-lua/plenary.nvim' },
config = function()
local harpoon = require 'harpoon'

-- REQUIRED
harpoon:setup()
-- REQUIRED

vim.keymap.set('n', '<leader>oa', function()
harpoon:list():add()
end, { desc = 'Add File' })

vim.keymap.set('n', '<leader>oi', function()
harpoon.ui:toggle_quick_menu(harpoon:list())
end, { desc = 'Open L[I]st' })

vim.keymap.set('n', '<leader>1', function()
harpoon:list():select(1)
end, { desc = 'Select [1]' })

vim.keymap.set('n', '<leader>2', function()
harpoon:list():select(2)
end, { desc = 'Select [2]' })

vim.keymap.set('n', '<leader>3', function()
harpoon:list():select(3)
end, { desc = 'Select [3]' })

vim.keymap.set('n', '<leader>4', function()
harpoon:list():select(4)
end, { desc = 'Select [4]' })

-- Toggle previous & next buffers stored within Harpoon list
vim.keymap.set('n', '<leader>oj', function()
harpoon:list():prev()
end, { desc = 'Previus File' })

vim.keymap.set('n', '<leader>ok', function()
harpoon:list():next()
end, { desc = 'Next File' })
end,
}
95 changes: 94 additions & 1 deletion lua/custom/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,97 @@
-- I promise not to create any merge conflicts in this directory :)
--
-- See the kickstart.nvim README for more information
return {}
return {
-------------------------------------UI-------------------------------------
{
'akinsho/bufferline.nvim',
version = '*',
dependencies = 'nvim-tree/nvim-web-devicons',
config = function()
require('bufferline').setup {}
end,
},
-------------------------------------UTILS-------------------------------------
require 'custom.plugins.avante',
-- i use this so i can comment in TS components etc
'JoosepAlviste/nvim-ts-context-commentstring',
{
'numToStr/Comment.nvim',
config = function()
require('Comment').setup {
pre_hook = require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook(),
}
end,
},
{
'kdheepak/lazygit.nvim',
lazy = true,
cmd = {
'LazyGit',
'LazyGitConfig',
'LazyGitCurrentFile',
'LazyGitFilter',
'LazyGitFilterCurrentFile',
},
-- optional for floating window border decoration
dependencies = {
'nvim-lua/plenary.nvim',
},
-- setting the keybinding for LazyGit with 'keys' is recommended in
-- order to load the plugin when the command is run for the first time
keys = {
{ '<leader>lg', '<cmd>LazyGit<cr>', desc = 'LazyGit' },
},
},

{
'windwp/nvim-ts-autotag',
config = function()
require('nvim-ts-autotag').setup()
end,
},
{
'mikavilpas/yazi.nvim',
event = 'VeryLazy',
keys = {
-- 👇 in this section, choose your own keymappings!
{
'<leader>y',
mode = { 'n', 'v' },
'<cmd>Yazi<cr>',
desc = 'Open [Y]azi at the current file',
},
},
opts = {
-- if you want to open yazi instead of netrw, see below for more info
open_for_directories = false,
keymaps = {
show_help = '<f1>',
},
},
},
'moll/vim-bbye',
{
'folke/flash.nvim',
event = 'VeryLazy',
---@type Flash.Config
opts = {},
-- stylua: ignore
keys = {
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
{ "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
},
},
-------------------------------------COLORS-------------------------------------
{ 'catppuccin/nvim', as = 'catppuccin' },
{ 'rose-pine/neovim', name = 'rose-pine' },
{
'folke/tokyonight.nvim',
lazy = false,
priority = 1000,
opts = {},
},
}
21 changes: 20 additions & 1 deletion lua/kickstart/plugins/neo-tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ return {
},
cmd = 'Neotree',
keys = {
{ '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
{ '<leader>e', ':Neotree toggle reveal<CR>', desc = 'NeoTree reveal', silent = true },
},
opts = {
filesystem = {
Expand All @@ -22,4 +22,23 @@ return {
},
},
},
config = function()
require('neo-tree').setup {
popup_border_style = 'rounded',
close_if_last_window = true,
enable_git_status = true,
enable_diagnostics = true,
event_handlers = {
{
event = 'file_opened',
handler = function(file_path)
-- auto close
-- vimc.cmd("Neotree close")
-- OR
require('neo-tree.command').execute { action = 'close' }
end,
},
},
}
end,
}