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/plugins')
require('my/tools')
local map = require('my.functions').map local map = require('my.functions').map
@ -25,12 +24,14 @@ require('Comment').setup({
local location = nil local location = nil
if ctx.ctype == comment_utils.ctype.block then if ctx.ctype == comment_utils.ctype.block then
location = context_utils.get_cursor_location() 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() location = context_utils.get_visual_start_location()
end end
return context_internal.calculate_commentstring { 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, location = location,
} }
end end

View File

@ -26,5 +26,4 @@ vim.api.nvim_create_autocmd(
vim.opt_local.conceallevel = 2 vim.opt_local.conceallevel = 2
vim.opt_local.concealcursor = 'nc' vim.opt_local.concealcursor = 'nc'
end end
} })
)

View File

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

View File

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

View File

@ -23,20 +23,21 @@ if vim.g.started_by_firenvim then
vim.o.textwidth = 0 vim.o.textwidth = 0
vim.o.colorcolumn = '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_augroup('firenvim', { clear = true })
vim.api.nvim_create_autocmd( vim.api.nvim_create_autocmd(
{ 'BufEnter' }, { 'BufEnter' },
{ {
group = 'firenvim', group = 'firenvim',
pattern = { pattern = {
'schlomp.space_*', FV_fileprefix .. 'schlomp\\.space_*',
'codeberg.org_*', FV_fileprefix .. 'codeberg\\.org_*',
'gitlab.com_*', FV_fileprefix .. 'gitlab\\.com_*',
'github.com_*', FV_fileprefix .. 'github\\.com_*',
'very.tastytea.de_*', FV_fileprefix .. 'very\\.tastytea\\.de_*',
'bookwyrm.social_*', FV_fileprefix .. 'bookwyrm\\.social_*',
'openlibrary.org_*', FV_fileprefix .. 'openlibrary\\.org_*',
'bugs.gentoo.org_*', FV_fileprefix .. 'bugs\\.gentoo\\.org_*',
}, },
command = [[set filetype=markdown | set tw=0 cc=0]] 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 local packer_bootstrap
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
packer_bootstrap = vim.fn.system({ packer_bootstrap = vim.fn.system({
@ -65,7 +66,10 @@ require('packer').startup(function(use)
-- tools -- tools
use { use {
'https://github.com/folke/which-key.nvim' 'https://github.com/folke/which-key.nvim',
config = function()
require('which-key').setup({})
end
} }
use { use {
'https://github.com/nvim-telescope/telescope.nvim', 'https://github.com/nvim-telescope/telescope.nvim',

View File

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