diff --git a/nvim/lua/indent.lua b/nvim/lua/indent.lua index e4ff042..96ea283 100644 --- a/nvim/lua/indent.lua +++ b/nvim/lua/indent.lua @@ -7,44 +7,44 @@ createAutoCmd = vim.api.nvim_create_autocmd -- Basic thing for compiling languages. createAutoCmd({ - "BufNewFile", - "BufRead", + "BufNewFile", + "BufRead", },{ - pattern = "*.go,*.c,*.cc,*.C,*.cpp,*.rs,*.mk", - callback = function() - local buf = vim.bo[vim.api.nvim_get_current_buf()] - vim.o.expandtab = false - vim.o.tabstop = 4 - vim.o.shiftwidth = 4 - end, + pattern = "*.go,*.c,*.cc,*.C,*.cpp,*.rs,*.lua", + callback = function() + local buf = vim.bo[vim.api.nvim_get_current_buf()] + vim.o.expandtab = false + vim.o.tabstop = 4 + vim.o.shiftwidth = 4 + end, }) createAutoCmd({ - "BufNewFile", - "BufRead", + "BufNewFile", + "BufRead", },{ - pattern = "*.txt,*.lua,*.js,*.jsx,*.scss,*.css,*.sass,*.html,*.htmlx,*.tmpl,*.tpl,*.yml,*.yaml,*.toml,*.tml", - callback = function() - local buf = vim.bo[vim.api.nvim_get_current_buf()] - buf.expandtab = true - buf.shiftwidth=2 - buf.tabstop=2 - buf.softtabstop = 0 - end, + pattern = "*.txt,*.js,*.jsx,*.scss,*.css,*.sass,*.html,*.htmlx,*.tmpl,*.tpl,*.yml,*.yaml,*.toml,*.tml", + callback = function() + local buf = vim.bo[vim.api.nvim_get_current_buf()] + buf.expandtab = true + buf.shiftwidth=2 + buf.tabstop=2 + buf.softtabstop = 0 + end, }) createAutoCmd({ - "BufNewFile", - "BufRead", + "BufNewFile", + "BufRead", },{ - pattern = "*.md,*.py", - callback = function() - local buf = vim.bo[vim.api.nvim_get_current_buf()] - buf.expandtab = true - buf.shiftwidth=4 - buf.tabstop=4 - buf.softtabstop = 0 - end, + pattern = "*.md,*.py", + callback = function() + local buf = vim.bo[vim.api.nvim_get_current_buf()] + buf.expandtab = true + buf.shiftwidth=4 + buf.tabstop=4 + buf.softtabstop = 0 + end, }) diff --git a/nvim/lua/maps.lua b/nvim/lua/maps.lua index 240ed40..d67918b 100644 --- a/nvim/lua/maps.lua +++ b/nvim/lua/maps.lua @@ -1,7 +1,7 @@ local function escape(str) - local escape_chars = [[;,."|\]] - return vim.fn.escape(str, escape_chars) + local escape_chars = [[;,."|\]] + return vim.fn.escape(str, escape_chars) end local en_shift = [[~QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>]] @@ -9,8 +9,8 @@ local ru_shift = [[ËЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТ local en = [[`qwertyuiop[]asdfghjkl;'zxcvbnm]] local ru = [[ёйцукенгшщзхъфывапролджэячсмить]] vim.opt.langmap = vim.fn.join({ - escape(ru_shift) .. ';' .. escape(en_shift), - escape(ru) .. ';' .. escape(en), + escape(ru_shift) .. ';' .. escape(en_shift), + escape(ru) .. ';' .. escape(en), }, ',') vim.o.timeout = false @@ -19,85 +19,85 @@ local map = vim.api.nvim_set_keymap -- Configuration fast editing. local opts = {nowait=true, silent = true} - map('n', '\\rconf', ':source $HOME/lib/nvim/init.lua\n', opts) - map('n', '\\econf', ':e $HOME/lib/nvim/init.lua\n', opts) - map('n', '\\emap', ':e $HOME/lib/nvim/lua/maps.lua\n', opts) - map('n', '\\ic', ':set ic!\n', opts) + map('n', '\\rconf', ':source $HOME/lib/nvim/init.lua\n', opts) + map('n', '\\econf', ':e $HOME/lib/nvim/init.lua\n', opts) + map('n', '\\emap', ':e $HOME/lib/nvim/lua/maps.lua\n', opts) + map('n', '\\ic', ':set ic!\n', opts) - map('n', '', 'o', opts) + map('n', '', 'o', opts) -- Quit - map('n', '\\q', ":quit\n", opts) - map('n', '\\qa', ":qa\n", opts) + map('n', '\\q', ":quit\n", opts) + map('n', '\\qa', ":qa\n", opts) -- Moving around. - map('n', '\\home', ":cd $HOME\n", opts) - map('n', '\\cd', ":cd ", {silent = false}) - map('n', '\\lcd', ":lcd ", {silent = false}) - map('n', '\\tcd', ":tcd ", {silent = false}) - map('n', '\\pwd', ':pwd\n', {silent = false}) - map('n', '\\aa', ':argadd ', {silent = false}) - map('n', '\\bb', ':b ', {silent = false}) - map('n', '\\b#', ':b#\n ', {silent = true}) + map('n', '\\home', ":cd $HOME\n", opts) + map('n', '\\cd', ":cd ", {silent = false}) + map('n', '\\lcd', ":lcd ", {silent = false}) + map('n', '\\tcd', ":tcd ", {silent = false}) + map('n', '\\pwd', ':pwd\n', {silent = false}) + map('n', '\\aa', ':argadd ', {silent = false}) + map('n', '\\bb', ':b ', {silent = false}) + map('n', '\\b#', ':b#\n ', {silent = true}) - map('n', '\\lex', ":Lexplore\n", opts) - map('n', '\\ex', ":Explore\n", opts) + map('n', '\\lex', ":Lexplore\n", opts) + map('n', '\\ex', ":Explore\n", opts) -- Search - map('n', '\\noh', ':noh\n', opts) + map('n', '\\noh', ':noh\n', opts) -- Tabs. - map('n', '\\tn', ':tabnew\n', opts) + map('n', '\\tn', ':tabnew\n', opts) -- Fold - map('n', '<2-LeftMouse>', 'za', opts) + map('n', '<2-LeftMouse>', 'za', opts) -- Insert - -- Literal tabs with Shift-Tab - map('i', '', '\t', opts) - map('n', '', 'hx', opts) + -- Literal tabs with Shift-Tab + map('i', '', '\t', opts) + map('n', '', 'hx', opts) -- Empty - map('n', '', '', opts) + map('n', '', '', opts) -- Help. - map('n', '\\th', ":tab help ", {silent=false}) + map('n', '\\th', ":tab help ", {silent=false}) -- vim.api.nvim_del_keymap('n', '') -- vim.api.nvim_del_keymap('n', '') -- Windows - -- Moving - map('n', '', '', opts) - map('n', '', '', opts) - opts = {silent = true} - map('n', '', 'l', opts) - map('n', '', 'h', opts) - map('n', '', 'k', opts) - map('n', '', 'j', opts) + -- Moving + map('n', '', '', opts) + map('n', '', '', opts) + opts = {silent = true} + map('n', '', 'l', opts) + map('n', '', 'h', opts) + map('n', '', 'k', opts) + map('n', '', 'j', opts) - map('n', 'gl', 'l', opts) - map('n', 'gh', 'h', opts) - map('n', 'gk', 'k', opts) - map('n', 'gj', 'j', opts) - -- Resizing - map('n', '+', '+', opts) - map('n', '-', '-', opts) - -- map('n', '', '3<', opts) - -- map('n', '', '3>', opts) - map('n', '', '3>', opts) - map('n', '', '3<', opts) - -- Splitting - map('n', '\\|', 'v', opts) - map('n', '\\-', 's', opts) + map('n', 'gl', 'l', opts) + map('n', 'gh', 'h', opts) + map('n', 'gk', 'k', opts) + map('n', 'gj', 'j', opts) + -- Resizing + map('n', '+', '+', opts) + map('n', '-', '-', opts) + -- map('n', '', '3<', opts) + -- map('n', '', '3>', opts) + map('n', '', '3>', opts) + map('n', '', '3<', opts) + -- Splitting + map('n', '\\|', 'v', opts) + map('n', '\\-', 's', opts) - -- Move - map('n', 'L', '$', opts) - map('n', 'H', '^', opts) + -- Move + map('n', 'L', '$', opts) + map('n', 'H', '^', opts) -- Netrw vim.api.nvim_create_autocmd('filetype', { - pattern = 'netrw', - callback = function() - local buf = vim.api.nvim_get_current_buf() - vim.api.nvim_buf_set_keymap(buf, "n", 'f', '%', opts) - end, + pattern = 'netrw', + callback = function() + local buf = vim.api.nvim_get_current_buf() + vim.api.nvim_buf_set_keymap(buf, "n", 'f', '%', opts) + end, })