From c76c6ac42bdce0b7738491d81760ba3fa48f9e98 Mon Sep 17 00:00:00 2001 From: surdeus Date: Sun, 10 Sep 2023 13:36:08 +0300 Subject: [PATCH] MORE NEOVIM. --- nvim/init.lua | 7 +++- nvim/lua/color/night.lua | 3 ++ nvim/lua/indent.lua | 52 ++++++++++++++--------------- nvim/lua/maps.lua | 71 ++++++++++++++++++++-------------------- 4 files changed, 70 insertions(+), 63 deletions(-) diff --git a/nvim/init.lua b/nvim/init.lua index 093aa99..f300f4d 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -12,7 +12,12 @@ vim.opt.swapfile = false vim.o.number = true vim.o.cursorline = true vim.o.guicursor = 'n-v-c-sm-i-ci-ve:block,r-cr-o:hor20,a:blinkoff700-blinkoff400-blinkoff250-Cursor/lCursor' - +vim.opt.listchars = { + tab = '|-', + trail = '.', + lead = '.', +} +vim.opt.list = true require("indent") require("maps") diff --git a/nvim/lua/color/night.lua b/nvim/lua/color/night.lua index fe553da..6b8a284 100644 --- a/nvim/lua/color/night.lua +++ b/nvim/lua/color/night.lua @@ -4,6 +4,7 @@ local package = {} local c = require("color.cons").colors package.hls = { + -- The highlights to be applied via color.apply method. Normal = {fg = "white", bg = "black"}, TabLine = {bold = false, fg = "black", bg = "darkgray" }, @@ -49,6 +50,8 @@ package.hls = { VertSplit = {bold=true, fg="gray"}, Visual = {reverse=true}, + + Whitespace = {bold = false, fg="gray"}, } return package diff --git a/nvim/lua/indent.lua b/nvim/lua/indent.lua index 7583fff..e4ff042 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", - callback = function() - local buf = vim.bo[vim.api.nvim_get_current_buf()] + 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, + end, }) createAutoCmd({ - "BufNewFile", - "BufRead", + "BufNewFile", + "BufRead", },{ - pattern = "*.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,*.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, }) 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 0f57e44..e76d8fe 100644 --- a/nvim/lua/maps.lua +++ b/nvim/lua/maps.lua @@ -5,20 +5,20 @@ local map = vim.api.nvim_set_keymap -- Configuration fast editing. local opts = {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', '\\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) -- Quit 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', '\\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}) @@ -30,48 +30,47 @@ local opts = {silent = true} map('n', '\\noh', ':noh\n', opts) -- Tabs. - map('n', '\\tn', ':tabnew\n', opts) + map('n', '\\tn', ':tabnew\n', opts) -- Fold - - map('n', 'zO', "zR", opts) - -- Insert - -- Literal tabs with Shift-Tab - map('i', '', '\t', opts) - + -- Literal tabs with Shift-Tab + map('i', '', '\t', opts) + map('n', '', 'hx', opts) -- Empty map('n', '', '', opts) - + +-- Help. + 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) - -- 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) + -- 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) + -- 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) -- 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) + local buf = vim.api.nvim_get_current_buf() + vim.api.nvim_buf_set_keymap(buf, "n", 'f', '%', opts) end, })