You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
1.7 KiB
76 lines
1.7 KiB
vim.opt.mouse:append('a')
|
|
vim.opt.number = true
|
|
vim.opt.linebreak = true
|
|
vim.opt.shiftwidth = 2
|
|
vim.opt.tabstop = 2
|
|
vim.opt.softtabstop = 2
|
|
vim.opt.expandtab = true
|
|
vim.opt.smarttab = true
|
|
vim.opt.shiftround = true
|
|
vim.opt.autoindent = true
|
|
vim.opt.textwidth = 80
|
|
vim.opt.colorcolumn = "80"
|
|
vim.opt.list = true
|
|
|
|
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
|
|
vim.opt.undofile = true
|
|
vim.opt.hlsearch = false
|
|
vim.opt.incsearch = true
|
|
|
|
vim.g.airline_theme = "base16_chalk"
|
|
vim.g.airline_powerline_fonts = 1
|
|
|
|
vim.opt.nu = true
|
|
vim.opt.rnu = true
|
|
|
|
vim.opt.scrolloff = 7
|
|
|
|
vim.cmd("filetype plugin indent on")
|
|
vim.cmd("filetype on")
|
|
|
|
vim.api.nvim_create_autocmd("FileType", {
|
|
pattern = "python",
|
|
callback = function(args)
|
|
vim.bo.textwidth = 0
|
|
vim.bo.formatprg = "autopep8"
|
|
vim.bo.shiftwidth = 4
|
|
vim.bo.tabstop = 4
|
|
vim.bo.softtabstop = 4
|
|
end
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd("FileType", {
|
|
pattern = { "markdown", "tex", "text" },
|
|
callback = function(args)
|
|
vim.o.smarttab = false
|
|
vim.bo.autoindent = false
|
|
end
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd("FileType", {
|
|
pattern = { "c", "cpp", "slang" },
|
|
callback = function(args)
|
|
vim.bo.cindent = true
|
|
end
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd("FileType", {
|
|
pattern = "go",
|
|
callback = function(args)
|
|
vim.bo.shiftwidth = 4
|
|
vim.bo.expandtab = false
|
|
vim.bo.tabstop = 4
|
|
vim.bo.softtabstop = 4
|
|
vim.bo.preserveindent = true
|
|
vim.bo.copyindent = true
|
|
vim.bo.formatprg = "gofmt -e -w"
|
|
vim.api.nvim_set_keymap("n", "<F4>", ":w|:!cpgo test<CR>", { noremap = true })
|
|
end
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
|
pattern = { "*.go", "*.py", "*.lua", "*.ts", "*.tsx", "*.js", "*.md", "*.json" },
|
|
callback = function(args)
|
|
vim.lsp.buf.formatting_sync()
|
|
end
|
|
})
|