pretty, null-ls w/ lua sql nix prettier
This commit is contained in:
parent
103d1b2ed6
commit
edf06af994
@ -6,7 +6,7 @@
|
|||||||
shellAliases = {
|
shellAliases = {
|
||||||
grep = "grep --color";
|
grep = "grep --color";
|
||||||
};
|
};
|
||||||
profileExtra =''
|
profileExtra = ''
|
||||||
set -o vi
|
set -o vi
|
||||||
[ ! -z $TMUX ] || tmux a || tmux
|
[ ! -z $TMUX ] || tmux a || tmux
|
||||||
neofetch
|
neofetch
|
||||||
|
8
home.nix
8
home.nix
@ -36,7 +36,7 @@ in
|
|||||||
tldr
|
tldr
|
||||||
] ++ optionals isDarwin [
|
] ++ optionals isDarwin [
|
||||||
iterm2
|
iterm2
|
||||||
] ++ optionals isLinux [];
|
] ++ optionals isLinux [ ];
|
||||||
|
|
||||||
# Misc Programs
|
# Misc Programs
|
||||||
programs.jq.enable = true;
|
programs.jq.enable = true;
|
||||||
@ -50,13 +50,15 @@ in
|
|||||||
|
|
||||||
# Darwin Spotlight Indexing Hack
|
# Darwin Spotlight Indexing Hack
|
||||||
home.activation = mkIf isDarwin {
|
home.activation = mkIf isDarwin {
|
||||||
copyApplications = let
|
copyApplications =
|
||||||
|
let
|
||||||
apps = pkgs.buildEnv {
|
apps = pkgs.buildEnv {
|
||||||
name = "home-manager-applications";
|
name = "home-manager-applications";
|
||||||
paths = config.home.packages;
|
paths = config.home.packages;
|
||||||
pathsToLink = "/Applications";
|
pathsToLink = "/Applications";
|
||||||
};
|
};
|
||||||
in lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
in
|
||||||
|
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||||
baseDir="$HOME/Applications/Home Manager Apps"
|
baseDir="$HOME/Applications/Home Manager Apps"
|
||||||
if [ -d "$baseDir" ]; then
|
if [ -d "$baseDir" ]; then
|
||||||
rm -rf "$baseDir"
|
rm -rf "$baseDir"
|
||||||
|
@ -5,4 +5,3 @@
|
|||||||
source = ./config/htoprc;
|
source = ./config/htoprc;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,4 +10,3 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
vim.g.nord_borders = true
|
vim.g.nord_borders = true
|
||||||
vim.g.nord_contrast = true
|
vim.g.nord_contrast = true
|
||||||
vim.cmd('colorscheme nord')
|
vim.cmd('colorscheme nord')
|
||||||
--vim.cmd('colorscheme embark')
|
-- vim.cmd('colorscheme embark')
|
||||||
--vim.cmd('colorscheme gruvbox-material')
|
-- vim.cmd('colorscheme gruvbox-material')
|
||||||
|
|
||||||
-- Set Leader
|
-- Set Leader
|
||||||
vim.keymap.set("n", "<Space>", "<Nop>", { silent = true })
|
vim.keymap.set("n", "<Space>", "<Nop>", {silent = true})
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
|
|
||||||
-- Disable NetRW
|
-- Disable NetRW
|
||||||
@ -41,7 +41,7 @@ vim.opt.foldlevel = 2
|
|||||||
|
|
||||||
-- Mappings.
|
-- Mappings.
|
||||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
-- 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', '<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_prev, opts)
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
local cmp = require('cmp')
|
local cmp = require('cmp')
|
||||||
require("luasnip.loaders.from_vscode").lazy_load()
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
|
||||||
|
|
||||||
-- Check Tab Completion
|
-- Check Tab Completion
|
||||||
local has_words_before = function()
|
local has_words_before = function()
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
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
|
return col ~= 0 and
|
||||||
|
vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col,
|
||||||
|
col)
|
||||||
|
:match("%s") == nil
|
||||||
end
|
end
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args) require'luasnip'.lsp_expand(args.body) end
|
||||||
require'luasnip'.lsp_expand(args.body)
|
|
||||||
end
|
|
||||||
},
|
},
|
||||||
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
@ -26,7 +26,7 @@ cmp.setup({
|
|||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end, { "i", "s" }),
|
end, {"i", "s"}),
|
||||||
|
|
||||||
-- Reverse Tab Completion
|
-- Reverse Tab Completion
|
||||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
@ -35,47 +35,37 @@ cmp.setup({
|
|||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end, { "i", "s" }),
|
end, {"i", "s"}),
|
||||||
|
|
||||||
-- Misc Mappings
|
-- Misc Mappings
|
||||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
['<C-Space>'] = cmp.mapping.complete(),
|
['<C-Space>'] = cmp.mapping.complete(),
|
||||||
['<C-e>'] = cmp.mapping.abort(),
|
['<C-e>'] = cmp.mapping.abort(),
|
||||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
['<CR>'] = cmp.mapping.confirm({select = true})
|
||||||
|
|
||||||
}),
|
}),
|
||||||
|
|
||||||
-- Default Sources
|
-- Default Sources
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = 'nvim_lsp' },
|
{name = 'nvim_lsp'}, {name = 'luasnip'}, {name = 'path'},
|
||||||
{ name = 'luasnip' },
|
{name = 'buffer'}
|
||||||
{ name = 'path' },
|
|
||||||
{ name = 'buffer' },
|
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Completion - `/` and `?`
|
-- Completion - `/` and `?`
|
||||||
cmp.setup.cmdline({ '/', '?' }, {
|
cmp.setup.cmdline({'/', '?'}, {
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
sources = {
|
sources = {{name = 'buffer'}}
|
||||||
{ name = 'buffer' },
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Completion = `:`
|
-- Completion = `:`
|
||||||
cmp.setup.cmdline(':', {
|
cmp.setup.cmdline(':', {
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({{name = 'path'}, {name = 'cmdline'}})
|
||||||
{ name = 'path' },
|
|
||||||
{ name = 'cmdline' },
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Autopairs
|
-- Autopairs
|
||||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||||
cmp.event:on(
|
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
||||||
'confirm_done',
|
|
||||||
cmp_autopairs.on_confirm_done()
|
|
||||||
)
|
|
||||||
|
@ -7,7 +7,7 @@ require('leap-config')
|
|||||||
require('lsp-config')
|
require('lsp-config')
|
||||||
require('lsp-lines-config')
|
require('lsp-lines-config')
|
||||||
require('lualine-config')
|
require('lualine-config')
|
||||||
require('neoformat-config')
|
require('null-ls-config')
|
||||||
require('noice-config')
|
require('noice-config')
|
||||||
require('numb-config')
|
require('numb-config')
|
||||||
require('telescope-config')
|
require('telescope-config')
|
||||||
|
@ -4,14 +4,15 @@ local nvim_lsp = require('lspconfig')
|
|||||||
local on_attach = function(client, bufnr)
|
local on_attach = function(client, bufnr)
|
||||||
-- Mappings.
|
-- Mappings.
|
||||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
local bufopts = { noremap=true, silent=true, buffer=bufnr }
|
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.declaration, bufopts)
|
||||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, 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', 'K', vim.lsp.buf.hover, bufopts)
|
||||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, 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', '<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>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>wr', vim.lsp.buf.remove_workspace_folder,
|
||||||
|
bufopts)
|
||||||
vim.keymap.set('n', '<space>wl', function()
|
vim.keymap.set('n', '<space>wl', function()
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
end, bufopts)
|
end, bufopts)
|
||||||
@ -19,42 +20,33 @@ local on_attach = function(client, bufnr)
|
|||||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, 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', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, 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)
|
vim.keymap.set('n', '<space>f',
|
||||||
|
function() vim.lsp.buf.format {async = true} end, bufopts)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Define LSP Flags & Capabilities
|
-- Define LSP Flags & Capabilities
|
||||||
local lsp_flags = {
|
local lsp_flags = {debounce_text_changes = 150}
|
||||||
debounce_text_changes = 150,
|
|
||||||
}
|
|
||||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
|
||||||
-- Python LSP Configuration
|
-- Python LSP Configuration
|
||||||
nvim_lsp.pyright.setup{
|
nvim_lsp.pyright.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
flags = lsp_flags,
|
flags = lsp_flags,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities
|
||||||
}
|
}
|
||||||
|
|
||||||
-- HTML LSP Configuration
|
-- HTML LSP Configuration
|
||||||
nvim_lsp.html.setup{
|
nvim_lsp.html.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
flags = lsp_flags,
|
flags = lsp_flags,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
cmd = {
|
cmd = {nix_vars.htmlserver, "--stdio"}
|
||||||
nix_vars.htmlserver,
|
|
||||||
"--stdio",
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Typescript / Javascript LSP Configuration
|
-- Typescript / Javascript LSP Configuration
|
||||||
nvim_lsp.tsserver.setup{
|
nvim_lsp.tsserver.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
flags = lsp_flags,
|
flags = lsp_flags,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
cmd = {
|
cmd = {nix_vars.tsserver, "--stdio", "--tsserver-path", nix_vars.tslib}
|
||||||
nix_vars.tsserver,
|
|
||||||
"--stdio",
|
|
||||||
"--tsserver-path",
|
|
||||||
nix_vars.tslib,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,2 @@
|
|||||||
require("lsp_lines").setup()
|
require("lsp_lines").setup()
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({virtual_text = false})
|
||||||
virtual_text = false,
|
|
||||||
})
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
require('lualine').setup({
|
require('lualine').setup({
|
||||||
options = {
|
options = {
|
||||||
theme = "nord",
|
theme = "nord"
|
||||||
-- theme = "OceanicNext",
|
-- 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,15 +1,11 @@
|
|||||||
-- Noice Doc Scrolling
|
-- Noice Doc Scrolling
|
||||||
vim.keymap.set("n", "<c-f>", function()
|
vim.keymap.set("n", "<c-f>", function()
|
||||||
if not require("noice.lsp").scroll(4) then
|
if not require("noice.lsp").scroll(4) then return "<c-f>" end
|
||||||
return "<c-f>"
|
end, {silent = true, expr = true})
|
||||||
end
|
|
||||||
end, { silent = true, expr = true })
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<c-b>", function()
|
vim.keymap.set("n", "<c-b>", function()
|
||||||
if not require("noice.lsp").scroll(-4) then
|
if not require("noice.lsp").scroll(-4) then return "<c-b>" end
|
||||||
return "<c-b>"
|
end, {silent = true, expr = true})
|
||||||
end
|
|
||||||
end, { silent = true, expr = true })
|
|
||||||
|
|
||||||
-- Noice Setup
|
-- Noice Setup
|
||||||
require("noice").setup({
|
require("noice").setup({
|
||||||
@ -17,16 +13,14 @@ require("noice").setup({
|
|||||||
override = {
|
override = {
|
||||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||||
["vim.lsp.util.stylize_markdown"] = true,
|
["vim.lsp.util.stylize_markdown"] = true,
|
||||||
["cmp.entry.get_documentation"] = false,
|
["cmp.entry.get_documentation"] = false
|
||||||
},
|
|
||||||
signature = {
|
|
||||||
enabled = false,
|
|
||||||
},
|
},
|
||||||
|
signature = {enabled = false}
|
||||||
},
|
},
|
||||||
presets = {
|
presets = {
|
||||||
command_palette = true, -- position the cmdline and popupmenu together
|
command_palette = true, -- position the cmdline and popupmenu together
|
||||||
long_message_to_split = true, -- long messages will be sent to a split
|
long_message_to_split = true, -- long messages will be sent to a split
|
||||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||||
lsp_doc_border = false, -- add a border to hover docs and signature help
|
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
|
||||||
|
})
|
@ -4,7 +4,7 @@ require('telescope').setup {
|
|||||||
fuzzy = true,
|
fuzzy = true,
|
||||||
override_generic_sorter = true,
|
override_generic_sorter = true,
|
||||||
override_file_sorter = true,
|
override_file_sorter = true,
|
||||||
case_mode = "smart_case",
|
case_mode = "smart_case"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
require'nvim-treesitter.configs'.setup {
|
require'nvim-treesitter.configs'.setup {
|
||||||
highlight = {
|
highlight = {enable = true, additional_vim_regex_highlighting = false}
|
||||||
enable = true,
|
|
||||||
additional_vim_regex_highlighting = false,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ in
|
|||||||
diffview-nvim # Diff View
|
diffview-nvim # Diff View
|
||||||
leap-nvim # Quick Movement
|
leap-nvim # Quick Movement
|
||||||
neo-tree-nvim # File Explorer
|
neo-tree-nvim # File Explorer
|
||||||
neoformat # Format
|
null-ls-nvim # Formatters
|
||||||
numb-nvim # Peek / Jump to Lines
|
numb-nvim # Peek / Jump to Lines
|
||||||
nvim-autopairs # Automatically Close Pairs (),[],{}
|
nvim-autopairs # Automatically Close Pairs (),[],{}
|
||||||
telescope-fzf-native-nvim # Faster Telescope
|
telescope-fzf-native-nvim # Faster Telescope
|
||||||
@ -58,7 +58,8 @@ in
|
|||||||
plugins: with pkgs; subtractLists [
|
plugins: with pkgs; subtractLists [
|
||||||
tree-sitter-grammars.tree-sitter-bash
|
tree-sitter-grammars.tree-sitter-bash
|
||||||
tree-sitter-grammars.tree-sitter-kotlin
|
tree-sitter-grammars.tree-sitter-kotlin
|
||||||
] tree-sitter.allGrammars
|
]
|
||||||
|
tree-sitter.allGrammars
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -76,8 +77,11 @@ in
|
|||||||
nodePackages.typescript-language-server
|
nodePackages.typescript-language-server
|
||||||
nodePackages.vscode-html-languageserver-bin
|
nodePackages.vscode-html-languageserver-bin
|
||||||
|
|
||||||
# Parser
|
# Formatters
|
||||||
python310Packages.sqlparse
|
luaformatter
|
||||||
|
nixpkgs-fmt
|
||||||
|
nodePackages.prettier
|
||||||
|
sqlfluff
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user