Added mapping

This commit is contained in:
Fabian Schmidt 2021-02-24 19:14:06 +01:00
parent 8e7a8e3680
commit 6b421a3f3e
2 changed files with 54 additions and 23 deletions

View File

@ -0,0 +1,28 @@
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
vim.g.mapleader = ","
-- Toggle Goyo
map('n', '<C-g>', ':Goyo<Enter>', {noremap = false})
-- Open and move to resized terminal
map('n', '<leader>t', '<C-w>s<C-w>j :terminal<CR>:res 5<CR>i', {noremap = false})
-- Enter normal mode in terminal
map('t', '<Esc>', '<C-\\><C-N>')
-- Clear highlight
map('n', '<C-l>', '<cmd>noh<CR>')
-- Move to window in any mode
map('t', 'ª', '<C-\\><C-N><C-w>h')
map('t', 'º', '<C-\\><C-N><C-w>j')
map('t', '', '<C-\\><C-N><C-w>k')
map('t', '@', '<C-\\><C-N><C-w>l')
map('i', 'ª', '<C-\\><C-N><C-w>h')
map('i', 'º', '<C-\\><C-N><C-w>j')
map('i', '', '<C-\\><C-N><C-w>k')
map('i', '@', '<C-\\><C-N><C-w>l')
map('n', 'ª', '<C-w>h')
map('n', 'º', '<C-w>j')
map('n', '', '<C-w>k')
map('n', '@', '<C-w>l')

View File

@ -1,37 +1,40 @@
-- settings.lua -- settings.lua
local o = vim.o
local wo = vim.wo
local bo = vim.bo
local g = vim.g
local cmd = vim.cmd local cmd = vim.cmd
local scopes = {o = vim.o, bo = vim.bo, wo = vim.wo}
local function opt(scope, key, value)
scopes[scope][key] = value
if scope ~= 'o' then scopes['o'][key] = value end
end
---- Misc Options ---- Misc Options
-- global options -- global options
o.swapfile = true opt('o', 'swapfile', true)
o.dir = '/tmp' opt('o', 'dir', '/tmp')
o.smartcase = true opt('o', 'smartcase', true)
o.laststatus = 2 opt('o', 'laststatus', 2)
o.hlsearch = true opt('o', 'hlsearch', true)
o.incsearch = true opt('o', 'incsearch', true)
o.ignorecase = true opt('o', 'ignorecase', true)
o.scrolloff = 12 opt('o', 'scrolloff', 12)
o.mouse = 'a' opt('o', 'mouse', 'a')
-- window-local options -- window-local options
wo.number = true opt('wo', 'number', true)
wo.wrap = false opt('wo', 'wrap', false)
-- buffer-local options -- buffer-local options
bo.shiftwidth = 4 opt('bo', 'shiftwidth', 4)
bo.tabstop = 4 opt('bo', 'tabstop', 4)
bo.softtabstop = 4 opt('bo', 'softtabstop', 4)
bo.expandtab = true opt('bo', 'expandtab', true)
bo.autoindent = true opt('bo', 'autoindent', true)
---- Theme ---- Theme
-- Font -- Font
o.guifont = 'Source Code Pro for Powerline' opt('o', 'guifont', 'Source Code Pro for Powerline')
-- Statusline -- Statusline
local lualine = require('lualine') local lualine = require('lualine')
@ -43,9 +46,9 @@ bufferline.setup()
local function ColorDarcula() local function ColorDarcula()
lualine.options.theme = 'onedark' lualine.options.theme = 'onedark'
g.limelight_conceal_ctermfg = 'DarkGray' limelight_conceal_ctermfg = 'DarkGray'
cmd 'colorscheme darcula' cmd 'colorscheme darcula'
end end
bo.syntax = 'on' opt('bo', 'syntax', 'on')
ColorDarcula() ColorDarcula()