MORE NEOVIM.

This commit is contained in:
Andrey Parhomenko 2023-09-10 13:36:08 +03:00
parent d5acf56587
commit c76c6ac42b
4 changed files with 70 additions and 63 deletions

View file

@ -12,7 +12,12 @@ vim.opt.swapfile = false
vim.o.number = true vim.o.number = true
vim.o.cursorline = 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.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("indent")
require("maps") require("maps")

View file

@ -4,6 +4,7 @@ local package = {}
local c = require("color.cons").colors local c = require("color.cons").colors
package.hls = { package.hls = {
-- The highlights to be applied via color.apply method.
Normal = {fg = "white", bg = "black"}, Normal = {fg = "white", bg = "black"},
TabLine = {bold = false, fg = "black", bg = "darkgray" }, TabLine = {bold = false, fg = "black", bg = "darkgray" },
@ -49,6 +50,8 @@ package.hls = {
VertSplit = {bold=true, fg="gray"}, VertSplit = {bold=true, fg="gray"},
Visual = {reverse=true}, Visual = {reverse=true},
Whitespace = {bold = false, fg="gray"},
} }
return package return package

View file

@ -7,44 +7,44 @@ createAutoCmd = vim.api.nvim_create_autocmd
-- Basic thing for compiling languages. -- Basic thing for compiling languages.
createAutoCmd({ createAutoCmd({
"BufNewFile", "BufNewFile",
"BufRead", "BufRead",
},{ },{
pattern = "*.go,*.c,*.cc,*.C,*.cpp,*.rs", pattern = "*.go,*.c,*.cc,*.C,*.cpp,*.rs,*.mk",
callback = function() callback = function()
local buf = vim.bo[vim.api.nvim_get_current_buf()] local buf = vim.bo[vim.api.nvim_get_current_buf()]
vim.o.expandtab = false vim.o.expandtab = false
vim.o.tabstop = 4 vim.o.tabstop = 4
vim.o.shiftwidth = 4 vim.o.shiftwidth = 4
end, end,
}) })
createAutoCmd({ createAutoCmd({
"BufNewFile", "BufNewFile",
"BufRead", "BufRead",
},{ },{
pattern = "*.lua,*.js,*.jsx,*.scss,*.css,*.sass,*.html,*.htmlx,*.tmpl,*.tpl,*.yml,*.yaml,*.toml,*.tml", pattern = "*.txt,*.lua,*.js,*.jsx,*.scss,*.css,*.sass,*.html,*.htmlx,*.tmpl,*.tpl,*.yml,*.yaml,*.toml,*.tml",
callback = function() callback = function()
local buf = vim.bo[vim.api.nvim_get_current_buf()] local buf = vim.bo[vim.api.nvim_get_current_buf()]
buf.expandtab = true buf.expandtab = true
buf.shiftwidth=2 buf.shiftwidth=2
buf.tabstop=2 buf.tabstop=2
buf.softtabstop = 0 buf.softtabstop = 0
end, end,
}) })
createAutoCmd({ createAutoCmd({
"BufNewFile", "BufNewFile",
"BufRead", "BufRead",
},{ },{
pattern = "*.md,*.py", pattern = "*.md,*.py",
callback = function() callback = function()
local buf = vim.bo[vim.api.nvim_get_current_buf()] local buf = vim.bo[vim.api.nvim_get_current_buf()]
buf.expandtab = true buf.expandtab = true
buf.shiftwidth=4 buf.shiftwidth=4
buf.tabstop=4 buf.tabstop=4
buf.softtabstop = 0 buf.softtabstop = 0
end, end,
}) })

View file

@ -5,20 +5,20 @@ local map = vim.api.nvim_set_keymap
-- Configuration fast editing. -- Configuration fast editing.
local opts = {silent = true} local opts = {silent = true}
map('n', '\\rconf', ':source $HOME/lib/nvim/init.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', '\\econf', ':e $HOME/lib/nvim/init.lua\n', opts)
map('n', '\\emap', ':e $HOME/lib/nvim/lua/maps.lua\n', opts) map('n', '\\emap', ':e $HOME/lib/nvim/lua/maps.lua\n', opts)
-- Quit -- Quit
map('n', '\\q', ":quit\n", opts) map('n', '\\q', ":quit\n", opts)
map('n', '\\qa', ":qa\n", opts) map('n', '\\qa', ":qa\n", opts)
-- Moving around. -- Moving around.
map('n', '\\home', ":cd $HOME\n", opts) map('n', '\\home', ":cd $HOME\n", opts)
map('n', '\\cd', ":cd ", {silent = false}) map('n', '\\cd', ":cd ", {silent = false})
map('n', '\\lcd', ":lcd ", {silent = false}) map('n', '\\lcd', ":lcd ", {silent = false})
map('n', '\\tcd', ":tcd ", {silent = false}) map('n', '\\tcd', ":tcd ", {silent = false})
map('n', '\\pwd', ':pwd\n', {silent = false}) map('n', '\\pwd', ':pwd\n', {silent = false})
map('n', '\\aa', ':argadd ', {silent = false}) map('n', '\\aa', ':argadd ', {silent = false})
map('n', '\\bb', ':b ', {silent = false}) map('n', '\\bb', ':b ', {silent = false})
map('n', '\\b#', ':b#\n ', {silent = true}) map('n', '\\b#', ':b#\n ', {silent = true})
@ -30,48 +30,47 @@ local opts = {silent = true}
map('n', '\\noh', ':noh\n', opts) map('n', '\\noh', ':noh\n', opts)
-- Tabs. -- Tabs.
map('n', '\\tn', ':tabnew\n', opts) map('n', '\\tn', ':tabnew\n', opts)
-- Fold -- Fold
map('n', 'zO', "zR", opts)
-- Insert -- Insert
-- Literal tabs with Shift-Tab -- Literal tabs with Shift-Tab
map('i', '<S-Tab>', '\t', opts) map('i', '<S-Tab>', '\t', opts)
map('n', '<Backspace>', 'hx', opts)
-- Empty -- Empty
map('n', '<C-l>', '', opts) map('n', '<C-l>', '', opts)
-- Help.
map('n', '\\th', ":tab help ", {silent=false})
-- vim.api.nvim_del_keymap('n', '<C-l>') -- vim.api.nvim_del_keymap('n', '<C-l>')
-- vim.api.nvim_del_keymap('n', '<C-r>') -- vim.api.nvim_del_keymap('n', '<C-r>')
-- Windows -- Windows
-- Moving -- Moving
map('n', '<S-b>', '<C-b>', opts) map('n', '<S-b>', '<C-b>', opts)
map('n', '<S-f>', '<C-f>', opts) map('n', '<S-f>', '<C-f>', opts)
opts = {silent = true} opts = {silent = true}
map('n', '<A-l>', '<C-w>l', opts) map('n', '<A-l>', '<C-w>l', opts)
map('n', '<A-h>', '<C-w>h', opts) map('n', '<A-h>', '<C-w>h', opts)
map('n', '<A-k>', '<C-w>k', opts) map('n', '<A-k>', '<C-w>k', opts)
map('n', '<A-j>', '<C-w>j', opts) map('n', '<A-j>', '<C-w>j', opts)
-- Resizing -- Resizing
map('n', '+', '<C-w>+', opts) map('n', '+', '<C-w>+', opts)
map('n', '-', '<C-w>-', opts) map('n', '-', '<C-w>-', opts)
-- map('n', '<C-h>', '3<C-w><', opts) -- map('n', '<C-h>', '3<C-w><', opts)
-- map('n', '<C-l>', '3<C-w>>', opts) -- map('n', '<C-l>', '3<C-w>>', opts)
map('n', '<Space>', '3<C-w>>', opts) map('n', '<Space>', '3<C-w>>', opts)
map('n', '<C-Space>', '3<C-w><', opts) map('n', '<C-Space>', '3<C-w><', opts)
-- Splitting -- Splitting
map('n', '\\|', '<C-w>v', opts) map('n', '\\|', '<C-w>v', opts)
map('n', '\\-', '<C-w>s', opts) map('n', '\\-', '<C-w>s', opts)
-- Netrw -- Netrw
vim.api.nvim_create_autocmd('filetype', { vim.api.nvim_create_autocmd('filetype', {
pattern = 'netrw', pattern = 'netrw',
callback = function() callback = function()
local buf = vim.api.nvim_get_current_buf() local buf = vim.api.nvim_get_current_buf()
vim.api.nvim_buf_set_keymap(buf, "n", 'f', '%', opts) vim.api.nvim_buf_set_keymap(buf, "n", 'f', '%', opts)
end, end,
}) })