-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.lua
215 lines (195 loc) · 6.38 KB
/
config.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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
--[[
THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT
`lvim` is the global options object
]]
if vim.g.neovide then
vim.o.guifont = "FiraCode Nerd Font Mono:H14"
end
if vim.loop.os_uname().sysname:find "Windows" and true or false then
vim.opt.shell = "pwsh.exe -NoLogo"
vim.opt.shellcmdflag =
"-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;"
vim.cmd [[
let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
let &shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
set shellquote= shellxquote=
]]
-- Set a compatible clipboard manager
vim.g.clipboard = {
copy = {
["+"] = "win32yank.exe -i --crlf",
["*"] = "win32yank.exe -i --crlf",
},
paste = {
["+"] = "win32yank.exe -o --lf",
["*"] = "win32yank.exe -o --lf",
},
}
end
-- vim options
vim.opt.shiftwidth = 4
vim.opt.tabstop = 4
vim.opt.relativenumber = false
-- general
lvim.log.level = "info"
lvim.format_on_save = {
enabled = true,
pattern = {"*.lua","*.go"},
timeout = 1000,
}
-- to disable icons and use a minimalist setup, uncomment the following
-- lvim.use_icons = false
-- keymappings <https://www.lunarvim.org/docs/configuration/keybindings>
lvim.leader = "space"
-- add your own keymapping
lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
lvim.keys.normal_mode["<C-n>"] = ":NvimTreeToggle<CR>"
lvim.keys.normal_mode["<F1>"] = "<cmd>lua vim.diagnostic.open_float()<CR>"
lvim.keys.normal_mode["<F2>"] = ":WhichKey<CR>"
lvim.keys.normal_mode["<F3>"] = ":Telescope live_grep_args<CR>"
--lvim.keys.normal_mode["<F4>"] = ":AerialToggle<CR>"
lvim.keys.normal_mode["<F4>"] = ":SymbolsOutline<CR>"
lvim.keys.normal_mode["<F5>"] = "<Esc>:Telescope treesitter<CR>"
lvim.keys.normal_mode["<F6>"] = ":terminal<CR>"
-- lvim.keys.normal_mode["<F>"] = ":terminal<CR>"
lvim.keys.normal_mode["Z"] = ":TZFocus<CR>"
lvim.builtin.which_key.mappings["s"] = {
"<CMD>SymbolsOutline<CR>", "SymbolsOutline"
}
local keymap = vim.keymap.set
-- Better window navigation
keymap("n", "<m-h>", "<C-w>h", opts)
keymap("n", "<m-j>", "<C-w>j", opts)
keymap("n", "<m-k>", "<C-w>k", opts)
keymap("n", "<m-l>", "<C-w>l", opts)
keymap("n", "<m-tab>", "<c-6>", opts)
vim.api.nvim_set_keymap("n", "<S-l>", ":bnext<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<S-h>", ":bprevious<CR>", { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", "<S-h>", ":bprevious<CR>", { noremap = true, silent = true })
-- lvim.keys.normal_mode["<S-l>"] = ":BufferLineCycleNext<CR>"
-- lvim.keys.normal_mode["<S-h>"] = ":BufferLineCyclePrev<CR>"
-- -- Use which-key to add extra bindings with the leader-key prefix
-- lvim.builtin.which_key.mappings["W"] = { "<cmd>noautocmd w<cr>", "Save without formatting" }
-- lvim.builtin.which_key.mappings["P"] = { "<cmd>Telescope projects<CR>", "Projects" }
-- -- Change theme settings
-- lvim.colorscheme = "lunar"
lvim.builtin.alpha.active = true
lvim.builtin.alpha.mode = "dashboard"
lvim.builtin.terminal.active = true
lvim.builtin.nvimtree.setup.view.side = "left"
lvim.builtin.nvimtree.setup.renderer.icons.show.git = true
-- Automatically install missing parsers when entering buffer
lvim.builtin.treesitter.auto_install = true
lvim.builtin.treesitter.ignore_install = { "haskell" }
lvim.builtin.treesitter.highlight.enabled = true
lvim.builtin.treesitter.autotag.enable = true
lvim.builtin.treesitter.rainbow.enable = true
lvim.builtin.treesitter.textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["at"] = "@class.outer",
["it"] = "@class.inner",
["ac"] = "@call.outer",
["ic"] = "@call.inner",
["aa"] = "@parameter.outer",
["ia"] = "@parameter.inner",
["al"] = "@loop.outer",
["il"] = "@loop.inner",
["ai"] = "@conditional.outer",
["ii"] = "@conditional.inner",
["a/"] = "@comment.outer",
["i/"] = "@comment.inner",
["ab"] = "@block.outer",
["ib"] = "@block.inner",
["as"] = "@statement.outer",
["is"] = "@scopename.inner",
["aA"] = "@attribute.outer",
["iA"] = "@attribute.inner",
["aF"] = "@frame.outer",
["iF"] = "@frame.inner",
},
},
}
local actions = require("telescope.actions")
pastfn = function(prompt_bufnr)
local action_state = require "telescope.actions.state"
local current_picker = action_state.get_current_picker(prompt_bufnr)
current_picker:reset_prompt()
local entry = vim.fn.getreg("*")
if entry ~= nil then
current_picker:set_prompt(entry)
end
end
lvim.builtin.bufferline.options.numbers = "ordinal"
lvim.builtin.bufferline.options.separator_style = { '|', '|' }
local function open_nvim_tree(data)
-- buffer is a directory
local directory = vim.fn.isdirectory(data.file) == 1
if not directory then
return
end
-- create a new, empty buffer
vim.cmd.enew()
-- change to the directory
vim.cmd.cd(data.file)
-- open the tree
require("nvim-tree.api").tree.open()
end
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
lvim.builtin.telescope.defaults.mappings.i["<C-v>"] = pastfn
lvim.plugins = {
{
"mrjones2014/nvim-ts-rainbow",
},
{ -- telescope instant searching
"nvim-telescope/telescope-live-grep-args.nvim",
config = function()
require("telescope").load_extension('live_grep_args')
end
},
{
"simrat39/symbols-outline.nvim",
config = function()
require('symbols-outline').setup()
end
},
{
"f-person/git-blame.nvim",
event = "BufRead",
config = function()
vim.cmd "highlight default link gitblame SpecialComment"
vim.g.gitblame_enabled = 0
end,
},
{
"ray-x/lsp_signature.nvim",
event = "BufRead",
config = function()
require "lsp_signature".setup()
end
},
{
"nvim-treesitter/nvim-treesitter-textobjects",
},
{
"Pocco81/true-zen.nvim",
config = function()
require("true-zen").setup {
-- your config goes here
-- or just leave it empty :)
}
end,
},
{ "tpope/vim-repeat" },
{
"tpope/vim-surround",
-- event = "BufRead",
-- keys = {"c", "d", "y"}
},
}