-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
71 lines (57 loc) · 1.89 KB
/
init.lua
File metadata and controls
71 lines (57 loc) · 1.89 KB
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
-- Basic options
vim.opt.compatible = false
vim.opt.termguicolors = true
vim.opt.expandtab = true
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.backup = false
vim.opt.swapfile = false
vim.opt.foldenable = false
vim.opt.number = true
vim.opt.clipboard = "unnamed"
vim.opt.conceallevel = 2
vim.opt.completeopt = "noinsert"
vim.g["deoplete#enable_at_startup"] = 1
require("config.lazy")
local map = vim.keymap.set
-- Leader mappings
map("n", "<Leader>e", ":e <C-R>=expand('%:p:h') . '/' <CR>")
map("n", "<Leader>s", ":sp <C-R>=expand('%:p:h') . '/' <CR>")
map("n", "<Leader>v", ":vsp <C-R>=expand('%:p:h') . '/' <CR>")
map("n", "<Leader>t", ":FZF<CR>")
map("n", "<Leader>f", ":Rg<CR>")
map("n", "<Leader>d", ":ALEGoToDefinition -vsplit<CR>")
map("n", "<Leader>r", ":ALEFindReferences -relative<CR>")
map("n", "<Leader>h", ":ALEHover<CR>")
map("n", "<Leader>g", ":vertical Git<CR>")
vim.keymap.set({'n', 'v'}, '<Leader>cc', ':PChatNew<CR>', { noremap = true, silent = true })
vim.keymap.set({'n', 'v'}, '<Leader>cr', ':PRewrite<CR>', { noremap = true })
-- Tab completion
vim.keymap.set("i", "<TAB>", function()
return vim.fn.pumvisible() == 1 and "<C-n>" or "<TAB>"
end, { expr = true })
local autocmd = vim.api.nvim_create_autocmd
-- FileType specific settings
autocmd("FileType", {
pattern = { "typescript", "typescriptreact", "typescript.tsx" },
callback = function()
vim.opt_local.tabstop = 2
vim.opt_local.shiftwidth = 2
vim.opt_local.expandtab = true
end,
})
autocmd("FileType", {
pattern = "markdown",
callback = function()
vim.keymap.set("n", "<Leader>d", "ge<CR>", { buffer = true })
vim.keymap.set("n", "k", "gk", { buffer = true })
vim.keymap.set("n", "j", "gj", { buffer = true })
vim.opt_local.linebreak = true
end,
})
autocmd("FileType", {
pattern = "tex",
callback = function()
vim.fn["deoplete#custom#buffer_option"]("auto_complete", false)
end,
})