Skip to content

Commit

Permalink
build(all): configuration complete
Browse files Browse the repository at this point in the history
- elegance never goes out of style: SimpleNvim takes you through the beauty of timeless code
  • Loading branch information
askfiy committed Aug 22, 2023
0 parents commit 792eea9
Show file tree
Hide file tree
Showing 108 changed files with 6,155 additions and 0 deletions.
373 changes: 373 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions ftplugin/c.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vim.opt_local.expandtab = true
vim.opt_local.shiftwidth = 4
vim.opt_local.tabstop = 4
vim.opt_local.softtabstop = 4
5 changes: 5 additions & 0 deletions ftplugin/css.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
vim.opt_local.expandtab = true
vim.opt_local.shiftwidth = 2
vim.opt_local.tabstop = 2
vim.opt_local.softtabstop = 2
vim.opt_local.iskeyword = "@,48-57,_,192-255,-"
4 changes: 4 additions & 0 deletions ftplugin/go.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vim.opt_local.expandtab = false
vim.opt_local.shiftwidth = 4
vim.opt_local.tabstop = 4
vim.opt_local.softtabstop = 4
5 changes: 5 additions & 0 deletions ftplugin/html.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
vim.opt_local.expandtab = true
vim.opt_local.shiftwidth = 2
vim.opt_local.tabstop = 2
vim.opt_local.softtabstop = 2
vim.opt_local.iskeyword = "@,48-57,_,192-255,-"
4 changes: 4 additions & 0 deletions ftplugin/javascript.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vim.opt_local.expandtab = true
vim.opt_local.shiftwidth = 2
vim.opt_local.tabstop = 2
vim.opt_local.softtabstop = 2
4 changes: 4 additions & 0 deletions ftplugin/json.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vim.opt_local.expandtab = true
vim.opt_local.shiftwidth = 2
vim.opt_local.tabstop = 2
vim.opt_local.softtabstop = 2
4 changes: 4 additions & 0 deletions ftplugin/lua.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vim.opt_local.expandtab = true
vim.opt_local.shiftwidth = 4
vim.opt_local.tabstop = 4
vim.opt_local.softtabstop = 4
5 changes: 5 additions & 0 deletions ftplugin/markdown.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
vim.opt_local.expandtab = true
vim.opt_local.shiftwidth = 2
vim.opt_local.tabstop = 2
vim.opt_local.softtabstop = 2
vim.opt_local.smartindent = false
4 changes: 4 additions & 0 deletions ftplugin/python.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vim.opt_local.expandtab = true
vim.opt_local.shiftwidth = 4
vim.opt_local.tabstop = 4
vim.opt_local.softtabstop = 4
4 changes: 4 additions & 0 deletions ftplugin/sh.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vim.opt_local.expandtab = true
vim.opt_local.shiftwidth = 2
vim.opt_local.tabstop = 2
vim.opt_local.softtabstop = 2
4 changes: 4 additions & 0 deletions ftplugin/sql.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vim.opt_local.expandtab = true
vim.opt_local.shiftwidth = 2
vim.opt_local.tabstop = 2
vim.opt_local.softtabstop = 2
4 changes: 4 additions & 0 deletions ftplugin/txt.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vim.opt_local.expandtab = true
vim.opt_local.shiftwidth = 4
vim.opt_local.tabstop = 4
vim.opt_local.softtabstop = 4
4 changes: 4 additions & 0 deletions ftplugin/typescript.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vim.opt_local.expandtab = true
vim.opt_local.shiftwidth = 2
vim.opt_local.tabstop = 2
vim.opt_local.softtabstop = 2
4 changes: 4 additions & 0 deletions ftplugin/vim.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vim.opt_local.expandtab = true
vim.opt_local.shiftwidth = 4
vim.opt_local.tabstop = 4
vim.opt_local.softtabstop = 4
4 changes: 4 additions & 0 deletions ftplugin/vue.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vim.opt_local.expandtab = true
vim.opt_local.shiftwidth = 2
vim.opt_local.tabstop = 2
vim.opt_local.softtabstop = 2
4 changes: 4 additions & 0 deletions ftplugin/yaml.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
vim.opt_local.expandtab = true
vim.opt_local.shiftwidth = 2
vim.opt_local.tabstop = 2
vim.opt_local.softtabstop = 2
6 changes: 6 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- author: askfiy

require("core.setting")
require("core.mapping")
require("core.command")
require("core.depends")
54 changes: 54 additions & 0 deletions lazy-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
"LuaSnip": { "branch": "master", "commit": "c4d6298347f7707e9757351b2ee03d0c00da5c20" },
"aerial.nvim": { "branch": "master", "commit": "ffb5fd0aa7fcd5c3f68df38f89af3aa007f76604" },
"bufferline.nvim": { "branch": "main", "commit": "417b303328118b6d836ae330142e88771c48a8a3" },
"ccc.nvim": { "branch": "main", "commit": "4a0ddaf787cc82796e84ab8a7f70d086f250aeb6" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp-tabnine": { "branch": "main", "commit": "b93f82ef5150e578677fc2e2b4b328b19eed77e1" },
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"efmls-configs-nvim": { "branch": "main", "commit": "ed408da89d86faeae3265a6d25f4491e44ede334" },
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
"friendly-snippets": { "branch": "main", "commit": "377d45475b49e37460a902d6d569d2093d4037d0" },
"gitsigns.nvim": { "branch": "main", "commit": "749267aaa863c30d721c9913699c5d94e0c07dd3" },
"lazy.nvim": { "branch": "main", "commit": "dac844ed617dda4f9ec85eb88e9629ad2add5e05" },
"lsp_extra_dim": { "branch": "master", "commit": "a1b77c34354e2d792da538022c58e9ed80ea9ce3" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "2997f467881ac4faa6f8c5e7065e3a672297c8ad" },
"mason.nvim": { "branch": "main", "commit": "a51c2d063c5377ee9e58c5f9cda7c7436787be72" },
"neodev.nvim": { "branch": "main", "commit": "e9bc652e22f9cd1892630bf019db363ac403ee39" },
"nvim-autopairs": { "branch": "master", "commit": "ae5b41ce880a6d850055e262d6dfebd362bb276e" },
"nvim-cmp": { "branch": "main", "commit": "51f1e11a89ec701221877532ee1a23557d291dd5" },
"nvim-dap": { "branch": "master", "commit": "897c433ff2fbcf6f71a57bf18460d810e173d1e0" },
"nvim-dap-ui": { "branch": "master", "commit": "85b16ac2309d85c88577cd8ee1733ce52be8227e" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "57f1dbd0458dd84a286b27768c142e1567f3ce3b" },
"nvim-dap-vscode-js": { "branch": "main", "commit": "03bd29672d7fab5e515fc8469b7d07cc5994bbf6" },
"nvim-hlslens": { "branch": "main", "commit": "f0281591a59e95400babf61a96e59ba20e5c9533" },
"nvim-lightbulb": { "branch": "master", "commit": "8f00b89dd1b1dbde16872bee5fbcee2e58c9b8e9" },
"nvim-lspconfig": { "branch": "master", "commit": "67f151e84daddc86cc65f5d935e592f76b9f4496" },
"nvim-markdown-preview": { "branch": "master", "commit": "3d6f941beb223b23122973d077522e9e2ee33068" },
"nvim-picgo": { "branch": "master", "commit": "73d5b5171d9125c1b43bd5448c8b611de7b5dbd5" },
"nvim-spectre": { "branch": "master", "commit": "eb17a856a6f17e03d8d610cbc00cd9f2f39e3fd7" },
"nvim-toggler": { "branch": "main", "commit": "c10828c333a91bcb1dbdae9131ced799158c16b0" },
"nvim-tree.lua": { "branch": "master", "commit": "920868dba13466586897a8f40220eca6b2caac41" },
"nvim-treesitter": { "branch": "master", "commit": "7c935d6bd5ecb36e7c6cf6678e1eaa38b85111f3" },
"nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "9bff161dfece6ecf3459e6e46ca42e49f9ed939f" },
"nvim-ufo": { "branch": "main", "commit": "aebd36bf5447862671356fcd5d4a8708ce6c9470" },
"nvim-web-devicons": { "branch": "master", "commit": "cfc8824cc1db316a276b36517f093baccb8e799a" },
"plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" },
"promise-async": { "branch": "main", "commit": "e94f35161b8c5d4a4ca3b6ff93dd073eb9214c0e" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" },
"telescope.nvim": { "branch": "master", "commit": "2d92125620417fbea82ec30303823e3cd69e90e8" },
"toggleterm.nvim": { "branch": "main", "commit": "12cba0a1967b4f3f31903484dec72a6100dcf515" },
"translate.nvim": { "branch": "main", "commit": "30cc9e9f339b61e7bd40bc1ba7af73ea193bf589" },
"vim-dadbod": { "branch": "master", "commit": "7d80bbd11c407a09e0f7b869c38f3dec3902805f" },
"vim-dadbod-completion": { "branch": "master", "commit": "fc7321a17f4c55db11fae89a884ddf4724020bae" },
"vim-dadbod-ui": { "branch": "master", "commit": "200aebf70e6fc4b0eb1d3ecf0d57028e198d8dc6" },
"vim-illuminate": { "branch": "master", "commit": "76f28e858f1caae87bfa45fb4fd09e4b053fc45b" },
"vim-python-pep8-indent": { "branch": "master", "commit": "60ba5e11a61618c0344e2db190210145083c91f8" },
"visual_studio_code": { "branch": "master", "commit": "142353d98edeef00dc85d51054ef3e42bd4a3a66" },
"which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" }
}
74 changes: 74 additions & 0 deletions lua/conf/config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
return {
auto_save = true,
float_border = false,
input_switch = true,
transparent_background = false,
lspconfig = {
inlay_hint = false,
semantic_token = false,
},
icon = {
diagnostic = {
enable = false,
groups = {
Error = "",
Warn = "",
Info = "󰋽",
Hint = "󰋽",
},
},
kind = {
enable = true,
groups = {
Default = "",
String = "",
Number = "",
Boolean = "",
Array = "",
Object = "",
Key = "",
Null = "",
Text = "",
Method = "",
Function = "",
Constructor = "",
Namespace = "",
Field = "",
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "󰅴",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "﬌",
Event = "",
Operator = "",
TypeParameter = "",
},
},
},
database = {
{
name = "mysql(example)",
url = "mysql://username:password@localhost:3306/db?protocol=tcp",
},
{
name = "postgresql(example)",
url = "postgres://username:password@localhost:5432/db",
},
{
name = "Singapore Xizi",
url = "postgres://postgres:[email protected]:5432/xjpxz",
},
},
}
48 changes: 48 additions & 0 deletions lua/conf/preference.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
vim.g.mapleader = " "

vim.opt.ruler = false
vim.opt.showmode = false
vim.opt.swapfile = false
vim.opt.cmdheight = 1
vim.opt.signcolumn = "yes:1"
vim.opt.completeopt = "menuone,noselect"
vim.opt.pumheight = 10
vim.opt.updatetime = 500
vim.opt.timeoutlen = 500
vim.opt.termguicolors = true
vim.opt.cursorline = true
vim.opt.numberwidth = 2
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.splitright = true
vim.opt.scrolloff = 21
vim.opt.smoothscroll = true
vim.opt.mouse = "a"
vim.opt.list = true
vim.opt.spell = true
vim.opt.spelllang = "en_us,cjk"
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.filetype = "plugin"
vim.opt.foldmethod = "indent"
vim.opt.foldlevel = 100
vim.opt.foldlevelstart = 99
vim.opt.foldcolumn = "0"
vim.opt.clipboard = "unnamedplus"
vim.opt.smartindent = true
vim.opt.iskeyword = "@,48-57,_,192-255"
vim.opt.laststatus = 3
vim.opt.linebreak = true
vim.opt.fillchars = "eob: "
vim.opt.fileencodings = "ucs-bom,utf-8,gbk,big5,gb18030,latin1"
vim.opt.sessionoptions = "buffers,curdir,folds,help,tabpages,winsize,globals"

vim.opt.undofile = true

-- vim.opt.listchars:append("space:⋅")
-- vim.opt.listchars:append("eol:↴")
-- vim.opt.listchars:append("tab:↹ ")

vim.opt.diffopt:append("vertical")
vim.opt.shortmess:append("sI")
vim.opt.whichwrap:append("<>[]hl")
46 changes: 46 additions & 0 deletions lua/core/command/autocmd.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
local api = require("utils.api")

vim.api.nvim_create_autocmd("BufReadPost", {
pattern = { "*" },
callback = function()
if
vim.fn.line("'\"") > 0
and vim.fn.line("'\"") <= vim.fn.line("$")
then
---@diagnostic disable-next-line: param-type-mismatch
vim.fn.setpos(".", vim.fn.getpos("'\""))
-- how do I center the buffer in a sane way??
-- vim.cmd('normal zz')
vim.cmd("silent! foldopen")
end
end,
})

vim.api.nvim_create_autocmd({ "BufEnter" }, {
pattern = { "*" },
callback = function()
vim.opt.formatoptions = vim.opt.formatoptions - { "c", "r", "o" }
end,
})

if api.get_setting().is_auto_save() then
vim.api.nvim_create_autocmd({ "InsertLeave", "TextChanged" }, {
pattern = { "*" },
callback = function()
vim.cmd("silent! wall")
end,
nested = true,
})
end

if api.get_setting().is_input_switch() then
vim.api.nvim_create_autocmd({ "InsertLeave" }, {
pattern = { "*" },
callback = function()
local input_status = tonumber(vim.fn.system("fcitx5-remote"))
if input_status == 2 then
vim.fn.system("fcitx5-remote -c")
end
end,
})
end
2 changes: 2 additions & 0 deletions lua/core/command/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require("core.command.usercmd")
require("core.command.autocmd")
31 changes: 31 additions & 0 deletions lua/core/command/usercmd.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
local api = require("utils.api")

vim.api.nvim_create_user_command("BufferDelete", function(ctx)
---@diagnostic disable-next-line: missing-parameter
local file_exists = vim.fn.filereadable(vim.fn.expand("%p"))
local modified = vim.api.nvim_buf_get_option(0, "modified")

if file_exists == 0 and modified then
local user_choice = vim.fn.input(
"The file is not saved, whether to force delete? Press enter or input [y/n]:"
)
if user_choice == "y" or user_choice:len() == 0 then
vim.cmd("bd!")
end
return
end

local force = not vim.bo.buflisted or vim.bo.buftype == "nofile"

vim.cmd(
force and "bd!"
or ("bp | bd! %s"):format(vim.api.nvim_get_current_buf())
)
end, { desc = "Delete the current Buffer while maintaining the window layout" })

vim.api.nvim_create_user_command("OpenUserSnippetFile", function(ctx)
local snippet_file_name = vim.bo.filetype .. ".json"
local snippet_file_path =
api.path.join(vim.fn.stdpath("config"), "snippets", snippet_file_name)
vim.cmd((":e %s"):format(snippet_file_path))
end, { desc = "Open user snippet file from current filetype" })
Loading

0 comments on commit 792eea9

Please sign in to comment.