personalize kickstart
This commit is contained in:
parent
3cfccc01be
commit
4795540b7d
1 changed files with 58 additions and 15 deletions
73
init.lua
73
init.lua
|
@ -63,7 +63,7 @@ Kickstart Guide:
|
|||
This should be the first place you go to look when you're stuck or confused
|
||||
with something. It's one of my favorite neovim features.
|
||||
|
||||
MOST IMPORTANTLY, we provide a keymap "<space>sh" to [s]earch the [h]elp documentation,
|
||||
MOST IMPORTANTLY, we provide a keymap "<spa e>sh" to [s]earch the [h]elp documentation,
|
||||
which is very useful when you're not sure exactly what you're looking for.
|
||||
|
||||
I have left several `:help X` comments throughout the init.lua
|
||||
|
@ -154,6 +154,9 @@ vim.opt.scrolloff = 10
|
|||
-- [[ Basic Keymaps ]]
|
||||
-- See `:help vim.keymap.set()`
|
||||
|
||||
-- duplicate command mode without need for shift
|
||||
vim.keymap.set('n', ';', ':', { desc = 'enter command mode', nowait = true })
|
||||
|
||||
-- Set highlight on search, but clear on pressing <Esc> in normal mode
|
||||
vim.opt.hlsearch = true
|
||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||
|
@ -187,6 +190,36 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
|
|||
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' })
|
||||
|
||||
vim.keymap.set('n', '<C-d>', '<C-d>zz', { desc = 'scroll down centered' })
|
||||
vim.keymap.set('n', '<C-u>', '<C-u>zz', { desc = 'scroll down centered' })
|
||||
|
||||
vim.keymap.set('n', 'J', 'mzJ`z', { desc = 'Join lines keep cursor position' })
|
||||
|
||||
vim.keymap.set('n', 'n', 'nzzzv', { desc = 'search forward centered' })
|
||||
vim.keymap.set('n', 'N', 'Nzzzv', { desc = 'search backward centered' })
|
||||
|
||||
vim.keymap.set('n', '<leader>y', '"+y', { desc = 'yank to system clipboard' })
|
||||
vim.keymap.set('n', '<leader>Y', '"+Y', { desc = 'yank lines to system clipboard' })
|
||||
vim.keymap.set('n', '<leader>d', '_d', { desc = 'delete to void register' })
|
||||
vim.keymap.set('n', '<C-f>', '<cmd>silent !tmux neww tmux-sessionizer<CR>', { desc = 'switch projects when using tmux' })
|
||||
vim.keymap.set('n', '<leader>s', ':%s/<C-r><C-w>/<C-r><C-w>/gI<Left><Left><Left>', { desc = 'replace word under cursor' })
|
||||
|
||||
vim.keymap.set('n', '<leader>cm', ':%s/\\r$//g<CR>', { desc = 'Remove CR from end of line' })
|
||||
|
||||
vim.keymap.set('n', '<leader>x', '<cmd>!chmod +x %<CR>', { desc = 'set execute bit on open script' })
|
||||
|
||||
vim.keymap.set('n', 'x', '"_x', { desc = 'del char keep clip' })
|
||||
vim.keymap.set('n', 'X', '"_X', { desc = 'del char keep clip' })
|
||||
|
||||
vim.keymap.set('n', '<leader>cr', function()
|
||||
require('nvchad.renamer').open()
|
||||
end, { desc = 'LSP Rename' })
|
||||
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv", { desc = 'Move selected text down' })
|
||||
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv", { desc = 'Move selected text up' })
|
||||
vim.keymap.set('v', '<C-c>', '<Esc>', { desc = 'exit vertical edit mode' })
|
||||
vim.keymap.set('i', 'jk', '<ESC>')
|
||||
vim.keymap.set('t', 'jk', '<C-\\><C-n>')
|
||||
|
||||
-- [[ Basic Autocommands ]]
|
||||
-- See `:help lua-guide-autocommands`
|
||||
|
||||
|
@ -234,7 +267,7 @@ require('lazy').setup({
|
|||
-- This is equivalent to:
|
||||
-- require('Comment').setup({})
|
||||
|
||||
-- "gc" to comment visual regions/lines
|
||||
-- "gc" to com ent visual regions/lines
|
||||
{ 'numToStr/Comment.nvim', opts = {} },
|
||||
|
||||
-- Here is a more advanced example where we pass configuration
|
||||
|
@ -320,7 +353,7 @@ require('lazy').setup({
|
|||
},
|
||||
config = function()
|
||||
-- Telescope is a fuzzy finder that comes with a lot of different things that
|
||||
-- it can fuzzy find! It's more than just a "file finder", it can search
|
||||
-- it can fuzzy find! It's more than just a "fi e finder", it can search
|
||||
-- many different aspects of Neovim, your workspace, LSP, and more!
|
||||
--
|
||||
-- The easiest way to use telescope, is to start by doing something like:
|
||||
|
@ -328,13 +361,6 @@ require('lazy').setup({
|
|||
--
|
||||
-- After running this command, a window will open up and you're able to
|
||||
-- type in the prompt window. You'll see a list of help_tags options and
|
||||
-- a corresponding preview of the help.
|
||||
--
|
||||
-- Two important keymaps to use while in telescope are:
|
||||
-- - Insert mode: <c-/>
|
||||
-- - Normal mode: ?
|
||||
--
|
||||
-- This opens a window that shows you all of the keymaps for the current
|
||||
-- telescope picker. This is really useful to discover what Telescope can
|
||||
-- do as well as how to actually do it!
|
||||
|
||||
|
@ -532,10 +558,9 @@ require('lazy').setup({
|
|||
-- - settings (table): Override the default settings passed when initializing the server.
|
||||
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
||||
local servers = {
|
||||
-- clangd = {},
|
||||
-- gopls = {},
|
||||
-- pyright = {},
|
||||
-- rust_analyzer = {},
|
||||
clangd = {},
|
||||
cssls = {},
|
||||
gopls = {},
|
||||
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||
--
|
||||
-- Some languages (like typescript) have entire language plugins that can be useful:
|
||||
|
@ -544,7 +569,6 @@ require('lazy').setup({
|
|||
-- But for many setups, the LSP (`tsserver`) will work just fine
|
||||
-- tsserver = {},
|
||||
--
|
||||
|
||||
lua_ls = {
|
||||
-- cmd = {...},
|
||||
-- filetypes { ...},
|
||||
|
@ -571,6 +595,11 @@ require('lazy').setup({
|
|||
},
|
||||
},
|
||||
},
|
||||
html = {},
|
||||
htmx = {},
|
||||
pyright = {},
|
||||
rust_analyzer = {},
|
||||
yamlls = {},
|
||||
}
|
||||
|
||||
-- Ensure the servers and tools above are installed
|
||||
|
@ -624,6 +653,13 @@ require('lazy').setup({
|
|||
},
|
||||
},
|
||||
|
||||
{ -- copilot
|
||||
'zbirenbaum/copilot.lua',
|
||||
cmd = 'Copilot',
|
||||
event = 'InsertEnter',
|
||||
opts = {},
|
||||
},
|
||||
|
||||
{ -- Autocompletion
|
||||
'hrsh7th/nvim-cmp',
|
||||
event = 'InsertEnter',
|
||||
|
@ -654,6 +690,9 @@ require('lazy').setup({
|
|||
-- for various frameworks/libraries/etc. but you will have to
|
||||
-- set up the ones that are useful for you.
|
||||
-- 'rafamadriz/friendly-snippets',
|
||||
|
||||
-- add copilot support
|
||||
'hrsh7th/cmp-copilot',
|
||||
},
|
||||
config = function()
|
||||
-- See `:help cmp`
|
||||
|
@ -710,9 +749,13 @@ require('lazy').setup({
|
|||
},
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'copilot' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'path' },
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue