more changes for my preferences
This commit is contained in:
parent
33ddc3de88
commit
72bec883ad
244
init.lua
244
init.lua
|
|
@ -93,7 +93,9 @@ vim.g.maplocalleader = ' '
|
|||
-- See `:help vim.opt`
|
||||
-- NOTE: You can change these options as you wish!
|
||||
-- For more options, you can see `:help option-list`
|
||||
|
||||
-- autoindent if possible when entering a new line in a block
|
||||
vim.opt.autowriteall = false
|
||||
vim.opt.smartindent = true
|
||||
-- Make line numbers default
|
||||
vim.opt.number = true
|
||||
-- You can also add relative line numbers, to help with jumping.
|
||||
|
|
@ -166,6 +168,9 @@ vim.opt.guicursor = {
|
|||
}
|
||||
-- [[ Basic Keymaps ]]
|
||||
-- See `:help vim.keymap.set()`
|
||||
-- recenter to middle after page jump
|
||||
vim.keymap.set('n', '<C-d>', '<C-d>zz')
|
||||
vim.keymap.set('n', '<C-u>', '<C-u>zz')
|
||||
|
||||
-- Clear highlights on search when pressing <Esc> in normal mode
|
||||
-- See `:help hlsearch`
|
||||
|
|
@ -188,6 +193,21 @@ vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
|||
vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
||||
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
||||
|
||||
vim.keymap.set('i', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
||||
vim.keymap.set('i', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
||||
vim.keymap.set('i', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
||||
vim.keymap.set('i', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
||||
|
||||
vim.keymap.set('v', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
||||
vim.keymap.set('v', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
||||
vim.keymap.set('v', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
||||
vim.keymap.set('v', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
||||
|
||||
vim.keymap.set('c', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
||||
vim.keymap.set('c', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
||||
vim.keymap.set('c', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
||||
vim.keymap.set('c', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
||||
|
||||
-- Keybinds to make split navigation easier.
|
||||
-- Use CTRL+<hjkl> to switch between windows
|
||||
--
|
||||
|
|
@ -268,30 +288,6 @@ require('lazy').setup({
|
|||
{ '<c-\\>', '<cmd><C-U>TmuxNavigatePrevious<cr>' },
|
||||
},
|
||||
},
|
||||
{
|
||||
'stevearc/oil.nvim',
|
||||
---@module 'oil'
|
||||
---@type oil.SetupOpts
|
||||
opts = {},
|
||||
-- Optional dependencies
|
||||
dependencies = { { 'echasnovski/mini.icons', opts = {} } },
|
||||
-- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons
|
||||
-- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations.
|
||||
lazy = false,
|
||||
config = function()
|
||||
require('oil').setup {
|
||||
vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' }),
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
'nvimdev/dashboard-nvim',
|
||||
event = 'VimEnter',
|
||||
config = function()
|
||||
require('dashboard').setup {}
|
||||
end,
|
||||
dependencies = { { 'nvim-tree/nvim-web-devicons' } },
|
||||
},
|
||||
-- Alternatively, use `config = function() ... end` for full control over the configuration.
|
||||
-- If you prefer to call `setup` explicitly, use:
|
||||
-- {
|
||||
|
|
@ -496,7 +492,66 @@ require('lazy').setup({
|
|||
end, { desc = '[S]earch [N]eovim files' })
|
||||
end,
|
||||
},
|
||||
{
|
||||
'ThePrimeagen/harpoon',
|
||||
branch = 'harpoon2',
|
||||
dependencies = { 'nvim-lua/plenary.nvim', 'nvim-telescope/telescope.nvim' },
|
||||
config = function()
|
||||
local harpoon = require 'harpoon'
|
||||
harpoon:setup()
|
||||
vim.keymap.set('n', '<leader>a', function()
|
||||
harpoon:list():add()
|
||||
end, { desc = '[A]dd to Harpoon list' })
|
||||
vim.keymap.set('n', '<leader>e', function()
|
||||
harpoon.ui:toggle_quick_menu(harpoon:list())
|
||||
end, { desc = 'Toggle Harpoon m[E]nu' })
|
||||
|
||||
vim.keymap.set('n', '<leader>1', function()
|
||||
harpoon:list():select(1)
|
||||
end, { desc = 'Harpoon 1' })
|
||||
vim.keymap.set('n', '<leader>2', function()
|
||||
harpoon:list():select(2)
|
||||
end, { desc = 'Harpoon 2' })
|
||||
vim.keymap.set('n', '<leader>3', function()
|
||||
harpoon:list():select(3)
|
||||
end, { desc = 'Harpoon 3' })
|
||||
vim.keymap.set('n', '<leader>4', function()
|
||||
harpoon:list():select(4)
|
||||
end, { desc = 'Harpoon 4' })
|
||||
|
||||
-- Toggle previous & next buffers stored within Harpoon list
|
||||
vim.keymap.set('n', '<leader>p', function()
|
||||
harpoon:list():prev()
|
||||
end, { desc = '[P]revious Harpoon' })
|
||||
vim.keymap.set('n', '<leader>n', function()
|
||||
harpoon:list():next()
|
||||
end, { desc = '[N]ext Harpoon' })
|
||||
|
||||
-- basic telescope configuration
|
||||
local conf = require('telescope.config').values
|
||||
local function toggle_telescope(harpoon_files)
|
||||
local file_paths = {}
|
||||
for _, item in ipairs(harpoon_files.items) do
|
||||
table.insert(file_paths, item.value)
|
||||
end
|
||||
|
||||
require('telescope.pickers')
|
||||
.new({}, {
|
||||
prompt_title = 'Harpoon',
|
||||
finder = require('telescope.finders').new_table {
|
||||
results = file_paths,
|
||||
},
|
||||
previewer = conf.file_previewer {},
|
||||
sorter = conf.generic_sorter {},
|
||||
})
|
||||
:find()
|
||||
end
|
||||
|
||||
vim.keymap.set('n', '<leader><S-E>', function()
|
||||
toggle_telescope(harpoon:list())
|
||||
end, { desc = 'Open harpoon window' })
|
||||
end,
|
||||
},
|
||||
-- LSP Plugins
|
||||
{
|
||||
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
|
||||
|
|
@ -797,10 +852,14 @@ require('lazy').setup({
|
|||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
-- Conform can also run multiple formatters sequentially
|
||||
-- python = { "isort", "black" },
|
||||
--
|
||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
||||
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||
-- python = { 'ruff' },
|
||||
javascript = { 'prettier' },
|
||||
typescript = { 'prettier' },
|
||||
javascriptreact = { 'prettier' },
|
||||
typescriptreact = { 'prettier' },
|
||||
css = { 'prettier' },
|
||||
html = { 'prettier' },
|
||||
json = { 'prettier' },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -914,45 +973,13 @@ require('lazy').setup({
|
|||
vim.cmd 'colorscheme kanagawa'
|
||||
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',
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
config = function()
|
||||
-- Better Around/Inside textobjects
|
||||
--
|
||||
-- Examples:
|
||||
-- - va) - [V]isually select [A]round [)]paren
|
||||
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
|
||||
-- - ci' - [C]hange [I]nside [']quote
|
||||
require('mini.ai').setup { n_lines = 500 }
|
||||
|
||||
-- Add/delete/replace surroundings (brackets, quotes, etc.)
|
||||
--
|
||||
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
|
||||
-- - sd' - [S]urround [D]elete [']quotes
|
||||
-- - sr)' - [S]urround [R]eplace [)] [']
|
||||
require('mini.surround').setup()
|
||||
|
||||
-- Simple and easy statusline.
|
||||
-- You could remove this setup call if you don't like it,
|
||||
-- and try some other statusline plugin
|
||||
local statusline = require 'mini.statusline'
|
||||
|
||||
statusline.setup { use_icons = false }
|
||||
|
||||
-- You can configure sections in the statusline by overriding their
|
||||
-- default behavior. For example, here we set the section for
|
||||
-- cursor location to LINE:COLUMN
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
statusline.section_location = function()
|
||||
return '%2l:%-2v'
|
||||
end
|
||||
|
||||
-- ... and there is more!
|
||||
-- Check out: https://github.com/echasnovski/mini.nvim
|
||||
require('lualine').setup {
|
||||
theme = 'base16',
|
||||
}
|
||||
end,
|
||||
},
|
||||
{ -- Highlight, edit, and navigate code
|
||||
|
|
@ -997,7 +1024,90 @@ require('lazy').setup({
|
|||
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
|
||||
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
||||
},
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter-context',
|
||||
},
|
||||
{
|
||||
'windwp/nvim-autopairs',
|
||||
event = 'InsertEnter',
|
||||
config = true,
|
||||
-- use opts = {} for passing setup options
|
||||
-- this is equivalent to setup({}) function
|
||||
},
|
||||
{
|
||||
'folke/snacks.nvim',
|
||||
priority = 1000,
|
||||
lazy = false,
|
||||
},
|
||||
{
|
||||
'mikavilpas/yazi.nvim',
|
||||
event = 'VeryLazy',
|
||||
dependencies = {
|
||||
'folke/snacks.nvim',
|
||||
},
|
||||
keys = {
|
||||
-- 👇 in this section, choose your own keymappings!
|
||||
{
|
||||
'<leader>-',
|
||||
mode = { 'n', 'v' },
|
||||
'<cmd>Yazi<cr>',
|
||||
desc = 'Open yazi at the current file',
|
||||
},
|
||||
{
|
||||
-- Open in the current working directory
|
||||
'<leader>cw',
|
||||
'<cmd>Yazi cwd<cr>',
|
||||
desc = "Open the file manager in nvim's working directory",
|
||||
},
|
||||
{
|
||||
'<c-up>',
|
||||
'<cmd>Yazi toggle<cr>',
|
||||
desc = 'Resume the last yazi session',
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
-- if you want to open yazi instead of netrw, see below for more info
|
||||
open_for_directories = false,
|
||||
keymaps = {
|
||||
show_help = '<f1>',
|
||||
},
|
||||
},
|
||||
-- 👇 if you use `open_for_directories=true`, this is recommended
|
||||
init = function()
|
||||
-- More details: https://github.com/mikavilpas/yazi.nvim/issues/802
|
||||
-- vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
end,
|
||||
},
|
||||
{
|
||||
'goolord/alpha-nvim',
|
||||
config = function()
|
||||
local alpha = require 'alpha'
|
||||
local dashboard = require 'alpha.themes.dashboard'
|
||||
dashboard.section.header.val = {
|
||||
' ',
|
||||
' ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ',
|
||||
' ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ',
|
||||
' ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ',
|
||||
' ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ',
|
||||
' ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ',
|
||||
' ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ',
|
||||
' ',
|
||||
}
|
||||
|
||||
-- Set menu
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button('e', ' > New file', ':ene <BAR> startinsert <CR>'),
|
||||
dashboard.button('f', ' > Find file', ':cd $HOME/dev | Telescope find_files<CR>'),
|
||||
dashboard.button('r', ' > Recent', ':Telescope oldfiles<CR>'),
|
||||
dashboard.button('s', ' > Settings', ':e $MYVIMRC | :cd %:p:h | split . | wincmd k | pwd<CR>'),
|
||||
dashboard.button('q', ' > Quit NVIM', ':qa<CR>'),
|
||||
}
|
||||
|
||||
-- Send config to alpha
|
||||
alpha.setup(dashboard.opts)
|
||||
end,
|
||||
},
|
||||
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
||||
-- init.lua. If you want these files, they are in the repository, so you can just download them and
|
||||
-- place them in the correct locations.
|
||||
|
|
|
|||
Loading…
Reference in New Issue