pretty, null-ls w/ lua sql nix prettier
This commit is contained in:
parent
103d1b2ed6
commit
edf06af994
@ -6,7 +6,7 @@
|
||||
shellAliases = {
|
||||
grep = "grep --color";
|
||||
};
|
||||
profileExtra =''
|
||||
profileExtra = ''
|
||||
set -o vi
|
||||
[ ! -z $TMUX ] || tmux a || tmux
|
||||
neofetch
|
||||
|
20
home.nix
20
home.nix
@ -36,7 +36,7 @@ in
|
||||
tldr
|
||||
] ++ optionals isDarwin [
|
||||
iterm2
|
||||
] ++ optionals isLinux [];
|
||||
] ++ optionals isLinux [ ];
|
||||
|
||||
# Misc Programs
|
||||
programs.jq.enable = true;
|
||||
@ -50,13 +50,15 @@ in
|
||||
|
||||
# Darwin Spotlight Indexing Hack
|
||||
home.activation = mkIf isDarwin {
|
||||
copyApplications = let
|
||||
apps = pkgs.buildEnv {
|
||||
name = "home-manager-applications";
|
||||
paths = config.home.packages;
|
||||
pathsToLink = "/Applications";
|
||||
};
|
||||
in lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
copyApplications =
|
||||
let
|
||||
apps = pkgs.buildEnv {
|
||||
name = "home-manager-applications";
|
||||
paths = config.home.packages;
|
||||
pathsToLink = "/Applications";
|
||||
};
|
||||
in
|
||||
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
baseDir="$HOME/Applications/Home Manager Apps"
|
||||
if [ -d "$baseDir" ]; then
|
||||
rm -rf "$baseDir"
|
||||
@ -67,7 +69,7 @@ in
|
||||
$DRY_RUN_CMD cp ''${VERBOSE_ARG:+-v} -fHRL "$appFile" "$baseDir"
|
||||
$DRY_RUN_CMD chmod ''${VERBOSE_ARG:+-v} -R +w "$target"
|
||||
done
|
||||
'';
|
||||
'';
|
||||
};
|
||||
|
||||
# Darwin Spotlight Indexing Hack
|
||||
|
@ -5,4 +5,3 @@
|
||||
source = ./config/htoprc;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -10,4 +10,3 @@ in
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
require('aerial').setup({
|
||||
on_attach = function(bufnr)
|
||||
vim.keymap.set('n', '{', '<cmd>AerialPrev<CR>', {buffer = bufnr})
|
||||
vim.keymap.set('n', '}', '<cmd>AerialNext<CR>', {buffer = bufnr})
|
||||
end
|
||||
on_attach = function(bufnr)
|
||||
vim.keymap.set('n', '{', '<cmd>AerialPrev<CR>', {buffer = bufnr})
|
||||
vim.keymap.set('n', '}', '<cmd>AerialNext<CR>', {buffer = bufnr})
|
||||
end
|
||||
})
|
||||
|
||||
vim.keymap.set('n', '<leader>a', '<cmd>AerialToggle!<CR>')
|
||||
|
@ -2,11 +2,11 @@
|
||||
vim.g.nord_borders = true
|
||||
vim.g.nord_contrast = true
|
||||
vim.cmd('colorscheme nord')
|
||||
--vim.cmd('colorscheme embark')
|
||||
--vim.cmd('colorscheme gruvbox-material')
|
||||
-- vim.cmd('colorscheme embark')
|
||||
-- vim.cmd('colorscheme gruvbox-material')
|
||||
|
||||
-- Set Leader
|
||||
vim.keymap.set("n", "<Space>", "<Nop>", { silent = true })
|
||||
vim.keymap.set("n", "<Space>", "<Nop>", {silent = true})
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- Disable NetRW
|
||||
@ -41,7 +41,7 @@ vim.opt.foldlevel = 2
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
local opts = { noremap=true, silent=true }
|
||||
local opts = {noremap = true, silent = true}
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
|
@ -1,81 +1,71 @@
|
||||
local cmp = require('cmp')
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
|
||||
-- Check Tab Completion
|
||||
local has_words_before = function()
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col ~= 0 and
|
||||
vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col,
|
||||
col)
|
||||
:match("%s") == nil
|
||||
end
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require'luasnip'.lsp_expand(args.body)
|
||||
end
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args) require'luasnip'.lsp_expand(args.body) end
|
||||
},
|
||||
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
|
||||
-- Tab Completion
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
-- Tab Completion
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {"i", "s"}),
|
||||
|
||||
-- Reverse Tab Completion
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
-- Reverse Tab Completion
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {"i", "s"}),
|
||||
|
||||
-- Misc Mappings
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
-- Misc Mappings
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({select = true})
|
||||
|
||||
}),
|
||||
}),
|
||||
|
||||
-- Default Sources
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'path' },
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
-- Default Sources
|
||||
sources = cmp.config.sources({
|
||||
{name = 'nvim_lsp'}, {name = 'luasnip'}, {name = 'path'},
|
||||
{name = 'buffer'}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
-- Completion - `/` and `?`
|
||||
cmp.setup.cmdline({ '/', '?' }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' },
|
||||
}
|
||||
cmp.setup.cmdline({'/', '?'}, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {{name = 'buffer'}}
|
||||
})
|
||||
|
||||
-- Completion = `:`
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' },
|
||||
{ name = 'cmdline' },
|
||||
})
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({{name = 'path'}, {name = 'cmdline'}})
|
||||
})
|
||||
|
||||
-- Autopairs
|
||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||
cmp.event:on(
|
||||
'confirm_done',
|
||||
cmp_autopairs.on_confirm_done()
|
||||
)
|
||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
||||
|
@ -7,7 +7,7 @@ require('leap-config')
|
||||
require('lsp-config')
|
||||
require('lsp-lines-config')
|
||||
require('lualine-config')
|
||||
require('neoformat-config')
|
||||
require('null-ls-config')
|
||||
require('noice-config')
|
||||
require('numb-config')
|
||||
require('telescope-config')
|
||||
|
@ -2,59 +2,51 @@ local nix_vars = require("nix-vars")
|
||||
local nvim_lsp = require('lspconfig')
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap=true, silent=true, buffer=bufnr }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<space>f', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = {noremap = true, silent = true, buffer = bufnr}
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder,
|
||||
bufopts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<space>f',
|
||||
function() vim.lsp.buf.format {async = true} end, bufopts)
|
||||
end
|
||||
|
||||
-- Define LSP Flags & Capabilities
|
||||
local lsp_flags = {
|
||||
debounce_text_changes = 150,
|
||||
}
|
||||
local lsp_flags = {debounce_text_changes = 150}
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
-- Python LSP Configuration
|
||||
nvim_lsp.pyright.setup{
|
||||
nvim_lsp.pyright.setup {
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
-- HTML LSP Configuration
|
||||
nvim_lsp.html.setup{
|
||||
nvim_lsp.html.setup {
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
cmd = {
|
||||
nix_vars.htmlserver,
|
||||
"--stdio",
|
||||
}
|
||||
cmd = {nix_vars.htmlserver, "--stdio"}
|
||||
}
|
||||
|
||||
-- Typescript / Javascript LSP Configuration
|
||||
nvim_lsp.tsserver.setup{
|
||||
nvim_lsp.tsserver.setup {
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
cmd = {
|
||||
nix_vars.tsserver,
|
||||
"--stdio",
|
||||
"--tsserver-path",
|
||||
nix_vars.tslib,
|
||||
}
|
||||
cmd = {nix_vars.tsserver, "--stdio", "--tsserver-path", nix_vars.tslib}
|
||||
}
|
||||
|
@ -1,4 +1,2 @@
|
||||
require("lsp_lines").setup()
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
})
|
||||
vim.diagnostic.config({virtual_text = false})
|
||||
|
@ -1,6 +1,6 @@
|
||||
require('lualine').setup({
|
||||
options = {
|
||||
theme = "nord",
|
||||
-- theme = "OceanicNext",
|
||||
}
|
||||
options = {
|
||||
theme = "nord"
|
||||
-- theme = "OceanicNext",
|
||||
}
|
||||
})
|
||||
|
@ -1,10 +0,0 @@
|
||||
vim.g.neoformat_sql_sqlformat = {
|
||||
exe = "sqlformat",
|
||||
args = { "--reindent", "-k", "upper", "-" },
|
||||
stdin = 1
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = { "*.sql" },
|
||||
command = "Neoformat",
|
||||
})
|
@ -1,32 +1,26 @@
|
||||
-- Noice Doc Scrolling
|
||||
vim.keymap.set("n", "<c-f>", function()
|
||||
if not require("noice.lsp").scroll(4) then
|
||||
return "<c-f>"
|
||||
end
|
||||
end, { silent = true, expr = true })
|
||||
if not require("noice.lsp").scroll(4) then return "<c-f>" end
|
||||
end, {silent = true, expr = true})
|
||||
|
||||
vim.keymap.set("n", "<c-b>", function()
|
||||
if not require("noice.lsp").scroll(-4) then
|
||||
return "<c-b>"
|
||||
end
|
||||
end, { silent = true, expr = true })
|
||||
if not require("noice.lsp").scroll(-4) then return "<c-b>" end
|
||||
end, {silent = true, expr = true})
|
||||
|
||||
-- Noice Setup
|
||||
require("noice").setup({
|
||||
lsp = {
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = false,
|
||||
lsp = {
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = false
|
||||
},
|
||||
signature = {enabled = false}
|
||||
},
|
||||
signature = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
presets = {
|
||||
command_palette = true, -- position the cmdline and popupmenu together
|
||||
long_message_to_split = true, -- long messages will be sent to a split
|
||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||
},
|
||||
presets = {
|
||||
command_palette = true, -- position the cmdline and popupmenu together
|
||||
long_message_to_split = true, -- long messages will be sent to a split
|
||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = false -- add a border to hover docs and signature help
|
||||
}
|
||||
})
|
||||
|
28
nvim/config/lua/null-ls-config.lua
Normal file
28
nvim/config/lua/null-ls-config.lua
Normal file
@ -0,0 +1,28 @@
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.completion.spell,
|
||||
null_ls.builtins.formatting.nixpkgs_fmt,
|
||||
null_ls.builtins.formatting.lua_format,
|
||||
null_ls.builtins.formatting.prettier.with({
|
||||
filetypes = {"json", "yaml", "markdown"}
|
||||
}), null_ls.builtins.diagnostics.sqlfluff
|
||||
.with({extra_args = {"--dialect", "ansi"}}),
|
||||
null_ls.builtins.formatting.sqlfluff
|
||||
.with({extra_args = {"--dialect", "ansi"}})
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({group = augroup, buffer = bufnr})
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format()
|
||||
-- vim.lsp.buf.format({ async = true })
|
||||
end
|
||||
})
|
||||
end
|
||||
end
|
||||
})
|
@ -1,12 +1,12 @@
|
||||
require('telescope').setup {
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true,
|
||||
override_generic_sorter = true,
|
||||
override_file_sorter = true,
|
||||
case_mode = "smart_case",
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true,
|
||||
override_generic_sorter = true,
|
||||
override_file_sorter = true,
|
||||
case_mode = "smart_case"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
require('telescope').load_extension('fzf')
|
||||
|
@ -1,6 +1,3 @@
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
highlight = {enable = true, additional_vim_regex_highlighting = false}
|
||||
}
|
||||
|
@ -15,38 +15,38 @@ in
|
||||
# ------------------
|
||||
# --- Completion ---
|
||||
# ------------------
|
||||
cmp-buffer # Buffer Word Completion
|
||||
cmp-cmdline # Command Line Completion
|
||||
cmp-nvim-lsp # Main LSP
|
||||
cmp-path # Path Completion
|
||||
cmp_luasnip # Snippets Completion
|
||||
cmp-buffer # Buffer Word Completion
|
||||
cmp-cmdline # Command Line Completion
|
||||
cmp-nvim-lsp # Main LSP
|
||||
cmp-path # Path Completion
|
||||
cmp_luasnip # Snippets Completion
|
||||
friendly-snippets # Snippets
|
||||
lsp_lines-nvim # Inline Diagnostics
|
||||
luasnip # Snippets
|
||||
nvim-cmp # Completions
|
||||
nvim-lspconfig # LSP Config
|
||||
lsp_lines-nvim # Inline Diagnostics
|
||||
luasnip # Snippets
|
||||
nvim-cmp # Completions
|
||||
nvim-lspconfig # LSP Config
|
||||
|
||||
# ------------------
|
||||
# ----- Helpers ----
|
||||
# ------------------
|
||||
aerial-nvim # Code Outline
|
||||
comment-nvim # Code Comments
|
||||
diffview-nvim # Diff View
|
||||
leap-nvim # Quick Movement
|
||||
neo-tree-nvim # File Explorer
|
||||
neoformat # Format
|
||||
numb-nvim # Peek / Jump to Lines
|
||||
nvim-autopairs # Automatically Close Pairs (),[],{}
|
||||
aerial-nvim # Code Outline
|
||||
comment-nvim # Code Comments
|
||||
diffview-nvim # Diff View
|
||||
leap-nvim # Quick Movement
|
||||
neo-tree-nvim # File Explorer
|
||||
null-ls-nvim # Formatters
|
||||
numb-nvim # Peek / Jump to Lines
|
||||
nvim-autopairs # Automatically Close Pairs (),[],{}
|
||||
telescope-fzf-native-nvim # Faster Telescope
|
||||
telescope-nvim # Fuzzy Finder
|
||||
vim-nix # Nix Helpers
|
||||
telescope-nvim # Fuzzy Finder
|
||||
vim-nix # Nix Helpers
|
||||
|
||||
# ------------------
|
||||
# --- Theme / UI ---
|
||||
# ------------------
|
||||
nord-nvim # Theme
|
||||
lualine-nvim # Bottom Line
|
||||
noice-nvim # UI Tweaks
|
||||
nord-nvim # Theme
|
||||
lualine-nvim # Bottom Line
|
||||
noice-nvim # UI Tweaks
|
||||
nvim-web-devicons # Dev Icons
|
||||
|
||||
# ------------------
|
||||
@ -58,7 +58,8 @@ in
|
||||
plugins: with pkgs; subtractLists [
|
||||
tree-sitter-grammars.tree-sitter-bash
|
||||
tree-sitter-grammars.tree-sitter-kotlin
|
||||
] tree-sitter.allGrammars
|
||||
]
|
||||
tree-sitter.allGrammars
|
||||
)
|
||||
)
|
||||
|
||||
@ -76,8 +77,11 @@ in
|
||||
nodePackages.typescript-language-server
|
||||
nodePackages.vscode-html-languageserver-bin
|
||||
|
||||
# Parser
|
||||
python310Packages.sqlparse
|
||||
# Formatters
|
||||
luaformatter
|
||||
nixpkgs-fmt
|
||||
nodePackages.prettier
|
||||
sqlfluff
|
||||
|
||||
];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user