-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
131 lines (113 loc) · 4.12 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
vim.o.updatetime = 200
vim.o.termguicolors = true
vim.o.number = true
vim.o.relativenumber = true
vim.o.showmode = true
vim.o.smartcase = true
vim.o.smarttab = true
vim.o.smartindent = true
vim.o.autoindent = true
vim.o.expandtab = true
vim.o.shiftwidth = 2
vim.o.softtabstop = 2
vim.o.tabstop = 2
vim.o.background = 'dark'
vim.o.laststatus = 2
vim.o.mouse = 'a'
vim.o.undofile = true
vim.o.conceallevel = 0
vim.o.cmdheight=1
vim.opt.completeopt = {'menu', 'menuone', 'noselect'}
vim.g.mapleader = ','
vim.g.maplocalleader = ','
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git", "clone", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git", "--branch=stable", -- latest stable release
lazypath
})
end
vim.opt.rtp:prepend(lazypath)
vim.o.guifont = 'Liga SFMono Nerd Font:h14'
require 'plugins'
require'masonconfig'.setup()
vim.api.nvim_create_autocmd('BufWritePost',
{command = 'source <afile>', pattern = 'nvim/.init.lua'})
vim.g.vimtex_view_method = 'sioyek'
vim.g.vimtex_compiler_latexmk = {
options = {
'-verbose', '-synctex=1', '-interaction=nonstopmode', '-shell-escape'
}
}
vim.g.vimtex_quickfix_enabled = 0
vim.keymap.set('n', '<leader>b', ':JABSOpen<cr>')
vim.diagnostic.config({virtual_text = false, virtual_lines = false})
local signs = {Error = " ", Warn = " ", Hint = " ", Info = " "}
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, {text = icon, texthl = hl, numhl = hl})
end
-- Pane navigation
vim.keymap.set({'n', 't'}, '<C-h>', '<CMD>NavigatorLeft<CR>')
vim.keymap.set({'n', 't'}, '<C-l>', '<CMD>NavigatorRight<CR>')
vim.keymap.set({'n', 't'}, '<C-k>', '<CMD>NavigatorUp<CR>')
vim.keymap.set({'n', 't'}, '<C-j>', '<CMD>NavigatorDown<CR>')
vim.keymap.set({'n', 't'}, '<C-p>', '<CMD>NavigatorPrevious<CR>')
-- Navigation in insert mode
vim.api.nvim_set_keymap('i', '<C-b>', '<ESC>^i', {silent = true, noremap = true})
vim.api.nvim_set_keymap('i', '<C-e>', '<End>', {silent = true, noremap = true})
vim.api.nvim_set_keymap('i', '<C-h>', '<Left>', {silent = true, noremap = true})
vim.api.nvim_set_keymap('i', '<C-l>', '<Right>', {silent = true, noremap = true})
vim.api.nvim_set_keymap('i', '<C-j>', '<Down>', {silent = true, noremap = true})
vim.api.nvim_set_keymap('i', '<C-k>', '<Up>', {silent = true, noremap = true})
-- Better noh
vim.api.nvim_set_keymap('n', '<Esc>', '<cmd>noh<CR>', {silent = true, noremap = true})
vim.keymap.set('n', ',vv', ':vs<cr>')
vim.keymap.set('n', ',ss', ':split<cr>')
vim.keymap.set('n', ',lsp', ':LspStart<cr>')
vim.keymap.set('n', ';', ':')
vim.keymap.set('i', 'jk', '<esc>')
local highlight_group = vim.api.nvim_create_augroup('YankHighlight',
{clear = true})
vim.api.nvim_create_autocmd('TextYankPost', {
callback = function() vim.highlight.on_yank() end,
group = highlight_group,
pattern = '*'
})
vim.api.nvim_create_autocmd('BufEnter', {
pattern = '*.go',
callback = function() vim.o.expandtab = false end
})
-- vim.api.nvim_create_autocmd('InsertEnter', {
-- pattern = '*.md',
-- callback = function() vim.o.conceallevel = 0 end
-- })
--
-- vim.api.nvim_create_autocmd('InsertLeave', {
-- pattern = '*.md',
-- callback = function() vim.o.conceallevel = 2 end
-- })
-- Key bindings
vim.keymap.set({'n', 'i'}, '<c-s>', '<esc>:w<cr>')
vim.keymap.set({'n', 'i'}, '<D-s>', '<esc>:w<cr>')
vim.keymap.set({'n', 'i'}, '<F6>', '<esc>:w<cr>')
-- neovide
if vim.g.neovide then
vim.g.neovide_input_use_logo = true
vim.g.neovide_refresh_rate = 120
vim.g.neovide_input_macos_alt_is_meta = true
end
vim.keymap.set('n', 'ca', vim.lsp.buf.code_action)
vim.keymap.set('n', '<c-tab>', ':bn<cr>')
vim.keymap.set('n', '<c-s-tab>', ':bp<cr>')
function EdgeGetPalette()
local conf = vim.fn['edge#get_configuration']()
return vim.fn['edge#get_palette'](conf.style, conf.dim_foreground,
conf.colors_override)
end
require 'dapconfig'
require 'colorschemes'
require 'highlights'
require 'usercommands'
-- require 'netman'