Repository navigation
Expand file tree
/
Copy pathinit.lua
More file actions
154 lines (141 loc) · 3.83 KB
/
Copy pathinit.lua
File metadata and controls
154 lines (141 loc) · 3.83 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
-- Ensures packer gets installed
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('mappings')
require('extras')
-- Think about using lbr (:h lbr)
-- Table for global variables
vim.g.vimsyn_embed = 'l'
local o_options = {
mouse = 'a',
inccommand = 'split',
termguicolors = true,
wildmenu = true,
colorcolumn = '80',
number = true,
-- 7 lines up and down of limit to the cursor
so = 7,
cursorcolumn = true,
cursorline = true,
ruler = true,
cmdheight = 0,
backspace = 'eol,start,indent',
whichwrap = 'b,s,<,>,h,l',
ai = true,
si = true,
ignorecase = true,
smartcase = true,
incsearch = true,
hlsearch = true,
magic = true,
showmatch = true,
backup = false,
wb = false,
swapfile = false,
expandtab = true,
smarttab = true,
shiftwidth = 2,
tabstop = 2,
-- clipboard = 'unnamedplus',
-- formatprg = "par\\ -rjw79",
listchars = 'tab:→\\ ,space:·,nbsp:␣,trail:•,eol:↵,precedes:«,extends:»',
hidden = true,
guifont = 'Iosevka Nerd Font Mono:h14',
exrc = true, -- allow local config files
-- lazyredraw = true, -- don't update screen when doing macros
conceallevel = 2, -- needed for obsidian
signcolumn = "yes",
}
for name, value in pairs(o_options) do
-- vim.o[name] = value
vim.opt[name] = value
end
-- keymaps for getting in and out of the system clipboard
vim.keymap.set('n','<leader>y' , '"+y')
vim.keymap.set('v','<leader>y' , '"+y')
vim.keymap.set('n','<leader>yl','"+yy')
vim.keymap.set('n','<leader>Y' ,' "+Y')
vim.keymap.set('n', '<leader>p', '"+p')
-- comands that didn't work with the above
vim.cmd([[
set list
set nowrap
set noswapfile
set cc=80
]])
-- Setting up tabs and keeping my sanity on Makefiles
-- vim.cmd([[
-- set expandtab
-- set shiftwidth=2
-- set tabstop=8
-- set smarttab
-- autocmd FileType make set nosmarttab
-- ]])
-- Folding
vim.cmd([[
set foldmethod=expr
set foldexpr=nvim_treesitter#foldexpr()
set foldlevel=2
set foldopen=block,hor,mark,percent,quickfix,tag
]])
-- Undofiles
vim.cmd([[
set undodir=~/.config/nvim/undodir
set undofile
]])
-- Exception for Makefiles
vim.cmd([[autocmd FileType make set nosmarttab]])
-- Relative number doings
-- vim.cmd([[set number relativenumber]])
-- map_toggle_settings("number", "relativenumber")
-- completion helper
vim.cmd([[
set shortmess+=c
]])
local relnums = vim.api.nvim_create_augroup('RelativeNumbers', { clear = true })
vim.api.nvim_create_autocmd(
'BufEnter',
{ pattern = '*', command = 'set relativenumber', group = relnums }
)
vim.api.nvim_create_autocmd(
'FocusGained',
{ pattern = '*', command = 'set relativenumber', group = relnums }
)
vim.api.nvim_create_autocmd(
'InsertLeave',
{ pattern = '*', command = 'set relativenumber', group = relnums }
)
vim.api.nvim_create_autocmd(
'BufLeave',
{ pattern = '*', command = 'set norelativenumber', group = relnums }
)
vim.api.nvim_create_autocmd(
'FocusLost',
{ pattern = '*', command = 'set norelativenumber', group = relnums }
)
vim.api.nvim_create_autocmd(
'InsertEnter',
{ pattern = '*', command = 'set norelativenumber', group = relnums }
)
local backtofile = vim.api.nvim_create_augroup('Back2File', { clear = true })
vim.api.nvim_create_autocmd('BufReadPost', {
pattern = '*',
command = [[if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif]],
group = backtofile,
})
require('packages')
-- ftplugin for zk
vim.cmd('filetype plugin on')
-- require('plugins')
-- require("statusline")
-- require("lsp")