update config
This commit is contained in:
parent
ab6de4d9e4
commit
55541787e3
124
init.lua
124
init.lua
|
@ -143,15 +143,20 @@ require('lazy').setup({
|
|||
},
|
||||
config = function()
|
||||
-- [[ Configure Telescope ]]
|
||||
local actions = {}
|
||||
require('telescope').setup {
|
||||
-- You can put your default mappings / updates / etc. in here
|
||||
-- All the info you're looking for is in `:help telescope.setup()`
|
||||
--
|
||||
-- defaults = {
|
||||
-- mappings = {
|
||||
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
|
||||
-- },
|
||||
-- },
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
['<c-enter>'] = 'to_fuzzy_refine',
|
||||
['<C-j>'] = 'move_selection_next',
|
||||
['<C-k>'] = 'move_selection_previous',
|
||||
},
|
||||
},
|
||||
},
|
||||
-- pickers = {}
|
||||
extensions = {
|
||||
['ui-select'] = {
|
||||
|
@ -164,14 +169,36 @@ require('lazy').setup({
|
|||
pcall(require('telescope').load_extension, 'fzf')
|
||||
pcall(require('telescope').load_extension, 'ui-select')
|
||||
|
||||
-- Available Telescope themes:
|
||||
-- get_dropdown() - A dropdown menu style with a floating window
|
||||
-- get_cursor() - A cursor-based selection style with a floating window
|
||||
-- get_ivy() - The Ivy style with a vertical list layout
|
||||
-- get_center() - A centered layout with a floating window
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
local builtin = require 'telescope.builtin'
|
||||
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
||||
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
||||
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||
|
||||
vim.keymap.set('n', '<leader>sf', function()
|
||||
builtin.find_files(require('telescope.themes').get_dropdown())
|
||||
end, { desc = '[S]earch [F]iles' })
|
||||
|
||||
vim.keymap.set('n', '<leader>f', function()
|
||||
builtin.find_files(require('telescope.themes').get_dropdown())
|
||||
end, { desc = '[S]earch [F]iles' })
|
||||
|
||||
vim.keymap.set('n', '<leader>sg', function()
|
||||
builtin.live_grep(require('telescope.themes').get_ivy())
|
||||
end, { desc = '[S]earch by [G]rep' })
|
||||
|
||||
vim.keymap.set('n', '<leader>F', function()
|
||||
builtin.live_grep(require('telescope.themes').get_ivy())
|
||||
end, { desc = '[S]earch by [G]rep' })
|
||||
|
||||
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
||||
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
||||
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
||||
-- vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
||||
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
|
@ -224,31 +251,6 @@ require('lazy').setup({
|
|||
'hrsh7th/cmp-nvim-lsp',
|
||||
},
|
||||
config = function()
|
||||
-- Brief aside: **What is LSP?**
|
||||
--
|
||||
-- LSP is an initialism you've probably heard, but might not understand what it is.
|
||||
--
|
||||
-- LSP stands for Language Server Protocol. It's a protocol that helps editors
|
||||
-- and language tooling communicate in a standardized fashion.
|
||||
--
|
||||
-- In general, you have a "server" which is some tool built to understand a particular
|
||||
-- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers
|
||||
-- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone
|
||||
-- processes that communicate with some "client" - in this case, Neovim!
|
||||
--
|
||||
-- LSP provides Neovim with features like:
|
||||
-- - Go to definition
|
||||
-- - Find references
|
||||
-- - Autocompletion
|
||||
-- - Symbol Search
|
||||
-- - and more!
|
||||
--
|
||||
-- Thus, Language Servers are external tools that must be installed separately from
|
||||
-- Neovim. This is where `mason` and related plugins come into play.
|
||||
--
|
||||
-- If you're wondering about lsp vs treesitter, you can check out the wonderfully
|
||||
-- and elegantly composed help section, `:help lsp-vs-treesitter`
|
||||
|
||||
-- This function gets run when an LSP attaches to a particular buffer.
|
||||
-- That is to say, every time a new file is opened that is associated with
|
||||
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
|
||||
|
@ -289,7 +291,7 @@ require('lazy').setup({
|
|||
|
||||
-- Fuzzy find all the symbols in your current workspace.
|
||||
-- Similar to document symbols, except searches over your entire project.
|
||||
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
-- map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
|
||||
-- Rename the variable under your cursor.
|
||||
-- Most Language Servers support renaming across files, etc.
|
||||
|
@ -297,12 +299,15 @@ require('lazy').setup({
|
|||
|
||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
||||
-- or a suggestion from your LSP for this to activate.
|
||||
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
|
||||
-- i will comment this out becouse of close <space>c
|
||||
-- map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
|
||||
|
||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||
-- For example, in C this would take you to the header.
|
||||
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
|
||||
vim.diagnostic.config { virtual_text = false }
|
||||
|
||||
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
|
||||
---@param client vim.lsp.Client
|
||||
---@param method vim.lsp.protocol.Method
|
||||
|
@ -531,12 +536,12 @@ require('lazy').setup({
|
|||
-- `friendly-snippets` contains a variety of premade snippets.
|
||||
-- See the README about individual language/framework/plugin snippets:
|
||||
-- https://github.com/rafamadriz/friendly-snippets
|
||||
-- {
|
||||
-- 'rafamadriz/friendly-snippets',
|
||||
-- config = function()
|
||||
-- require('luasnip.loaders.from_vscode').lazy_load()
|
||||
-- end,
|
||||
-- },
|
||||
{
|
||||
'rafamadriz/friendly-snippets',
|
||||
config = function()
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
|
@ -585,7 +590,7 @@ require('lazy').setup({
|
|||
|
||||
-- If you prefer more traditional completion keymaps,
|
||||
-- you can uncomment the following lines
|
||||
--['<CR>'] = cmp.mapping.confirm { select = true },
|
||||
['<CR>'] = cmp.mapping.confirm { select = true },
|
||||
--['<Tab>'] = cmp.mapping.select_next_item(),
|
||||
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||
|
||||
|
@ -631,34 +636,22 @@ require('lazy').setup({
|
|||
end,
|
||||
},
|
||||
|
||||
{ -- You can easily change to a different colorscheme.
|
||||
-- Change the name of the colorscheme plugin below, and then
|
||||
-- change the command in the config to whatever the name of that colorscheme is.
|
||||
--
|
||||
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
||||
'folke/tokyonight.nvim',
|
||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
||||
config = function()
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
require('tokyonight').setup {
|
||||
styles = {
|
||||
comments = { italic = false }, -- Disable italics in comments
|
||||
},
|
||||
}
|
||||
|
||||
-- Load the colorscheme here.
|
||||
-- Like many other themes, this one has different styles, and you could load
|
||||
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
||||
vim.cmd.colorscheme 'tokyonight-night'
|
||||
end,
|
||||
},
|
||||
|
||||
-- Highlight todo, notes, etc in comments
|
||||
{ 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } },
|
||||
|
||||
{ -- Collection of various small independent plugins/modules
|
||||
'echasnovski/mini.nvim',
|
||||
config = function()
|
||||
local gen_loader = require('mini.snippets').gen_loader
|
||||
require('mini.snippets').setup {
|
||||
snippets = {
|
||||
-- Load custom file with global snippets first (adjust for Windows)
|
||||
gen_loader.from_file '~/.config/nvim/snippets/global.json',
|
||||
|
||||
-- Load snippets based on current language by reading files from
|
||||
-- "snippets/" subdirectories from 'runtimepath' directories.
|
||||
gen_loader.from_lang(),
|
||||
},
|
||||
}
|
||||
-- Better Around/Inside textobjects
|
||||
--
|
||||
-- Examples:
|
||||
|
@ -769,3 +762,6 @@ require('lazy').setup({
|
|||
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
|
||||
-- load after plugins
|
||||
require 'custom.colors'
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
vim.cmd [[ colorscheme rose-pine-main ]]
|
||||
-- vim.cmd [[ colorscheme tokyonight ]]
|
|
@ -20,8 +20,8 @@ vim.keymap.set('n', '<leader>d', '<cmd>lua vim.diagnostic.open_float()<CR>', { d
|
|||
-- 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>/', '<Plug>(comment_toggle_linewise_current)', { desc = 'Toggle comment line' })
|
||||
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
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
--
|
||||
-- See the kickstart.nvim README for more information
|
||||
return {
|
||||
-------------------------------------UI-------------------------------------
|
||||
{
|
||||
'akinsho/bufferline.nvim',
|
||||
version = '*',
|
||||
|
@ -11,6 +12,34 @@ return {
|
|||
require('bufferline').setup {}
|
||||
end,
|
||||
},
|
||||
-------------------------------------UTILS-------------------------------------
|
||||
{
|
||||
'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',
|
||||
|
@ -46,9 +75,13 @@ return {
|
|||
{ "<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 = {},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ return {
|
|||
},
|
||||
cmd = 'Neotree',
|
||||
keys = {
|
||||
{ '<leader>e', ':Neotree toggle<CR>', desc = 'NeoTree reveal', silent = true },
|
||||
{ '<leader>e', ':Neotree toggle reveal<CR>', desc = 'NeoTree reveal', silent = true },
|
||||
},
|
||||
opts = {
|
||||
filesystem = {
|
||||
|
@ -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,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue