made tab helper, relative movement

This commit is contained in:
2022-10-10 08:12:29 -05:00
parent 61446bb8e5
commit a8ad2d6fe8
17 changed files with 39 additions and 45 deletions
+1 -2
View File
@@ -1,2 +1 @@
vim.bo.shiftwidth = 2 require("helpers").set_tab(2)
vim.bo.tabstop = 2
+1 -2
View File
@@ -1,2 +1 @@
vim.bo.shiftwidth = 2 require("helpers").set_tab(2)
vim.bo.tabstop = 2
+1 -3
View File
@@ -1,3 +1 @@
local len = 2 require("helpers").set_tab(2)
vim.bo.shiftwidth = len
vim.bo.tabstop = len
+1 -3
View File
@@ -1,3 +1 @@
local len = 2 require("helpers").set_tab(2)
vim.bo.shiftwidth = len
vim.bo.tabstop = len
+1 -3
View File
@@ -1,3 +1 @@
local len = 2 require("helpers").set_tab(2)
vim.bo.shiftwidth = len
vim.bo.tabstop = len
+1 -3
View File
@@ -1,3 +1 @@
local len = 2 require("helpers").set_tab(2)
vim.bo.shiftwidth = len
vim.bo.tabstop = len
+2 -8
View File
@@ -1,13 +1,7 @@
local function local_map(mode, lhs, rhs, opts) local map = require("helpers").map
local options = { noremap = true }
if opts then
options = vim.tbl_extend("force", options, opts)
end
vim.api.nvim_buf_set_keymap(0, mode, lhs, rhs, options)
end
local function silent_map(mode, lhs, rhs) local function silent_map(mode, lhs, rhs)
local_map(mode, lhs, rhs, { silent = true }) map(mode, lhs, rhs, { silent = true })
end end
silent_map("n", "<Up>", "gk") silent_map("n", "<Up>", "gk")
+1 -3
View File
@@ -1,3 +1 @@
local len = 2 require("helpers").set_tab(2)
vim.bo.shiftwidth = len
vim.bo.tabstop = len
+1 -3
View File
@@ -1,3 +1 @@
local len = 2 require("helpers").set_tab(2)
vim.bo.shiftwidth = len
vim.bo.tabstop = len
+1 -3
View File
@@ -1,3 +1 @@
local len = 2 require("helpers").set_tab(2)
vim.bo.shiftwidth = len
vim.bo.tabstop = len
+1 -2
View File
@@ -1,2 +1 @@
vim.bo.shiftwidth = 4 require("helpers").set_tab(4)
vim.bo.tabstop = 4
-1
View File
@@ -1,3 +1,2 @@
require("packer_check")
require("base") require("base")
require("plugins") require("plugins")
+15 -3
View File
@@ -1,9 +1,7 @@
-- SHOULD NOT CONTAIN ANY SETTINGS RELATED TO EXTERNAL PLUGINS -- SHOULD NOT CONTAIN ANY SETTINGS RELATED TO EXTERNAL PLUGINS
-- OR CUSTOM CODE YOU YOURSELF WROTE. -- OR CUSTOM CODE YOU YOURSELF WROTE.
local helpers = require("helpers") local map = require("helpers").map
local map = helpers.map
local opt = vim.opt local opt = vim.opt
local g = vim.g local g = vim.g
@@ -53,6 +51,20 @@ map("t", "<C-Space>", [[<C-\><C-n>]])
map("n", [[<Leader>\]], ":" .. term_command .. "<CR>") map("n", [[<Leader>\]], ":" .. term_command .. "<CR>")
map("n", [[<Leader>|]], ":v" .. term_command .. "<CR>") map("n", [[<Leader>|]], ":v" .. term_command .. "<CR>")
-- Move cursor relative to visual line breaks
local function silent_map(mode, lhs, rhs)
map(mode, lhs, rhs, { silent = true })
end
silent_map("n", "<Up>", "gk")
silent_map("n", "<Down>", "gj")
silent_map("n", "<Home>", "g<Home>")
silent_map("n", "<End>", "g<End>")
silent_map("i", "<Up>", "<C-o>gk")
silent_map("i", "<Down>", "<C-o>gj")
silent_map("i", "<Home>", "<C-o>g<Home>")
silent_map("i", "<End>", "<C-o>g<End>")
opt.autoindent = true opt.autoindent = true
opt.autoread = true opt.autoread = true
+5
View File
@@ -71,4 +71,9 @@ function M.lsp_config_defaults()
} }
end end
function M.set_tab(length)
vim.bo.shiftwidth = length
vim.bo.tabstop = length
end
return M return M
+6 -6
View File
@@ -36,11 +36,15 @@ function M.fzf()
map("n", "<Leader>r", ":Rg <C-R><C-W><CR>") map("n", "<Leader>r", ":Rg <C-R><C-W><CR>")
map("n", "<Leader>R", ":Rg<CR>") map("n", "<Leader>R", ":Rg<CR>")
map("n", "<Leader>s", ":Lines<CR>") map("n", "<Leader>s", ":Lines<CR>")
map("n", "<Leader>gf", ":GFiles<CR>") map("n", "<Leader>gl", ":GFiles<CR>")
map("n", "<Leader>gn", ":GFiles?<CR>") map("n", "<Leader>gs", ":GFiles?<CR>")
map("n", "<Leader>gc", ":Commits<CR>") map("n", "<Leader>gc", ":Commits<CR>")
end end
function M.fzf_checkout()
map("n", "<Leader>gb", ":GBranches<CR>")
end
function M.rnvimr() function M.rnvimr()
map("n", "<Leader>f", [[:RnvimrToggle<CR>]]) map("n", "<Leader>f", [[:RnvimrToggle<CR>]])
end end
@@ -72,10 +76,6 @@ function M.auto_session()
}) })
end end
function M.fzf_checkout()
map("n", "<Leader>gb", ":GBranches<CR>")
end
function M.indent_blankline() function M.indent_blankline()
vim.opt.list = true vim.opt.list = true
+1
View File
@@ -1,3 +1,4 @@
require("plugins.install_packer")
require("plugins.startup") require("plugins.startup")
local config = require("plugins.config") local config = require("plugins.config")