1
0
Fork 0

nvim: autoformat everything, clean up, small fixes

This commit is contained in:
tastytea 2022-08-17 01:47:49 +02:00
parent d9d666e45b
commit cc34940c06
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
7 changed files with 37 additions and 32 deletions

View File

@ -1,5 +1,4 @@
require('my/plugins')
require('my/tools')
local map = require('my.functions').map
@ -25,12 +24,14 @@ require('Comment').setup({
local location = nil
if ctx.ctype == comment_utils.ctype.block then
location = context_utils.get_cursor_location()
elseif ctx.cmotion == comment_utils.cmotion.v or ctx.cmotion == comment_utils.cmotion.V then
elseif ctx.cmotion == comment_utils.cmotion.v or
ctx.cmotion == comment_utils.cmotion.V then
location = context_utils.get_visual_start_location()
end
return context_internal.calculate_commentstring {
key = ctx.ctype == comment_utils.ctype.line and "__default" or "__multiline",
key = ctx.ctype == comment_utils.ctype.line and "__default" or
"__multiline",
location = location,
}
end
@ -73,7 +74,7 @@ require('gitsigns').setup({
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
map('n', '<Leader>gb', function() gs.blame_line({ full=true }) end,
map('n', '<Leader>gb', function() gs.blame_line({ full = true }) end,
'Show blame for current line', bufnr)
end
})

View File

@ -1,6 +1,6 @@
require('my/plugins')
require'nvim-treesitter.configs'.setup {
require 'nvim-treesitter.configs'.setup {
ensure_installed = 'all',
highlight = {
enable = true,
@ -8,23 +8,22 @@ require'nvim-treesitter.configs'.setup {
},
context_commentstring = {
enable = true,
enable_autocmd = false -- handled by Comment
enable_autocmd = false -- handled by Comment
}
}
require('orgmode').setup{}
require('orgmode').setup {}
require('orgmode').setup_ts_grammar()
vim.api.nvim_create_augroup('config_fileformats', { clear = true })
vim.api.nvim_create_autocmd(
{ 'BufEnter' },
{
group = 'config_fileformats',
pattern = { '*.org' },
callback = function()
-- allow to hide stuff, like links
vim.opt_local.conceallevel = 2
vim.opt_local.concealcursor = 'nc'
end
}
)
{ 'BufEnter' },
{
group = 'config_fileformats',
pattern = { '*.org' },
callback = function()
-- allow to hide stuff, like links
vim.opt_local.conceallevel = 2
vim.opt_local.concealcursor = 'nc'
end
})

View File

@ -12,6 +12,7 @@ function M.remove_trailing_whitespace()
vim.cmd([[keeppatterns %s/\s\+$//e]])
vim.api.nvim_win_set_cursor(0, curpos)
end
vim.api.nvim_create_augroup('config_functions', { clear = true })
vim.api.nvim_create_autocmd(
{ 'BufWritePre' },
@ -63,6 +64,7 @@ function M.insert_modeline()
print('modeline inserted')
end
end
vim.api.nvim_create_user_command('ModelineInsert', M.insert_modeline, {})
-- set colorcolumn to textwidth after buffer is displayed or option is changed
@ -73,6 +75,7 @@ function M.set_colorcolumn()
vim.opt_local.colorcolumn = ''
end
end
vim.api.nvim_create_augroup('config_settings', { clear = true })
vim.api.nvim_create_autocmd(
{ 'BufEnter' },

View File

@ -1,3 +1,4 @@
---@format disable
local map = require('my.functions').map
vim.g.mapleader = ' ' -- <Leader>

View File

@ -23,20 +23,21 @@ if vim.g.started_by_firenvim then
vim.o.textwidth = 0
vim.o.colorcolumn = '0'
local FV_fileprefix = vim.env['XDG_RUNTIME_DIR'] .. '/firenvim/'
vim.api.nvim_create_augroup('firenvim', { clear = true })
vim.api.nvim_create_autocmd(
{ 'BufEnter' },
{
group = 'firenvim',
pattern = {
'schlomp.space_*',
'codeberg.org_*',
'gitlab.com_*',
'github.com_*',
'very.tastytea.de_*',
'bookwyrm.social_*',
'openlibrary.org_*',
'bugs.gentoo.org_*',
FV_fileprefix .. 'schlomp\\.space_*',
FV_fileprefix .. 'codeberg\\.org_*',
FV_fileprefix .. 'gitlab\\.com_*',
FV_fileprefix .. 'github\\.com_*',
FV_fileprefix .. 'very\\.tastytea\\.de_*',
FV_fileprefix .. 'bookwyrm\\.social_*',
FV_fileprefix .. 'openlibrary\\.org_*',
FV_fileprefix .. 'bugs\\.gentoo\\.org_*',
},
command = [[set filetype=markdown | set tw=0 cc=0]]
})

View File

@ -1,4 +1,5 @@
local install_path = vim.fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
local install_path = vim.fn.stdpath('data') ..
'/site/pack/packer/start/packer.nvim'
local packer_bootstrap
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
packer_bootstrap = vim.fn.system({
@ -65,7 +66,10 @@ require('packer').startup(function(use)
-- tools
use {
'https://github.com/folke/which-key.nvim'
'https://github.com/folke/which-key.nvim',
config = function()
require('which-key').setup({})
end
}
use {
'https://github.com/nvim-telescope/telescope.nvim',

View File

@ -1,10 +1,6 @@
require('my/plugins')
require('my/filetypes')
local map = require('my.functions').map
require('which-key').setup{}
local telescope = require('telescope')
local actions = require('telescope.actions')
telescope.load_extension('media_files') -- FIXME: does not work