------------------------------------------------------------------------------- -- -- Basic Settings -- vim.cmd 'filetype off' -- Leaders vim.g.mapleader = ',' vim.g.maplocalleader = '-' -- Better Unix support vim.opt.viewoptions = {'folds', 'options', 'cursor', 'unix', 'slash'} vim.opt.encoding = 'utf-8' -- True color support vim.opt.termguicolors = true -- Theme (required plugin 'material-vim') -- Available styles: default, planight, ocean, lighter -- darker, default-community, palenight-community, ocean-community, -- lighter-community, darker-community vim.g.material_theme_style = 'default' vim.g.lightline = { colorscheme = 'material_vim' } vim.cmd 'colorscheme material' -- Other options vim.cmd 'syntax on' vim.opt.backspace = {'indent', 'eol', 'start'} vim.opt.laststatus = 2 vim.opt.showmode = false -- Tabs as spaces vim.opt.expandtab = true vim.opt.tabstop = 2 vim.opt.softtabstop = 2 vim.opt.shiftwidth = 2 -- Fixes broken cursor on Linux vim.opt.guicursor = '' -- Disable mouse / touchpad vim.opt.mouse = '' -- Incremental substitutin vim.opt.inccommand = 'split' ------------------------------------------------------------------------------- -- -- General editor options -- -- Hide files when leaving them. vim.opt.hidden = true -- Show line numbers. vim.opt.number = true -- Minimum line number column width. vim.opt.numberwidth = 1 -- Number of screen lines to use for the commandline. vim.opt.cmdheight = 2 -- Lines length limit (0 if no limit). vim.opt.textwidth = 0 -- Don't cut lines in the middle of a work. vim.opt.linebreak = true -- Show matching parenthesis. vim.opt.showmatch = true -- Time during which the matching parenthesis is shown. vim.opt.matchtime = 2 -- Sensible default line auto cutting and formatting. vim.opt.formatoptions = 'jtcrq' -- Copy/Past to/from clipboard. vim.opt.clipboard = 'unnamedplus' -- Highlight line cursor is currently on. vim.opt.cursorline = true -- Select the first item of popup menu automatically without inserting it. vim.opt.completeopt:append('noinsert') -- Invisible characters representation when :set list vim.opt.listchars = { tab = '→ ', trail = '~', nbsp = '␣', eol = '¬', } -- Search -- Incremental search. vim.opt.incsearch = true -- Case insensitive. vim.opt.ignorecase = true -- Case insensitive if no uppercase letter in pattern, case sensitive otherwise. vim.opt.smartcase = true -- Spell vim.opt.spelllang = 'en,ru' ------------------------------------------------------------------------------- -- -- File type specified -- local bufReadFile = {'BufNewFile', 'BufRead'} -- Set up a line limiter for each lang local line_limiter_augroup = vim.api.nvim_create_augroup('line_limiter', {}) local function set_line_limiter(pattern, limit) vim.api.nvim_create_autocmd(bufReadFile, { pattern = pattern, group = line_limiter_augroup, callback = function () vim.wo.colorcolumn = limit end, }) end set_line_limiter('*.nix', '101') set_line_limiter('*.vim', '101') set_line_limiter('*.lua', '101') set_line_limiter('*.ts,*.tsx', '101') set_line_limiter('*.js.*.jsx', '101') set_line_limiter('*.rs', '101') set_line_limiter('*.json', '81') set_line_limiter('*.yml','*.yaml', '81') set_line_limiter('*.md', '81') set_line_limiter('*.html', '81') set_line_limiter('*.css', '81') -- TODO: add line limiter for haskell -- Spell check for markdown files local spell_check_augroup = vim.api.nvim_create_augroup('spell_check', {}) local function enable_spell_check(pattern) vim.api.nvim_create_autocmd(bufReadFile, { pattern = pattern, group = spell_check_augroup, callback = function () vim.wo.spell = true end, }) end enable_spell_check '*.md' ------------------------------------------------------------------------------- -- -- Bindings -- local function disable_search_highlighting() vim.opt.hlsearch = false end vim.keymap.set('n', '', disable_search_highlighting, { desc = 'Clear search highlighting' }) -- Enable fast navigation between windows vim.keymap.set('n', '', 'h') vim.keymap.set('n', '', 'l') vim.keymap.set('n', '', 'j') vim.keymap.set('n', '', 'k') -- Disable the annoying and useless ex-mode vim.keymap.set('n', 'Q', '') vim.keymap.set('n', 'gQ', '') -- Disable arrow keys vim.keymap.set('n', '', '') vim.keymap.set('n', '', '') vim.keymap.set('n', '', '') vim.keymap.set('n', '', '') vim.keymap.set('v', '', '') vim.keymap.set('v', '', '') vim.keymap.set('v', '', '') vim.keymap.set('v', '', '') -- ... instead of insert mode for rus lang vim.keymap.set('i', '', '') vim.keymap.set('i', '', '') vim.keymap.set('i', '', '') vim.keymap.set('i', '', '') -- Disable page up / down vim.keymap.set('n', '', '') vim.keymap.set('n', '', '') vim.keymap.set('v', '', '') vim.keymap.set('v', '', '') vim.keymap.set('i', '', '') vim.keymap.set('i', '', '') ------------------------------------------------------------------------------- -- -- Abbreviatures -- vim.cmd 'cabbrev bsp belowright split' vim.cmd 'cabbrev rvsp belowright vsplit'