adding keymaps
This commit is contained in:
parent
b7a58b6314
commit
f823a67f73
60
init.lua
60
init.lua
|
|
@ -205,6 +205,8 @@ vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper win
|
|||
-- vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" })
|
||||
-- vim.keymap.set("n", "<C-S-k>", "<C-w>K", { desc = "Move window to the upper" })
|
||||
|
||||
vim.keymap.set('n', '<C-t>', ':tabnew<CR>', { noremap = true, silent = true })
|
||||
|
||||
-- [[ Basic Autocommands ]]
|
||||
-- See `:help lua-guide-autocommands`
|
||||
|
||||
|
|
@ -999,8 +1001,33 @@ require('lazy').setup({
|
|||
build = ':TSUpdate',
|
||||
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
},
|
||||
opts = {
|
||||
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
|
||||
ensure_installed = {
|
||||
'bash',
|
||||
'c',
|
||||
'diff',
|
||||
'html',
|
||||
'lua',
|
||||
'luadoc',
|
||||
'markdown',
|
||||
'markdown_inline',
|
||||
'query',
|
||||
'vim',
|
||||
'vimdoc',
|
||||
'yaml',
|
||||
'java',
|
||||
'javascript',
|
||||
'json',
|
||||
'python',
|
||||
'rust',
|
||||
'scala',
|
||||
'typescript',
|
||||
'go',
|
||||
'cpp',
|
||||
},
|
||||
-- Autoinstall languages that are not installed
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
|
|
@ -1011,6 +1038,18 @@ require('lazy').setup({
|
|||
additional_vim_regex_highlighting = { 'ruby' },
|
||||
},
|
||||
indent = { enable = true, disable = { 'ruby' } },
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
['af'] = '@function.outer',
|
||||
['if'] = '@function.inner',
|
||||
['ac'] = '@class.outer',
|
||||
['ic'] = '@class.inner',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- 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:
|
||||
|
|
@ -1098,5 +1137,24 @@ require('lazy').setup({
|
|||
},
|
||||
})
|
||||
|
||||
vim.keymap.set('n', '<leader>uc', function()
|
||||
local start = vim.fn.line '.'
|
||||
local finish = start
|
||||
|
||||
-- extend upward
|
||||
while start > 1 and vim.fn.getline(start - 1):match '^#' do
|
||||
start = start - 1
|
||||
end
|
||||
|
||||
-- extend downward
|
||||
local last = vim.fn.line '$'
|
||||
while finish < last and vim.fn.getline(finish + 1):match '^#' do
|
||||
finish = finish + 1
|
||||
end
|
||||
|
||||
-- Run Comment.nvim operator in normal mode over the range
|
||||
vim.cmd(string.format('%d,%dnormal gc', start, finish))
|
||||
end, { desc = 'Toggle comment on contiguous # block' })
|
||||
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
"nvim-metals": { "branch": "main", "commit": "40f7b9ea6ded898319136f4d6a94da9487584309" },
|
||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
|
||||
|
|
|
|||
Loading…
Reference in New Issue