From f0cb9f1f65c103a86447f9bbed64bd98a0b36cd8 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Mon, 30 Aug 2021 18:18:12 +0200 Subject: vim: cleanup --- .vim/init.lua | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to '.vim/init.lua') diff --git a/.vim/init.lua b/.vim/init.lua index ac7eb9e..f7e5363 100644 --- a/.vim/init.lua +++ b/.vim/init.lua @@ -62,7 +62,6 @@ cmd [[ colorscheme lush ]] -- KEY BINDS -- {{{ local nnoremap = require('astronauta.keymap').nnoremap -local inoremap = require('astronauta.keymap').inoremap local vnoremap = require('astronauta.keymap').vnoremap local tnoremap = require('astronauta.keymap').tnoremap @@ -71,18 +70,18 @@ nnoremap { 'gb', function() cmd [[ bnext ]] end } nnoremap { 'gB', function() cmd [[ bprevious ]] end } nnoremap { '', function() cmd [[ silent! normal za ]] end } --- terminal tnoremap { '', [[ ]] } tnoremap { 'qq', [[ :bdelete! ]] } vnoremap { 'T', function() cmd [[ retab! | call feedkeys("\") ]] end } -nnoremap { 'gf', function() require('misc').file_under_cursor(function(s) vim.cmd('edit ' .. s) end) end } -nnoremap { 'gF', function() require('misc').open_under_cursor() end } -nnoremap { 'gx', function() require('misc').open_under_cursor('url-launcher') end } -nnoremap { 'gGw', function() require('misc').word_under_cursor(function(s) require('telescope.builtin.files').grep_string({ search = s }) end) end } -nnoremap { 'gGe', function() require('misc').expr_under_cursor(function(s) require('telescope.builtin.files').grep_string({ search = s }) end) end } -nnoremap { 'gGf', function() require('misc').file_under_cursor(function(s) require('telescope.builtin.files').grep_string({ search = s }) end) end } -nnoremap { 'gs', function() require('misc').word_under_cursor(function(s) vim.fn.feedkeys(':%s/' .. s .. '//g'); cmd [[ call feedkeys("\\") ]] end) end } +local misc = require('misc') +nnoremap { 'gf', function() misc.file_under_cursor(function(s) vim.cmd('edit ' .. s) end) end } +nnoremap { 'gF', function() misc.open_under_cursor() end } +nnoremap { 'gx', function() misc.open_under_cursor('url-launcher') end } +nnoremap { 'gGw', function() misc.word_under_cursor(function(s) require('telescope.builtin.files').grep_string({ search = s }) end) end } +nnoremap { 'gGe', function() misc.expr_under_cursor(function(s) require('telescope.builtin.files').grep_string({ search = s }) end) end } +nnoremap { 'gGf', function() misc.file_under_cursor(function(s) require('telescope.builtin.files').grep_string({ search = s }) end) end } +nnoremap { 'gs', function() misc.word_under_cursor(function(s) vim.fn.feedkeys(':%s/' .. s .. '//g'); cmd [[ call feedkeys("\\") ]] end) end } -- }}} -- AUTO GROUPS -- {{{ @@ -107,7 +106,7 @@ augroup { -- USER COMMANDS -- {{{ cmd [[ command! BalenaDiagnosticsFold call balena_diagnostics_fold#apply() ]] -cmd [[ command! -range SortLine ,lua require('misc').sort_line() ]] +cmd [[ command! -range SortLine ,lua misc.sort_line() ]] cmd [[ command! -nargs=* Make lua require('job').make({}) ]] cmd [[ command! -nargs=* Sh lua require('job').sh(table.concat({}, ' ')) ]] -- }}} -- cgit 1.4.1