mirror of
https://github.com/lloeki/vimfiles.git
synced 2025-12-06 05:24:39 +01:00
Compare commits
3 commits
8617f69d4c
...
8171a831b0
| Author | SHA1 | Date | |
|---|---|---|---|
| 8171a831b0 | |||
| daec0e9249 | |||
| c3e9c4e745 |
7 changed files with 184 additions and 47 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -4,4 +4,5 @@
|
||||||
/plugged/*
|
/plugged/*
|
||||||
/autoload/plug.vim.old
|
/autoload/plug.vim.old
|
||||||
/.envrc
|
/.envrc
|
||||||
|
/.direnv
|
||||||
/localvim
|
/localvim
|
||||||
|
|
|
||||||
10
default.nix
Normal file
10
default.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
(import
|
||||||
|
(
|
||||||
|
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
|
||||||
|
fetchTarball {
|
||||||
|
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||||
|
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{ src = ./.; }
|
||||||
|
).defaultNix
|
||||||
76
flake.lock
generated
Normal file
76
flake.lock
generated
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-compat": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1696426674,
|
||||||
|
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||||
|
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||||
|
"revCount": 57,
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1726560853,
|
||||||
|
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1729097500,
|
||||||
|
"narHash": "sha256-NMxk91m62pA97pbHqYDNhTgzr24MzKf5D+ZCDlmHXmw=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "764efd34fe199a705d62d0738452076e8276dd98",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "master",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
23
flake.nix
Normal file
23
flake.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/master";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, flake-utils, flake-compat }:
|
||||||
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
|
let
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
in {
|
||||||
|
devShell = pkgs.mkShell {
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
vim
|
||||||
|
neovim
|
||||||
|
vim-language-server
|
||||||
|
vim-vint
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -18,6 +18,9 @@ Plug 'olivertaylor/vacme'
|
||||||
Plug 'pbrisbin/vim-colors-off'
|
Plug 'pbrisbin/vim-colors-off'
|
||||||
Plug 'ikaros/smpl-vim'
|
Plug 'ikaros/smpl-vim'
|
||||||
|
|
||||||
|
" Detect dark/light mode
|
||||||
|
Plug 'vimpostor/vim-lumen'
|
||||||
|
|
||||||
" External tool integration
|
" External tool integration
|
||||||
Plug 'tpope/vim-bundler' " bundler + gem-ctags
|
Plug 'tpope/vim-bundler' " bundler + gem-ctags
|
||||||
Plug 'tpope/vim-fugitive' " git
|
Plug 'tpope/vim-fugitive' " git
|
||||||
|
|
|
||||||
20
shell.nix
20
shell.nix
|
|
@ -1,10 +1,10 @@
|
||||||
{ pkgs ? import(fetchTarball("https://github.com/NixOS/nixpkgs/archive/d51f8579f03a76718d643dd184ae964e6f0dd751.tar.gz")) {} }:
|
(import
|
||||||
|
(
|
||||||
pkgs.mkShell {
|
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
|
||||||
nativeBuildInputs = with pkgs; [
|
fetchTarball {
|
||||||
vim
|
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||||
neovim
|
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||||
vim-language-server
|
}
|
||||||
vim-vint
|
)
|
||||||
];
|
{ src = ./.; }
|
||||||
}
|
).shellNix
|
||||||
|
|
|
||||||
98
vimrc
98
vimrc
|
|
@ -17,17 +17,21 @@ let g:netrw_dirhistmax = 0
|
||||||
set clipboard^=unnamed
|
set clipboard^=unnamed
|
||||||
|
|
||||||
" Terminal title
|
" Terminal title
|
||||||
if has('macunix') && $TERM_PROGRAM == 'Apple_Terminal'
|
if has('macunix') && $TERM_PROGRAM ==# 'Apple_Terminal'
|
||||||
set title
|
set title
|
||||||
set t_ts=]6;
|
set t_ts=]6;
|
||||||
set t_fs=
|
set t_fs=
|
||||||
if !exists("autocmd_terminal_title")
|
if !exists('autocmd_terminal_title')
|
||||||
let autocmd_terminal_title = 1
|
let autocmd_terminal_title = 1
|
||||||
autocmd BufEnter,BufRead * let &titlestring = "file://" . hostname() . expand("%:p")
|
augroup TermTitle
|
||||||
|
autocmd BufEnter,BufRead * let &titlestring = "file://" . hostname() . expand("%:p")
|
||||||
|
augroup END
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
set title
|
set title
|
||||||
autocmd BufEnter,BufRead * let &titlestring = expand("%:p")
|
augroup TermTitle
|
||||||
|
autocmd BufEnter,BufRead * let &titlestring = expand("%:p")
|
||||||
|
augroup END
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Airline
|
" Airline
|
||||||
|
|
@ -41,23 +45,23 @@ let g:airline_symbols.linenr = ''
|
||||||
let g:airline_symbols.branch = '⎇'
|
let g:airline_symbols.branch = '⎇'
|
||||||
let g:airline_symbols.whitespace = ''
|
let g:airline_symbols.whitespace = ''
|
||||||
|
|
||||||
" Terminal behavior and appearance
|
function! DetectMode()
|
||||||
if !has('gui_running')
|
if has('macunix') && $TERM_PROGRAM ==# 'Apple_Terminal'
|
||||||
set showtabline=1 "automatic tab bar
|
let s:mode = system('defaults read -g AppleInterfaceStyle')
|
||||||
set mouse=n "mouse support
|
if v:shell_error
|
||||||
if has("mouse_sgr")
|
set background=light
|
||||||
set ttymouse=sgr
|
else
|
||||||
end
|
set background=dark
|
||||||
"set background=light
|
endif
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
if $SSH_CLIENT
|
function! ApplyMode()
|
||||||
colorscheme smpl
|
" set theme
|
||||||
else
|
if &background ==# 'light'
|
||||||
if &background == 'light'
|
|
||||||
colorscheme nofrils-light
|
colorscheme nofrils-light
|
||||||
else
|
else
|
||||||
"colorscheme nofrils-dark
|
colorscheme nofrils-dark
|
||||||
colorscheme nofrils-light
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
"use terminal background
|
"use terminal background
|
||||||
|
|
@ -72,9 +76,29 @@ if !has('gui_running')
|
||||||
hi statement ctermbg=none
|
hi statement ctermbg=none
|
||||||
hi LineNr ctermbg=none
|
hi LineNr ctermbg=none
|
||||||
endif
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Terminal behavior and appearance
|
||||||
|
if !has('gui_running')
|
||||||
|
set showtabline=1 "automatic tab bar
|
||||||
|
set mouse=n "mouse support
|
||||||
|
if has('mouse_sgr')
|
||||||
|
set ttymouse=sgr
|
||||||
|
end
|
||||||
|
|
||||||
|
if $SSH_CLIENT
|
||||||
|
colorscheme smpl
|
||||||
|
else
|
||||||
|
call DetectMode()
|
||||||
|
call ApplyMode()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
augroup Lumen
|
||||||
|
autocmd User LumenLight call ApplyMode()
|
||||||
|
autocmd User LumenDark call ApplyMode()
|
||||||
|
augroup END
|
||||||
|
|
||||||
" Appearance tweaks
|
" Appearance tweaks
|
||||||
hi VertSplit cterm=NONE gui=NONE
|
hi VertSplit cterm=NONE gui=NONE
|
||||||
set fillchars+=vert:│
|
set fillchars+=vert:│
|
||||||
|
|
@ -86,7 +110,7 @@ let g:ale_virtualtext_cursor = 0
|
||||||
let g:ale_ruby_rubocop_executable = 'bundle'
|
let g:ale_ruby_rubocop_executable = 'bundle'
|
||||||
let g:ale_ruby_steep_executable = 'bundle'
|
let g:ale_ruby_steep_executable = 'bundle'
|
||||||
let g:ale_ruby_standardrb_executable = 'bundle'
|
let g:ale_ruby_standardrb_executable = 'bundle'
|
||||||
let g:go_fmt_command = "goimports"
|
let g:go_fmt_command = 'goimports'
|
||||||
"let g:ale_linters = {'ruby': ['standardrb']}
|
"let g:ale_linters = {'ruby': ['standardrb']}
|
||||||
"let g:ale_fixers = { 'python': ['black'], 'ruby': ['standardrb'] }
|
"let g:ale_fixers = { 'python': ['black'], 'ruby': ['standardrb'] }
|
||||||
"let g:ale_fix_on_save = 1
|
"let g:ale_fix_on_save = 1
|
||||||
|
|
@ -126,14 +150,14 @@ set hlsearch "highlight search matches
|
||||||
set showmatch "highlight both matching parentheses
|
set showmatch "highlight both matching parentheses
|
||||||
|
|
||||||
" Swap and undo files
|
" Swap and undo files
|
||||||
set dir=~/.vim/tmp/swap//,/var/tmp//,/tmp//,.
|
set directory=~/.vim/tmp/swap//,/var/tmp//,/tmp//,.
|
||||||
"set undodir=~/.vim/tmp/undo//,.
|
"set undodir=~/.vim/tmp/undo//,.
|
||||||
|
|
||||||
" Buffer management
|
" Buffer management
|
||||||
set swb=usetab "make :sb <filename> go to tabs too
|
set switchbuf=usetab "make :sb <filename> go to tabs too
|
||||||
|
|
||||||
" SuperTab options
|
" SuperTab options
|
||||||
let g:SuperTabDefaultCompletionType = "context"
|
let g:SuperTabDefaultCompletionType = 'context'
|
||||||
" Complete options (disable preview scratch window)
|
" Complete options (disable preview scratch window)
|
||||||
set completeopt=menu,menuone,longest
|
set completeopt=menu,menuone,longest
|
||||||
" Limit popup menu height
|
" Limit popup menu height
|
||||||
|
|
@ -185,7 +209,7 @@ xmap ga <Plug>(EasyAlign)
|
||||||
nmap ga <Plug>(EasyAlign)
|
nmap ga <Plug>(EasyAlign)
|
||||||
|
|
||||||
" organ
|
" organ
|
||||||
if ! exists("g:organ_loaded")
|
if ! exists('g:organ_loaded')
|
||||||
let g:organ_config = {}
|
let g:organ_config = {}
|
||||||
let g:organ_config.speedkeys = 1
|
let g:organ_config.speedkeys = 1
|
||||||
endif
|
endif
|
||||||
|
|
@ -198,10 +222,10 @@ let g:EditorConfig_exclude_patterns = ['fugitive://.\*']
|
||||||
|
|
||||||
" Restore last known cursor position
|
" Restore last known cursor position
|
||||||
function! ResCur()
|
function! ResCur()
|
||||||
if &filetype == 'netrw'
|
if &filetype ==# 'netrw'
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
if line("'\"") <= line("$")
|
if line("'\"") <= line('$')
|
||||||
normal! g`"
|
normal! g`"
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
|
|
@ -212,7 +236,7 @@ if has('macunix')
|
||||||
function! OpenURLUnderCursor()
|
function! OpenURLUnderCursor()
|
||||||
let s:uri = matchstr(getline('.'), '[a-z]*:\/\/[^ >,;()]*')
|
let s:uri = matchstr(getline('.'), '[a-z]*:\/\/[^ >,;()]*')
|
||||||
let s:uri = shellescape(s:uri, 1)
|
let s:uri = shellescape(s:uri, 1)
|
||||||
if s:uri != ''
|
if s:uri !=# ''
|
||||||
silent exec "!open '".s:uri."'"
|
silent exec "!open '".s:uri."'"
|
||||||
:redraw!
|
:redraw!
|
||||||
endif
|
endif
|
||||||
|
|
@ -221,12 +245,12 @@ if has('macunix')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Unfold at cursor position
|
" Unfold at cursor position
|
||||||
if has("folding")
|
if has('folding')
|
||||||
function! UnfoldCur()
|
function! UnfoldCur()
|
||||||
if !&foldenable
|
if !&foldenable
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
let cl = line(".")
|
let cl = line('.')
|
||||||
if cl <= 1
|
if cl <= 1
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
@ -234,7 +258,7 @@ if has("folding")
|
||||||
let uf = foldlevel(cl - 1)
|
let uf = foldlevel(cl - 1)
|
||||||
let min = (cf > uf ? uf : cf)
|
let min = (cf > uf ? uf : cf)
|
||||||
if min
|
if min
|
||||||
execute "normal!" min . "zo"
|
execute 'normal!' min . 'zo'
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
@ -243,7 +267,7 @@ endif
|
||||||
" Restore last known cursor position on open
|
" Restore last known cursor position on open
|
||||||
augroup resCur
|
augroup resCur
|
||||||
autocmd!
|
autocmd!
|
||||||
if has("folding")
|
if has('folding')
|
||||||
autocmd BufWinEnter * if ResCur() | call UnfoldCur() | endif
|
autocmd BufWinEnter * if ResCur() | call UnfoldCur() | endif
|
||||||
else
|
else
|
||||||
autocmd BufWinEnter * call ResCur()
|
autocmd BufWinEnter * call ResCur()
|
||||||
|
|
@ -269,7 +293,7 @@ endfunction
|
||||||
|
|
||||||
function! ShellcheckSet(buffer)
|
function! ShellcheckSet(buffer)
|
||||||
let l:shell = ShellcheckDetect(a:buffer)
|
let l:shell = ShellcheckDetect(a:buffer)
|
||||||
if l:shell == 'bash'
|
if l:shell ==# 'bash'
|
||||||
call setbufvar(a:buffer, 'is_bash', 1)
|
call setbufvar(a:buffer, 'is_bash', 1)
|
||||||
else
|
else
|
||||||
call setbufvar(a:buffer, 'is_bash', 0)
|
call setbufvar(a:buffer, 'is_bash', 0)
|
||||||
|
|
@ -310,7 +334,7 @@ endfunction
|
||||||
map <leader>fs :call FormatSort()<CR>
|
map <leader>fs :call FormatSort()<CR>
|
||||||
|
|
||||||
" Go tools path
|
" Go tools path
|
||||||
let g:go_bin_path = expand('$HOME') . "/.local/libexec/go/bin"
|
let g:go_bin_path = expand('$HOME') . '/.local/libexec/go/bin'
|
||||||
|
|
||||||
if expand('%:t') =~? 'rfc\d\+' || expand('%:t') =~? 'draft-.*-\d\{2,}'
|
if expand('%:t') =~? 'rfc\d\+' || expand('%:t') =~? 'draft-.*-\d\{2,}'
|
||||||
setfiletype rfc
|
setfiletype rfc
|
||||||
|
|
@ -320,7 +344,7 @@ endif
|
||||||
map <leader>s :mksession!<CR>
|
map <leader>s :mksession!<CR>
|
||||||
" Restore session if Session.vim exists
|
" Restore session if Session.vim exists
|
||||||
"function! RestoreSession()
|
"function! RestoreSession()
|
||||||
" if argc() == 0 && filereadable("Session.vim") "vim called without arguments
|
" if argc() == 0 && filereadable('Session.vim') "vim called without arguments
|
||||||
" "let answer = confirm('foo?', '&Yes\nNo', 1)
|
" "let answer = confirm('foo?', '&Yes\nNo', 1)
|
||||||
" execute 'source Session.vim'
|
" execute 'source Session.vim'
|
||||||
" end
|
" end
|
||||||
|
|
@ -331,9 +355,9 @@ map <leader>s :mksession!<CR>
|
||||||
source $VIMRUNTIME/macros/matchit.vim
|
source $VIMRUNTIME/macros/matchit.vim
|
||||||
|
|
||||||
function! UpdateTags()
|
function! UpdateTags()
|
||||||
execute ":silent !ctags -R ."
|
execute ':silent !ctags -R .'
|
||||||
execute ":redraw!"
|
execute ':redraw!'
|
||||||
echohl StatusLine | echo "tags updated" | echohl None
|
echohl StatusLine | echo 'tags updated' | echohl None
|
||||||
endfunction
|
endfunction
|
||||||
nnoremap <F8> :call UpdateTags()<CR>
|
nnoremap <F8> :call UpdateTags()<CR>
|
||||||
|
|
||||||
|
|
@ -351,7 +375,7 @@ function! LocalInit()
|
||||||
|
|
||||||
if filereadable(s:local_config_file)
|
if filereadable(s:local_config_file)
|
||||||
if index(s:local_config_allowed, s:local_config_file) < 0
|
if index(s:local_config_allowed, s:local_config_file) < 0
|
||||||
echo "local config file disallowed: " . s:local_config_file
|
echo 'local config file disallowed: ' . s:local_config_file
|
||||||
else
|
else
|
||||||
call LocalLoad()
|
call LocalLoad()
|
||||||
endif
|
endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue