mirror of https://github.com/zpl-zak/nvimrc
update keymap
parent
f9487a7f9a
commit
b216bc031e
|
@ -0,0 +1,48 @@
|
|||
-- [[ Configure Telescope ]]
|
||||
-- See `:help telescope` and `:help telescope.setup()`
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
file_ignore_patterns = {
|
||||
"node_modules",
|
||||
"tags",
|
||||
"art",
|
||||
"bin",
|
||||
"dlls",
|
||||
"__pycache__"
|
||||
},
|
||||
mappings = {
|
||||
i = {
|
||||
['<C-u>'] = false,
|
||||
['<C-d>'] = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(require('telescope').load_extension, 'fzf')
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>?', builtin.oldfiles, { desc = '[?] Find recently opened files' })
|
||||
vim.keymap.set('n', '<leader><space>', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
})
|
||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
|
||||
vim.keymap.set('n', '<C-p>', builtin.git_files, { desc = 'Search [G]it [F]iles' })
|
||||
vim.keymap.set('n', '<leader>gf', builtin.git_files, { desc = 'Search [G]it [F]iles' })
|
||||
vim.keymap.set('n', '<leader>ff', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
||||
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
||||
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||
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>ps', function ()
|
||||
builtin.grep_string({ search = vim.fn.input("Grep > ") })
|
||||
end)
|
|
@ -1,7 +1,5 @@
|
|||
-- load options
|
||||
-- load lazy package manager
|
||||
require('configs.lazy')
|
||||
require('options')
|
||||
require('keymap')
|
||||
|
||||
-- load configs
|
||||
local config_path = vim.fn.stdpath("config") .. "/lua/zak/configs"
|
||||
|
@ -10,3 +8,7 @@ for _, file in ipairs(vim.fn.readdir(config_path, [[v:val =~ '\.lua$']])) do
|
|||
require("configs."..file:gsub("%.lua$", ""))
|
||||
end
|
||||
end
|
||||
|
||||
-- load options
|
||||
require('options')
|
||||
require('keymap')
|
||||
|
|
|
@ -19,30 +19,6 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
|||
pattern = '*',
|
||||
})
|
||||
|
||||
-- [[ Configure Telescope ]]
|
||||
-- See `:help telescope` and `:help telescope.setup()`
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
file_ignore_patterns = {
|
||||
"node_modules",
|
||||
"tags",
|
||||
"art",
|
||||
"bin",
|
||||
"dlls",
|
||||
"__pycache__"
|
||||
},
|
||||
mappings = {
|
||||
i = {
|
||||
['<C-u>'] = false,
|
||||
['<C-d>'] = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(require('telescope').load_extension, 'fzf')
|
||||
|
||||
-- other maps
|
||||
vim.keymap.set('n', '<leader>mm', vim.cmd.Ex)
|
||||
|
||||
|
@ -55,36 +31,40 @@ vim.keymap.set('n', '<C-b>', ':!./build.sh<CR><CR>')
|
|||
vim.keymap.set('n', '<A-b>', ':!./build.sh<CR>')
|
||||
|
||||
-- scroll keymap
|
||||
vim.keymap.set('n', '<c-up>', '<c-u>')
|
||||
vim.keymap.set('n', '<c-down>', '<c-d>')
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>?', builtin.oldfiles, { desc = '[?] Find recently opened files' })
|
||||
vim.keymap.set('n', '<leader><space>', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
})
|
||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
|
||||
vim.keymap.set('n', '<C-p>', builtin.git_files, { desc = 'Search [G]it [F]iles' })
|
||||
vim.keymap.set('n', '<leader>gf', builtin.git_files, { desc = 'Search [G]it [F]iles' })
|
||||
vim.keymap.set('n', '<leader>ff', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
||||
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
||||
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||
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>ps', function ()
|
||||
builtin.grep_string({ search = vim.fn.input("Grep > ") })
|
||||
end)
|
||||
vim.keymap.set('n', '<c-up>', '<c-u>zz')
|
||||
vim.keymap.set('n', '<c-down>', '<c-d>zz')
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" })
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" })
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" })
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" })
|
||||
|
||||
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", "n", "nzzzv")
|
||||
vim.keymap.set("n", "N", "Nzzzv")
|
||||
|
||||
-- greatest remap ever
|
||||
vim.keymap.set("x", "<leader>p", [["_dP]])
|
||||
|
||||
-- next greatest remap ever : asbjornHaland
|
||||
vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]])
|
||||
vim.keymap.set("n", "<leader>Y", [["+Y]])
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "<leader>d", [["_d]])
|
||||
|
||||
-- This is going to get me cancelled
|
||||
vim.keymap.set("i", "<C-c>", "<Esc>")
|
||||
|
||||
vim.keymap.set("n", "Q", "<nop>")
|
||||
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format)
|
||||
|
||||
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")
|
||||
|
||||
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
|
||||
|
|
|
@ -3,22 +3,30 @@
|
|||
|
||||
-- Set highlight on search
|
||||
vim.o.hlsearch = false
|
||||
vim.o.incsearch = true
|
||||
|
||||
-- Make line numbers default
|
||||
vim.wo.number = true
|
||||
vim.o.guicursor = ""
|
||||
vim.o.nu = true
|
||||
vim.o.relativenumber = true
|
||||
|
||||
-- Enable mouse mode
|
||||
vim.o.mouse = 'a'
|
||||
|
||||
-- Sync clipboard between OS and Neovim.
|
||||
-- Remove this option if you want your OS clipboard to remain independent.
|
||||
-- See `:help 'clipboard'`
|
||||
vim.o.clipboard = 'unnamedplus'
|
||||
|
||||
-- Enable break indent
|
||||
vim.o.breakindent = true
|
||||
|
||||
-- disable text wrap
|
||||
vim.o.wrap = false
|
||||
|
||||
-- Save undo history
|
||||
vim.o.swapfile = false
|
||||
vim.o.backup = false
|
||||
vim.o.undodir = os.getenv("HOME") .. "/.vim/undodir"
|
||||
vim.o.undofile = true
|
||||
|
||||
-- Case insensitive searching UNLESS /C or capital in search
|
||||
|
@ -28,8 +36,8 @@ vim.o.smartcase = true
|
|||
-- Keep signcolumn on by default
|
||||
vim.wo.signcolumn = 'yes'
|
||||
|
||||
-- Decrease update time
|
||||
vim.o.updatetime = 250
|
||||
-- Set update time
|
||||
vim.o.updatetime = 50
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
|
||||
|
@ -39,9 +47,15 @@ vim.o.completeopt = 'menuone,noselect'
|
|||
-- NOTE: You should make sure your terminal supports this
|
||||
vim.o.termguicolors = true
|
||||
|
||||
vim.o.scrolloff = 8
|
||||
vim.o.signcolumn = "yes"
|
||||
vim.opt.isfname:append("@-@")
|
||||
vim.o.colorcolumn = "80"
|
||||
|
||||
-- indent setup
|
||||
vim.opt.list = false
|
||||
vim.o.list = false
|
||||
vim.opt.listchars:append "eol: "
|
||||
vim.o.smartindent = true
|
||||
|
||||
vim.cmd([[ set shellcmdflag=-c ]])
|
||||
|
||||
|
|
Loading…
Reference in New Issue