-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
122 lines (109 loc) · 4.25 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
-- Set <space> as the leader key
vim.g.mapleader = ' '
vim.g.maplocalleader = ','
-- disable netrw, we use nvim-tree
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- Options
vim.opt.termguicolors = true -- set term gui colors (most terminals support this)
vim.opt.wrap = false -- prevent line wrap on long lines
vim.opt.scrolloff = 10
vim.opt.relativenumber = true -- Relative line numbers
vim.opt.cursorline = true -- Enable highlighting of the current line
vim.opt.expandtab = true -- Use spaces instead of tabs
vim.opt.splitbelow = true -- Put new windows below current
vim.opt.splitright = true -- Put new windows right of current
vim.opt.completeopt = 'menu,menuone,noselect' -- completion options
vim.opt.signcolumn = 'yes' -- Always show the sign column, otherwise it would shift the text each time
vim.opt.fillchars = { eob = '~' }
vim.opt.pumheight = 10 -- Maximum number of entries in a popup
-- vim.opt.shell = '/bin/sh' -- fish is slow
vim.opt.shell = '/opt/homebrew/bin/fish' -- fish is slow
vim.o.mouse = 'a' -- Enable mouse mode
vim.o.clipboard = 'unnamedplus' -- system clipboard
vim.o.undofile = true -- Save undo history
vim.o.breakindent = true -- Indent wrapped lines
vim.opt.showmode = false -- don't show mode since we use a statusline
vim.opt.jumpoptions = 'stack,view' -- jump back c-o preserves y cursor position
vim.opt.updatetime = 250 -- Decrease update time
vim.opt.timeoutlen = 300 -- Decrease mapped sequence wait time (whick-key appears sooner)
vim.opt.list = true -- differentiate white spaces
vim.opt.listchars = { tab = ' ', trail = '·', nbsp = '␣' }
-- vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
vim.opt.inccommand = 'split' -- Preview substitutions live, as you type!
vim.opt.hlsearch = true -- highlight search (esc keymap to hide)
-- disable vim configuration options inside files
vim.opt.modeline = false
-- sync buffers automatically
vim.opt.autoread = true
-- disable neovim generating a swapfile and showing the error
vim.opt.swapfile = false
-- folds
-- za toggle fold, zo open fold, zc close fold
-- zM close all folds, zR open all folds
vim.opt.foldmethod = 'indent'
vim.opt.foldenable = false
vim.opt.foldlevel = 99
-- Auto formating options (o in a docblock adds * prefix)
-- vim.opt.formatoptions = 'jrcqlo'
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
vim.opt.ignorecase = true
vim.opt.smartcase = true
-- Global variables
vim.g.personal_notes = '~/Projects/notes'
-- Install package manager
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)
require('lazy').setup({
{
'nmac427/guess-indent.nvim',
config = function()
require('guess-indent').setup {
auto_cmd = true,
}
-- Automatically detect indent settings
-- had to change this because https://github.com/NMAC427/guess-indent.nvim/issues/3#issuecomment-1613353299
-- vim.cmd [[
-- augroup GuessIndent
-- autocmd!
-- autocmd FileType * lua require("guess-indent").set_from_buffer("auto_cmd")
-- " Run once when saving for new files
-- autocmd BufNewFile * autocmd BufWritePost <buffer=abuf> ++once silent lua require("guess-indent").set_from_buffer("auto_cmd")
-- augroup END
-- ]]
end,
}, -- :GuessIndent Detect tabstop and shiftwidth automatically
-- { 'tpope/vim-sleuth' }, -- Detect tabstop and shiftwidth automatically
{ 'tpope/vim-repeat', event = 'VeryLazy' },
-- alternative https://github.com/pteroctopus/faster.nvim
{ 'LunarVim/bigfile.nvim', opts = {} },
{ import = 'user.plugins' },
{ import = 'user.plugins.ai' },
}, {
change_detection = {
-- automatically check for config file changes and reload the ui
enabled = false,
notify = false, -- get a notification when changes are found
},
})
-- Custom filetypes
vim.filetype.add {
extension = {
vcl = 'c',
tftpl = 'c',
mathjs = 'mathjs',
},
}
require 'user.autocmds'
require 'user.cmds'
require 'user.keymaps'