Skip to content

Commit

Permalink
feat(neovim): add insert mode <C-l>
Browse files Browse the repository at this point in the history
  • Loading branch information
yuma140902 committed Oct 13, 2024
1 parent ec2a21b commit 2660648
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions neovim/nvim/lua/keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ local function register_keymaps()
{ '<space>j', group = 'Join/Split' },
})

-- バニラ
-- ノーマルモード
map('n', '[b', '<cmd>bprev<cr>', '前のバッファ')
map('n', ']b', '<cmd>bnext<cr>', '次のバッファ')
local open = 'xdg-open'
Expand All @@ -27,12 +27,20 @@ local function register_keymaps()
open = 'start'
end
map({ 'n', 'x' }, 'gx', '<cmd>silent !' .. open .. ' <cfile><cr>', '標準アプリで開く')

-- タブ
map('n', '<C-H>', '<cmd>tabprev<cr>')
map('n', '<C-L>', '<cmd>tabnext<cr>')

-- バニラ - ターミナル
-- インサートモード
map('i', '<C-l>', function()
-- [Vim でアルファベット大文字の単語を楽に打つ裏技](https://zenn.dev/vim_jp/articles/2024-10-07-vim-insert-uppercase)
local line = vim.fn.getline(".")
local col = vim.fn.getpos(".")[3]
local substring = line:sub(1, col - 1)
local result = vim.fn.matchstr(substring, "[a-zA-Z0-9_]*$")
return "<C-w>" .. result:upper()
end, '直前の単語を大文字にする', { expr = true })

-- ターミナル
map('n', '<space>tn', '<cmd>terminal<cr>', 'ターミナルを開く')
map('n', '<space>tt', '<cmd>tabnew<cr><cmd>terminal<cr><cmd>startinsert<cr>', 'ターミナルを新規タブで開く')
map('n', '<space>tf', '<cmd>Lspsaga term_toggle<cr>', 'floating windowのターミナルをトグル')
Expand Down

0 comments on commit 2660648

Please sign in to comment.