88 lines
2.6 KiB
Lua
88 lines
2.6 KiB
Lua
local opt, api, cmd = vim.opt, vim.api, vim.cmd
|
|
local fn, ui = vim.fn, vim.ui
|
|
|
|
-- colorscheme -----------------------------------------------------------------
|
|
|
|
cmd.colorscheme("basic")
|
|
|
|
-- options ---------------------------------------------------------------------
|
|
|
|
opt.undofile = true
|
|
opt.backup = false
|
|
opt.writebackup = false
|
|
opt.mouse = "nvi"
|
|
opt.title = true
|
|
opt.shortmess:append({ I = true })
|
|
opt.number = true
|
|
opt.relativenumber = true
|
|
opt.signcolumn = "number"
|
|
opt.textwidth = 80
|
|
opt.colorcolumn = "+1"
|
|
opt.expandtab = true
|
|
opt.tabstop = 4
|
|
opt.shiftwidth = 4
|
|
opt.softtabstop = -1
|
|
opt.smarttab = true
|
|
opt.showtabline = 2
|
|
opt.winbar = "%f%( %h%m%r%y%)"
|
|
opt.laststatus = 3
|
|
opt.ignorecase = true
|
|
opt.infercase = true
|
|
opt.smartcase = true
|
|
opt.smartindent = true
|
|
opt.clipboard = "unnamedplus"
|
|
opt.wildoptions = { "fuzzy" }
|
|
opt.wildignorecase = true
|
|
opt.path = ".,,**"
|
|
opt.completeopt = { "menuone", "preview" }
|
|
opt.scrolloff = 10
|
|
|
|
-- statusline ------------------------------------------------------------------
|
|
|
|
function _G.statusline()
|
|
local wordcount = fn.wordcount()
|
|
return table.concat({
|
|
fn.pathshorten(fn.getcwd()),
|
|
" %=",
|
|
" <%b> ",
|
|
wordcount.visual_chars or wordcount.cursor_chars, "/", wordcount.chars, " ",
|
|
wordcount.visual_words or wordcount.cursor_words, "/", wordcount.words
|
|
})
|
|
end
|
|
opt.statusline = "%!v:lua.statusline()"
|
|
|
|
|
|
-- keymaps ---------------------------------------------------------------------
|
|
|
|
local keymap_set = vim.keymap.set
|
|
|
|
keymap_set("n", "<esc>", "<cmd>nohlsearch<cr>")
|
|
keymap_set("c", "<m-h>", "<left>")
|
|
keymap_set("c", "<m-l>", "<right>")
|
|
keymap_set("n", "<leader>f", ":find ")
|
|
keymap_set("n", "<leader>b", ":buffer ")
|
|
keymap_set("n", "<leader>h", ":help ")
|
|
keymap_set("n", "<leader>g", ":vimgrep /")
|
|
keymap_set("n", "<leader>s", "<cmd>:set spell!<cr>")
|
|
keymap_set("n", "<leader>m", "<cmd>make<cr>")
|
|
keymap_set("n", "<leader>d", "<cmd>bdelete<cr>")
|
|
keymap_set("n", "]b", "<cmd>bnext<cr>")
|
|
keymap_set("n", "[b", "<cmd>bprev<cr>")
|
|
keymap_set("n", "]B", "<cmd>blast<cr>")
|
|
keymap_set("n", "[B", "<cmd>bfirst<cr>")
|
|
keymap_set("n", "]t", "<cmd>tabnext<cr>")
|
|
keymap_set("n", "[t", "<cmd>tabprev<cr>")
|
|
keymap_set("n", "]T", "<cmd>tablast<cr>")
|
|
keymap_set("n", "[T", "<cmd>tabfirst<cr>")
|
|
keymap_set("n", "]q", "<cmd>cnext<cr>zz")
|
|
keymap_set("n", "[q", "<cmd>cprev<cr>zz")
|
|
keymap_set("n", "]Q", "<cmd>clast<cr>zz")
|
|
keymap_set("n", "[Q", "<cmd>cfirst<cr>zz")
|
|
keymap_set("n", "<leader>co", "<cmd>copen<cr>")
|
|
keymap_set("n", "<leader>cc", "<cmd>cclose<cr>")
|
|
keymap_set("n", "<c-h>", "<c-w>h")
|
|
keymap_set("n", "<c-j>", "<c-w>j")
|
|
keymap_set("n", "<c-k>", "<c-w>k")
|
|
keymap_set("n", "<c-l>", "<c-w>l")
|
|
keymap_set("n", "<leader>.", "<cmd>e.<cr>")
|