Compare commits
4 commits
d0ab90518d
...
236bb15139
| Author | SHA1 | Date | |
|---|---|---|---|
| 236bb15139 | |||
| 8b5ffaa227 | |||
| 479f03bbec | |||
| 40338acb1e |
4 changed files with 51 additions and 17 deletions
33
lua/config/autocommands.lua
Normal file
33
lua/config/autocommands.lua
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
local augroup = vim.api.nvim_create_augroup("UserConfig", {})
|
||||||
|
|
||||||
|
-- highlight yanked text
|
||||||
|
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||||
|
group = augroup,
|
||||||
|
callback = function()
|
||||||
|
vim.highlight.on_yank()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- open file on previous position before quitting
|
||||||
|
vim.api.nvim_create_autocmd("BufReadPost", {
|
||||||
|
group = augroup,
|
||||||
|
callback = function()
|
||||||
|
local mark = vim.api.nvim_buf_get_mark(0, '"')
|
||||||
|
local lcount = vim.api.nvim_buf_line_count(0)
|
||||||
|
if mark[1] > 0 and mark[1] <= lcount then
|
||||||
|
pcall(vim.api.nvim_win_set_cursor, 0, mark)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- create directories if they don't exist
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
group = augroup,
|
||||||
|
callback = function()
|
||||||
|
local dir = vim.fn.expand('<afile>:p:h')
|
||||||
|
if vim.fn.isdirectory(dir) == 0 then
|
||||||
|
vim.fn.mkdir(dir, 'p')
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
@ -24,3 +24,10 @@ vim.keymap.set("v", ">", ">gv", { desc = "Indent right and reselect" })
|
||||||
|
|
||||||
-- file exploring
|
-- file exploring
|
||||||
vim.keymap.set("n", "<Leader>e", ":Oil<CR>", { desc = "Open oil file explorer" })
|
vim.keymap.set("n", "<Leader>e", ":Oil<CR>", { desc = "Open oil file explorer" })
|
||||||
|
|
||||||
|
-- Copy Full File-Path
|
||||||
|
vim.keymap.set("n", "<leader>yp", function()
|
||||||
|
local path = vim.fn.expand("%:p")
|
||||||
|
vim.fn.setreg("+", path)
|
||||||
|
print("file:", path)
|
||||||
|
end)
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,6 @@ vim.opt.inccommand = "split"
|
||||||
vim.opt.ignorecase = true
|
vim.opt.ignorecase = true
|
||||||
vim.opt.smartcase = true
|
vim.opt.smartcase = true
|
||||||
|
|
||||||
-- matching bracket settings
|
|
||||||
vim.opt.showmatch = true
|
|
||||||
vim.opt.matchtime = 2
|
|
||||||
|
|
||||||
-- commandline settings
|
-- commandline settings
|
||||||
vim.opt.cmdheight = 1
|
vim.opt.cmdheight = 1
|
||||||
vim.opt.showmode = false
|
vim.opt.showmode = false
|
||||||
|
|
@ -50,16 +46,6 @@ vim.opt.pumheight = 10
|
||||||
vim.opt.pumblend = 10
|
vim.opt.pumblend = 10
|
||||||
vim.opt.winblend = 0
|
vim.opt.winblend = 0
|
||||||
|
|
||||||
-- concealing settings
|
|
||||||
vim.opt.conceallevel = 0
|
|
||||||
vim.opt.concealcursor = ""
|
|
||||||
|
|
||||||
-- redraw lazilly
|
|
||||||
vim.opt.lazyredraw = true
|
|
||||||
|
|
||||||
-- lower syntax highlighing for performance
|
|
||||||
vim.opt.synmaxcol = 300
|
|
||||||
|
|
||||||
-- better completion options
|
-- better completion options
|
||||||
vim.opt.completeopt = "menuone,noinsert,noselect"
|
vim.opt.completeopt = "menuone,noinsert,noselect"
|
||||||
|
|
||||||
|
|
@ -76,7 +62,7 @@ vim.opt.swapfile = false
|
||||||
vim.opt.undofile = true
|
vim.opt.undofile = true
|
||||||
vim.opt.undodir = vim.fn.expand("~/.local/state/nvim/undo")
|
vim.opt.undodir = vim.fn.expand("~/.local/state/nvim/undo")
|
||||||
vim.opt.autoread = true
|
vim.opt.autoread = true
|
||||||
vim.opt.autowrite = true
|
vim.opt.autowrite = false
|
||||||
|
|
||||||
-- durations for completion and other stuff
|
-- durations for completion and other stuff
|
||||||
vim.opt.updatetime = 300
|
vim.opt.updatetime = 300
|
||||||
|
|
@ -90,6 +76,10 @@ vim.opt.backspace = "indent,eol,start"
|
||||||
vim.opt.autochdir = false
|
vim.opt.autochdir = false
|
||||||
vim.opt.iskeyword:append("-") -- treat dash as part of the word
|
vim.opt.iskeyword:append("-") -- treat dash as part of the word
|
||||||
vim.opt.path:append("**") -- include subdirectories in search
|
vim.opt.path:append("**") -- include subdirectories in search
|
||||||
vim.opt.selection = "exclusive"
|
|
||||||
vim.opt.modifiable = true
|
vim.opt.modifiable = true
|
||||||
vim.opt.encoding = "UTF8"
|
vim.opt.encoding = "UTF8"
|
||||||
|
|
||||||
|
-- better completion settings for the commandline
|
||||||
|
vim.opt.wildmenu = true
|
||||||
|
vim.opt.wildmode = "longest:full,full"
|
||||||
|
vim.opt.wildignore:append({ "*.o", "*.obj", "*.pyc", "*.class", "*.jar" })
|
||||||
|
|
|
||||||
|
|
@ -1 +1,5 @@
|
||||||
require("mini.pick").setup()
|
require("mini.pick").setup()
|
||||||
|
require("mini.icons").setup()
|
||||||
|
require("mini.statusline").setup()
|
||||||
|
require("mini.git").setup()
|
||||||
|
require("mini.diff").setup()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue