101 lines
2.3 KiB
Lua
101 lines
2.3 KiB
Lua
-- Source configs with dependencies {{{
|
|
--for _, file in ipairs(vim.fn.readdir(vim.fn.stdpath('config')..'/lua-heavy', [[v:val =~ '\.lua$']])) do
|
|
-- require(file:gsub('%.lua$', ''))
|
|
--end
|
|
-- }}}
|
|
|
|
-- General Editor Settings {{{
|
|
vim.opt.number = true
|
|
vim.opt.relativenumber = true
|
|
vim.opt.cursorline = true
|
|
vim.opt.tabstop = 4
|
|
vim.opt.shiftwidth = 4
|
|
vim.opt.expandtab = false
|
|
vim.opt.list = true
|
|
vim.opt.listchars:append 'space:·'
|
|
vim.opt.path:append '**'
|
|
vim.opt.path:append '.'
|
|
vim.opt.wildmenu = true
|
|
vim.opt.wrap = false
|
|
vim.opt.clipboard = 'unnamedplus'
|
|
vim.opt.undofile = true
|
|
vim.opt.ignorecase = true
|
|
vim.opt.smartcase = true
|
|
vim.opt.updatetime = 250
|
|
vim.opt.timeoutlen = 300
|
|
vim.opt.inccommand = 'split'
|
|
vim.opt.foldmethod = 'marker'
|
|
-- }}}
|
|
|
|
-- Setup (Disable) Netrw {{{
|
|
vim.g.loaded_netrw = 1
|
|
vim.g.loaded_netrwPlugin = 1
|
|
--[[
|
|
vim.g.netrw_banner = 0
|
|
vim.g.netrw_sort_sequence = '[\\/]$'
|
|
vim.g.netrw_sort_options = 'i'
|
|
vim.g.netrw_silent = 1
|
|
]]
|
|
-- }}}
|
|
|
|
-- WriteSudo and ReadSudo hacks {{{
|
|
vim.api.nvim_create_user_command('WriteSudo', 'w !sudo tee %', {})
|
|
vim.api.nvim_create_user_command('ReadSudo', function(opts)
|
|
vim.cmd('r !sudo cat ' .. opts['args'])
|
|
end, { nargs = 1 })
|
|
-- }}}
|
|
|
|
-- Statusbar {{{
|
|
vim.opt.statusline = ' #%n %f %h%w%m%r %= %y %l:%c %p%% '
|
|
-- }}}
|
|
|
|
-- Toggle Terminal Script {{{
|
|
local te_buf = nil
|
|
local te_win_id = nil
|
|
|
|
local v = vim
|
|
local fun = v.fn
|
|
local cmd = v.api.nvim_command
|
|
local gotoid = fun.win_gotoid
|
|
local getid = fun.win_getid
|
|
|
|
local function openTerminal()
|
|
if fun.bufexists(te_buf) ~= 1 then
|
|
cmd("au TermOpen * setlocal nonumber norelativenumber signcolumn=no")
|
|
cmd("sp | winc J | res 10 | te")
|
|
te_win_id = getid()
|
|
te_buf = fun.bufnr('%')
|
|
elseif gotoid(te_win_id) ~= 1 then
|
|
cmd("sb " .. te_buf .. "| winc J | res 10")
|
|
te_win_id = getid()
|
|
end
|
|
cmd("startinsert")
|
|
end
|
|
|
|
local function hideTerminal()
|
|
if gotoid(te_win_id) == 1 then
|
|
cmd("hide")
|
|
end
|
|
end
|
|
|
|
function ToggleTerminal()
|
|
if gotoid(te_win_id) == 1 then
|
|
hideTerminal()
|
|
else
|
|
openTerminal()
|
|
end
|
|
end
|
|
-- }}}
|
|
|
|
-- Automatic insertmode in Terminal Mode {{{
|
|
vim.api.nvim_create_autocmd({ 'TermOpen' }, {
|
|
pattern = { 'term://*' },
|
|
command = 'startinsert',
|
|
})
|
|
-- }}}
|
|
|
|
-- Keymaps {{{
|
|
vim.api.nvim_set_keymap('n', '<leader>f', ':find ', { noremap = true, silent = true })
|
|
vim.keymap.set('n', '<leader>t', ToggleTerminal)
|
|
-- }}}
|