update telescope, add neogit, add emacs movement commands in insert mode
This commit is contained in:
parent
e667abf5ee
commit
2b5101486c
57
init.lua
57
init.lua
|
|
@ -190,6 +190,14 @@ 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-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-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||||
|
|
||||||
|
-- Emacs-style movement in insert mode
|
||||||
|
vim.keymap.set('i', '<C-a>', '<Home>', { desc = 'Beginning of line' })
|
||||||
|
vim.keymap.set('i', '<C-e>', '<End>', { desc = 'End of line' })
|
||||||
|
vim.keymap.set('i', '<C-n>', '<Down>', { desc = 'Next line' })
|
||||||
|
vim.keymap.set('i', '<C-p>', '<Up>', { desc = 'Previous line' })
|
||||||
|
vim.keymap.set('i', '<C-f>', '<Right>', { desc = 'Forward char' })
|
||||||
|
vim.keymap.set('i', '<C-b>', '<Left>', { desc = 'Back char' })
|
||||||
|
|
||||||
-- [[ Basic Autocommands ]]
|
-- [[ Basic Autocommands ]]
|
||||||
-- See `:help lua-guide-autocommands`
|
-- See `:help lua-guide-autocommands`
|
||||||
|
|
||||||
|
|
@ -256,6 +264,20 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{ -- Git interface like magit
|
||||||
|
'NeogitOrg/neogit',
|
||||||
|
dependencies = {
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
|
'sindrets/diffview.nvim',
|
||||||
|
'nvim-telescope/telescope.nvim',
|
||||||
|
},
|
||||||
|
cmd = 'Neogit',
|
||||||
|
keys = {
|
||||||
|
{ '<leader>g', '<cmd>Neogit<cr>', desc = 'Neogit' },
|
||||||
|
},
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
|
||||||
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
|
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
|
||||||
--
|
--
|
||||||
-- This is often very useful to both group configuration, as well as handle
|
-- This is often very useful to both group configuration, as well as handle
|
||||||
|
|
@ -281,6 +303,7 @@ require('lazy').setup({
|
||||||
require('which-key').add {
|
require('which-key').add {
|
||||||
{ '<leader>c', group = '[C]ode' },
|
{ '<leader>c', group = '[C]ode' },
|
||||||
{ '<leader>d', group = '[D]ocument' },
|
{ '<leader>d', group = '[D]ocument' },
|
||||||
|
{ '<leader>p', group = '[P]roject' },
|
||||||
{ '<leader>r', group = '[R]ename' },
|
{ '<leader>r', group = '[R]ename' },
|
||||||
{ '<leader>s', group = '[S]earch' },
|
{ '<leader>s', group = '[S]earch' },
|
||||||
{ '<leader>w', group = '[W]orkspace' },
|
{ '<leader>w', group = '[W]orkspace' },
|
||||||
|
|
@ -300,7 +323,7 @@ require('lazy').setup({
|
||||||
{ -- Fuzzy Finder (files, lsp, etc)
|
{ -- Fuzzy Finder (files, lsp, etc)
|
||||||
'nvim-telescope/telescope.nvim',
|
'nvim-telescope/telescope.nvim',
|
||||||
event = 'VimEnter',
|
event = 'VimEnter',
|
||||||
branch = '0.1.x',
|
version = '*',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-lua/plenary.nvim',
|
'nvim-lua/plenary.nvim',
|
||||||
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
||||||
|
|
@ -366,6 +389,8 @@ require('lazy').setup({
|
||||||
|
|
||||||
-- See `:help telescope.builtin`
|
-- See `:help telescope.builtin`
|
||||||
local builtin = require 'telescope.builtin'
|
local builtin = require 'telescope.builtin'
|
||||||
|
vim.keymap.set('n', '<leader>f', builtin.find_files, { desc = 'Find files' })
|
||||||
|
vim.keymap.set('n', '<leader>pf', builtin.git_files, { desc = 'Project files (git)' })
|
||||||
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
||||||
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
||||||
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||||
|
|
@ -843,31 +868,11 @@ require('lazy').setup({
|
||||||
{ -- Highlight, edit, and navigate code
|
{ -- Highlight, edit, and navigate code
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
build = ':TSUpdate',
|
build = ':TSUpdate',
|
||||||
opts = {
|
config = function()
|
||||||
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'clojure', 'python' },
|
require('nvim-treesitter').setup {}
|
||||||
-- Autoinstall languages that are not installed
|
-- Install parsers if missing
|
||||||
auto_install = true,
|
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'clojure', 'python' }
|
||||||
highlight = {
|
require('nvim-treesitter').install(parsers)
|
||||||
enable = true,
|
|
||||||
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
|
|
||||||
-- If you are experiencing weird indenting issues, add the language to
|
|
||||||
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
|
|
||||||
additional_vim_regex_highlighting = { 'ruby' },
|
|
||||||
},
|
|
||||||
indent = { enable = true, disable = { 'ruby' } },
|
|
||||||
},
|
|
||||||
config = function(_, opts)
|
|
||||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
|
||||||
require('nvim-treesitter.configs').setup(opts)
|
|
||||||
|
|
||||||
-- There are additional nvim-treesitter modules that you can use to interact
|
|
||||||
-- with nvim-treesitter. You should go explore a few and see what interests you:
|
|
||||||
--
|
|
||||||
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod`
|
|
||||||
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
|
|
||||||
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue