commit 961bf3e9371698cdf0cc1c3b8bc29fd330464fdd
parent d7876d56e54fb2796e22417ffca4141d66a92e2b
Author: Tomas Nemec <nemi@skaut.cz>
Date: Thu, 14 Apr 2022 09:04:16 +0200
update
Diffstat:
17 files changed, 42 insertions(+), 279 deletions(-)
diff --git a/compiler/dart_ng_test.vim b/compiler/dart_ng_test.vim
@@ -11,7 +11,7 @@ let current_compiler = "dart_ng_test"
let s:cpo_save = &cpo
set cpo&vim
-set makeprg=pub\ run\ build_runner\ test\ -c\ test\ --\ --no-color\ %
+set makeprg=pub\ run\ build_runner\ test\ --\ --no-color\ %
set errorformat=%E%.%#\]\ %m\ \[E\]%.%#,%Z%.%#\.dart\ %l:%c\ %.%#,%C%.%#
let &cpo = s:cpo_save
diff --git a/lua/tms/u/git.lua b/lua/tms/u/git.lua
@@ -1,14 +0,0 @@
-local M = {}
-
-M.is_git = function(path)
- ---@diagnostic disable-next-line: unused-local
- local id = vim.fn.jobstart('git -C "' .. path .. '" rev-parse', {on_exit = function(_, code, type) end})
- local status = vim.fn.jobwait({id})[1]
- if status == 0 then
- return true
- else
- return false
- end
-end
-
-return M
diff --git a/lua/tms/u/plugins.lua b/lua/tms/u/plugins.lua
@@ -1,13 +0,0 @@
-local M = {}
-
-M.path = function(dir, name)
- local plugin_utils = require('packer.plugin_utils')
- local packer_lists = {}
- packer_lists['opt'], packer_lists['start'] = plugin_utils.list_installed_plugins()
- for p_path, _ in pairs(packer_lists[dir]) do
- local plugin_name = vim.fn.fnamemodify(p_path, ':t:r')
- if plugin_name == name then return p_path end
- end
-end
-
-return M
diff --git a/lua/tms/ws/init.lua b/lua/tms/ws/init.lua
@@ -3,7 +3,7 @@ local M = {}
M.medoro = {
path = '*/medoro/**',
config = function()
- vim.keymap.set('n', '<leader>pl', '<cmd>lua require("tms.ws.medoro").lang()<cr>', {buffer = true, noremap = true})
+ vim.keymap.set('n', '<leader>pl', '<cmd>lua require("tms.ws.medoro").lang()<cr>', { buffer = true, noremap = true })
end,
}
diff --git a/lua/tms/ws/medoro.lua b/lua/tms/ws/medoro.lua
@@ -2,7 +2,7 @@ local M = {}
M.lang = function()
local cwd = '/home/tms/dev/medoro/dpgw/dpgw/src/main/resources/org/medoro/dpgw/core/lang/'
- local files = {'lang.properties', 'lang_cs.properties'}
+ local files = { 'lang.properties', 'lang_cs.properties' }
require('telescope.builtin').live_grep({
cwd = cwd,
search_dirs = files,
diff --git a/plugin/bufonly.vim b/plugin/bufonly.vim
@@ -73,3 +73,8 @@ function! BufOnly(buffer, bang)
endif
endfunction
+
+lua << EOF
+ vim.keymap.set('n', '<leader>bo', '<cmd>BufOnly<cr>', { noremap = true })
+ vim.keymap.set('n', '<leader>bO', '<cmd>BufOnly!<cr>', { noremap = true })
+EOF
diff --git a/plugin/bufremove.lua b/plugin/bufremove.lua
@@ -91,7 +91,7 @@ function H.unshow_and_cmd(buf_id, force, cmd)
if not H.is_valid_id(buf_id, 'buffer') then return false end
- local fun_name = ({['bdelete'] = 'delete', ['bwipeout'] = 'wipeout'})[cmd]
+ local fun_name = ({ ['bdelete'] = 'delete', ['bwipeout'] = 'wipeout' })[cmd]
if not H.can_remove(buf_id, force, fun_name) then return false end
-- Unshow buffer from all windows
@@ -149,13 +149,13 @@ end
function H.notify(msg) vim.notify(string.format('(bufremove) %s', msg)) end
vim.api.nvim_create_user_command('BufDelete', function(data) BufRemove.delete(data.args, data.bang) end,
- {nargs = '?', bang = true})
+ { nargs = '?', bang = true })
vim.api.nvim_create_user_command('BufWipeout', function(data) BufRemove.wipeout(data.args, data.bang) end,
- {nargs = '?', bang = true})
-vim.api.nvim_create_user_command('BufUnshow', function(data) BufRemove.unshow(data.args) end, {nargs = '?'})
-vim.api
- .nvim_create_user_command('BufWinUnshow', function(data) BufRemove.unshow_in_window(data.args) end, {nargs = '?'})
-vim.keymap.set('n', '<leader>bd', BufRemove.delete, {noremap = true})
-vim.keymap.set('n', '<leader>bw', BufRemove.wipeout, {noremap = true})
-vim.keymap.set('n', '<leader>bu', BufRemove.unshow, {noremap = true})
-vim.keymap.set('n', '<leader>bU', BufRemove.unshow_in_window, {noremap = true})
+ { nargs = '?', bang = true })
+vim.api.nvim_create_user_command('BufUnshow', function(data) BufRemove.unshow(data.args) end, { nargs = '?' })
+vim.api.nvim_create_user_command('BufWinUnshow', function(data) BufRemove.unshow_in_window(data.args) end,
+ { nargs = '?' })
+vim.keymap.set('n', '<leader>bd', BufRemove.delete, { noremap = true })
+vim.keymap.set('n', '<leader>bw', BufRemove.wipeout, { noremap = true })
+vim.keymap.set('n', '<leader>bu', BufRemove.unshow, { noremap = true })
+vim.keymap.set('n', '<leader>bU', BufRemove.unshow_in_window, { noremap = true })
diff --git a/plugin/color.vim b/plugin/color.vim
@@ -1,4 +0,0 @@
-function! SynGroup()
- let l:s = synID(line('.'), col('.'), 1)
- echo synIDattr(l:s, 'name') . ' -> ' . synIDattr(synIDtrans(l:s), 'name')
-endfun
diff --git a/plugin/diagnostic.lua b/plugin/diagnostic.lua
@@ -1,13 +1,12 @@
-vim.diagnostic.config({virtual_text = false, underline = false, float = {border = 'single'}, severity_sort = true})
-
-vim.keymap.set('n', 'gs', function() vim.diagnostic.open_float(0, {scope = 'line'}) end, {silent = true})
-vim.keymap.set('n', 'gS', function() vim.diagnostic.open_float(0, {scope = 'cursor'}) end, {silent = true})
-vim.keymap.set('n', 'gll', function() vim.diagnostic.setloclist() end, {silent = true})
-vim.keymap.set('n', 'glq', function() vim.diagnostic.setqflist() end, {silent = true})
-
-local goto_next = function() vim.diagnostic.goto_next({float = false}) end
-local goto_prev = function() vim.diagnostic.goto_prev({float = false}) end
-vim.keymap.set('n', '>d', goto_next, {silent = true})
-vim.keymap.set('n', '>(', goto_next, {silent = true})
-vim.keymap.set('n', '<d', goto_prev, {silent = true})
-vim.keymap.set('n', '<(', goto_prev, {silent = true})
+vim.diagnostic.config({ virtual_text = false, underline = false, float = { border = 'single' }, severity_sort = true })
+local opts = { silent = true }
+local goto_next = function() vim.diagnostic.goto_next({ float = false }) end
+local goto_prev = function() vim.diagnostic.goto_prev({ float = false }) end
+vim.keymap.set('n', '>d', goto_next, opts)
+vim.keymap.set('n', '>(', goto_next, opts)
+vim.keymap.set('n', '<d', goto_prev, opts)
+vim.keymap.set('n', '<(', goto_prev, opts)
+vim.keymap.set('n', 'gs', function() vim.diagnostic.open_float(0, { scope = 'line' }) end, opts)
+vim.keymap.set('n', 'gS', function() vim.diagnostic.open_float(0, { scope = 'cursor' }) end, opts)
+vim.keymap.set('n', 'gll', function() vim.diagnostic.setloclist() end, opts)
+vim.keymap.set('n', 'glq', function() vim.diagnostic.setqflist() end, opts)
diff --git a/plugin/file_pairs.lua b/plugin/file_pairs.lua
@@ -1,13 +1,13 @@
-local ft_letter = {html = 't', scss = 's', dart = 'd', css = 'c'}
+local ft_letter = { html = 't', scss = 's', dart = 'd', css = 'c' }
local letter_set = {}
local set_mark = function(letter, path, buffer)
path = path or vim.fn.expand('%')
if buffer == nil then buffer = true end
- vim.keymap.set('n', '<leader>m' .. letter, '<cmd>edit ' .. path .. '<cr>', {buffer = buffer, noremap = true})
- vim.keymap.set('n', '<leader>mv' .. letter, '<cmd>vsplit ' .. path .. '<cr>', {buffer = buffer, noremap = true})
- vim.keymap.set('n', '<leader>mx' .. letter, '<cmd>split ' .. path .. '<cr>', {buffer = buffer, noremap = true})
+ vim.keymap.set('n', '<leader>m' .. letter, '<cmd>edit ' .. path .. '<cr>', { buffer = buffer, noremap = true })
+ vim.keymap.set('n', '<leader>mv' .. letter, '<cmd>vsplit ' .. path .. '<cr>', { buffer = buffer, noremap = true })
+ vim.keymap.set('n', '<leader>mx' .. letter, '<cmd>split ' .. path .. '<cr>', { buffer = buffer, noremap = true })
end
local unset_marks = function()
@@ -49,7 +49,7 @@ local configure = function()
end
end
- vim.fn.jobstart(string.format('fd -t f "^%s\\." "%s"', filename, dir), {on_stdout = on_event, on_exit = on_event})
+ vim.fn.jobstart(string.format('fd -t f "^%s\\." "%s"', filename, dir), { on_stdout = on_event, on_exit = on_event })
end
-vim.api.nvim_create_autocmd('BufEnter', {callback = configure})
+vim.api.nvim_create_autocmd('BufEnter', { callback = configure })
diff --git a/plugin/fold.vim b/plugin/fold.vim
@@ -1,9 +0,0 @@
-function! MyFoldText()
- let line = getline(v:foldstart)
- let folded_line_num = v:foldend - v:foldstart
- let line_text = substitute(line, '^"{\+', '', 'g')
- let fillcharcount = 80 - len(line_text) - len(folded_line_num)
- return repeat(' ', 4) . line_text . repeat(' ', fillcharcount) . ' (' . folded_line_num . ' L) '
-endfunction
-
-
diff --git a/plugin/git_blame.lua b/plugin/git_blame.lua
@@ -1,72 +0,0 @@
-local create_win = function()
- -- We save handle to window from which we open the navigation
- -- start_win = vim.api.nvim_get_current_win()
- local startingBuf = vim.api.nvim_command_output('echo expand(\'%:p\') ')
-
- vim.api.nvim_command('topleft vnew') -- We open a new vertical window at the far left
- local win = vim.api.nvim_get_current_win() -- We save our navigation window handle...
- local buf = vim.api.nvim_get_current_buf() -- ...and it's buffer handle.
-
- -- We should name our buffer. All buffers in vim must have unique names.
- -- The easiest solution will be adding buffer handle to it
- -- because it is already unique and it's just a number.
- vim.api.nvim_buf_set_name(buf, 'GBlame #' .. buf)
-
- -- Now we set some options for our buffer.
- -- nofile prevent mark buffer as modified so we never get warnings about not saved changes.
- -- Also some plugins treat nofile buffers different.
- -- For example coc.nvim don't triggers aoutcompletation for these.
- vim.api.nvim_buf_set_option(buf, 'buftype', 'nofile')
- -- We do not need swapfile for this buffer.
- vim.api.nvim_buf_set_option(buf, 'swapfile', false)
- -- And we would rather prefer that this buffer will be destroyed when hide.
- vim.api.nvim_buf_set_option(buf, 'bufhidden', 'wipe')
- -- It's not necessary but it is good practice to set custom filetype.
- -- This allows users to create their own autocommand or colorschemes on filetype.
- -- and prevent collisions with other plugins.
- vim.api.nvim_buf_set_option(buf, 'filetype', 'git-blame')
-
- -- For better UX we will turn off line wrap and turn on current line highlight.
- vim.api.nvim_win_set_option(win, 'wrap', false)
- vim.api.nvim_win_set_option(win, 'cursorline', true)
- vim.api.nvim_win_set_width(win, 40)
- -- set_mappings() -- At end we will set mappings for our navigation.
-
- -- the grep is an ugly but super performant way to remove everything up until the first occurance of " ("
- -- which strips off the commit hash and filename from the git blame log
-
- vim.api.nvim_command('read!git blame --date human ' .. startingBuf .. ' | grep -o " (.* [0-9]\\+)" | cut -c 3- ')
- -- vim.api.nvim_command('read!git blame --date human ' .. startingBuf .. ' | sed -n "s/ (/&\n/;s/.*\n//p"' )
- vim.cmd('normal gg')
- vim.cmd('normal dd') -- there is an empty line at the top of the file - remove it
-end
-
-local get_current_window = function() return vim.api.nvim_get_current_win() end
-
-local function get_current_cursor_location(window) return vim.api.nvim_win_get_cursor(window) end
-
-local function set_cursor_position(window, position) return vim.api.nvim_win_set_cursor(window, position) end
-
-local blame = function()
- local starting_window = get_current_window()
-
- vim.api.nvim_win_set_option(starting_window, 'scrollbind', true)
-
- local starting_cursor_location = get_current_cursor_location(starting_window)
-
- vim.cmd('normal gg')
-
- create_win()
-
- local blame_window = get_current_window()
-
- set_cursor_position(blame_window, starting_cursor_location)
-
- vim.api.nvim_win_set_option(starting_window, 'scrollbind', true)
-
- vim.cmd('normal gg')
-
- set_cursor_position(starting_window, starting_cursor_location)
-end
-
-vim.api.nvim_create_user_command('GitBlame', blame, {})
diff --git a/plugin/globals.lua b/plugin/globals.lua
@@ -1,7 +1,7 @@
P = function(v) print(vim.inspect(v)) end
D = function(...)
- local objects = vim.tbl_map(vim.inspect, {...})
+ local objects = vim.tbl_map(vim.inspect, { ... })
print(unpack(objects))
end
diff --git a/plugin/grep.lua b/plugin/grep.lua
@@ -9,9 +9,9 @@ function! GrepOperator(type)
endif
silent execute "grep! -F -- " . shellescape(@@)
- " copen
+ copen
endfunction
]]
-vim.keymap.set('n', '<leader>r', ':set operatorfunc=GrepOperator<cr>g@', {noremap = true})
-vim.keymap.set('v', '<leader>r', ':<c-u>call GrepOperator(visualmode())<cr>', {noremap = true})
+vim.keymap.set('n', '<leader>r', ':set operatorfunc=GrepOperator<cr>g@', { noremap = true })
+vim.keymap.set('v', '<leader>r', ':<c-u>call GrepOperator(visualmode())<cr>', { noremap = true })
diff --git a/plugin/keymap.lua b/plugin/keymap.lua
@@ -19,8 +19,6 @@ vim.keymap.set('n', '<leader>q', '<cmd>quit<cr>', { noremap = true })
vim.keymap.set('n', '<leader>Q', '<cmd>quit!<cr>', { noremap = true })
vim.keymap.set('n', '<leader>M', '<cmd>messages<cr>', { noremap = true })
vim.keymap.set('n', '<leader>so', '<cmd>source<cr>', { noremap = true })
-vim.keymap.set('n', '<leader>bo', '<cmd>BufOnly<cr>', { noremap = true })
-vim.keymap.set('n', '<leader>bO', '<cmd>BufOnly!<cr>', { noremap = true })
-- window movement
vim.keymap.set('n', '<a-h>', '<c-w>h', { noremap = true })
vim.keymap.set('n', '<a-j>', '<c-w>j', { noremap = true })
diff --git a/plugin/ws.lua b/plugin/ws.lua
@@ -2,8 +2,8 @@ local ws = require('tms.ws')
for name, setup in pairs(ws) do
if setup.path then
- local group = vim.api.nvim_create_augroup('user-project-' .. name, {clear = true})
- vim.api.nvim_create_autocmd('VimEnter', {group = group, pattern = setup.path, callback = setup.config})
+ local group = vim.api.nvim_create_augroup('user-project-' .. name, { clear = true })
+ vim.api.nvim_create_autocmd('VimEnter', { group = group, pattern = setup.path, callback = setup.config })
end
-- if setup.buffer then au.addListener('user-project-buffer-' .. name, {'BufEnter ' .. setup.buffer}, setup.config) end
-- if setup.filetypes then
diff --git a/syntax/latte.vim b/syntax/latte.vim
@@ -1,127 +0,0 @@
-" Vim syntax file
-" Language: Latte Templates
-" Maintainer: Martin Janiczek <martin@janiczek.cz>
-" Latest Revision: 11 March 2012
-" URL: http://forum.nette.org/cs/10222-latte-vim-syntax-highlighter
-" URL: https://github.com/janiczek/vim-latte
-
-" ============================================================
-" ================================ INCLUDES AND WHATNOT ======
-" ============================================================
-
-" check if we loaded this file before
-if exists('b:current_syntax') && b:current_syntax == 'latte'
- finish
-endif
-
-" we want to highlight PHP, HTML, CSS, JS
-runtime! syntax/php.vim
-
-" ============================================================
-" ========================================= DEFINITIONS ======
-" ============================================================
-
-" TODO: should we recognize things like => , : or not?
-" TODO: more specifically, should we allow only the macros
-" that really are in Latte? like:
-" {link Presenter:action} <-- good
-" {link} <-- bad
-" TODO: is this style (#blocks same color as $phpVars) ok?
-" (n:attrs different color than attrs)
-" TODO: macros inside <a> links
-
-" ------------------------------------------------------------
-" ------------------------------------------- n:attribs ------
-" ------------------------------------------------------------
-
-" Commented out because it breaks highlighting of inline CSS and JS.
-" TODO?
-
-"" n:attrib: <tag n:foo="$bar">
-"syn match latteAttribute contained /n:[a-zA-Z]\+\>/
-
-"" for attributes:
-"syn region htmlTag start=+<[^/]+ end=+>+
-" \ contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster,latteAttribute
-
-" ------------------------------------------------------------
-" ---------------------------------------------- macros ------
-" ------------------------------------------------------------
-
-" macro: {a macro}
-syn region latteMacro start="{\S" end="}"
- \ contains=latteBlockName,latteString,latteVariable
-
-" block name: #blockName
-syn match latteBlockName /#[$_a-zA-Z0-9]\+\>/ contained
-
-" string: 'abcdÄ™'
-syn region latteString start=+'+ end=+'+ contained
- \ contains=latteVariable
-
-syn region latteString start=+"+ end=+"+ contained
- \ contains=latteVariable
-
-" ------------------------------------------------------------
-" -------------------------------------------- comments ------
-" ------------------------------------------------------------
-
-" comments: {* a basic comment *}
-syn region latteComment start="{\*" end="\*}"
- \ contains=latteTodo
-
-" todo: {* TODO something *}
-syn keyword latteTodo contained TODO FIXME XXX
-
-" ------------------------------------------------------------
-" ----------------------------------------- annotations ------
-" ------------------------------------------------------------
-
-" annotation comments: {** an @annotation comment *}
-syn region latteAnnotationComment start="{\*\*" end="\*}"
- \ contains=latteTodo,latteAnnotation,latteVariable,latteType
-
-" annotation: @param
-syn match latteAnnotation /@[$_a-zA-Z][$_a-zA-Z0-9]*\>/ contained
-
-" variable: $myVar
-syn match latteVariable /$[_a-zA-Z][_a-zA-Z0-9]*\>/ contained
-
-" type: string
-syn keyword latteType contained boolean integer float double
- \ string array object resource NULL
-
-" ------------------------------------------------------------
-" ---------------------------------------- HTML strings ------
-" ------------------------------------------------------------
-" (so we can highlight things inside them too ;) )
-
-" for values:
-syn region htmlString contained start=+"+ end=+"+
- \ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc,latteMacro,latteVariable
-
-syn region htmlString contained start=+'+ end=+'+
- \ contains=htmlSpecialChar,javaScriptExpression,@htmlPreproc,latteMacro,latteVariable
-
-" ============================================================
-" =========================================== WIRING ;) ======
-" ============================================================
-
-" finally, use the definitions!
-
-"hi def link latteAttribute Type
-
-hi def link latteMacro PreProc
-hi def link latteBlockName Identifier
-hi def link latteString String
-
-hi def link latteComment Comment
-hi def link latteTodo Todo
-
-hi def link latteAnnotationComment Comment
-hi def link latteAnnotation PreProc
-hi def link latteVariable Identifier
-hi def link latteType Type
-
-" prevent the file from loading again (see top)
-let b:current_syntax = 'latte'