return cmds as a module
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
local yank = require("user.utils").yank
|
||||
|
||||
function open_terminal(vertically)
|
||||
local M = {}
|
||||
|
||||
M.open_terminal = function(vertically)
|
||||
vertically = vertically or false
|
||||
|
||||
if vertically then
|
||||
@@ -10,7 +12,7 @@ function open_terminal(vertically)
|
||||
end
|
||||
end
|
||||
|
||||
function copy_diagnostic_message()
|
||||
M.copy_diagnostic_message = function()
|
||||
local diagnostics = vim.lsp.diagnostic.get_line_diagnostics()
|
||||
|
||||
if #diagnostics == 0 then
|
||||
@@ -26,3 +28,5 @@ function copy_diagnostic_message()
|
||||
|
||||
print("Diagnostic message was yanked")
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@@ -31,8 +31,8 @@ vmap(">", ">gv")
|
||||
|
||||
-- Terminal
|
||||
tmap("<ESC>", "<C-\\><C-n>") -- Escape - in terminal mode, quit to normal mode
|
||||
nmap("Th", ":lua open_terminal()<CR>") -- Shift+t - open terminal in horizontal split
|
||||
nmap("Tv", ":lua open_terminal(true)<CR>") -- Shift+t+v - open terminal in vertical split
|
||||
nmap("Th", ":lua require('user.cmds').open_terminal()<CR>") -- Shift+t - open terminal in horizontal split
|
||||
nmap("Tv", ":lua require('user.cmds').open_terminal(true)<CR>") -- Shift+t+v - open terminal in vertical split
|
||||
|
||||
-- Tabs
|
||||
nmap("H", ":tabprev<CR>") -- Shift+h - open previous tab
|
||||
@@ -55,7 +55,7 @@ nmap("<F2>", ":lua vim.lsp.buf.rename()<CR>") -- F2 - Rename thing under the cur
|
||||
nmap("<leader>.", ":lua vim.lsp.buf.code_action()<CR>") -- Leader+. - show code actions to run
|
||||
vmap("<leader>.", ":lua vim.lsp.buf.range_code_action()<CR>") -- same as above but for visual mode
|
||||
nmap("<leader>dd", ':lua vim.diagnostic.open_float(nil, {focus = false, scope = "cursor"})<CR>') -- Leader+d - show diagnostics in float window
|
||||
nmap("<leader>dy", ":lua copy_diagnostic_message()<CR>") -- Leader+d+c - copy diagnostic message
|
||||
nmap("<leader>dy", ":lua require('user.cmds').copy_diagnostic_message()<CR>") -- Leader+d+c - copy diagnostic message
|
||||
|
||||
-- Git
|
||||
nmap("<leader>gg", ":G<CR>") -- Leader+g+g - open vim-fugitive window
|
||||
|
||||
Reference in New Issue
Block a user