-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
113 lines (92 loc) · 2.75 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
if vim.loader then
vim.loader.enable()
end
if not vim.keycode then
vim.keycode = function(str)
return vim.api.nvim_replace_termcodes(str, true, true, true)
end
end
if vim.version.lt(vim.version(), { 0, 9 }) then
vim.api.nvim_err_writeln 'Neovim version is too old!! please use update it'
end
if not vim.base64 then
vim.base64 = {
encode = require('utils.strings').base64_encode,
decode = require('utils.strings').base64_decode,
}
end
local nvim = require 'nvim'
if not vim.keymap then
vim.keymap = nvim.keymap
end
vim.g.has_ui = #vim.api.nvim_list_uis() > 0
vim.g.loaded_2html_plugin = 1
vim.g.loaded_gzip = 1
vim.g.loaded_rrhelper = 1
vim.g.loaded_tarPlugin = 1
vim.g.loaded_zipPlugin = 1
vim.g.loaded_tutor_mode_plugin = 1
vim.g.loaded_tarPlugin = 1
vim.g.loaded_vimballPlugin = 1
vim.g.loaded_ruby_provider = 0
vim.g.loaded_node_provider = 0
vim.g.loaded_perl_provider = 0
vim.g.loaded_python_provider = 0
vim.g.loaded_python3_provider = 0
vim.g.show_diagnostics = true
vim.g.alternates = {}
vim.g.tests = {}
vim.g.makefiles = {}
vim.g.short_branch_name = true
vim.g.port = 0x8AC
if nvim.has 'win32' then
-- vim.go.shell = 'cmd.exe'
vim.go.shell = 'powershell'
vim.go.shellcmdflag = table.concat({
'-NoLogo',
'-NoProfile',
'-ExecutionPolicy',
'RemoteSigned',
'-Command',
-- '[Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;',
}, ' ')
vim.go.shellredir = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
vim.go.shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
vim.go.shellquote = ''
vim.go.shellxquote = ''
vim.go.shellslash = true
end
vim.go.termguicolors = true
vim.g.mapleader = ' '
vim.g.minimal = vim.env.VIM_MIN ~= nil or vim.g.minimal ~= nil
vim.g.bare = vim.env.VIM_BARE ~= nil or vim.g.bare ~= nil
if vim.env.TMUX_WINDOW then
local socket = vim.fn.stdpath 'cache' .. '/socket.win' .. vim.env.TMUX_WINDOW
if vim.fn.filereadable(socket) ~= 1 then
vim.fn.serverstart(socket)
end
end
require 'utils.filetype_detect'
require 'globals'
require 'completions'
require 'watch_files'
require 'configs.options'
require 'configs.mappings'
require 'configs.commands'
require 'configs.autocmds'
nvim.setup(false)
vim.cmd.packadd { args = { 'matchit' }, bang = false }
-- NOTE: overload/replace vim.* functions
require 'overloads.notify'
require 'overloads.ui.open'
if vim.g.has_ui then
require 'overloads.ui.select'
-- require 'overloads.ui.input'
-- require 'overloads.paste'
require('threads.parse').ssh_hosts()
else
local hosts = require('threads.parsers').sshconfig()
for host, attrs in pairs(hosts) do
STORAGE.hosts[host] = attrs
end
end