aboutsummaryrefslogtreecommitdiff
path: root/init.lua
blob: a68778dfd0d5b92aed450b69466a78d8cca9d070 (plain)
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
--------------------------------------------------------------------------------
-- vim options, first sourced from vimrc, then appended by Neovim specific stuff
--------------------------------------------------------------------------------
local configdir = vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":p:h")
vim.cmd('source ' .. configdir .. '/vimrc')

vim.opt.encoding='utf-8'
vim.opt.inccommand = "nosplit" -- Neovim only: preview substitute and such things in real time 
vim.opt.shadafile = configdir .. "/shada.file"

--------------------------------------------------------------------------------
-- Bootstrap lazy.nvim
--------------------------------------------------------------------------------
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
  local lazyrepo = "https://github.com/folke/lazy.nvim.git"
  local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
  if vim.v.shell_error ~= 0 then
    vim.api.nvim_echo({
      { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
      { out, "WarningMsg" },
      { "\nPress any key to exit..." },
    }, true, {})
    vim.fn.getchar()
    os.exit(1)
  end
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
	spec = {
	{ import = "plugins", },
  'coderonline/vim-fancy-line',
  'coderonline/vim-recently-used',
  }
})

-- Restore cursor position
vim.api.nvim_create_autocmd({ "BufReadPost" }, {
    callback = function() vim.cmd('silent! normal! g`"zv') end
})

-- LSP says 'fix available', but there is no such command? Let us fix that:
vim.api.nvim_create_user_command(
  'LspFix',
  function()
    vim.lsp.buf.code_action()
  end, {}
)

-- speaking of lsp, lets enable logging (TODO: remove if you remove
-- `lua/cmp.lua`, but why would you?)
vim.g.lsp_log_verbose = 1
vim.g.lsp_log_file = configdir .. ('/vim-lsp.log')
vim.lsp.set_log_level 'error'
if vim.fn.has 'nvim-0.5.1' == 1 then
  require('vim.lsp.log').set_format_func(vim.inspect)
end

-- If you need scoop for some dependencies on Windows machines this may come
-- handy:
if vim.fn.has("win32") then
  vim.opt.rtp:append(vim.fn.expand("$HOME\\scoop\\shims"))
end

if vim.g.neovide then
  vim.guifont = "monospace:h11:b"
  vim.g.neovide_cursor_animation_length = 0.03
  vim.g.neovide_cursor_trail_size = 0.8
  vim.g.neovide_scroll_animation_length = 0.05
  vim.g.neovide_transparency = 0.9
  vim.g.neovide_cursor_animation_length=0
  vim.g.neovide_cursor_vfx_mode = ""
  vim.g.neovide_floating_blur_amount_x = 4.0
  vim.g.neovide_floating_blur_amount_y = 4.0
  vim.g.neovide_background_color = '#383a62'
  vim.g.neovide_scale_factor = 1.0
end

-- vim: tabstop=2 shiftwidth=2 softtabstop=2
..