7 files changed,
96 insertions(+),
95 deletions(-)
Author:
Smirnov Olexander
ss2316544@gmail.com
Committed at:
2022-04-29 11:34:27 +0300
Parent:
c6616e7
M
init.lua
@@ -1,10 +1,8 @@
require "impatient" -require "fk.options" -require "fk.keymapings" -require "fk.disable" -require "fk.globals" +require "core.options" require "fk.plugin" -require "fk.autocmd" +require "core.keymaps" +require "core.autocmd" require("onenord").setup()
A
lua/core/options.lua
@@ -0,0 +1,68 @@
+local o, g = vim.opt, vim.g + +-- use filetype.lua instead of filetype.vim +g.did_load_filetypes = 1 +g.do_filetype_lua = 1 + +-- leader +g.mapleader = " " +g.maplocalleader = "," + +-- indent +o.smartindent = true +o.expandtab = true +o.cursorline = true +o.shiftwidth = 4 +o.tabstop = 4 + +o.ignorecase = true +o.smartcase = true +o.number = true +o.termguicolors = true +o.completeopt = { "menuone", "noselect" } +o.clipboard = "unnamedplus" +o.timeoutlen = 250 +o.fileencoding = "utf-8" +o.mouse = "a" +o.showmode = false +o.splitbelow = true +o.splitright = true +o.pumheight = 8 +o.numberwidth = 4 +o.scrolloff = 8 +o.sidescrolloff = 8 +o.signcolumn = "yes" +o.hidden = true +o.title = true +o.wrap = false + +-- swap files +o.undofile = true +o.swapfile = false +o.writebackup = false + +-- disable build-in modules +for _, i in pairs { + "netrw", + "netrwPlugin", + "netrwSettings", + "netrwFileHandlers", + "gzip", + "zip", + "tohtml", + "man", + "zipPlugin", + "tar", + "tarPlugin", + "getscript", + "getscriptPlugin", + "vimball", + "vimballPlugin", + "2html_plugin", + "logipat", + "rrhelper", + "spellfile_plugin", + "matchit", +} do + vim.g["loaded_" .. i] = 1 +end
A
lua/core/utils.lua
@@ -0,0 +1,14 @@
+return { + ---@param mode string + ---@param from string + ---@param to string + ---@param expr boolean + map = function(mode, from, to, expr) + if expr then + vim.keymap.set(mode, from, to, { noremap = true, expr = true }) + return + end + + vim.keymap.set(mode, from, to, { noremap = true, silent = true }) + end, +}
D
@@ -1,28 +0,0 @@
-vim.g.loaded_perl_provider = 0 -vim.g.loaded_ruby_provider = 0 -vim.g.loaded_node_provider = 0 - -for _, i in pairs { - "netrw", - "netrwPlugin", - "netrwSettings", - "netrwFileHandlers", - "gzip", - "zip", - "tohtml", - "man", - "zipPlugin", - "tar", - "tarPlugin", - "getscript", - "getscriptPlugin", - "vimball", - "vimballPlugin", - "2html_plugin", - "logipat", - "rrhelper", - "spellfile_plugin", - "matchit", -} do - vim.g["loaded_" .. i] = 1 -end
M
lua/core/keymaps.lua
→lua/core/keymaps.lua
@@ -1,40 +1,31 @@
-local function map(mode, from, to, expr) - if expr or false then - vim.keymap.set(mode, from, to, { noremap = true, expr = true }) - return - end - - vim.keymap.set(mode, from, to, { noremap = true, silent = true }) -end +local map = require "core.utils".map +-- general map("n", "<C-s>", "<cmd>write!<cr>") -map("i", "<C-s>", "<cmd>write!<cr>") map("i", "jk", "<esc>") +--- buffers map("n", "<S-h>", "<cmd>bp!<cr>") map("n", "<S-l>", "<cmd>bn!<cr>") - -map("n", "<leader>ps", "<cmd>PackerSync<cr>") +map("n", "<leader>c", "<cmd>bdelete!<cr>") +-- select in pupup by C-j & C-k map("i", "<C-j>", 'pumvisible() ? "\\<down>" : "\\<C-j>"', true) map("i", "<C-k>", 'pumvisible() ? "\\<up>" : "\\<C-k>"', true) map("c", "<C-j>", 'pumvisible() ? "\\<C-n>" : "\\<C-j>"', true) map("c", "<C-k>", 'pumvisible() ? "\\<C-p>" : "\\<C-k>"', true) +-- window navigation and resize +map("n", "<C-h>", "<cmd>wincmd h<cr>") +map("n", "<C-j>", "<cmd>wincmd j<cr>") +map("n", "<C-k>", "<cmd>wincmd k<cr>") +map("n", "<C-l>", "<cmd>wincmd l<cr>") map("n", "<C-Left>", "<cmd>vertical resize -2<cr>") map("n", "<C-Down>", "<cmd>resize +2<cr>") map("n", "<C-Up", "<cmd>resize -1<cr>") map("n", "<C-Right>", "<cmd>vertical resize +2<CR>") -map("n", "<C-h>", "<cmd>wincmd h<cr>") -map("n", "<C-j>", "<cmd>wincmd j<cr>") -map("n", "<C-k>", "<cmd>wincmd k<cr>") -map("n", "<C-l>", "<cmd>wincmd l<cr>") -map("t", "<C-h>", "<C-\\><C-n><C-w>h") -map("t", "<C-j>", "<C-\\><C-n><C-w>j") -map("t", "<C-k>", "<C-\\><C-n><C-w>k") -map("t", "<C-l>", "<C-\\><C-n><C-w>l") - +-- move strings map("i", "<A-j>", "<Esc>:m .+1<CR>==gi") map("i", "<A-k>", "<Esc>:m .-2<CR>==gi") map("v", "K", ":move '<-2<CR>gv-gv")
D
@@ -1,42 +0,0 @@
-local o = vim.opt - -vim.g.did_load_filetypes = 1 - --- leader -vim.g.mapleader = " " -vim.g.maplocalleader = "," - --- tab -o.smartindent = true -o.expandtab = true -o.cursorline = true -o.shiftwidth = 4 -o.tabstop = 4 - --- serarch -o.ignorecase = true -o.smartcase = true - -o.number = true -o.termguicolors = true -o.completeopt = { "menuone", "noselect" } -o.clipboard = "unnamedplus" -o.timeoutlen = 250 -o.fileencoding = "utf-8" -o.mouse = "a" -o.showmode = false -o.splitbelow = true -o.splitright = true -o.pumheight = 8 -o.numberwidth = 4 -o.scrolloff = 8 -o.sidescrolloff = 8 -o.signcolumn = "yes" -o.hidden = true -o.title = true -o.wrap = false - --- swap files -o.undofile = true -o.swapfile = false -o.writebackup = false