-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
148 lines (131 loc) · 4.1 KB
/
Copy pathinit.lua
File metadata and controls
148 lines (131 loc) · 4.1 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
vim.g.mapleader = ' '
vim.g.maplocalleader = ','
local opt = vim.opt
vim.g.mono_color_comments = true
-- local function set_background_from_macos()
-- local handle = io.popen 'defaults read -g AppleInterfaceStyle 2>/dev/null'
-- local result = handle:read '*a'
-- handle:close()
--
-- if result:match 'Dark' then
-- vim.o.background = 'dark'
-- vim.cmd [[colorscheme flexoki-mono]]
-- else
-- vim.o.background = 'light'
-- vim.cmd [[colorscheme flexoki-mono-light]]
-- end
-- end
--
-- if vim.loop.os_uname().sysname == 'Darwin' then
-- set_background_from_macos()
-- else
-- vim.o.background = 'dark'
-- vim.cmd [[colorscheme flexoki-mono]]
-- end
vim.cmd [[colorscheme nord]]
opt.shortmess = ''
opt.shortmess = opt.shortmess + 'ct'
opt.pumheight = 10
opt.laststatus = 3
opt.winbar = '%= %m %f'
opt.wildmenu = true
opt.wildmode = { 'longest', 'full' }
-- Ignore compiled files
opt.wildignore = '__pycache__'
opt.wildignore = opt.wildignore + { '*.o', '*~', '*.pyc', '*pycache*' }
opt.completeopt = { 'menuone', 'noselect' }
opt.termguicolors = true
opt.showmode = false
opt.showcmd = true
opt.cmdheight = 1 -- Height of the command bar
opt.incsearch = true -- Makes search act like search in modern browsers
opt.showmatch = true -- show matching brackets when text indicator is over them
opt.number = true -- But show the actual number for the line we're on
opt.ignorecase = true -- Ignore case when searching...
opt.smartcase = true -- ... unless there is a capital letter in the query
opt.hidden = true -- I like having buffers stay around
opt.cursorline = true -- Highlight the current line
opt.signcolumn = 'yes'
opt.splitright = true -- Prefer windows splitting to the right
opt.splitbelow = true -- Prefer windows splitting to the bottom
opt.updatetime = 1000 -- Make updates happen faster
opt.hlsearch = true -- Highlight searches
opt.scrolloff = 10 -- Make it so there are always ten lines below my cursor
-- Tabs
opt.autoindent = true
opt.cindent = true
opt.wrap = true
opt.tabstop = 4
opt.shiftwidth = 4
opt.softtabstop = 4
opt.expandtab = true
opt.linebreak = true
opt.mouse = 'a'
opt.listchars = { tab = ' ', trail = '·', extends = '»', precedes = '«', nbsp = '░' }
opt.list = true
opt.winborder = 'single'
opt.pumborder = 'single'
local opts = { silent = true }
local map = vim.keymap.set
map("n", "<leader>q", function() -- toggle quickfix
for _, win in ipairs(vim.fn.getwininfo()) do
if win.quickfix == 1 then
vim.cmd("cclose")
return
end
end
vim.cmd("copen")
end)
require 'lsp'
require 'statusline'
-- https://github.com/neovim/neovim/pull/27855
require('vim._core.ui2').enable({
enable = true, -- Whether to enable or disable the UI.
msg = { -- Options related to the message module.
---@type 'cmd'|'msg' Where to place regular messages, either in the
---cmdline or in a separate ephemeral message window.
target = 'cmd',
timeout = 2000, -- Time a message is visible in the message window.
},
})
-- Plugins
local gh = function(x)
return 'https://github.com/' .. x
end
vim.pack.add {
{ src = gh 'nvim-treesitter/nvim-treesitter' },
{ src = gh 'stevearc/oil.nvim' },
{ src = gh 'nvim-mini/mini.nvim' },
}
local nts = require 'nvim-treesitter'
local langs = { 'lua', 'rust', 'go', 'zig', 'yaml', 'swift' }
nts.setup {
install_dir = vim.fn.stdpath 'data' .. '/site',
}
nts.install(langs)
vim.api.nvim_create_autocmd('PackChanged', {
callback = function()
nts.update()
end,
})
vim.api.nvim_create_autocmd('FileType', {
pattern = langs,
callback = function()
vim.treesitter.start()
end,
})
require 'plugins.oil'
require 'plugins.mini'
-- from https://github.com/hifanx/dotfiles/blob/master/nvim/.config/nvim/init.lua
vim.api.nvim_create_autocmd('FileType', {
desc = 'Proper "formatoptions"',
group = vim.api.nvim_create_augroup('formatoptions', { clear = true }),
callback = function()
vim.cmd 'setlocal formatoptions-=c formatoptions-=o'
end,
})
vim.api.nvim_create_autocmd('VimResized', {
desc = 'Auto resize splits on terminal resize',
group = vim.api.nvim_create_augroup('nequo/vimresized', { clear = true }),
command = 'wincmd =',
})