autocommands for filetypes
This commit is contained in:
parent
dc339b1b12
commit
6bff5a9075
144
init.lua
144
init.lua
|
@ -1,88 +1,89 @@
|
||||||
local opt = vim.opt
|
local opt = vim.opt
|
||||||
local g = vim.g
|
local g = vim.g
|
||||||
|
|
||||||
g.mapleader = ' '
|
vim.g.mapleader = ' '
|
||||||
g.maplocalleader = ';'
|
vim.g.maplocalleader = ';'
|
||||||
g.python3_host_prog = '/usr/bin/python3'
|
vim.g.python3_host_prog = '/usr/bin/python3'
|
||||||
|
|
||||||
opt.mouse = 'a' -- mouse does annoying things for me if it's not 'a'
|
vim.o.mouse = 'a' -- mouse does annoying things for me if it's not 'a'
|
||||||
opt.signcolumn = 'yes'
|
vim.o.signcolumn = 'yes'
|
||||||
opt.clipboard = '' -- don't just use the system clipboard
|
vim.o.clipboard = '' -- don't just use the system clipboard
|
||||||
opt.wrap = false
|
vim.o.wrap = false
|
||||||
opt.breakindent = false
|
vim.o.breakindent = false
|
||||||
opt.spell = false
|
vim.o.spell = false
|
||||||
opt.conceallevel = 2
|
vim.o.conceallevel = 2
|
||||||
opt.undofile = true
|
vim.o.concealcursor = 'nc'
|
||||||
opt.undolevels = 10000
|
vim.o.undofile = true
|
||||||
opt.writebackup = false
|
vim.o.undolevels = 10000
|
||||||
opt.history = 5000
|
vim.o.writebackup = false
|
||||||
opt.shada = { "'1000", '<50', 's10', 'h' }
|
vim.o.history = 5000
|
||||||
|
vim.o.shada = { "'1000", '<50', 's10', 'h' }
|
||||||
|
vim.g.syntax = true
|
||||||
|
|
||||||
-- Tabs and Indents
|
-- Tabs and Indents
|
||||||
-- ===
|
-- ===
|
||||||
|
vim.o.textwidth = 80 -- Text width maximum chars before wrapping
|
||||||
opt.textwidth = 80 -- Text width maximum chars before wrapping
|
vim.o.tabstop = 4 -- The number of spaces a tab is
|
||||||
opt.tabstop = 4 -- The number of spaces a tab is
|
vim.o.shiftwidth = 4 -- Number of spaces to use in auto(indent)
|
||||||
opt.shiftwidth = 4 -- Number of spaces to use in auto(indent)
|
vim.o.smarttab = true -- Tab insert blanks according to 'shiftwidth'
|
||||||
opt.smarttab = true -- Tab insert blanks according to 'shiftwidth'
|
vim.o.autoindent = true -- Use same indenting on new lines
|
||||||
opt.autoindent = true -- Use same indenting on new lines
|
vim.o.smartindent = true -- Smart autoindenting on new lines
|
||||||
opt.smartindent = true -- Smart autoindenting on new lines
|
vim.o.shiftround = true -- Round indent to multiple of 'shiftwidth'
|
||||||
opt.shiftround = true -- Round indent to multiple of 'shiftwidth'
|
|
||||||
|
|
||||||
-- Timing
|
-- Timing
|
||||||
-- ===
|
-- ===
|
||||||
opt.ttimeout = true
|
vim.o.ttimeout = true
|
||||||
opt.timeoutlen = 500 -- Time out on mappings
|
vim.o.timeoutlen = 500 -- Time out on mappings
|
||||||
opt.ttimeoutlen = 10 -- Time out on key codes
|
vim.o.ttimeoutlen = 10 -- Time out on key codes
|
||||||
opt.updatetime = 250 -- Idle time to write swap and trigger CursorHold
|
vim.o.updatetime = 250 -- Idle time to write swap and trigger CursorHold
|
||||||
|
|
||||||
-- Searching
|
-- Searching
|
||||||
-- ===
|
-- ===
|
||||||
opt.ignorecase = true -- Search ignoring case
|
vim.o.ignorecase = true -- Search ignoring case
|
||||||
opt.smartcase = true -- Keep case when searching with *
|
vim.o.smartcase = true -- Keep case when searching with *
|
||||||
opt.infercase = true -- Adjust case in insert completion mode
|
vim.o.infercase = true -- Adjust case in insert completion mode
|
||||||
opt.incsearch = true -- Incremental search
|
vim.o.incsearch = true -- Incremental search
|
||||||
vim.opt.hlsearch = true -- highlight searched stuff
|
vim.opt.hlsearch = true -- highlight searched stuff
|
||||||
|
|
||||||
-- Formatting
|
-- Formatting
|
||||||
-- ===
|
-- ===
|
||||||
|
|
||||||
opt.wrap = false -- No wrap by default
|
vim.o.wrap = false -- No wrap by default
|
||||||
opt.linebreak = true -- Break long lines at 'breakat'
|
vim.o.linebreak = true -- Break long lines at 'breakat'
|
||||||
opt.breakat = '\\ \\ ;:,!?' -- Long lines break chars
|
vim.o.breakat = '\\ \\ ;:,!?' -- Long lines break chars
|
||||||
opt.startofline = false -- Cursor in same column for few commands
|
vim.o.startofline = false -- Cursor in same column for few commands
|
||||||
opt.splitbelow = true -- Splits open bottom right
|
vim.o.splitbelow = true -- Splits open bottom right
|
||||||
opt.splitright = true
|
vim.o.splitright = true
|
||||||
opt.breakindentopt = { shift = 2, min = 20 }
|
vim.o.breakindentopt = { shift = 2, min = 20 }
|
||||||
opt.formatoptions = '' -- see :h fo-table & :h formatoptions
|
vim.o.formatoptions = '' -- see :h fo-table & :h formatoptions
|
||||||
vim.opt.breakindent = true
|
vim.opt.breakindent = true
|
||||||
|
|
||||||
-- Diff
|
-- Diff
|
||||||
-- ===
|
-- ===
|
||||||
|
|
||||||
opt.diffopt:append { 'iwhite', 'indent-heuristic', 'algorithm:patience' }
|
vim.o.diffopt:append { 'iwhite', 'indent-heuristic', 'algorithm:patience' }
|
||||||
opt.wildmode = 'longest:full,full' -- Command-line completion mode
|
vim.o.wildmode = 'longest:full,full' -- Command-line completion mode
|
||||||
|
|
||||||
-- Folds
|
-- Folds
|
||||||
-- ===
|
-- ===
|
||||||
|
|
||||||
opt.foldlevel = 10 -- start with all folds open
|
vim.o.foldlevel = 10 -- start with all folds open
|
||||||
|
|
||||||
-- Editor UI
|
-- Editor UI
|
||||||
-- ===
|
-- ===
|
||||||
|
|
||||||
vim.o.guifont = 'FiraCode Nerd Font:h15'
|
vim.o.guifont = 'FiraCode Nerd Font:h15'
|
||||||
opt.termguicolors = true
|
vim.o.termguicolors = true
|
||||||
opt.shortmess = 'xsTOInfFitloCaAs'
|
vim.o.shortmess = 'xsTOInfFitloCaAs'
|
||||||
opt.showmode = true -- Show mode in cmd window
|
vim.o.showmode = true -- Show mode in cmd window
|
||||||
opt.scrolloff = 10 -- Keep at least n lines above/below
|
vim.o.scrolloff = 10 -- Keep at least n lines above/below
|
||||||
opt.sidescrolloff = 10 -- Keep at least n lines left/right
|
vim.o.sidescrolloff = 10 -- Keep at least n lines left/right
|
||||||
opt.numberwidth = 2 -- Minimum number of columns to use for the line number
|
vim.o.numberwidth = 2 -- Minimum number of columns to use for the line number
|
||||||
opt.number = true -- Show line numbers
|
vim.o.number = true -- Show line numbers
|
||||||
opt.relativenumber = true -- Show relative line numbers
|
vim.o.relativenumber = true -- Show relative line numbers
|
||||||
opt.ruler = true -- Default status ruler
|
vim.o.ruler = true -- Default status ruler
|
||||||
opt.showtabline = 1 -- Don't change this, goes back to a vanilla vim default
|
vim.o.showtabline = 1 -- Don't change this, goes back to a vanilla vim default
|
||||||
opt.laststatus = 3 -- Always show laststatus
|
vim.o.laststatus = 3 -- Always show laststatus
|
||||||
|
|
||||||
-- Sets how neovim will display certain whitespace characters in the editor.
|
-- Sets how neovim will display certain whitespace characters in the editor.
|
||||||
-- See `:help 'list'`
|
-- See `:help 'list'`
|
||||||
|
@ -116,31 +117,31 @@ if vim.g.neovide == true then
|
||||||
vim.g.neovide_fullscreen = true
|
vim.g.neovide_fullscreen = true
|
||||||
end
|
end
|
||||||
|
|
||||||
opt.helpheight = 0 -- Disable help window resizing
|
vim.o.helpheight = 0 -- Disable help window resizing
|
||||||
opt.winwidth = 30 -- Minimum width for active window
|
vim.o.winwidth = 30 -- Minimum width for active window
|
||||||
opt.winminwidth = 1 -- Minimum width for inactive windows
|
vim.o.winminwidth = 1 -- Minimum width for inactive windows
|
||||||
opt.winheight = 1 -- Minimum height for active window
|
vim.o.winheight = 1 -- Minimum height for active window
|
||||||
opt.winminheight = 1 -- Minimum height for inactive window
|
vim.o.winminheight = 1 -- Minimum height for inactive window
|
||||||
|
|
||||||
opt.showcmd = false -- show command in status line
|
vim.o.showcmd = false -- show command in status line
|
||||||
opt.cmdheight = 0
|
vim.o.cmdheight = 0
|
||||||
opt.cmdwinheight = 5 -- Command-line lines
|
vim.o.cmdwinheight = 5 -- Command-line lines
|
||||||
opt.equalalways = true -- Resize windows on split or close
|
vim.o.equalalways = true -- Resize windows on split or close
|
||||||
opt.colorcolumn = '80' -- Column highlight at textwidth's max character-limit
|
vim.o.colorcolumn = '80' -- Column highlight at textwidth's max character-limit
|
||||||
|
|
||||||
opt.cursorline = true
|
vim.o.cursorline = true
|
||||||
opt.cursorlineopt = { 'number', 'screenline' }
|
vim.o.cursorlineopt = { 'number', 'screenline' }
|
||||||
|
|
||||||
opt.pumheight = 10 -- Maximum number of items to show in the popup menu
|
vim.o.pumheight = 10 -- Maximum number of items to show in the popup menu
|
||||||
opt.pumwidth = 10 -- Minimum width for the popup menu
|
vim.o.pumwidth = 10 -- Minimum width for the popup menu
|
||||||
opt.pumblend = 10 -- Popup blend
|
vim.o.pumblend = 10 -- Popup blend
|
||||||
|
|
||||||
-- Spelling correction
|
-- Spelling correction
|
||||||
-- ===
|
-- ===
|
||||||
|
|
||||||
opt.spell = false -- manually enable spell with `set spell` or `<leader>ts`
|
vim.o.spell = false -- manually enable spell with `set spell` or `<leader>ts`
|
||||||
opt.spelllang = 'en,de_de,'
|
vim.o.spelllang = 'en,de_de,'
|
||||||
opt.spellsuggest = 'double,50,timeout:5000'
|
vim.o.spellsuggest = 'double,50,timeout:5000'
|
||||||
|
|
||||||
-- autocommands
|
-- autocommands
|
||||||
-- ===
|
-- ===
|
||||||
|
@ -175,6 +176,7 @@ end ---@diagnostic disable-next-line: undefined-field
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
require 'custom.maps'
|
require 'custom.maps'
|
||||||
|
require 'custom.autocmds'
|
||||||
require('lazy').setup({
|
require('lazy').setup({
|
||||||
{ import = 'custom.plugins' },
|
{ import = 'custom.plugins' },
|
||||||
}, {
|
}, {
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
local augroup = vim.api.nvim_create_augroup('plex_generic_autocmds', {})
|
||||||
|
|
||||||
|
-- always use the tex filetype for latex things, as those are most supported by
|
||||||
|
-- latex language servers.
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
group = augroup,
|
||||||
|
pattern = {
|
||||||
|
'latex',
|
||||||
|
'plaintex',
|
||||||
|
},
|
||||||
|
callback = function()
|
||||||
|
vim.bo.filetype = 'tex'
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- conceallevel is what converts things like **bold** to be displayed as bold
|
||||||
|
-- without the stars. This is useful, but we might not want it for some
|
||||||
|
-- filetypes.
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
group = augroup,
|
||||||
|
pattern = {
|
||||||
|
'latex',
|
||||||
|
'plaintex',
|
||||||
|
'tex',
|
||||||
|
},
|
||||||
|
callback = function()
|
||||||
|
vim.opt_local.conceallevel = 0
|
||||||
|
end,
|
||||||
|
})
|
Loading…
Reference in New Issue