diff --git a/home/.config/nvim/init.lua b/home/.config/nvim/init.lua index 8088924..beecaa3 100644 --- a/home/.config/nvim/init.lua +++ b/home/.config/nvim/init.lua @@ -2,6 +2,7 @@ require 'pluginmanager' require 'autocmd' require 'keybinds' require 'settings' +require 'common' -- Plugin configurations require 'pluginconf.lualine' diff --git a/home/.config/nvim/lua/common.lua b/home/.config/nvim/lua/common.lua new file mode 100644 index 0000000..6a974d5 --- /dev/null +++ b/home/.config/nvim/lua/common.lua @@ -0,0 +1,5 @@ +function MapKey(mode, keybind, command, opts) + local options = {noremap = true} + if opts then options = vim.tbl_extend('force', options, opts) end + vim.api.nvim_set_keymap(mode, keybind, command, options) +end diff --git a/home/.config/nvim/lua/keybinds.lua b/home/.config/nvim/lua/keybinds.lua index 198a667..21f6d91 100644 --- a/home/.config/nvim/lua/keybinds.lua +++ b/home/.config/nvim/lua/keybinds.lua @@ -1,27 +1,23 @@ -local function map(mode, lhs, rhs, opts) - local options = {noremap = true} - if opts then options = vim.tbl_extend('force', options, opts) end - vim.api.nvim_set_keymap(mode, lhs, rhs, options) -end +require 'common' -- Open/close tree browser -map('n', '', 'NvimTreeToggle') +MapKey('n', '', 'NvimTreeToggle') -- Telescope -map('n', '', 'Telescope find_files find_command=fd,-Ht,f') -map('n', '', 'Telescope live_grep') +MapKey('n', '', 'Telescope find_files find_command=fd,-Ht,f') +MapKey('n', '', 'Telescope live_grep') -- Completion -- Navigate completions with tab and shift tab -map('i', '', 'pumvisible() ? "\\" : "\\"', {expr = true}) -map('i', '', 'pumvisible() ? "\\" : "\\"', {expr = true}) +MapKey('i', '', 'pumvisible() ? "\\" : "\\"', {expr = true}) +MapKey('i', '', 'pumvisible() ? "\\" : "\\"', {expr = true}) -- Navigate between buffers -map('n', '', ':bn', {silent = true}) -map('n', '', ':bp', {silent = true}) +MapKey('n', '', ':bn', {silent = true}) +MapKey('n', '', ':bp', {silent = true}) -- Navigate between splits -map('n', '', '') -map('n', '', '') -map('n', '', '') -map('n', '', '') +MapKey('n', '', '') +MapKey('n', '', '') +MapKey('n', '', '') +MapKey('n', '', '') diff --git a/home/.config/nvim/lua/pager.lua b/home/.config/nvim/lua/pager.lua new file mode 100644 index 0000000..1534a44 --- /dev/null +++ b/home/.config/nvim/lua/pager.lua @@ -0,0 +1,5 @@ +-- Settings for pager mode +require 'common' + +MapKey('n', 'q', 'q') +--vim.cmd('set nomodifiable') diff --git a/home/.config/nvim/lua/pluginconf/lsp.lua b/home/.config/nvim/lua/pluginconf/lsp.lua index 51bfe6e..3aef542 100644 --- a/home/.config/nvim/lua/pluginconf/lsp.lua +++ b/home/.config/nvim/lua/pluginconf/lsp.lua @@ -50,7 +50,7 @@ lsp_installer.on_server_ready(function(server) local opts = {} -- Lua specific settings - if server_name == "sumneko_lua" then + if server.name == "sumneko_lua" then local runtime_path = vim.split(package.path, ';') opts.settings = { Lua = { diff --git a/home/.config/zsh/01-env.zsh b/home/.config/zsh/01-env.zsh index 55c9213..7092c72 100644 --- a/home/.config/zsh/01-env.zsh +++ b/home/.config/zsh/01-env.zsh @@ -50,10 +50,11 @@ export DOTREPO="$HOME/git/dotfiles" # nvim ftw! export EDITOR=nvim -export PAGER="$EDITOR -R" +export PAGER="$EDITOR -R +\"lua require 'pager'\"" +export GIT_PAGER="$EDITOR -R +\"lua require 'pager'\" \"Git log\"" export PARU_PAGER="$PAGER -c 'set ft=PKGBUILD'" export AUR_PAGER=$PAGER -export MANPAGER="$EDITOR +Man!" +export MANPAGER="$EDITOR +\"lua require 'pager'\" +Man!" # Use GPG for SSH authentication export GPG_TTY="$(tty)"