added keymap for navigation
This commit is contained in:
		
							parent
							
								
									7b4488ba07
								
							
						
					
					
						commit
						b2bbf271d7
					
				
							
								
								
									
										61
									
								
								init.lua
								
								
								
								
							
							
						
						
									
										61
									
								
								init.lua
								
								
								
								
							| 
						 | 
					@ -5,7 +5,6 @@
 | 
				
			||||||
=====================================================================
 | 
					=====================================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Kickstart.nvim is *not* a distribution.
 | 
					Kickstart.nvim is *not* a distribution.
 | 
				
			||||||
 | 
					 | 
				
			||||||
Kickstart.nvim is a template for your own configuration.
 | 
					Kickstart.nvim is a template for your own configuration.
 | 
				
			||||||
  The goal is that you can read every line of code, top-to-bottom, understand
 | 
					  The goal is that you can read every line of code, top-to-bottom, understand
 | 
				
			||||||
  what your configuration is doing, and modify it to suit your needs.
 | 
					  what your configuration is doing, and modify it to suit your needs.
 | 
				
			||||||
| 
						 | 
					@ -155,7 +154,7 @@ require('lazy').setup({
 | 
				
			||||||
    opts = {
 | 
					    opts = {
 | 
				
			||||||
      options = {
 | 
					      options = {
 | 
				
			||||||
        icons_enabled = false,
 | 
					        icons_enabled = false,
 | 
				
			||||||
        theme = 'onedark',
 | 
					        theme = 'powerline',
 | 
				
			||||||
        component_separators = '|',
 | 
					        component_separators = '|',
 | 
				
			||||||
        section_separators = '',
 | 
					        section_separators = '',
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
| 
						 | 
					@ -227,7 +226,8 @@ require('lazy').setup({
 | 
				
			||||||
vim.o.hlsearch = false
 | 
					vim.o.hlsearch = false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- Make line numbers default
 | 
					-- Make line numbers default
 | 
				
			||||||
vim.wo.number = true
 | 
					vim.o.number = true
 | 
				
			||||||
 | 
					vim.o.relativenumber = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- Enable mouse mode
 | 
					-- Enable mouse mode
 | 
				
			||||||
vim.o.mouse = 'a'
 | 
					vim.o.mouse = 'a'
 | 
				
			||||||
| 
						 | 
					@ -240,9 +240,26 @@ vim.o.clipboard = 'unnamedplus'
 | 
				
			||||||
-- Enable break indent
 | 
					-- Enable break indent
 | 
				
			||||||
vim.o.breakindent = true
 | 
					vim.o.breakindent = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- Save undo history
 | 
					-- Indent Configuration
 | 
				
			||||||
 | 
					vim.o.tabstop = 4
 | 
				
			||||||
 | 
					vim.o.softtabstop = 4
 | 
				
			||||||
 | 
					vim.o.shiftwidth = 4
 | 
				
			||||||
 | 
					vim.o.expandtab = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					vim.o.smartindent = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- Disable line wrap
 | 
				
			||||||
 | 
					vim.o.wrap = false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- Save undo history_list
 | 
				
			||||||
 | 
					vim.o.swapfile = false
 | 
				
			||||||
 | 
					vim.o.backup = false
 | 
				
			||||||
 | 
					vim.o.undodir = os.getenv("HOME") .. "/.vim/undodir"
 | 
				
			||||||
vim.o.undofile = true
 | 
					vim.o.undofile = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- Searching Configuration
 | 
				
			||||||
 | 
					vim.o.incsearch = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- Case-insensitive searching UNLESS \C or capital in search
 | 
					-- Case-insensitive searching UNLESS \C or capital in search
 | 
				
			||||||
vim.o.ignorecase = true
 | 
					vim.o.ignorecase = true
 | 
				
			||||||
vim.o.smartcase = true
 | 
					vim.o.smartcase = true
 | 
				
			||||||
| 
						 | 
					@ -251,7 +268,7 @@ vim.o.smartcase = true
 | 
				
			||||||
vim.wo.signcolumn = 'yes'
 | 
					vim.wo.signcolumn = 'yes'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- Decrease update time
 | 
					-- Decrease update time
 | 
				
			||||||
vim.o.updatetime = 250
 | 
					vim.o.updatetime = 50
 | 
				
			||||||
vim.o.timeoutlen = 300
 | 
					vim.o.timeoutlen = 300
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- Set completeopt to have a better completion experience
 | 
					-- Set completeopt to have a better completion experience
 | 
				
			||||||
| 
						 | 
					@ -260,17 +277,49 @@ vim.o.completeopt = 'menuone,noselect'
 | 
				
			||||||
-- NOTE: You should make sure your terminal supports this
 | 
					-- NOTE: You should make sure your terminal supports this
 | 
				
			||||||
vim.o.termguicolors = true
 | 
					vim.o.termguicolors = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					vim.o.scrolloff = 10
 | 
				
			||||||
 | 
					-- vim.o.isfname:append("@-@")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					vim.o.colorcolumn = "80"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- [[ Basic Keymaps ]]
 | 
					-- [[ Basic Keymaps ]]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- Keymaps for better default experience
 | 
					-- Keymaps for better default experience
 | 
				
			||||||
-- See `:help vim.keymap.set()`
 | 
					-- See `:help vim.keymap.set()`
 | 
				
			||||||
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
 | 
					vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
 | 
				
			||||||
vim.keymap.set('n', '<leader>pv', vim.cmd.Ex)
 | 
					vim.keymap.set('n', '<leader>pv', vim.cmd.Ex, { desc = "[P]roject [V]iew"})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- Remap for dealing with word wrap
 | 
					-- Remap for dealing with word wrap
 | 
				
			||||||
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
 | 
					vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
 | 
				
			||||||
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
 | 
					vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- Move lines
 | 
				
			||||||
 | 
					--
 | 
				
			||||||
 | 
					vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv")
 | 
				
			||||||
 | 
					vim.keymap.set('v', 'K', ":m '<-2<CR>gv=gv")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					vim.keymap.set('n', 'J', "mzj`z")
 | 
				
			||||||
 | 
					vim.keymap.set('n', '<C-d>', "<C-d>zz")
 | 
				
			||||||
 | 
					vim.keymap.set('n', '<C-u>', "<C-u>zz")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- Keep search line in the middle
 | 
				
			||||||
 | 
					vim.keymap.set('n', 'n', 'nzzzv')
 | 
				
			||||||
 | 
					vim.keymap.set('n', 'N', 'Nzzzv')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- Quick fix navigation
 | 
				
			||||||
 | 
					vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
 | 
				
			||||||
 | 
					vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
 | 
				
			||||||
 | 
					vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
 | 
				
			||||||
 | 
					vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- Copy from plus register
 | 
				
			||||||
 | 
					vim.keymap.set({ 'n', 'v' }, '<leader>y', "\"+y")
 | 
				
			||||||
 | 
					vim.keymap.set('n', '<leader>Y', "\"+Y")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- Replace current word
 | 
				
			||||||
 | 
					vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
 | 
				
			||||||
 | 
					vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- [[ Highlight on yank ]]
 | 
					-- [[ Highlight on yank ]]
 | 
				
			||||||
-- See `:help vim.highlight.on_yank()`
 | 
					-- See `:help vim.highlight.on_yank()`
 | 
				
			||||||
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
 | 
					local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue