diff options
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..a68778d --- /dev/null +++ b/init.lua | |||
@@ -0,0 +1,80 @@ | |||
1 | -------------------------------------------------------------------------------- | ||
2 | -- vim options, first sourced from vimrc, then appended by Neovim specific stuff | ||
3 | -------------------------------------------------------------------------------- | ||
4 | local configdir = vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":p:h") | ||
5 | vim.cmd('source ' .. configdir .. '/vimrc') | ||
6 | |||
7 | vim.opt.encoding='utf-8' | ||
8 | vim.opt.inccommand = "nosplit" -- Neovim only: preview substitute and such things in real time | ||
9 | vim.opt.shadafile = configdir .. "/shada.file" | ||
10 | |||
11 | -------------------------------------------------------------------------------- | ||
12 | -- Bootstrap lazy.nvim | ||
13 | -------------------------------------------------------------------------------- | ||
14 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" | ||
15 | if not (vim.uv or vim.loop).fs_stat(lazypath) then | ||
16 | local lazyrepo = "https://github.com/folke/lazy.nvim.git" | ||
17 | local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) | ||
18 | if vim.v.shell_error ~= 0 then | ||
19 | vim.api.nvim_echo({ | ||
20 | { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, | ||
21 | { out, "WarningMsg" }, | ||
22 | { "\nPress any key to exit..." }, | ||
23 | }, true, {}) | ||
24 | vim.fn.getchar() | ||
25 | os.exit(1) | ||
26 | end | ||
27 | end | ||
28 | vim.opt.rtp:prepend(lazypath) | ||
29 | |||
30 | require("lazy").setup({ | ||
31 | spec = { | ||
32 | { import = "plugins", }, | ||
33 | 'coderonline/vim-fancy-line', | ||
34 | 'coderonline/vim-recently-used', | ||
35 | } | ||
36 | }) | ||
37 | |||
38 | -- Restore cursor position | ||
39 | vim.api.nvim_create_autocmd({ "BufReadPost" }, { | ||
40 | callback = function() vim.cmd('silent! normal! g`"zv') end | ||
41 | }) | ||
42 | |||
43 | -- LSP says 'fix available', but there is no such command? Let us fix that: | ||
44 | vim.api.nvim_create_user_command( | ||
45 | 'LspFix', | ||
46 | function() | ||
47 | vim.lsp.buf.code_action() | ||
48 | end, {} | ||
49 | ) | ||
50 | |||
51 | -- speaking of lsp, lets enable logging (TODO: remove if you remove | ||
52 | -- `lua/cmp.lua`, but why would you?) | ||
53 | vim.g.lsp_log_verbose = 1 | ||
54 | vim.g.lsp_log_file = configdir .. ('/vim-lsp.log') | ||
55 | vim.lsp.set_log_level 'error' | ||
56 | if vim.fn.has 'nvim-0.5.1' == 1 then | ||
57 | require('vim.lsp.log').set_format_func(vim.inspect) | ||
58 | end | ||
59 | |||
60 | -- If you need scoop for some dependencies on Windows machines this may come | ||
61 | -- handy: | ||
62 | if vim.fn.has("win32") then | ||
63 | vim.opt.rtp:append(vim.fn.expand("$HOME\\scoop\\shims")) | ||
64 | end | ||
65 | |||
66 | if vim.g.neovide then | ||
67 | vim.guifont = "monospace:h11:b" | ||
68 | vim.g.neovide_cursor_animation_length = 0.03 | ||
69 | vim.g.neovide_cursor_trail_size = 0.8 | ||
70 | vim.g.neovide_scroll_animation_length = 0.05 | ||
71 | vim.g.neovide_transparency = 0.9 | ||
72 | vim.g.neovide_cursor_animation_length=0 | ||
73 | vim.g.neovide_cursor_vfx_mode = "" | ||
74 | vim.g.neovide_floating_blur_amount_x = 4.0 | ||
75 | vim.g.neovide_floating_blur_amount_y = 4.0 | ||
76 | vim.g.neovide_background_color = '#383a62' | ||
77 | vim.g.neovide_scale_factor = 1.0 | ||
78 | end | ||
79 | |||
80 | -- vim: tabstop=2 shiftwidth=2 softtabstop=2 | ||