Skip to content

Commit 5554178

Browse files
committed
update config
1 parent ab6de4d commit 5554178

File tree

5 files changed

+118
-68
lines changed

5 files changed

+118
-68
lines changed

init.lua

Lines changed: 60 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,20 @@ require('lazy').setup({
143143
},
144144
config = function()
145145
-- [[ Configure Telescope ]]
146+
local actions = {}
146147
require('telescope').setup {
147148
-- You can put your default mappings / updates / etc. in here
148149
-- All the info you're looking for is in `:help telescope.setup()`
149150
--
150-
-- defaults = {
151-
-- mappings = {
152-
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
153-
-- },
154-
-- },
151+
defaults = {
152+
mappings = {
153+
i = {
154+
['<c-enter>'] = 'to_fuzzy_refine',
155+
['<C-j>'] = 'move_selection_next',
156+
['<C-k>'] = 'move_selection_previous',
157+
},
158+
},
159+
},
155160
-- pickers = {}
156161
extensions = {
157162
['ui-select'] = {
@@ -164,14 +169,36 @@ require('lazy').setup({
164169
pcall(require('telescope').load_extension, 'fzf')
165170
pcall(require('telescope').load_extension, 'ui-select')
166171

172+
-- Available Telescope themes:
173+
-- get_dropdown() - A dropdown menu style with a floating window
174+
-- get_cursor() - A cursor-based selection style with a floating window
175+
-- get_ivy() - The Ivy style with a vertical list layout
176+
-- get_center() - A centered layout with a floating window
177+
167178
-- See `:help telescope.builtin`
168179
local builtin = require 'telescope.builtin'
169180
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
170181
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
171-
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
182+
183+
vim.keymap.set('n', '<leader>sf', function()
184+
builtin.find_files(require('telescope.themes').get_dropdown())
185+
end, { desc = '[S]earch [F]iles' })
186+
187+
vim.keymap.set('n', '<leader>f', function()
188+
builtin.find_files(require('telescope.themes').get_dropdown())
189+
end, { desc = '[S]earch [F]iles' })
190+
191+
vim.keymap.set('n', '<leader>sg', function()
192+
builtin.live_grep(require('telescope.themes').get_ivy())
193+
end, { desc = '[S]earch by [G]rep' })
194+
195+
vim.keymap.set('n', '<leader>F', function()
196+
builtin.live_grep(require('telescope.themes').get_ivy())
197+
end, { desc = '[S]earch by [G]rep' })
198+
172199
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
173200
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
174-
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
201+
-- vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
175202
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
176203
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
177204
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
@@ -224,31 +251,6 @@ require('lazy').setup({
224251
'hrsh7th/cmp-nvim-lsp',
225252
},
226253
config = function()
227-
-- Brief aside: **What is LSP?**
228-
--
229-
-- LSP is an initialism you've probably heard, but might not understand what it is.
230-
--
231-
-- LSP stands for Language Server Protocol. It's a protocol that helps editors
232-
-- and language tooling communicate in a standardized fashion.
233-
--
234-
-- In general, you have a "server" which is some tool built to understand a particular
235-
-- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers
236-
-- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone
237-
-- processes that communicate with some "client" - in this case, Neovim!
238-
--
239-
-- LSP provides Neovim with features like:
240-
-- - Go to definition
241-
-- - Find references
242-
-- - Autocompletion
243-
-- - Symbol Search
244-
-- - and more!
245-
--
246-
-- Thus, Language Servers are external tools that must be installed separately from
247-
-- Neovim. This is where `mason` and related plugins come into play.
248-
--
249-
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully
250-
-- and elegantly composed help section, `:help lsp-vs-treesitter`
251-
252254
-- This function gets run when an LSP attaches to a particular buffer.
253255
-- That is to say, every time a new file is opened that is associated with
254256
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
@@ -289,20 +291,23 @@ require('lazy').setup({
289291

290292
-- Fuzzy find all the symbols in your current workspace.
291293
-- Similar to document symbols, except searches over your entire project.
292-
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
294+
-- map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
293295

294296
-- Rename the variable under your cursor.
295297
-- Most Language Servers support renaming across files, etc.
296298
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
297299

298300
-- Execute a code action, usually your cursor needs to be on top of an error
299301
-- or a suggestion from your LSP for this to activate.
300-
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
302+
-- i will comment this out becouse of close <space>c
303+
-- map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
301304

302305
-- WARN: This is not Goto Definition, this is Goto Declaration.
303306
-- For example, in C this would take you to the header.
304307
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
305308

309+
vim.diagnostic.config { virtual_text = false }
310+
306311
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
307312
---@param client vim.lsp.Client
308313
---@param method vim.lsp.protocol.Method
@@ -531,12 +536,12 @@ require('lazy').setup({
531536
-- `friendly-snippets` contains a variety of premade snippets.
532537
-- See the README about individual language/framework/plugin snippets:
533538
-- https://github.com/rafamadriz/friendly-snippets
534-
-- {
535-
-- 'rafamadriz/friendly-snippets',
536-
-- config = function()
537-
-- require('luasnip.loaders.from_vscode').lazy_load()
538-
-- end,
539-
-- },
539+
{
540+
'rafamadriz/friendly-snippets',
541+
config = function()
542+
require('luasnip.loaders.from_vscode').lazy_load()
543+
end,
544+
},
540545
},
541546
},
542547
'saadparwaiz1/cmp_luasnip',
@@ -585,7 +590,7 @@ require('lazy').setup({
585590

586591
-- If you prefer more traditional completion keymaps,
587592
-- you can uncomment the following lines
588-
--['<CR>'] = cmp.mapping.confirm { select = true },
593+
['<CR>'] = cmp.mapping.confirm { select = true },
589594
--['<Tab>'] = cmp.mapping.select_next_item(),
590595
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
591596

@@ -631,34 +636,22 @@ require('lazy').setup({
631636
end,
632637
},
633638

634-
{ -- You can easily change to a different colorscheme.
635-
-- Change the name of the colorscheme plugin below, and then
636-
-- change the command in the config to whatever the name of that colorscheme is.
637-
--
638-
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
639-
'folke/tokyonight.nvim',
640-
priority = 1000, -- Make sure to load this before all the other start plugins.
641-
config = function()
642-
---@diagnostic disable-next-line: missing-fields
643-
require('tokyonight').setup {
644-
styles = {
645-
comments = { italic = false }, -- Disable italics in comments
646-
},
647-
}
648-
649-
-- Load the colorscheme here.
650-
-- Like many other themes, this one has different styles, and you could load
651-
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
652-
vim.cmd.colorscheme 'tokyonight-night'
653-
end,
654-
},
655-
656639
-- Highlight todo, notes, etc in comments
657640
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
658-
659641
{ -- Collection of various small independent plugins/modules
660642
'echasnovski/mini.nvim',
661643
config = function()
644+
local gen_loader = require('mini.snippets').gen_loader
645+
require('mini.snippets').setup {
646+
snippets = {
647+
-- Load custom file with global snippets first (adjust for Windows)
648+
gen_loader.from_file '~/.config/nvim/snippets/global.json',
649+
650+
-- Load snippets based on current language by reading files from
651+
-- "snippets/" subdirectories from 'runtimepath' directories.
652+
gen_loader.from_lang(),
653+
},
654+
}
662655
-- Better Around/Inside textobjects
663656
--
664657
-- Examples:
@@ -769,3 +762,6 @@ require('lazy').setup({
769762

770763
-- The line beneath this is called `modeline`. See `:help modeline`
771764
-- vim: ts=2 sts=2 sw=2 et
765+
766+
-- load after plugins
767+
require 'custom.colors'

lua/custom/colors.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vim.cmd [[ colorscheme rose-pine-main ]]
2+
-- vim.cmd [[ colorscheme tokyonight ]]

lua/custom/keymaps.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ vim.keymap.set('n', '<leader>d', '<cmd>lua vim.diagnostic.open_float()<CR>', { d
2020
-- Files
2121
vim.keymap.set('n', '<leader>q', '<cmd>q!<cr>', { desc = '[Q]uit' })
2222
vim.keymap.set('n', '<leader>w', '<cmd>w!<cr>', { desc = '[W]rite file' })
23-
vim.keymap.set('n', '<leader>/', '<Plug>(comment_toggle_linewise_current)', { desc = 'Toggle comment line' })
2423
vim.keymap.set('n', '<leader>.', '<cmd>luafile %<CR>', { desc = 'Source Lua file' })
24+
vim.keymap.set('n', '<leader>/', '<Plug>(comment_toggle_linewise_current)', { desc = 'Toggle comment line' })
2525
vim.keymap.set('v', '<leader>/', '<Plug>(comment_toggle_linewise_visual)', { desc = 'Toggle comment for selection' })
2626

2727
-- delete single character without copying into register

lua/custom/plugins/init.lua

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
--
44
-- See the kickstart.nvim README for more information
55
return {
6+
-------------------------------------UI-------------------------------------
67
{
78
'akinsho/bufferline.nvim',
89
version = '*',
@@ -11,6 +12,34 @@ return {
1112
require('bufferline').setup {}
1213
end,
1314
},
15+
-------------------------------------UTILS-------------------------------------
16+
{
17+
'kdheepak/lazygit.nvim',
18+
lazy = true,
19+
cmd = {
20+
'LazyGit',
21+
'LazyGitConfig',
22+
'LazyGitCurrentFile',
23+
'LazyGitFilter',
24+
'LazyGitFilterCurrentFile',
25+
},
26+
-- optional for floating window border decoration
27+
dependencies = {
28+
'nvim-lua/plenary.nvim',
29+
},
30+
-- setting the keybinding for LazyGit with 'keys' is recommended in
31+
-- order to load the plugin when the command is run for the first time
32+
keys = {
33+
{ '<leader>lg', '<cmd>LazyGit<cr>', desc = 'LazyGit' },
34+
},
35+
},
36+
37+
{
38+
'windwp/nvim-ts-autotag',
39+
config = function()
40+
require('nvim-ts-autotag').setup()
41+
end,
42+
},
1443
{
1544
'mikavilpas/yazi.nvim',
1645
event = 'VeryLazy',
@@ -46,9 +75,13 @@ return {
4675
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
4776
},
4877
},
49-
5078
-------------------------------------COLORS-------------------------------------
51-
---
5279
{ 'catppuccin/nvim', as = 'catppuccin' },
5380
{ 'rose-pine/neovim', name = 'rose-pine' },
81+
{
82+
'folke/tokyonight.nvim',
83+
lazy = false,
84+
priority = 1000,
85+
opts = {},
86+
},
5487
}

lua/kickstart/plugins/neo-tree.lua

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ return {
1111
},
1212
cmd = 'Neotree',
1313
keys = {
14-
{ '<leader>e', ':Neotree toggle<CR>', desc = 'NeoTree reveal', silent = true },
14+
{ '<leader>e', ':Neotree toggle reveal<CR>', desc = 'NeoTree reveal', silent = true },
1515
},
1616
opts = {
1717
filesystem = {
@@ -22,4 +22,23 @@ return {
2222
},
2323
},
2424
},
25+
config = function()
26+
require('neo-tree').setup {
27+
popup_border_style = 'rounded',
28+
close_if_last_window = true,
29+
enable_git_status = true,
30+
enable_diagnostics = true,
31+
event_handlers = {
32+
{
33+
event = 'file_opened',
34+
handler = function(file_path)
35+
-- auto close
36+
-- vimc.cmd("Neotree close")
37+
-- OR
38+
require('neo-tree.command').execute { action = 'close' }
39+
end,
40+
},
41+
},
42+
}
43+
end,
2544
}

0 commit comments

Comments
 (0)