aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim/lua/general.lua
blob: 9f52d4271507e7e28b8f85f419106ea686144feb (plain) (blame)
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
vim.opt.mouse = "a"
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.termguicolors = true
vim.opt.wrap = false
vim.opt.visualbell = true
vim.opt.undofile = true
vim.opt.backupcopy = "yes"
vim.opt.undolevels = 1000
vim.opt.wrap = false
vim.opt.colorcolumn = "120"
vim.opt.scrolloff = 5
vim.opt.spelllang = "en,nb"
vim.opt.cursorline = true

-- vim.opt.tabstop = 4
-- vim.opt.softtabstop = -1
-- vim.opt.shiftwidth = 4
-- vim.opt.expandtab = true
-- vim.opt.autoindent = true

vim.cmd [[autocmd FileType typescript setlocal softtabstop=2 expandtab]]
vim.cmd [[autocmd FileType typescriptreact setlocal shiftwidth=2 softtabstop=2 expandtab]]
vim.cmd [[autocmd FileType css setlocal shiftwidth=2 softtabstop=2 expandtab]]
vim.cmd [[autocmd FileType html setlocal shiftwidth=2 softtabstop=2 expandtab]]
vim.cmd [[autocmd BufNew,BufNewFile,BufRead *.cshtml :set filetype=razor]]
vim.cmd [[autocmd FileType json setlocal shiftwidth=2 softtabstop=2 expandtab]]
vim.cmd [[autocmd FileType cs setlocal shiftwidth=4 softtabstop=4 expandtab]]
vim.cmd [[autocmd FileType mail setlocal textwidth=72 colorcolumn=72 spell]]
vim.cmd [[autocmd FileType markdown setlocal textwidth=72 colorcolumn=72 spell]]
vim.cmd [[autocmd FileType gitcommit setlocal textwidth=72 colorcolumn=50,72 spell]]

vim.cmd [[filetype indent off]]

-- Comment the following lines to disable whitespace characters
vim.opt.list = true
vim.opt.listchars:append("space:⋅")
vim.opt.listchars:append("eol:↴")
vim.opt.listchars:append("tab:-->")

vim.cmd [[colorscheme dracula]]
vim.cmd [[hi Normal guibg=NONE ctermbg=NONE]]

vim.cmd [[highlight CursorLine ctermbg=none guibg=#0f0f0f gui=NONE cterm=NONE]]
vim.cmd [[augroup CursorLineTransparency
  autocmd!
  autocmd ColorScheme * highlight CursorLine guibg=#0f0f0f ctermbg=none
augroup END]]

vim.opt.spell = false

vim.g.markdown_fenced_languages = {
	"ts=typescript";
	"tsx=typescriptreact";
	"js=javascript";
	"jsx=javascriptreact";
	"json";
	"typescript";
	"javascript";
	"typescriptreact";
	"javascriptreact";
	"pwsh=ps1";
	"powershell=ps1";
	"ps1";
	"lua";
	"xml";
	"html";
	"mermaid";
	"yaml";
	"yml=yaml";
	"sql";
	"sh";
	"sh=bash";
	"console=sh";
	"cs";
	"c";
	"cpp";
	"ini=toml";
	"diff";
	"git";
}

if vim.fn.has("wsl") == 1 then
	vim.api.nvim_create_autocmd("TextYankPost", {
		group = vim.api.nvim_create_augroup("Yank", { clear = true });
		callback = function() vim.fn.system("clip.exe", vim.fn.getreg("\"")) end;
	})
else
	vim.api.nvim_create_autocmd("TextYankPost", {
		callback = function()
			if vim.v.event.operator == "y" and vim.v.event.regname == "+" then
				require("osc52").copy_register("+")
			end
		end;
	})
end