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.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")

View file

@ -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

View file

@ -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,
})

View file

@ -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', '<S-Tab>', '\t', opts)
-- Literal tabs with Shift-Tab
map('i', '<S-Tab>', '\t', opts)
map('n', '<Backspace>', 'hx', opts)
-- Empty
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-r>')
-- Windows
-- Moving
map('n', '<S-b>', '<C-b>', opts)
map('n', '<S-f>', '<C-f>', opts)
opts = {silent = true}
map('n', '<A-l>', '<C-w>l', opts)
map('n', '<A-h>', '<C-w>h', opts)
map('n', '<A-k>', '<C-w>k', opts)
map('n', '<A-j>', '<C-w>j', opts)
-- Resizing
map('n', '+', '<C-w>+', opts)
map('n', '-', '<C-w>-', opts)
-- map('n', '<C-h>', '3<C-w><', opts)
-- map('n', '<C-l>', '3<C-w>>', opts)
map('n', '<Space>', '3<C-w>>', opts)
map('n', '<C-Space>', '3<C-w><', opts)
-- Splitting
map('n', '\\|', '<C-w>v', opts)
map('n', '\\-', '<C-w>s', opts)
-- Moving
map('n', '<S-b>', '<C-b>', opts)
map('n', '<S-f>', '<C-f>', opts)
opts = {silent = true}
map('n', '<A-l>', '<C-w>l', opts)
map('n', '<A-h>', '<C-w>h', opts)
map('n', '<A-k>', '<C-w>k', opts)
map('n', '<A-j>', '<C-w>j', opts)
-- Resizing
map('n', '+', '<C-w>+', opts)
map('n', '-', '<C-w>-', opts)
-- map('n', '<C-h>', '3<C-w><', opts)
-- map('n', '<C-l>', '3<C-w>>', opts)
map('n', '<Space>', '3<C-w>>', opts)
map('n', '<C-Space>', '3<C-w><', opts)
-- Splitting
map('n', '\\|', '<C-w>v', opts)
map('n', '\\-', '<C-w>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,
})