From 983b993e4c764e4e9f8071c23d9ede13b8eedf67 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 14 Jan 2023 00:39:35 +0100 Subject: tv vim: scroll linewise when there's a touchscreen --- tv/2configs/vim.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tv/2configs/vim.nix') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index b8819ee3..a0225807 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -140,5 +140,16 @@ with import ./lib; " edit alternate buffer " For some reason neither putting 6 nor ^ works here... nnoremap a  + + if $TOUCHSCREEN == 1 + nnoremap + nnoremap + nnoremap 3 + nnoremap 3 + nnoremap 3 + nnoremap 3 + nnoremap + nnoremap + endif ''; } -- cgit v1.2.3 From 2c05d17476932ecd23e3ce902366d4c3d08dcaca Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 15 Jan 2023 01:50:04 +0100 Subject: tv vim: split plugins into base and extra --- tv/2configs/vim.nix | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'tv/2configs/vim.nix') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index a0225807..f3986e4f 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -11,18 +11,31 @@ with import ./lib; environment.variables.VIMINIT = ":so /etc/vimrc"; }; - extra-runtimepath = pkgs.tv.vim.makeRuntimePath [ - pkgs.tv.vimPlugins.elixir + base-plugins = [ pkgs.tv.vimPlugins.file-line - pkgs.tv.vimPlugins.fzf pkgs.tv.vimPlugins.hack + pkgs.vimPlugins.undotree + (pkgs.tv.vim.makePlugin (pkgs.write "vim-tv-base" { + "/ftplugin/haskell.vim".text = '' + if exists("g:vim_tv_ftplugin_haskell_loaded") + finish + endif + let g:vim_tv_ftplugin_haskell_loaded = 1 + + setlocal iskeyword+=' + ''; + })) + ]; + + extra-plugins = [ + pkgs.tv.vimPlugins.elixir + pkgs.tv.vimPlugins.fzf pkgs.tv.vimPlugins.jq pkgs.tv.vimPlugins.nix pkgs.tv.vimPlugins.showsyntax pkgs.tv.vimPlugins.tv pkgs.tv.vimPlugins.vim pkgs.vimPlugins.fzfWrapper - pkgs.vimPlugins.undotree pkgs.vimPlugins.vim-nftables ]; @@ -71,7 +84,7 @@ with import ./lib; set mouse=a set noruler set pastetoggle= - set runtimepath=${extra-runtimepath},$VIMRUNTIME + set runtimepath=${pkgs.tv.vim.makeRuntimePath base-plugins},$VIMRUNTIME set shortmess+=I set showcmd set showmatch @@ -88,13 +101,15 @@ with import ./lib; set wildmenu set wildmode=longest,full + set runtimepath^=${pkgs.tv.vim.makeRuntimePath extra-plugins} + syntax on + set et ts=2 sts=2 sw=2 filetype plugin indent on set t_Co=256 colorscheme hack - syntax on au Syntax * syn match Garbage containedin=ALL /\s\+$/ \ | syn match TabStop containedin=ALL /\t\+/ -- cgit v1.2.3 From 21f878d929fdfb0f277aa33c2fa32c5a63f3018a Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 16 Jan 2023 11:04:51 +0100 Subject: tv vim: DRY F{1,2} mapping --- tv/2configs/vim.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tv/2configs/vim.nix') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index f3986e4f..fde66d77 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -130,8 +130,8 @@ with import ./lib; nnoremap :tabp nnoremap :tabn - inoremap :tabp - inoremap :tabn + imap + imap noremap :ShowSyntax -- cgit v1.2.3 From 250a394da48120bd2deb791eb4c7fb6232a342bb Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 16 Jan 2023 11:05:41 +0100 Subject: tv vim: tabm with S-F{1,2} --- tv/2configs/vim.nix | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tv/2configs/vim.nix') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index fde66d77..2b5cd8d2 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -133,6 +133,11 @@ with import ./lib; imap imap + nnoremap :tabm -1 + nnoremap :tabm +1 + imap + imap + noremap :ShowSyntax " -- cgit v1.2.3 From dc3f5c683822d177001b71cc9ee6afa49f3b9969 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 17 Jan 2023 01:04:45 +0100 Subject: tv vimrc: rewrite to vim9script --- tv/2configs/vim.nix | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'tv/2configs/vim.nix') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 2b5cd8d2..2c17fbc7 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -71,7 +71,9 @@ with import ./lib; ]; }; - vimrc = pkgs.writeText "vimrc" '' + vimrc = pkgs.writeText "vimrc" /* vim */ '' + vim9script + set nocompatible set autoindent @@ -140,28 +142,28 @@ with import ./lib; noremap :ShowSyntax - " + # noremap Oa | noremap! Oa noremap Ob | noremap! Ob noremap Oc | noremap! Oc noremap Od | noremap! Od - " <[C]S-{Up,Down,Right,Left> + # <[C]S-{Up,Down,Right,Left}> noremap [a | noremap! [a noremap [b | noremap! [b noremap [c | noremap! [c noremap [d | noremap! [d vnoremap u - " fzf + # fzf nnoremap q :Buffers nnoremap f :Files nnoremap w :Rg - " edit alternate buffer - " For some reason neither putting 6 nor ^ works here... + # edit alternate buffer + # For some reason neither putting 6 nor ^ works here... nnoremap a  - if $TOUCHSCREEN == 1 + if $TOUCHSCREEN == "1" nnoremap nnoremap nnoremap 3 -- cgit v1.2.3 From ab43821bb1b084228146c47eb5f529415e617392 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 17 Jan 2023 01:05:26 +0100 Subject: tv vim: remember last position --- tv/2configs/vim.nix | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tv/2configs/vim.nix') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 2c17fbc7..8aee3108 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -173,5 +173,11 @@ with import ./lib; nnoremap nnoremap endif + + # remember last position + autocmd BufReadPost * + \ if line("'\"") > 0 && line("'\"") <= line("$") | + \ exe "normal! g`\"" | + \ endif ''; } -- cgit v1.2.3