mirror of
https://github.com/tiyn/dotfiles.git
synced 2025-03-31 00:17:46 +02:00
nvim: use ftplugin for filetypes
This commit is contained in:
parent
1eb2af2098
commit
3605c38993
7
.config/nvim/after/ftplugin/c.lua
Normal file
7
.config/nvim/after/ftplugin/c.lua
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
vim.api.nvim_create_autocmd({ 'VimLeave' },
|
||||||
|
{
|
||||||
|
command = '!cclear'
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.o.textwidth = 80
|
||||||
|
vim.o.colorcolumn = "-0"
|
4
.config/nvim/after/ftplugin/java.lua
Normal file
4
.config/nvim/after/ftplugin/java.lua
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
vim.o.shiftwidth = 2
|
||||||
|
vim.o.softtabstop = 2
|
||||||
|
vim.o.textwidth = 100
|
||||||
|
vim.o.colorcolumn = "-0"
|
4
.config/nvim/after/ftplugin/javascript.lua
Normal file
4
.config/nvim/after/ftplugin/javascript.lua
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
vim.o.shiftwidth = 2
|
||||||
|
vim.o.softtabstop = 2
|
||||||
|
vim.o.textwidth = 100
|
||||||
|
vim.o.colorcolumn = "-0"
|
4
.config/nvim/after/ftplugin/lua.lua
Normal file
4
.config/nvim/after/ftplugin/lua.lua
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
vim.o.shiftwidth = 2
|
||||||
|
vim.o.softtabstop = 2
|
||||||
|
vim.o.textwidth = 100
|
||||||
|
vim.o.colorcolumn = "-0"
|
9
.config/nvim/after/ftplugin/markdown.lua
Normal file
9
.config/nvim/after/ftplugin/markdown.lua
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
|
||||||
|
{
|
||||||
|
callback = function() vim.o.foldenable = false end
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.o.shiftwidth = 2
|
||||||
|
vim.o.softtabstop = 2
|
||||||
|
vim.o.textwidth = 100
|
||||||
|
vim.o.colorcolumn = "-0"
|
4
.config/nvim/after/ftplugin/nim.lua
Normal file
4
.config/nvim/after/ftplugin/nim.lua
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
vim.o.shiftwidth = 2
|
||||||
|
vim.o.softtabstop = 2
|
||||||
|
vim.o.textwidth = 80
|
||||||
|
vim.o.colorcolumn = "-0"
|
4
.config/nvim/after/ftplugin/python.lua
Normal file
4
.config/nvim/after/ftplugin/python.lua
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
vim.o.shiftwidth = 2
|
||||||
|
vim.o.softtabstop = 2
|
||||||
|
vim.o.textwidth = 80
|
||||||
|
vim.o.colorcolumn = "-0"
|
9
.config/nvim/after/ftplugin/tex.lua
Normal file
9
.config/nvim/after/ftplugin/tex.lua
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
vim.api.nvim_create_autocmd({ 'VimLeave' },
|
||||||
|
{
|
||||||
|
command = '!texclear %'
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.o.shiftwidth = 2
|
||||||
|
vim.o.softtabstop = 2
|
||||||
|
vim.o.textwidth = 80
|
||||||
|
vim.o.colorcolumn = "-0"
|
@ -73,15 +73,28 @@ vim.o.foldenable = true
|
|||||||
vim.o.conceallevel = 0
|
vim.o.conceallevel = 0
|
||||||
vim.g.markdown_folding = 1
|
vim.g.markdown_folding = 1
|
||||||
|
|
||||||
|
-- read files correctly
|
||||||
|
vim.filetype.add({
|
||||||
|
extension = {
|
||||||
|
c = 'c',
|
||||||
|
h = 'c',
|
||||||
|
html = 'html',
|
||||||
|
java = 'java',
|
||||||
|
js = 'javascript',
|
||||||
|
lua = 'lua',
|
||||||
|
md = 'markdown',
|
||||||
|
nim = 'nim',
|
||||||
|
py = 'python',
|
||||||
|
tex = 'tex',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
-- load general mapped keys
|
-- load general mapped keys
|
||||||
require('style')
|
require('style')
|
||||||
|
|
||||||
-- load plugins (autoload all files in plugin folder)
|
-- load plugins (autoload all files in plugin folder)
|
||||||
require('loadplugins')
|
require('loadplugins')
|
||||||
|
|
||||||
-- set filetypes correctly by extension
|
|
||||||
require('autocmd')
|
|
||||||
|
|
||||||
-- load general mapped keys
|
-- load general mapped keys
|
||||||
require('keymap')
|
require('keymap')
|
||||||
|
|
||||||
|
@ -1,116 +0,0 @@
|
|||||||
-- read files correctly
|
|
||||||
vim.filetype.add({
|
|
||||||
extension = {
|
|
||||||
c = 'c',
|
|
||||||
h = 'c',
|
|
||||||
html = 'html',
|
|
||||||
java = 'java',
|
|
||||||
js = 'javascript',
|
|
||||||
lua = 'lua',
|
|
||||||
md = 'markdown',
|
|
||||||
nim = 'nim',
|
|
||||||
py = 'python',
|
|
||||||
tex = 'tex',
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
-- settings for filetype: c
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ 'VimLeave' },
|
|
||||||
{
|
|
||||||
pattern = { '*.c' },
|
|
||||||
command = '!cclear'
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
|
|
||||||
{
|
|
||||||
pattern = { 'c' },
|
|
||||||
command = 'set colorcolumn=80'
|
|
||||||
})
|
|
||||||
|
|
||||||
-- settings for filetype: java
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ 'FileType' },
|
|
||||||
{
|
|
||||||
pattern = { 'java' },
|
|
||||||
command = 'setlocal shiftwidth=2 softtabstop=2',
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
|
|
||||||
{
|
|
||||||
pattern = { 'java' },
|
|
||||||
command = 'set colorcolumn=100'
|
|
||||||
})
|
|
||||||
|
|
||||||
-- settings for filetype: javascript
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ 'FileType' },
|
|
||||||
{
|
|
||||||
pattern = { 'javascript' },
|
|
||||||
command = 'setlocal shiftwidth=2 softtabstop=2',
|
|
||||||
})
|
|
||||||
|
|
||||||
-- settings for filetype: lua
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ 'FileType' },
|
|
||||||
{
|
|
||||||
pattern = { 'lua' },
|
|
||||||
command = 'setlocal shiftwidth=2 softtabstop=2',
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
|
|
||||||
{
|
|
||||||
pattern = { 'lua' },
|
|
||||||
command = 'set colorcolumn=100'
|
|
||||||
})
|
|
||||||
|
|
||||||
-- settings for filetype: markdown
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ 'FileType' },
|
|
||||||
{
|
|
||||||
pattern = { 'markdown' },
|
|
||||||
command = 'setlocal shiftwidth=2 softtabstop=2',
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
|
|
||||||
{
|
|
||||||
pattern = { 'markdown' },
|
|
||||||
command = 'set colorcolumn=100'
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
|
|
||||||
{
|
|
||||||
pattern = { 'markdown' },
|
|
||||||
command = 'set nofoldenable'
|
|
||||||
})
|
|
||||||
|
|
||||||
-- settings for filetype: nim
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
|
|
||||||
{
|
|
||||||
pattern = { 'nim' },
|
|
||||||
command = 'set colorcolumn=80'
|
|
||||||
})
|
|
||||||
|
|
||||||
-- settings for filetype: python
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
|
|
||||||
{
|
|
||||||
pattern = { 'python' },
|
|
||||||
command = 'set colorcolumn=80'
|
|
||||||
})
|
|
||||||
|
|
||||||
-- settings for filetype: tex
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ 'VimLeave' },
|
|
||||||
{
|
|
||||||
pattern = { '*.tex' },
|
|
||||||
command = '!texclear %'
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
|
|
||||||
{
|
|
||||||
pattern = { 'tex' },
|
|
||||||
command = 'set colorcolumn=80'
|
|
||||||
})
|
|
Loading…
x
Reference in New Issue
Block a user