-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
58 lines (48 loc) · 1.92 KB
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
-- TODO:
-- Replace instances of vim.cmd with lua api alternatives as they become available
require('helpers') -- simple helper methods
require('vimopts') -- basic vim/neovim options
require('plugins')
vim.g['test#strategy'] = "dispatch"
function _G.TrimWhitespace()
if vim.bo.filetype == "markdown" then
return
end
local patterns = { [[%s/\s\+$//e]], }
local save = vim.fn.winsaveview()
for _, p in pairs(patterns) do
vim.api.nvim_exec(string.format("keeppatterns silent! %s", p), false)
end
vim.fn.winrestview(save)
end
-- pre save action
local pre_save_augroup = vim.api.nvim_create_augroup( "presave_cmds", { clear = true} )
vim.api.nvim_create_autocmd( {"BufWritePre"}, { callback = TrimWhitespace, group = pre_save_augroup})
function _G.highlight_on_yank()
require'vim.highlight'.on_yank()
end
local highlight_yank_group = vim.api.nvim_create_augroup( "highlight_yank", { clear = true } )
vim.api.nvim_create_autocmd( {"TextYankPost"}, { group = highlight_yank_group, callback = highlight_on_yank})
-- Used in an interactive rebase, squash all commits into the earliest one then write and exit
function _G.fix_rebase()
vim.cmd([[
:2,$s/^pick /f /
:wq
]])
end
vim.cmd([[
augroup packer_user_config
autocmd!
autocmd BufWritePost plugins.lua source <afile> | PackerCompile
augroup end
]])
vim.cmd([[cabbrev ff <cmd>lua fix_rebase()<CR>]])
-- Mappings (general - plugin specific mappings live with their respective configs)
require('mappings')
require("completion") -- all code completion configuration, setup, mappings
require("treesitter") -- all treesitter configuration (and treesitter extensions)
require("lang") -- language specific configurations and LSP setup
require("statusbar") -- status bar setup and configuration
require("telescope_integration") -- telescope setup and extension config
require("gitsigns_config")
require("presentation")