-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.lua
154 lines (131 loc) · 3.22 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
require("modules.statusbar")
local packer = require("plugins")
local utils = require("modules.utils")
local globalOpts = {
backup = false,
cindent = true,
errorbells = false,
hidden = true,
ignorecase = true,
inccommand = "split",
incsearch = true,
laststatus = 2,
cmdheight = 1,
mouse = "",
scrolloff = 2,
shortmess = vim.o.shortmess .. "c",
showmode = false,
smartcase = true,
synmaxcol = 200,
termguicolors = true,
timeoutlen = 500,
writebackup = false,
completeopt = "menu,menuone,noselect",
title = true,
tabstop = 4,
shiftwidth = 4,
}
local bufferOpts = {
tabstop = 4,
shiftwidth = 4,
}
local windowOpts = {
signcolumn = "number",
number = true,
relativenumber = true,
}
for k, v in pairs(globalOpts) do
vim.o[k] = v
end
for k, v in pairs(bufferOpts) do
vim.bo[k] = v
end
for k, v in pairs(windowOpts) do
vim.wo[k] = v
end
vim.o.clipboard = vim.o.clipboard .. "unnamedplus"
local globalVars = {
loaded_netrw = 1,
loaded_netrwPlugin = 1,
netrw_banner = 0,
netrw_liststyle = 3,
netrw_altv = 1,
netrw_winsize = 25,
netrw_usetab = 0,
stt_auto_insert = 1,
stt_auto_quit = 1,
closer_dont_map = 1,
-- consclose_no_mappings = 0,
endwise_no_mappings = 0,
ctrlp_user_command = 'ag %s -l -g ""' ,
ctrlp_use_caching = 0,
haskell_indent_before_where = 2,
haskell_indent_after_bare_where = 2
}
for k, v in pairs(globalVars) do
vim.g[k] = v
end
vim.g.mapleader = " "
vim.g.maplocalleader = " "
local opts = {noremap = true, silent = true}
local mappings = {
-- Buffer list
{"n", "<leader>bo", ":buffers<CR>:buffer<space>", opts},
-- dirvish
{"n", "<leader>fm", ":Dirvish<CR>", opts},
-- Fix Y
{"n", "Y", "y$", {noremap = false}},
-- Move within splits with alt+{h,j,k,l}
-- {"n", "<C-h>", "<C-w>h", opts},
-- {"n", "<C-j>", "<C-w>j", opts},
-- {"n", "<C-k>", "<C-w>k", opts},
-- {"n", "<C-l>", "<C-w>l", opts},
-- Disable highlight with leader l
{"n", "<leader>l", ":nohlsearch<CR>", opts},
-- Terminal keybinds
{"n", "<F2>", ":ToggleTerm<CR>", opts},
{"n", "<leader>t", ":ToggleTerm<CR>", opts},
{"t", "<F2>", "<C-\\><C-n>:ToggleTerm<CR>", opts},
-- {"t", "<C-k>", "<C-\\><C-n><C-w>k", opts},
-- {"t", "<C-j>", "<C-\\><C-n><C-w>j", opts},
-- Last tab
{"n", "<A-9>", ":$tabnext<CR>", opts},
-- {"i", "<CR>", "v:lua.CR()", opts},
-- {"i", "<CR>", "<Cmd>call v:lua.require('modules.mappings').enter()<CR>", opts},
{"n", "<leader>up", [[:lua require("modules.utils").update()<CR>]], opts},
{"n", "<leader>lf", [[:CtrlP <CR>]], opts},
{"n", "<leader>lb", [[:CtrlPBuffer <CR>]], opts},
}
-- Make Alt + 1-8 select tabs
for i = 1, 8 do
local v = {"n","<A-"..i..">", i.."gt", opts}
table.insert(mappings,v)
end
for _, map in pairs(mappings) do
vim.api.nvim_set_keymap(unpack(map))
end
local autocmds = {
general = {
{
event = 'Filetype',
pattern = "netrw",
command = "nnoremap <buffer> <esc> <C-^>"
},
{
event = 'FileType',
pattern = {"nroff", "mail", "tex"},
command = "set spell spelllang=pt_br | set tw=80"
},
{
event = 'FileType',
pattern = "markdown",
command = "set spell spelllang=en | set tw=80"
},
}
}
utils.create_augroup_autocmd(autocmds)
if os.getenv("TERM") == 'linux' then
vim.cmd("colorscheme solitary")
else
vim.cmd("colorscheme mountainplex")
end