feat: transfer options and bindings
This commit is contained in:
parent
48cebf1f8f
commit
95660c65af
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
plugin/packer-compiled.lua
|
14
init.lua
14
init.lua
@ -1,4 +1,5 @@
|
|||||||
local g = vim.g
|
local g = vim.g
|
||||||
|
local cmd = vim.cmd
|
||||||
|
|
||||||
-- Allow loading */init.lua files
|
-- Allow loading */init.lua files
|
||||||
package.path = "./?/init.lua;"..package.path
|
package.path = "./?/init.lua;"..package.path
|
||||||
@ -7,7 +8,20 @@ package.path = "./?/init.lua;"..package.path
|
|||||||
g.mapleader = [[ ]]
|
g.mapleader = [[ ]]
|
||||||
g.maplocalleader = [[,]]
|
g.maplocalleader = [[,]]
|
||||||
|
|
||||||
|
-- Disable some built-in plugins we don't want
|
||||||
|
local disabled_built_ins = {
|
||||||
|
'matchit',
|
||||||
|
'netrw',
|
||||||
|
'netrwPlugin',
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, name in ipairs(disabled_built_ins) do
|
||||||
|
g['loaded_' .. name] = 1
|
||||||
|
end
|
||||||
|
|
||||||
require("impatient")
|
require("impatient")
|
||||||
require("plugins")
|
require("plugins")
|
||||||
|
require("options")
|
||||||
|
require("bindings")
|
||||||
|
|
||||||
|
|
||||||
|
18
lua/bindings.lua
Normal file
18
lua/bindings.lua
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
local map = require 'utils.map'
|
||||||
|
|
||||||
|
local silent = {silent = true}
|
||||||
|
|
||||||
|
-- Window movement
|
||||||
|
map('n', '<c-h>', '<c-w>h')
|
||||||
|
map('n', '<c-j>', '<c-w>j')
|
||||||
|
map('n', '<c-k>', '<c-w>k')
|
||||||
|
map('n', '<c-l>', '<c-w>l')
|
||||||
|
|
||||||
|
|
||||||
|
-- Toggle whitespace characters
|
||||||
|
map('n', '<leader>tw', ':setlocal list!<cr>')
|
||||||
|
|
||||||
|
|
||||||
|
-- Toggle numbers and sign column
|
||||||
|
map('n', '<leader>tn', ':setlocal relativenumber!<cr>:setlocal number!<cr>')
|
||||||
|
|
@ -0,0 +1,95 @@
|
|||||||
|
local opt = require 'utils.opt'
|
||||||
|
local o, wo, bo = vim.o, vim.wo, vim.bo
|
||||||
|
local cmd = vim.cmd
|
||||||
|
|
||||||
|
cmd [[syntax on]]
|
||||||
|
cmd [[filetype plugin on]]
|
||||||
|
|
||||||
|
|
||||||
|
local buffer = { o, bo }
|
||||||
|
local window = { o, wo }
|
||||||
|
|
||||||
|
-- Don't wrap text to next line if there isin't enough space
|
||||||
|
opt('wrap', false)
|
||||||
|
|
||||||
|
-- Highlight current line
|
||||||
|
opt('cursorline', true, window)
|
||||||
|
|
||||||
|
-- Store less in shada files
|
||||||
|
opt('shada', [['20,<50,s10,h,/100]])
|
||||||
|
|
||||||
|
-- Show current mode that you are in
|
||||||
|
opt('showmode', false)
|
||||||
|
|
||||||
|
-- Keep non-visible files open
|
||||||
|
opt('hidden', true)
|
||||||
|
|
||||||
|
-- Skip redrawing window while executing macro
|
||||||
|
opt('lazyredraw', true)
|
||||||
|
|
||||||
|
-- Always use system clipboard
|
||||||
|
opt('clipboard', 'unnamedplus')
|
||||||
|
|
||||||
|
-- Amount of time after which while typing mapping will be canceled
|
||||||
|
opt('timeoutlen', 300)
|
||||||
|
|
||||||
|
-- Load external project specific configs
|
||||||
|
opt('exrc', true)
|
||||||
|
opt('secure', true)
|
||||||
|
|
||||||
|
-- How whitespace characters should be displayed
|
||||||
|
opt('listchars', [[space:.,eol:$,tab:>-]])
|
||||||
|
|
||||||
|
-- If possible use 24 Bit Colors
|
||||||
|
if vim.fn.has('termguicolors') == 1 then
|
||||||
|
opt('termguicolors', true)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Better Searching (Incremental searching, live replacing)
|
||||||
|
opt('hlsearch', false)
|
||||||
|
opt('incsearch', true)
|
||||||
|
opt('inccommand', 'nosplit')
|
||||||
|
|
||||||
|
-- Always keep at least 8 blank lines below the last line
|
||||||
|
opt('scrolloff', 8)
|
||||||
|
|
||||||
|
-- Draw a line on the 80 character mark for reference
|
||||||
|
-- My laptop screen is pretty small so it's 80 so that 2 splits can fit
|
||||||
|
-- If you have a wider monitor go ahead and use 100 or 120.
|
||||||
|
opt('colorcolumn', '80')
|
||||||
|
|
||||||
|
-- Break lines
|
||||||
|
-- opt('textwidth', 80)
|
||||||
|
|
||||||
|
-- Display relative and absolute line numbers
|
||||||
|
opt('number', true, window)
|
||||||
|
opt('relativenumber', true, window)
|
||||||
|
|
||||||
|
-- Recovery
|
||||||
|
opt('undofile', true, buffer)
|
||||||
|
|
||||||
|
-- Mouse support
|
||||||
|
opt('mouse', 'nivh')
|
||||||
|
|
||||||
|
-- Auto sign column
|
||||||
|
opt('signcolumn', 'auto:1', window)
|
||||||
|
|
||||||
|
-- Disable those annoying DINGS when you pressing something too much
|
||||||
|
opt('errorbells', false)
|
||||||
|
|
||||||
|
-- Always use system clipboard
|
||||||
|
opt('clipboard', 'unnamedplus')
|
||||||
|
|
||||||
|
-- Identation/Tab settings
|
||||||
|
local tab_size = 2
|
||||||
|
opt('foldmethod', 'indent', window)
|
||||||
|
opt('expandtab', false, buffer)
|
||||||
|
opt('smartindent', true, buffer)
|
||||||
|
opt('shiftwidth', tab_size, buffer)
|
||||||
|
opt('tabstop', tab_size, buffer)
|
||||||
|
opt('softtabstop', tab_size, buffer)
|
||||||
|
|
||||||
|
-- Place splits below and to the right by default
|
||||||
|
opt('splitbelow', true)
|
||||||
|
opt('splitright', true)
|
||||||
|
|
@ -1,98 +0,0 @@
|
|||||||
-- Automatically generated packer.nvim plugin loader code
|
|
||||||
|
|
||||||
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
|
|
||||||
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.api.nvim_command('packadd packer.nvim')
|
|
||||||
|
|
||||||
local no_errors, error_msg = pcall(function()
|
|
||||||
|
|
||||||
local time
|
|
||||||
local profile_info
|
|
||||||
local should_profile = false
|
|
||||||
if should_profile then
|
|
||||||
local hrtime = vim.loop.hrtime
|
|
||||||
profile_info = {}
|
|
||||||
time = function(chunk, start)
|
|
||||||
if start then
|
|
||||||
profile_info[chunk] = hrtime()
|
|
||||||
else
|
|
||||||
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
time = function(chunk, start) end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function save_profiles(threshold)
|
|
||||||
local sorted_times = {}
|
|
||||||
for chunk_name, time_taken in pairs(profile_info) do
|
|
||||||
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
|
|
||||||
end
|
|
||||||
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
|
|
||||||
local results = {}
|
|
||||||
for i, elem in ipairs(sorted_times) do
|
|
||||||
if not threshold or threshold and elem[2] > threshold then
|
|
||||||
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
_G._packer = _G._packer or {}
|
|
||||||
_G._packer.profile_output = results
|
|
||||||
end
|
|
||||||
|
|
||||||
time([[Luarocks path setup]], true)
|
|
||||||
local package_path_str = "/home/puzonas/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/puzonas/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/puzonas/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/puzonas/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
|
|
||||||
local install_cpath_pattern = "/home/puzonas/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
|
|
||||||
if not string.find(package.path, package_path_str, 1, true) then
|
|
||||||
package.path = package.path .. ';' .. package_path_str
|
|
||||||
end
|
|
||||||
|
|
||||||
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
|
|
||||||
package.cpath = package.cpath .. ';' .. install_cpath_pattern
|
|
||||||
end
|
|
||||||
|
|
||||||
time([[Luarocks path setup]], false)
|
|
||||||
time([[try_loadstring definition]], true)
|
|
||||||
local function try_loadstring(s, component, name)
|
|
||||||
local success, result = pcall(loadstring(s))
|
|
||||||
if not success then
|
|
||||||
vim.schedule(function()
|
|
||||||
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
|
|
||||||
time([[try_loadstring definition]], false)
|
|
||||||
time([[Defining packer_plugins]], true)
|
|
||||||
_G.packer_plugins = {
|
|
||||||
["impatient.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/puzonas/.local/share/nvim/site/pack/packer/start/impatient.nvim"
|
|
||||||
},
|
|
||||||
["packer.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/puzonas/.local/share/nvim/site/pack/packer/start/packer.nvim"
|
|
||||||
},
|
|
||||||
["vim-fugitive"] = {
|
|
||||||
config = { "require 'config.fugitive'" },
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/puzonas/.local/share/nvim/site/pack/packer/start/vim-fugitive"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
time([[Defining packer_plugins]], false)
|
|
||||||
-- Config for: vim-fugitive
|
|
||||||
time([[Config for vim-fugitive]], true)
|
|
||||||
require 'config.fugitive'
|
|
||||||
time([[Config for vim-fugitive]], false)
|
|
||||||
if should_profile then save_profiles() end
|
|
||||||
|
|
||||||
end)
|
|
||||||
|
|
||||||
if not no_errors then
|
|
||||||
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
|
|
||||||
end
|
|
Loading…
Reference in New Issue
Block a user