Skip to content

Commit e9d83b0

Browse files
committed
new keymap and bg
1 parent 8df3deb commit e9d83b0

File tree

1 file changed

+58
-79
lines changed

1 file changed

+58
-79
lines changed

init.lua

Lines changed: 58 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -22,59 +22,59 @@
2222
2323
What is Kickstart?
2424
25-
Kickstart.nvim is *not* a distribution.
25+
Kickstart.nvim is *not* a distribution.
2626
27-
Kickstart.nvim is a starting point for your own configuration.
28-
The goal is that you can read every line of code, top-to-bottom, understand
29-
what your configuration is doing, and modify it to suit your needs.
27+
Kickstart.nvim is a starting point for your own configuration.
28+
The goal is that you can read every line of code, top-to-bottom, understand
29+
what your configuration is doing, and modify it to suit your needs.
3030
31-
Once you've done that, you can start exploring, configuring and tinkering to
32-
make Neovim your own! That might mean leaving Kickstart just the way it is for a while
33-
or immediately breaking it into modular pieces. It's up to you!
31+
Once you've done that, you can start exploring, configuring and tinkering to
32+
make Neovim your own! That might mean leaving Kickstart just the way it is for a while
33+
or immediately breaking it into modular pieces. It's up to you!
3434
35-
If you don't know anything about Lua, I recommend taking some time to read through
36-
a guide. One possible example which will only take 10-15 minutes:
37-
- https://learnxinyminutes.com/docs/lua/
35+
If you don't know anything about Lua, I recommend taking some time to read through
36+
a guide. One possible example which will only take 10-15 minutes:
37+
- https://learnxinyminutes.com/docs/lua/
3838
39-
After understanding a bit more about Lua, you can use `:help lua-guide` as a
40-
reference for how Neovim integrates Lua.
41-
- :help lua-guide
42-
- (or HTML version): https://neovim.io/doc/user/lua-guide.html
39+
After understanding a bit more about Lua, you can use `:help lua-guide` as a
40+
reference for how Neovim integrates Lua.
41+
- :help lua-guide
42+
- (or HTML version): https://neovim.io/doc/user/lua-guide.html
4343
4444
Kickstart Guide:
4545
46-
TODO: The very first thing you should do is to run the command `:Tutor` in Neovim.
46+
TODO: The very first thing you should do is to run the command `:Tutor` in Neovim.
4747
48-
If you don't know what this means, type the following:
49-
- <escape key>
50-
- :
51-
- Tutor
52-
- <enter key>
48+
If you don't know what this means, type the following:
49+
- <escape key>
50+
- :
51+
- Tutor
52+
- <enter key>
5353
54-
(If you already know the Neovim basics, you can skip this step.)
54+
(If you already know the Neovim basics, you can skip this step.)
5555
56-
Once you've completed that, you can continue working through **AND READING** the rest
57-
of the kickstart init.lua.
56+
Once you've completed that, you can continue working through **AND READING** the rest
57+
of the kickstart init.lua.
5858
59-
Next, run AND READ `:help`.
60-
This will open up a help window with some basic information
61-
about reading, navigating and searching the builtin help documentation.
59+
Next, run AND READ `:help`.
60+
This will open up a help window with some basic information
61+
about reading, navigating and searching the builtin help documentation.
6262
63-
This should be the first place you go to look when you're stuck or confused
64-
with something. It's one of my favorite Neovim features.
63+
This should be the first place you go to look when you're stuck or confused
64+
with something. It's one of my favorite Neovim features.
6565
66-
MOST IMPORTANTLY, we provide a keymap "<space>sh" to [s]earch the [h]elp documentation,
67-
which is very useful when you're not exactly sure of what you're looking for.
66+
MOST IMPORTANTLY, we provide a keymap "<space>sh" to [s]earch the [h]elp documentation,
67+
which is very useful when you're not exactly sure of what you're looking for.
6868
69-
I have left several `:help X` comments throughout the init.lua
70-
These are hints about where to find more information about the relevant settings,
71-
plugins or Neovim features used in Kickstart.
69+
I have left several `:help X` comments throughout the init.lua
70+
These are hints about where to find more information about the relevant settings,
71+
plugins or Neovim features used in Kickstart.
7272
73-
NOTE: Look for lines like this
73+
NOTE: Look for lines like this
7474
75-
Throughout the file. These are for you, the reader, to help you understand what is happening.
76-
Feel free to delete them once you know what you're doing, but they should serve as a guide
77-
for when you are first encountering a few different constructs in your Neovim config.
75+
Throughout the file. These are for you, the reader, to help you understand what is happening.
76+
Feel free to delete them once you know what you're doing, but they should serve as a guide
77+
for when you are first encountering a few different constructs in your Neovim config.
7878
7979
If you experience any errors while trying to install kickstart, run `:checkhealth` for more info.
8080
@@ -90,7 +90,7 @@ P.S. You can delete this when you're done too. It's your config now! :)
9090
vim.g.mapleader = ' '
9191
vim.g.maplocalleader = ' '
9292

93-
-- Set to true if you have a Nerd Font installed and selected in the terminal
93+
-- Set to true if you have a Nerd Font installed
9494
vim.g.have_nerd_font = false
9595

9696
-- [[ Setting options ]]
@@ -102,7 +102,7 @@ vim.g.have_nerd_font = false
102102
vim.opt.number = true
103103
-- You can also add relative line numbers, to help with jumping.
104104
-- Experiment for yourself to see if you like it!
105-
-- vim.opt.relativenumber = true
105+
vim.opt.relativenumber = true
106106

107107
-- Enable mouse mode, can be useful for resizing splits for example!
108108
vim.opt.mouse = 'a'
@@ -159,6 +159,7 @@ vim.opt.scrolloff = 10
159159

160160
-- Set highlight on search, but clear on pressing <Esc> in normal mode
161161
vim.opt.hlsearch = true
162+
vim.opt.incsearch = true
162163
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
163164

164165
-- Diagnostic keymaps
@@ -167,6 +168,21 @@ vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagn
167168
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
168169
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
169170

171+
-- Move highlighted text
172+
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv")
173+
vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv")
174+
175+
-- Move half page jumping with cursor in middle
176+
vim.keymap.set('n', 'n', 'nzzzv')
177+
vim.keymap.set('n', 'N', 'Nzzzv')
178+
179+
-- Search with cursor in the middle
180+
vim.keymap.set('n', '<C-d>', '<C-d>zz')
181+
vim.keymap.set('n', '<C-u>', '<C-u>zz')
182+
183+
-- Greatest remap ever
184+
vim.keymap.set('x', '<leader>p', '"_dP')
185+
170186
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
171187
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
172188
-- is not what someone will guess without a bit more experience.
@@ -286,13 +302,7 @@ require('lazy').setup({
286302
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
287303
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
288304
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
289-
['<leader>t'] = { name = '[T]oggle', _ = 'which_key_ignore' },
290-
['<leader>h'] = { name = 'Git [H]unk', _ = 'which_key_ignore' },
291305
}
292-
-- visual mode
293-
require('which-key').register({
294-
['<leader>h'] = { 'Git [H]unk' },
295-
}, { mode = 'v' })
296306
end,
297307
},
298308

@@ -412,7 +422,7 @@ require('lazy').setup({
412422
'neovim/nvim-lspconfig',
413423
dependencies = {
414424
-- Automatically install LSPs and related tools to stdpath for Neovim
415-
{ 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants
425+
'williamboman/mason.nvim',
416426
'williamboman/mason-lspconfig.nvim',
417427
'WhoIsSethDaniel/mason-tool-installer.nvim',
418428

@@ -514,37 +524,16 @@ require('lazy').setup({
514524
-- When you move your cursor, the highlights will be cleared (the second autocommand).
515525
local client = vim.lsp.get_client_by_id(event.data.client_id)
516526
if client and client.server_capabilities.documentHighlightProvider then
517-
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
518527
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
519528
buffer = event.buf,
520-
group = highlight_augroup,
521529
callback = vim.lsp.buf.document_highlight,
522530
})
523531

524532
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
525533
buffer = event.buf,
526-
group = highlight_augroup,
527534
callback = vim.lsp.buf.clear_references,
528535
})
529536
end
530-
531-
-- The following autocommand is used to enable inlay hints in your
532-
-- code, if the language server you are using supports them
533-
--
534-
-- This may be unwanted, since they displace some of your code
535-
if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
536-
map('<leader>th', function()
537-
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
538-
end, '[T]oggle Inlay [H]ints')
539-
end
540-
end,
541-
})
542-
543-
vim.api.nvim_create_autocmd('LspDetach', {
544-
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
545-
callback = function(event)
546-
vim.lsp.buf.clear_references()
547-
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event.buf }
548537
end,
549538
})
550539

@@ -731,12 +720,6 @@ require('lazy').setup({
731720
-- This will expand snippets if the LSP sent a snippet.
732721
['<C-y>'] = cmp.mapping.confirm { select = true },
733722

734-
-- If you prefer more traditional completion keymaps,
735-
-- you can uncomment the following lines
736-
--['<CR>'] = cmp.mapping.confirm { select = true },
737-
--['<Tab>'] = cmp.mapping.select_next_item(),
738-
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
739-
740723
-- Manually trigger a completion from nvim-cmp.
741724
-- Generally you don't need this, because nvim-cmp will display
742725
-- completions whenever it has completion options available.
@@ -785,7 +768,8 @@ require('lazy').setup({
785768
-- Like many other themes, this one has different styles, and you could load
786769
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
787770
vim.cmd.colorscheme 'tokyonight-night'
788-
771+
vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' })
772+
vim.api.nvim_set_hl(0, 'NormalFloat', { bg = 'none' })
789773
-- You can configure highlights by doing something like:
790774
vim.cmd.hi 'Comment gui=none'
791775
end,
@@ -850,8 +834,6 @@ require('lazy').setup({
850834
config = function(_, opts)
851835
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
852836

853-
-- Prefer git instead of curl in order to improve connectivity in some environments
854-
require('nvim-treesitter.install').prefer_git = true
855837
---@diagnostic disable-next-line: missing-fields
856838
require('nvim-treesitter.configs').setup(opts)
857839

@@ -876,9 +858,6 @@ require('lazy').setup({
876858
-- require 'kickstart.plugins.debug',
877859
-- require 'kickstart.plugins.indent_line',
878860
-- require 'kickstart.plugins.lint',
879-
-- require 'kickstart.plugins.autopairs',
880-
-- require 'kickstart.plugins.neo-tree',
881-
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
882861

883862
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
884863
-- This is the easiest way to modularize your config.

0 commit comments

Comments
 (0)