Compare commits
No commits in common. "d67d75eda33f720de6bb8491a9c9f9cf034d0daa" and "9439ed4c44142f1920ad1b569e5d1b229322d23c" have entirely different histories.
d67d75eda3
...
9439ed4c44
|
@ -81,7 +81,6 @@
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
nix
|
nix
|
||||||
nixd
|
|
||||||
agenix
|
agenix
|
||||||
age-plugin-yubikey
|
age-plugin-yubikey
|
||||||
cachix
|
cachix
|
||||||
|
@ -98,12 +97,10 @@
|
||||||
|
|
||||||
deploy-rs
|
deploy-rs
|
||||||
|
|
||||||
terraform-ls
|
|
||||||
opentofu
|
opentofu
|
||||||
terraform-backend-git
|
terraform-backend-git
|
||||||
|
|
||||||
deno
|
deno
|
||||||
denols
|
|
||||||
];
|
];
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
|
|
|
@ -29,6 +29,14 @@ in {
|
||||||
element-desktop
|
element-desktop
|
||||||
element-b12f
|
element-b12f
|
||||||
element-mezza
|
element-mezza
|
||||||
|
|
||||||
|
# Nix specific utilities
|
||||||
|
alejandra
|
||||||
|
manix
|
||||||
|
nix-index
|
||||||
|
nix-tree
|
||||||
|
nix-inspect
|
||||||
|
nvd
|
||||||
];
|
];
|
||||||
|
|
||||||
fonts = {
|
fonts = {
|
||||||
|
|
|
@ -22,12 +22,13 @@ in {
|
||||||
programs.command-not-found.enable = false;
|
programs.command-not-found.enable = false;
|
||||||
|
|
||||||
users.users."${psCfg.user.name}".packages = with pkgs; [
|
users.users."${psCfg.user.name}".packages = with pkgs; [
|
||||||
|
ack
|
||||||
asciinema
|
asciinema
|
||||||
bat
|
bat
|
||||||
blesh
|
blesh
|
||||||
eza
|
eza
|
||||||
fd
|
fd
|
||||||
ripgrep
|
jump
|
||||||
(nnn.overrideAttrs (o: {
|
(nnn.overrideAttrs (o: {
|
||||||
patches =
|
patches =
|
||||||
(o.patches or [])
|
(o.patches or [])
|
||||||
|
@ -38,17 +39,9 @@ in {
|
||||||
p
|
p
|
||||||
powerline
|
powerline
|
||||||
screen
|
screen
|
||||||
|
silver-searcher
|
||||||
watson
|
watson
|
||||||
jump
|
];
|
||||||
] ++ (if cfg.full then [
|
|
||||||
# Nix specific utilities
|
|
||||||
alejandra
|
|
||||||
manix
|
|
||||||
nix-index
|
|
||||||
nix-tree
|
|
||||||
nix-inspect
|
|
||||||
nvd
|
|
||||||
] else []);
|
|
||||||
|
|
||||||
home-manager.users."${psCfg.user.name}" = {
|
home-manager.users."${psCfg.user.name}" = {
|
||||||
xdg.dataFile."scripts/base16.sh".source = .local/share/scripts/base16.sh;
|
xdg.dataFile."scripts/base16.sh".source = .local/share/scripts/base16.sh;
|
||||||
|
@ -86,11 +79,13 @@ in {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
inherit lib;
|
inherit lib;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Ensure nvim backup directory gets created
|
# Ensure nvim backup directory gets created
|
||||||
# Workaround for E510: Can't make backup file (add ! to override)
|
# Workaround for E510: Can't make backup file (add ! to override)
|
||||||
xdg.dataFile."nvim/backup/.keep".text = "";
|
xdg.dataFile."nvim/backup/.keep".text = "";
|
||||||
xdg.dataFile."nvim/json-schemas/.keep".text = "";
|
xdg.dataFile."nvim/json-schemas/.keep".text = "";
|
||||||
|
# Generated with:
|
||||||
|
# docker run -it --name caddy-json-schema registry.greenbaum.cloud/gc/caddy-l4:2.5.2 caddy json-schema -output /srv/caddy_schema.json
|
||||||
|
xdg.dataFile."nvim/json-schemas/caddy_schema.json".source = .local/share/nvim/json-schemas/caddy_schema.json;
|
||||||
xdg.dataFile."nvim/templates/.keep".text = "";
|
xdg.dataFile."nvim/templates/.keep".text = "";
|
||||||
|
|
||||||
programs.git = import ./git {};
|
programs.git = import ./git {};
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
lua <<EOF
|
|
||||||
|
|
||||||
local luasnip = require 'luasnip'
|
|
||||||
|
|
||||||
local cmp = require 'cmp'
|
|
||||||
cmp.setup {
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
require('luasnip').lsp_expand(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
mapping = {
|
|
||||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
|
||||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
|
||||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
||||||
['<C-Space>'] = cmp.mapping.complete(),
|
|
||||||
['<C-e>'] = cmp.mapping.close(),
|
|
||||||
['<CR>'] = cmp.mapping.confirm {
|
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
|
||||||
select = true,
|
|
||||||
},
|
|
||||||
['<Tab>'] = function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
elseif luasnip.expand_or_jumpable() then
|
|
||||||
luasnip.expand_or_jump()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
['<S-Tab>'] = function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
elseif luasnip.jumpable(-1) then
|
|
||||||
luasnip.jump(-1)
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
sources = {
|
|
||||||
{ name = 'nvim_lsp' },
|
|
||||||
{ name = 'luasnip' },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
EOF
|
|
|
@ -7,6 +7,8 @@
|
||||||
psCfg = config.pub-solar;
|
psCfg = config.pub-solar;
|
||||||
cfg = config.pub-solar.terminal-life;
|
cfg = config.pub-solar.terminal-life;
|
||||||
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
|
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
|
||||||
|
|
||||||
|
preview-file = pkgs.writeShellScriptBin "preview-file" (import ./preview-file.nix pkgs);
|
||||||
in {
|
in {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
|
@ -18,35 +20,49 @@ in {
|
||||||
withRuby = true;
|
withRuby = true;
|
||||||
withPython3 = true;
|
withPython3 = true;
|
||||||
|
|
||||||
extraPackages = with pkgs; [
|
extraPackages = with pkgs;
|
||||||
ripgrep
|
lib.mkIf (cfg.full) [
|
||||||
nixd
|
ansible-language-server
|
||||||
universal-ctags
|
ccls
|
||||||
# ansible-language-server
|
gopls
|
||||||
# clang-tools
|
nixd
|
||||||
# gopls
|
nodejs
|
||||||
# nodePackages.bash-language-server
|
nodePackages.bash-language-server
|
||||||
# nodePackages.svelte-language-server
|
nodePackages.dockerfile-language-server-nodejs
|
||||||
# nodePackages.typescript
|
nodePackages.svelte-language-server
|
||||||
# nodePackages.typescript-language-server
|
nodePackages.typescript
|
||||||
# nodePackages.vue-language-server
|
nodePackages.typescript-language-server
|
||||||
# nodePackages.vscode-langservers-extracted
|
nodePackages.vim-language-server
|
||||||
# nginx-language-server
|
nodePackages.vue-language-server
|
||||||
# lua-language-server
|
nodePackages.vscode-langservers-extracted
|
||||||
# cmake-language-server
|
nodePackages.yaml-language-server
|
||||||
# vim-language-server
|
python3Packages.python-lsp-server
|
||||||
# yaml-language-server
|
python3Full
|
||||||
# python3Packages.python-lsp-server
|
rust-analyzer
|
||||||
# nodePackages.dockerfile-language-server-nodejs
|
solargraph
|
||||||
# docker-compose-language-service
|
terraform-ls
|
||||||
# rust-analyzer
|
universal-ctags
|
||||||
# cargo
|
];
|
||||||
# solargraph
|
|
||||||
# terraform-ls
|
plugins = with pkgs.vimPlugins; lib.mkIf cfg.full [
|
||||||
# python3Full
|
pkgs.vimPlugins.nvim-treesitter.withAllGrammars
|
||||||
];
|
|
||||||
|
# Dependencies for nvim-lspconfig
|
||||||
|
nvim-cmp
|
||||||
|
cmp-nvim-lsp
|
||||||
|
cmp_luasnip
|
||||||
|
luasnip
|
||||||
|
|
||||||
|
# Quickstart configs for neovim LSP
|
||||||
|
lsp_extensions-nvim
|
||||||
|
nvim-lspconfig
|
||||||
|
|
||||||
|
# Collaborative editing in Neovim using built-in capabilities
|
||||||
|
instant-nvim-nvfetcher
|
||||||
|
|
||||||
|
# Search functionality behind :Ack
|
||||||
|
ack-vim
|
||||||
|
|
||||||
plugins = with pkgs.vimPlugins; [
|
|
||||||
# The status bar in the bottom of the screen with the mode indication and file location
|
# The status bar in the bottom of the screen with the mode indication and file location
|
||||||
vim-airline
|
vim-airline
|
||||||
|
|
||||||
|
@ -59,9 +75,18 @@ in {
|
||||||
# Highlight characters when using f, F, t, and T
|
# Highlight characters when using f, F, t, and T
|
||||||
quick-scope
|
quick-scope
|
||||||
|
|
||||||
|
# Get sudo in vim; :SudaWrite <optional filename>
|
||||||
|
vim-suda
|
||||||
|
|
||||||
# Undo history etc. per project
|
# Undo history etc. per project
|
||||||
vim-workspace-nvfetcher
|
vim-workspace-nvfetcher
|
||||||
|
|
||||||
|
# JSON schemas
|
||||||
|
SchemaStore-nvim
|
||||||
|
|
||||||
|
# Work with tags files
|
||||||
|
vim-gutentags
|
||||||
|
|
||||||
# Neovim colorschemes / themes
|
# Neovim colorschemes / themes
|
||||||
sonokai
|
sonokai
|
||||||
vim-hybrid-material
|
vim-hybrid-material
|
||||||
|
@ -78,10 +103,9 @@ in {
|
||||||
# Ease your git workflow within Vim
|
# Ease your git workflow within Vim
|
||||||
vimagit-nvfetcher
|
vimagit-nvfetcher
|
||||||
|
|
||||||
# Telescope fuzzy finder
|
# FZF fuzzy finder
|
||||||
telescope-nvim
|
fzf-vim
|
||||||
telescope-fzf-native-nvim
|
fzfWrapper
|
||||||
|
|
||||||
# Make the yanked region apparent
|
# Make the yanked region apparent
|
||||||
vim-highlightedyank
|
vim-highlightedyank
|
||||||
|
|
||||||
|
@ -90,33 +114,16 @@ in {
|
||||||
|
|
||||||
# Unload, delete or wipe a buffer without closing the window
|
# Unload, delete or wipe a buffer without closing the window
|
||||||
vim-bufkill
|
vim-bufkill
|
||||||
|
|
||||||
# Defaults everyone can agree on
|
# Defaults everyone can agree on
|
||||||
vim-sensible
|
vim-sensible
|
||||||
|
|
||||||
# Work with tags files
|
# emmet for vim: http://emmet.io/
|
||||||
vim-gutentags
|
emmet-vim
|
||||||
] ++ (if cfg.full then [
|
# Caddyfile syntax support for Vim
|
||||||
nvim-treesitter.withAllGrammars
|
vim-caddyfile-nvfetcher
|
||||||
|
];
|
||||||
|
|
||||||
# Dependencies for nvim-lspconfig
|
extraConfig = builtins.concatStringsSep "\n" [
|
||||||
nvim-cmp
|
|
||||||
cmp-nvim-lsp
|
|
||||||
cmp_luasnip
|
|
||||||
luasnip
|
|
||||||
|
|
||||||
# Quickstart configs for neovim LSP
|
|
||||||
lsp_extensions-nvim
|
|
||||||
nvim-lspconfig
|
|
||||||
|
|
||||||
# Collaborative editing in Neovim using built-in capabilities
|
|
||||||
instant-nvim-nvfetcher
|
|
||||||
|
|
||||||
# JSON schemas
|
|
||||||
SchemaStore-nvim
|
|
||||||
] else []);
|
|
||||||
|
|
||||||
extraConfig = builtins.concatStringsSep "\n" ([
|
|
||||||
''
|
''
|
||||||
" Persistent undo
|
" Persistent undo
|
||||||
set undofile
|
set undofile
|
||||||
|
@ -129,9 +136,13 @@ in {
|
||||||
(builtins.readFile ./plugins.vim)
|
(builtins.readFile ./plugins.vim)
|
||||||
(builtins.readFile ./clipboard.vim)
|
(builtins.readFile ./clipboard.vim)
|
||||||
(builtins.readFile ./ui.vim)
|
(builtins.readFile ./ui.vim)
|
||||||
(builtins.readFile ./filetypes.vim)
|
(builtins.readFile ./quickfixopenall.vim)
|
||||||
] ++ (if cfg.full then [
|
|
||||||
(builtins.readFile ./lsp.vim)
|
(builtins.readFile ./lsp.vim)
|
||||||
(builtins.readFile ./cmp.vim)
|
(builtins.readFile ./filetypes.vim)
|
||||||
] else []));
|
''
|
||||||
|
" fzf with file preview
|
||||||
|
command! -bang -nargs=? -complete=dir Files
|
||||||
|
\ call fzf#vim#files(<q-args>, { 'options': ['--keep-right', '--cycle', '--layout', 'reverse', '--preview', '${preview-file}/bin/preview-file {}'] }, <bang>0)
|
||||||
|
''
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,13 +73,34 @@ xnoremap p pgvy
|
||||||
inoremap jj <Esc>
|
inoremap jj <Esc>
|
||||||
|
|
||||||
" Open new buffer
|
" Open new buffer
|
||||||
nmap <leader>bn :enew<cr>
|
nmap <leader>T :enew<cr>
|
||||||
|
|
||||||
|
" Move to the next buffer
|
||||||
nmap <leader>l :bnext<CR>
|
nmap <leader>l :bnext<CR>
|
||||||
nmap <leader>bn :bnext<CR>
|
|
||||||
|
" Move to the previous buffer
|
||||||
nmap <leader>j :bprevious<CR>
|
nmap <leader>j :bprevious<CR>
|
||||||
nmap <leader>bp :bprevious<CR>
|
|
||||||
|
" Close the current buffer and move to the previous one
|
||||||
|
" This replicates the idea of closing a tab
|
||||||
nmap <leader>q :bp <BAR> bd #<CR>
|
nmap <leader>q :bp <BAR> bd #<CR>
|
||||||
nmap <leader>bq :bp <BAR> bd #<CR>
|
|
||||||
|
" Show all open buffers and their status
|
||||||
|
nmap <leader>bl :ls<CR>
|
||||||
|
|
||||||
|
" Mapping selecting mappings
|
||||||
|
nmap <leader><tab> <plug>(fzf-maps-n)
|
||||||
|
xmap <leader><tab> <plug>(fzf-maps-x)
|
||||||
|
omap <leader><tab> <plug>(fzf-maps-o)
|
||||||
|
|
||||||
|
nmap <c-p> :Files<CR>
|
||||||
|
imap <c-p> <ESC>:Files<CR>
|
||||||
|
|
||||||
|
" Insert mode completion
|
||||||
|
imap <c-x><c-k> <plug>(fzf-complete-word)
|
||||||
|
imap <c-x><c-f> <plug>(fzf-complete-path)
|
||||||
|
imap <c-x><c-j> <plug>(fzf-complete-file)
|
||||||
|
imap <c-x><c-l> <plug>(fzf-complete-line)
|
||||||
|
|
||||||
" Clear quickfix shortcut
|
" Clear quickfix shortcut
|
||||||
nmap <Leader>c :ccl<CR>
|
nmap <Leader>c :ccl<CR>
|
||||||
|
@ -89,3 +110,7 @@ nmap <Leader>c :ccl<CR>
|
||||||
if has("autocmd")
|
if has("autocmd")
|
||||||
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
nmap - :NnnPicker %<CR>
|
||||||
|
nmap <leader>n :NnnPicker %<CR>
|
||||||
|
nmap <leader>N :NnnPicker<CR>
|
||||||
|
|
|
@ -1,149 +1,258 @@
|
||||||
|
" Set completeopt to have a better completion experience
|
||||||
|
" :help completeopt
|
||||||
|
" menuone: popup even when there's only one match
|
||||||
|
" noinsert: Do not insert text until a selection is made
|
||||||
|
" noselect: Do not select, force user to select one from the menu
|
||||||
|
set completeopt=menuone,noinsert,noselect
|
||||||
|
|
||||||
|
" Avoid showing extra messages when using completion
|
||||||
|
set shortmess+=c
|
||||||
|
|
||||||
|
function AddTemplate(tmpl_file)
|
||||||
|
exe "0read " . a:tmpl_file
|
||||||
|
set nomodified
|
||||||
|
6
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
autocmd BufNewFile shell.nix call AddTemplate("$XDG_DATA_HOME/nvim/templates/shell.nix.tmpl")
|
||||||
|
|
||||||
" Configure neovim 0.6+ experimental LSPs
|
" Configure neovim 0.6+ experimental LSPs
|
||||||
" https://github.com/neovim/nvim-lspconfig
|
" https://github.com/neovim/nvim-lspconfig
|
||||||
" https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
" https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||||
" https://github.com/neovim/nvim-lspconfig/wiki/UI-Customization
|
" https://github.com/neovim/nvim-lspconfig/wiki/UI-Customization
|
||||||
" https://gitlab.com/Iron_E/dotfiles/-/blob/master/.config/nvim/lua/_config/plugin/nvim_lsp.lua
|
" https://gitlab.com/Iron_E/dotfiles/-/blob/master/.config/nvim/lua/_config/plugin/nvim_lsp.lua
|
||||||
|
|
||||||
lua <<EOF
|
lua <<EOF
|
||||||
|
local nvim_lsp = require('lspconfig')
|
||||||
|
|
||||||
-- Set completeopt to have a better completion experience
|
-- Mappings (global)
|
||||||
vim.o.completeopt = 'menuone,noselect,noinsert'
|
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||||
vim.o.shortmess = vim.o.shortmess .. 'c'
|
local opts = { noremap=true, silent=true }
|
||||||
vim.o.signcolumn = 'yes:2'
|
vim.api.nvim_set_keymap('n', '<leader>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
|
||||||
|
vim.api.nvim_set_keymap('n', 'g[', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
|
||||||
|
vim.api.nvim_set_keymap('n', 'g]', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
|
||||||
|
vim.api.nvim_set_keymap('n', '<leader>dq', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
|
||||||
|
vim.api.nvim_set_keymap('n', '<leader>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||||
|
|
||||||
local lspconfig = require('lspconfig')
|
-- Use an on_attach function to only map the following keys
|
||||||
|
-- after the language server attaches to the current buffer
|
||||||
|
local on_attach = function(client, bufnr)
|
||||||
|
-- Enable completion triggered by <c-x><c-o>
|
||||||
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
|
|
||||||
-- Mappings (global)
|
-- Mappings (available if LSP is configured and attached to buffer)
|
||||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
local opts = { noremap=true, silent=true }
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||||
vim.api.nvim_set_keymap('n', '<leader>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||||
vim.api.nvim_set_keymap('n', 'g[', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||||
vim.api.nvim_set_keymap('n', 'g]', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||||
vim.api.nvim_set_keymap('n', '<leader>dq', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||||
vim.api.nvim_set_keymap('n', '<leader>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||||
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||||
|
|
||||||
local on_attach = function(client, bufnr)
|
-- Show diagnostic popup on cursor hold
|
||||||
-- Enable completion triggered by <c-x><c-o>
|
vim.api.nvim_create_autocmd("CursorHold", {
|
||||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
buffer = bufnr,
|
||||||
|
callback = function()
|
||||||
|
local opts = {
|
||||||
|
focusable = false,
|
||||||
|
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
|
||||||
|
border = 'rounded',
|
||||||
|
source = 'always',
|
||||||
|
prefix = ' ',
|
||||||
|
scope = 'cursor',
|
||||||
|
}
|
||||||
|
vim.diagnostic.open_float(nil, opts)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
-- Mappings (available if LSP is configured and attached to buffer)
|
end
|
||||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
|
||||||
|
|
||||||
-- Show diagnostic popup on cursor hold
|
-- Add additional capabilities supported by nvim-cmp
|
||||||
vim.api.nvim_create_autocmd("CursorHold", {
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
buffer = bufnr,
|
-- vscode HTML lsp needs this https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#html
|
||||||
callback = function()
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
local opts = {
|
|
||||||
focusable = false,
|
|
||||||
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
|
|
||||||
border = 'rounded',
|
|
||||||
source = 'always',
|
|
||||||
prefix = ' ',
|
|
||||||
scope = 'cursor',
|
|
||||||
}
|
|
||||||
vim.diagnostic.open_float(nil, opts)
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
end
|
-- vscode HTML lsp needs this https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#html
|
||||||
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
|
|
||||||
local lspconfig = require 'lspconfig'
|
local use_denols_for_typescript = not(os.getenv('NVIM_USE_DENOLS') == nil)
|
||||||
-- Add additional capabilities supported by nvim-cmp
|
|
||||||
local CAPABILITIES = require('cmp_nvim_lsp').default_capabilities()
|
|
||||||
|
|
||||||
--- Event handlers
|
for lsp_key, lsp_settings in pairs({
|
||||||
local HANDLERS = {
|
'ansiblels', ---------------------------- Ansible
|
||||||
-- TODO: replace with vim.lsp.protocol.Methods
|
'bashls', ------------------------------- Bash
|
||||||
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, FLOAT_CONFIG),
|
'ccls', --------------------------------- C / C++ / Objective-C
|
||||||
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, FLOAT_CONFIG),
|
'cssls', -------------------------------- CSS / SCSS / LESS
|
||||||
}
|
'dockerls', ----------------------------- Docker
|
||||||
|
['gopls'] = { --------------------------- Go
|
||||||
|
['settings'] = {
|
||||||
|
['gopls'] = {
|
||||||
|
['analyses'] = {
|
||||||
|
['unusedparams'] = true,
|
||||||
|
},
|
||||||
|
['staticcheck'] = true
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'html', --------------------------------- HTML
|
||||||
|
['jdtls'] = { --------------------------- Java
|
||||||
|
['root_dir'] = nvim_lsp.util.root_pattern('.git', 'pom.xml', 'build.xml'),
|
||||||
|
['init_options'] = {
|
||||||
|
['jvm_args'] = {['java.format.settings.url'] = vim.fn.stdpath('config')..'/eclipse-formatter.xml'},
|
||||||
|
['workspace'] = vim.fn.stdpath('cache')..'/java-workspaces'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
['jsonls'] = { -------------------------- JSON
|
||||||
|
['settings'] = {
|
||||||
|
['json'] = {
|
||||||
|
['schemas' ] = vim.list_extend(
|
||||||
|
{
|
||||||
|
{
|
||||||
|
['description'] = 'JSON schema for Caddy v2',
|
||||||
|
['fileMatch'] = { '*caddy*.json' },
|
||||||
|
['name'] = 'caddy_schema.json',
|
||||||
|
['url'] = vim.fn.stdpath('data')..'/json-schemas/caddy_schema.json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
require('schemastore').json.schemas()
|
||||||
|
),
|
||||||
|
['validate'] = { ['enable'] = true }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'nixd', --------------------------------- Nix
|
||||||
|
'phpactor', ----------------------------- PHP
|
||||||
|
'pylsp', -------------------------------- Python
|
||||||
|
'solargraph', --------------------------- Ruby
|
||||||
|
'rust_analyzer', ------------------------ Rust
|
||||||
|
['sqlls'] = {
|
||||||
|
['cmd'] = {vim.fn.stdpath('data')..'/nvm/versions/node/v12.19.0/bin/sql-language-server', 'up', '--method', 'stdio'}
|
||||||
|
},
|
||||||
|
['terraformls'] = { --------------------- Terraform
|
||||||
|
['filetypes'] = { 'terraform', 'hcl', 'tf' }
|
||||||
|
},
|
||||||
|
|
||||||
-- vscode HTML lsp needs this https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#html
|
-- The TS/JS server is chosen depending on an environment variable,
|
||||||
CAPABILITIES.textDocument.completion.completionItem.snippetSupport = true
|
-- since denols is nicer for Deno based projects
|
||||||
|
------------------------ Deno TS/JS
|
||||||
|
------------------------------------ Typescript / JavaScript
|
||||||
|
(use_denols_for_typescript and 'denols' or 'tsserver'),
|
||||||
|
|
||||||
local function setup(lsp, config)
|
'vuels', -------------------------------- Vue
|
||||||
if config == nil then
|
'svelte', ------------------------------- Svelte
|
||||||
config = {}
|
['yamlls'] = { -------------------------- YAML
|
||||||
end
|
['settings'] = {
|
||||||
|
['yaml'] = {
|
||||||
|
['schemas'] = {
|
||||||
|
['https://json.schemastore.org/github-workflow'] = '.github/workflows/*.{yml,yaml}',
|
||||||
|
['https://json.schemastore.org/github-action'] = '.github/action.{yml,yaml}',
|
||||||
|
['https://json.schemastore.org/drone'] = '*.drone.{yml,yaml}',
|
||||||
|
['https://json.schemastore.org/swagger-2.0'] = 'swagger.{yml,yaml}',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}) do -- Setup all of the language servers. †
|
||||||
|
if type(lsp_key) == 'number' then -- Enable the LSP with defaults.
|
||||||
|
-- The `lsp` is an index in this case.
|
||||||
|
nvim_lsp[lsp_settings].setup{
|
||||||
|
on_attach = on_attach,
|
||||||
|
flags = {
|
||||||
|
debounce_text_changes = 150,
|
||||||
|
},
|
||||||
|
capabilities = capabilities,
|
||||||
|
}
|
||||||
|
else -- Use the LSP's configuration.
|
||||||
|
lsp_settings.on_attach = on_attach
|
||||||
|
lsp_settings.capabilities = capabilities
|
||||||
|
|
||||||
config.capabilities = CAPABILITIES
|
nvim_lsp[lsp_key].setup(lsp_settings)
|
||||||
config.handlers = HANDLERS
|
end
|
||||||
config.on_attach = on_attach
|
end -- ‡
|
||||||
lspconfig[lsp].setup(config)
|
|
||||||
end
|
|
||||||
|
|
||||||
setup('nixd')
|
-- configure floating diagnostics appearance, symbols
|
||||||
setup('bashls')
|
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||||
setup('clangd')
|
for type, icon in pairs(signs) do
|
||||||
setup('cssls')
|
local hl = "DiagnosticSign" .. type
|
||||||
setup('eslint')
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||||
setup('tsserver')
|
end
|
||||||
setup('denols')
|
|
||||||
setup('vuels')
|
|
||||||
setup('svelte')
|
|
||||||
setup('html')
|
|
||||||
setup('yamlls')
|
|
||||||
setup('jsonls', {
|
|
||||||
json = {
|
|
||||||
schemas = require('schemastore').json.schemas(),
|
|
||||||
validate = {
|
|
||||||
enable = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
setup('gopls', {
|
|
||||||
settings = {
|
|
||||||
gopls = { semanticTokens = true }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
setup('phpactor')
|
|
||||||
setup('pylsp')
|
|
||||||
setup('solargraph') -- ruby
|
|
||||||
setup('rust_analyzer', {
|
|
||||||
settings = {
|
|
||||||
['rust-analyzer'] = {
|
|
||||||
checkOnSave = { extraArgs = { "--target-dir", "/tmp/rust-analyzer-check" } },
|
|
||||||
diagnostics = { disabled = { 'inactive-code' } },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
setup('sqlls')
|
|
||||||
setup('salt_ls')
|
|
||||||
setup('ansiblels')
|
|
||||||
setup('dockerls')
|
|
||||||
setup('docker_compose_language_service')
|
|
||||||
setup('terraformls')
|
|
||||||
|
|
||||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#denols
|
-- Set completeopt to have a better completion experience
|
||||||
vim.g.markdown_fenced_languages = {
|
vim.o.completeopt = 'menuone,noselect'
|
||||||
"ts=typescript"
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Configure diagnostics
|
-- luasnip setup
|
||||||
vim.diagnostic.config({
|
local luasnip = require 'luasnip'
|
||||||
virtual_text = false,
|
|
||||||
signs = true,
|
|
||||||
underline = true,
|
|
||||||
update_in_insert = false,
|
|
||||||
severity_sort = false,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Change diagnostic symbols in the sign column (gutter)
|
-- nvim-cmp setup
|
||||||
local signs = { Error = "x ", Warn = "! ", Hint = "? ", Info = "i " }
|
local cmp = require 'cmp'
|
||||||
for type, icon in pairs(signs) do
|
cmp.setup {
|
||||||
local hl = "DiagnosticSign" .. type
|
snippet = {
|
||||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
expand = function(args)
|
||||||
end
|
require('luasnip').lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = {
|
||||||
|
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||||
|
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||||
|
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
['<C-Space>'] = cmp.mapping.complete(),
|
||||||
|
['<C-e>'] = cmp.mapping.close(),
|
||||||
|
['<CR>'] = cmp.mapping.confirm {
|
||||||
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
|
select = true,
|
||||||
|
},
|
||||||
|
['<Tab>'] = function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
['<S-Tab>'] = function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif luasnip.jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
sources = {
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'luasnip' },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#denols
|
||||||
|
vim.g.markdown_fenced_languages = {
|
||||||
|
"ts=typescript"
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Configure diagnostics
|
||||||
|
vim.diagnostic.config({
|
||||||
|
virtual_text = false,
|
||||||
|
signs = true,
|
||||||
|
underline = true,
|
||||||
|
update_in_insert = false,
|
||||||
|
severity_sort = false,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Change diagnostic symbols in the sign column (gutter)
|
||||||
|
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||||
|
for type, icon in pairs(signs) do
|
||||||
|
local hl = "DiagnosticSign" .. type
|
||||||
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||||
|
end
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
" have a fixed column for the diagnostics to appear in
|
||||||
|
" this removes the jitter when warnings/errors flow in
|
||||||
|
set signcolumn=yes:2
|
||||||
|
|
|
@ -4,9 +4,29 @@ autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
|
||||||
|
|
||||||
let g:gutentags_file_list_command = 'git ls-files'
|
let g:gutentags_file_list_command = 'git ls-files'
|
||||||
|
|
||||||
|
" quick-scope
|
||||||
" https://github.com/unblevable/quick-scope
|
" https://github.com/unblevable/quick-scope
|
||||||
let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']
|
let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']
|
||||||
|
|
||||||
|
" Golang
|
||||||
|
" Go test, Def, Decls shortcut
|
||||||
|
nmap <Leader>got :GoTest<CR>:botright copen<CR>
|
||||||
|
autocmd FileType go nmap gd :GoDef<CR>
|
||||||
|
autocmd FileType go nmap gD :GoDecls<CR>
|
||||||
|
|
||||||
|
" Go formatting
|
||||||
|
autocmd FileType go setlocal noexpandtab shiftwidth=4 tabstop=4 softtabstop=4 nolist
|
||||||
|
|
||||||
|
" Caddyfile indentation
|
||||||
|
autocmd FileType caddyfile setlocal noexpandtab shiftwidth=8 tabstop=8 softtabstop=8 nolist
|
||||||
|
|
||||||
|
" vim-go disable text-objects
|
||||||
|
let g:go_textobj_enabled = 0
|
||||||
|
|
||||||
|
" disable vim-go :GoDef short cut (gd)
|
||||||
|
" this is handled by LanguageClient [LC]
|
||||||
|
let g:go_def_mapping_enabled = 0
|
||||||
|
|
||||||
" GitGutter and vim Magit
|
" GitGutter and vim Magit
|
||||||
" inspired by: https://jakobgm.com/posts/vim/git-integration/
|
" inspired by: https://jakobgm.com/posts/vim/git-integration/
|
||||||
" Don't map gitgutter keys automatically, set them ourselves
|
" Don't map gitgutter keys automatically, set them ourselves
|
||||||
|
@ -23,11 +43,17 @@ nmap <Leader>gu <Plug>(GitGutterUndoHunk) " git undo (chunk)
|
||||||
" Open vimagit pane
|
" Open vimagit pane
|
||||||
nnoremap <leader>gs :Magit<CR> " git status
|
nnoremap <leader>gs :Magit<CR> " git status
|
||||||
|
|
||||||
|
" Push to remote
|
||||||
|
nnoremap <leader>gP :! git push<CR> " git Push
|
||||||
|
|
||||||
" Quick conflict resolution in git mergetool nvim
|
" Quick conflict resolution in git mergetool nvim
|
||||||
" http://vimcasts.org/episodes/fugitive-vim-resolving-merge-conflicts-with-vimdiff/
|
" http://vimcasts.org/episodes/fugitive-vim-resolving-merge-conflicts-with-vimdiff/
|
||||||
nmap <Leader>[ :diffget //2<CR>
|
nmap <Leader>[ :diffget //2<CR>
|
||||||
nmap <Leader>] :diffget //3<CR>
|
nmap <Leader>] :diffget //3<CR>
|
||||||
|
|
||||||
|
" netrw
|
||||||
|
let g:netrw_fastbrowse=0
|
||||||
|
|
||||||
" Auto-FMT rust code on save
|
" Auto-FMT rust code on save
|
||||||
let g:rustfmt_autosave = 1
|
let g:rustfmt_autosave = 1
|
||||||
|
|
||||||
|
@ -40,46 +66,22 @@ let g:highlightedyank_highlight_duration = 200
|
||||||
" Markdown options
|
" Markdown options
|
||||||
let g:vim_markdown_folding_disabled = 1
|
let g:vim_markdown_folding_disabled = 1
|
||||||
|
|
||||||
|
" Haskell options
|
||||||
|
let g:haskell_enable_quantification = 1 " to enable highlighting of `forall`
|
||||||
|
let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec`
|
||||||
|
let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc`
|
||||||
|
let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern`
|
||||||
|
let g:haskell_enable_typeroles = 1 " to enable highlighting of type roles
|
||||||
|
let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static`
|
||||||
|
let g:haskell_backpack = 1 " to enable highlighting of backpack keywords
|
||||||
|
|
||||||
|
" Emmet
|
||||||
|
let g:user_emmet_leader_key='<c-n>'
|
||||||
|
|
||||||
|
" Ack
|
||||||
|
if executable('ag')
|
||||||
|
let g:ackprg = 'ag --hidden --vimgrep'
|
||||||
|
endif
|
||||||
|
|
||||||
" nnn
|
" nnn
|
||||||
let g:nnn#command = 'nnn -d -e -H -r'
|
let g:nnn#command = 'nnn -d -e -H -r'
|
||||||
|
|
||||||
nmap - :NnnPicker %<CR>
|
|
||||||
nmap <leader>n :NnnPicker %<CR>
|
|
||||||
nmap <leader>N :NnnPicker<CR>
|
|
||||||
|
|
||||||
lua <<EOF
|
|
||||||
local actions = require("telescope.actions")
|
|
||||||
local telescope = require("telescope")
|
|
||||||
telescope.setup{
|
|
||||||
defaults = {
|
|
||||||
mappings = {
|
|
||||||
n = {
|
|
||||||
["k"] = actions.move_selection_next,
|
|
||||||
["i"] = actions.move_selection_previous,
|
|
||||||
["I"] = actions.move_to_top,
|
|
||||||
["K"] = actions.move_to_bottom,
|
|
||||||
["<C-c>"] = actions.close,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
extensions = {
|
|
||||||
fzf = {
|
|
||||||
fuzzy = true, -- false will only do exact matching
|
|
||||||
override_generic_sorter = true, -- override the generic sorter
|
|
||||||
override_file_sorter = true, -- override the file sorter
|
|
||||||
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
|
||||||
-- the default case_mode is "smart_case"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
telescope.load_extension('fzf')
|
|
||||||
|
|
||||||
local builtin = require('telescope.builtin')
|
|
||||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
|
|
||||||
vim.keymap.set('n', '<leader>f/', builtin.live_grep, {})
|
|
||||||
vim.keymap.set('n', '<leader>f?', builtin.builtin, {})
|
|
||||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
|
|
||||||
vim.keymap.set('n', '<leader>fc', builtin.commands, {})
|
|
||||||
vim.keymap.set('n', '<leader>ft', builtin.treesitter, {})
|
|
||||||
EOF
|
|
||||||
|
|
36
modules/terminal-life/nvim/preview-file.nix
Normal file
36
modules/terminal-life/nvim/preview-file.nix
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
self:
|
||||||
|
with self; ''
|
||||||
|
IFS=':' read -r -a INPUT <<< "$1"
|
||||||
|
FILE=''${INPUT[0]}
|
||||||
|
CENTER=''${INPUT[1]}
|
||||||
|
|
||||||
|
if [[ "$1" =~ ^[A-Za-z]:\\ ]]; then
|
||||||
|
FILE=$FILE:''${INPUT[1]}
|
||||||
|
CENTER=''${INPUT[2]}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$CENTER" && ! "$CENTER" =~ ^[0-9] ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
CENTER=''${CENTER/[^0-9]*/}
|
||||||
|
|
||||||
|
FILE="''${FILE/#\~\//$HOME/}"
|
||||||
|
if [ ! -r "$FILE" ]; then
|
||||||
|
echo "File not found ''${FILE}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$CENTER" ]; then
|
||||||
|
CENTER=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec cat "$FILE" \
|
||||||
|
| sed -e '/[#|\/\/ ?]-- copyright/,/[#\/\/]++/c\\' \
|
||||||
|
| ${pkgs.coreutils}/bin/tr -s '\n' \
|
||||||
|
| ${pkgs.bat}/bin/bat \
|
||||||
|
--style="''${BAT_STYLE:-numbers}" \
|
||||||
|
--color=always \
|
||||||
|
--pager=never \
|
||||||
|
--file-name="''$FILE" \
|
||||||
|
--highlight-line=$CENTER
|
||||||
|
''
|
20
modules/terminal-life/nvim/quickfixopenall.vim
Normal file
20
modules/terminal-life/nvim/quickfixopenall.vim
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
"Usage:
|
||||||
|
" 1. Perform a vimgrep search
|
||||||
|
" :vimgrep /def/ *.rb
|
||||||
|
" 2. Issue QuickFixOpenAll command
|
||||||
|
" :QuickFixOpenAll
|
||||||
|
function! QuickFixOpenAll()
|
||||||
|
if empty(getqflist())
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
let s:prev_val = ""
|
||||||
|
for d in getqflist()
|
||||||
|
let s:curr_val = bufname(d.bufnr)
|
||||||
|
if (s:curr_val != s:prev_val)
|
||||||
|
exec "edit " . s:curr_val
|
||||||
|
endif
|
||||||
|
let s:prev_val = s:curr_val
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
command! QuickFixOpenAll call QuickFixOpenAll()
|
|
@ -13,3 +13,20 @@ let g:airline#extensions#tabline#fnamemod = ':t' " Show just the filename
|
||||||
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
|
let g:airline#extensions#tabline#formatter = 'unique_tail_improved'
|
||||||
let g:airline_powerline_fonts = 1 " Use powerline fonts
|
let g:airline_powerline_fonts = 1 " Use powerline fonts
|
||||||
let g:airline_theme = 'sonokai'
|
let g:airline_theme = 'sonokai'
|
||||||
|
|
||||||
|
" Customize fzf colors to match your color scheme
|
||||||
|
" - fzf#wrap translates this to a set of `--color` options
|
||||||
|
let g:fzf_colors =
|
||||||
|
\ { 'fg': ['fg', 'Normal'],
|
||||||
|
\ 'bg': ['bg', 'Normal'],
|
||||||
|
\ 'hl': ['fg', 'Comment'],
|
||||||
|
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
|
||||||
|
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
|
||||||
|
\ 'hl+': ['fg', 'Statement'],
|
||||||
|
\ 'info': ['fg', 'PreProc'],
|
||||||
|
\ 'border': ['fg', 'Ignore'],
|
||||||
|
\ 'prompt': ['fg', 'Conditional'],
|
||||||
|
\ 'pointer': ['fg', 'Exception'],
|
||||||
|
\ 'marker': ['fg', 'Keyword'],
|
||||||
|
\ 'spinner': ['fg', 'Label'],
|
||||||
|
\ 'header': ['fg', 'Comment'] }
|
||||||
|
|
|
@ -14,7 +14,7 @@ with lib; let
|
||||||
|
|
||||||
generateMailAccount = args@{ address, ... }: rec {
|
generateMailAccount = args@{ address, ... }: rec {
|
||||||
inherit address;
|
inherit address;
|
||||||
realName = if (args ? "fullName") then args.fullName else psCfg.user.fullName;
|
realName = psCfg.user.fullName;
|
||||||
signature = {
|
signature = {
|
||||||
showSignature = "append";
|
showSignature = "append";
|
||||||
text = if (args ? "emptysignature") then "" else builtins.readFile (./.config/neomutt + "/${builtins.replaceStrings ["@"] ["_"] address}.signature");
|
text = if (args ? "emptysignature") then "" else builtins.readFile (./.config/neomutt + "/${builtins.replaceStrings ["@"] ["_"] address}.signature");
|
||||||
|
@ -133,13 +133,11 @@ in {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
fullName = "mezza";
|
|
||||||
address = mkEmailAddress "mail" "mezza.biz";
|
address = mkEmailAddress "mail" "mezza.biz";
|
||||||
host = "mail.mezza.biz";
|
host = "mail.mezza.biz";
|
||||||
emptysignature = true;
|
emptysignature = true;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
fullname = "hwd"+ "zz";
|
|
||||||
address = mkEmailAddress "mail" "h" + "w" + "dz" + "z.net";
|
address = mkEmailAddress "mail" "h" + "w" + "dz" + "z.net";
|
||||||
host = "mail.h" + "w" + "dz" + "z.net";
|
host = "mail.h" + "w" + "dz" + "z.net";
|
||||||
emptysignature = true;
|
emptysignature = true;
|
||||||
|
|
Loading…
Reference in a new issue