-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
251 lines (218 loc) · 6.58 KB
/
Copy pathinit.lua
File metadata and controls
251 lines (218 loc) · 6.58 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
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
require('plugins')
-- general config
vim.g.have_nerd_font = true
vim.o.number = true
vim.o.mouse = 'a'
vim.o.showmode = false
vim.schedule(function()
vim.o.clipboard = 'unnamedplus'
end)
vim.o.breakindent = true
vim.o.undofile = true
vim.o.ignorecase = true
vim.o.smartcase = true
vim.o.signcolumn = 'yes'
vim.o.updatetime = 250
vim.o.timeoutlen = 300
vim.o.splitright = true
vim.o.splitbelow = true
vim.o.list = true
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
vim.opt.termguicolors = true
vim.opt.colorcolumn = '120'
vim.cmd [[
highlight ColorColumn ctermbg=0 guibg=#2e2e2e
]]
vim.o.inccommand = 'split'
vim.o.cursorline = true
vim.o.scrolloff = 5
vim.o.confirm = true
vim.cmd.colorscheme 'paper'
-- use buffers like tabs
vim.api.nvim_create_user_command('Q', 'q', { desc = 'Close neovim' })
vim.keymap.set('n', 'gt', ':bnext<CR>', { desc = 'Next buffer' })
vim.keymap.set('n', 'gT', ':bprevious<CR>', { desc = 'Prev buffer' })
-- close buffer instead
vim.cmd([[
cnoreabbrev <expr> q getcmdtype() == ':' && getcmdline() == 'q' ? 'bdelete' : 'q'
]])
-- float term
vim.g.floaterm_title = '$1|$2'
vim.g.floaterm_giteditor = 'vim'
vim.g.floaterm_width = 0.999
vim.g.floaterm_height = 0.40
vim.g.floaterm_wintype = 'float'
vim.g.floaterm_position = 'bottom'
vim.g.floaterm_keymap_toggle = '<F1>'
vim.g.floaterm_keymap_new = '<F3>'
vim.g.floaterm_keymap_prev = '<F11>'
vim.g.floaterm_keymap_next = '<F12>'
-- linter
-- vim.g.python_pep8_indent_hang_closing = 0
-- vim.g.ale_linters = {
-- javascript = {'eslint'},
-- python = {'flake8', 'mypy', 'pyright', 'ruff'}
-- }
-- vim.g.ale_python_flake8_options = '--max-line-length=120'
-- vim.g.ale_sign_error = '✘'
-- vim.g.ale_sign_warning = '▲'
-- vim.g.ale_echo_msg_error_str = 'E'
-- vim.g.ale_echo_msg_warning_str = 'W'
-- vim.g.ale_echo_msg_format = '[%linter%] %s [%severity%]'
-- vim.g.ale_virtualtext_cursor = 0
-- vim.g.ale_lint_on_text_changed = 'never'
-- vim.api.nvim_set_keymap('n', 'q', '<Nop>', { noremap = true, silent = true })
-- vim.api.nvim_set_keymap('n', '<C-]>', '<C-w>T<C-]>', { noremap = true, silent = true })
-- vim.keymap.set('n', '<C-]>', ':TabExpand 1<CR>', { noremap = true, silent = true })
-- vim.api.nvim_set_keymap('n', '<C-]>', ':tab split | :tjump <C-R>=expand("<cword>")<CR><CR>', { noremap = true, silent = true })
--
-- ui utils
require('ibl').setup({
indent = { char = '│' },
scope = { enabled = false },
})
require('mini.indentscope').setup({
symbol = '│',
options = { try_as_border = true },
})
-- bufferline / tabs
require('bufferline').setup({
options = {
mode = 'buffers',
diagnostics = 'nvim_lsp',
always_show_bufferline = true,
show_buffer_close_icons = true,
show_close_icon = false,
-- separator_style = 'slant',
color_icons = true,
themable = true,
style_preset = bufferline.style_preset.no_italic,
separator_style = 'thin',
indicator = {
icon = '▎',
style = 'icon',
},
},
})
require('lualine').setup({
sections = {
lualine_c = {
{
'filename',
file_status = true,
path = 1 -- 0 = filename, 1 = relative path, 2 = absolute path
}
}
}
})
-- file explorer
require('neo-tree').setup({
filesystem = {
window = {
mappings = {
['\\'] = 'close_window',
},
},
},
})
vim.keymap.set('n', '\\', ':Neotree reveal<CR>', { desc = 'NeoTree reveal', silent = true })
-- fuzzy search
require('fzf-lua').setup()
vim.keymap.set('n', '<C-P>', '<cmd>lua require("fzf-lua").files()<CR>', { noremap = true, silent = true })
vim.keymap.set('n', '<C-g>', "<cmd>lua require('fzf-lua').live_grep_resume({ cmd = 'git grep -i --line-number --column --color=always' })<CR>", { noremap = true, silent = true })
-- lsp
require('lspconfig').pylsp.setup({
settings = {
pylsp = {
plugins = {
pycodestyle = {
enabled = true,
maxLineLength = 120
},
pyflakes = { enabled = false },
mccabe = { enabled = false },
black = { enabled = false },
isort = { enabled = false },
pylint = { enabled = false },
yapf = { enabled = false },
},
},
},
})
-- autocomplete
local cmp = require('cmp')
local luasnip = require('luasnip')
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm { select = true },
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
}),
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
})
-- git
require('gitsigns').setup {
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '-' },
topdelete = { text = '‾' },
changedelete = { text = '~' },
untracked = { text = '┆' },
},
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = {
interval = 1000,
follow_files = true
},
attach_to_untracked = true,
current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
delay = 500,
ignore_whitespace = false,
},
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
max_file_length = 40000, -- Disable if file is longer than this (in lines)
preview_config = {
border = 'single',
style = 'minimal',
relative = 'cursor',
row = 0,
col = 1
},
}
-- definitions preview
require('goto-preview').setup({
default_mappings = false,
width = 120,
height = 25,
border = {"↖", "─" ,"┐", "│", "┘", "─", "└", "│"},
preview_window_title = { enable = true, position = "center" },
stack_floating_preview_windows = true,
same_file_float_preview = false
})
vim.keymap.set("n", "<C-]>", "<cmd>lua require('goto-preview').goto_preview_definition()<CR>", { noremap = true, silent = true })