aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/lua/general.lua3
-rw-r--r--.config/nvim/lua/keybinds.lua2
-rw-r--r--.config/nvim/lua/lsp.lua41
-rw-r--r--.config/nvim/lua/plugins.lua64
4 files changed, 90 insertions, 20 deletions
diff --git a/.config/nvim/lua/general.lua b/.config/nvim/lua/general.lua
index ccf0ee3..9f52d42 100644
--- a/.config/nvim/lua/general.lua
+++ b/.config/nvim/lua/general.lua
@@ -19,10 +19,11 @@ vim.opt.cursorline = true
-- vim.opt.expandtab = true
-- vim.opt.autoindent = true
-vim.cmd [[autocmd FileType typescript setlocal shiftwidth=2 softtabstop=2 expandtab]]
+vim.cmd [[autocmd FileType typescript setlocal softtabstop=2 expandtab]]
vim.cmd [[autocmd FileType typescriptreact setlocal shiftwidth=2 softtabstop=2 expandtab]]
vim.cmd [[autocmd FileType css setlocal shiftwidth=2 softtabstop=2 expandtab]]
vim.cmd [[autocmd FileType html setlocal shiftwidth=2 softtabstop=2 expandtab]]
+vim.cmd [[autocmd BufNew,BufNewFile,BufRead *.cshtml :set filetype=razor]]
vim.cmd [[autocmd FileType json setlocal shiftwidth=2 softtabstop=2 expandtab]]
vim.cmd [[autocmd FileType cs setlocal shiftwidth=4 softtabstop=4 expandtab]]
vim.cmd [[autocmd FileType mail setlocal textwidth=72 colorcolumn=72 spell]]
diff --git a/.config/nvim/lua/keybinds.lua b/.config/nvim/lua/keybinds.lua
index b0cab46..69b2b8c 100644
--- a/.config/nvim/lua/keybinds.lua
+++ b/.config/nvim/lua/keybinds.lua
@@ -21,7 +21,7 @@ vim.keymap.set("i", "<A-b>", "<C-Left>")
vim.keymap.set("n", "<Leader>n", nt_api.tree.toggle)
vim.keymap.set("n", "<Leader><CR>", vim.lsp.buf.code_action)
vim.keymap.set("n", "<Leader>K", vim.lsp.buf.hover)
-vim.keymap.set("n", "<Leader>F", vim.lsp.buf.format)
+vim.keymap.set({ "n"; "v" }, "<Leader>F", vim.lsp.buf.format)
vim.keymap.set("n", "<Leader>d", vim.diagnostic.open_float)
vim.keymap.set("n", "<Leader>J", vim.lsp.buf.signature_help)
diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua
index 2591a8b..cd1f6f5 100644
--- a/.config/nvim/lua/lsp.lua
+++ b/.config/nvim/lua/lsp.lua
@@ -118,6 +118,7 @@ local lsputils = lspconfig.util
lspconfig.tsserver.setup({
on_attach = on_attach;
root_dir = lsputils.root_pattern("package.json", "tsconfig.json");
+ single_file_mode = false;
settings = {
typescript = {
inlayHints = {
@@ -144,27 +145,31 @@ lspconfig.tsserver.setup({
};
})
-deno_nvim.setup({
- server = {
- -- Uncomment to allow all js/ts files, not just in a deno context
- -- root_dir = vim.loop.cwd;
- capabilities = capabilities;
- on_attach = on_attach;
- settings = {
- deno = {
- unstable = true;
- inlayHints = {
- enumMemberValues = { enabled = true };
- functionLikeReturnTypes = { enabled = true };
- parameterNames = { enabled = "all" };
- parameterTypes = { enabled = true };
- propertyDeclarationTypes = { enabled = true };
- variableTypes = { enabled = true; suppressWhenTypeMatchesName = false };
+-- Temporarily disable
+if false then
+ deno_nvim.setup({
+ server = {
+ -- Uncomment to allow all js/ts files, not just in a deno context
+ -- root_dir = vim.loop.cwd;
+ root_dir = lsputils.root_pattern("deno.json", "deno.jsonc", "!package.json");
+ capabilities = capabilities;
+ on_attach = on_attach;
+ settings = {
+ deno = {
+ unstable = true;
+ inlayHints = {
+ enumMemberValues = { enabled = true };
+ functionLikeReturnTypes = { enabled = true };
+ parameterNames = { enabled = "all" };
+ parameterTypes = { enabled = true };
+ propertyDeclarationTypes = { enabled = true };
+ variableTypes = { enabled = true; suppressWhenTypeMatchesName = false };
+ };
};
};
};
- };
-});
+ });
+end
lspconfig.rust_analyzer.setup({
capabilities = capabilities;
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
index 711116a..85f0e6a 100644
--- a/.config/nvim/lua/plugins.lua
+++ b/.config/nvim/lua/plugins.lua
@@ -32,6 +32,7 @@ local PKGS = {
{ url = "https://github.com/nvim-treesitter/nvim-treesitter-context" };
{ url = "https://github.com/norcalli/nvim-colorizer.lua.git" };
{ url = "https://github.com/mracos/mermaid.vim.git" };
+ { url = "https://github.com/jlcrochet/vim-razor.git" };
-- Themes
{ url = "https://github.com/dracula/vim.git" };
@@ -101,6 +102,24 @@ local function init_plugins()
local gitsigns = require("gitsigns")
local marks = require("marks")
local neotest = require("neotest")
+ local telescope = require("telescope")
+ local telescopeConfig = require("telescope.config")
+ local previewers = require("telescope.previewers")
+
+ local _bad = { ".*%.cshtml" }
+ local bad_files = function(filepath)
+ for _, v in ipairs(_bad) do if filepath:match(v) then return false end end
+
+ return true
+ end
+
+ local new_maker = function(filepath, bufnr, opts)
+ opts = opts or {}
+ if opts.use_ft_detect == nil then opts.use_ft_detect = true end
+ opts.use_ft_detect = opts.use_ft_detect == false and false or
+ bad_files(filepath)
+ previewers.buffer_previewer_maker(filepath, bufnr, opts)
+ end
paq(PKGS)
@@ -312,6 +331,51 @@ local function init_plugins()
})
neotest.setup({ adapters = { require("neotest-dotnet") } })
+
+ -- Clone the default Telescope configuration
+ local vimgrep_arguments = { unpack(telescopeConfig.values.vimgrep_arguments) }
+
+ -- I want to search in hidden/dot files.
+ table.insert(vimgrep_arguments, "--hidden")
+ -- I don't want to search in the `.git` directory.
+ table.insert(vimgrep_arguments, "--glob")
+ table.insert(vimgrep_arguments, "!**/.git/*")
+
+ telescope.setup({
+ defaults = {
+ -- `hidden = true` is not supported in text grep commands.
+ vimgrep_arguments = vimgrep_arguments;
+ buffer_previewer_maker = new_maker;
+ };
+ pickers = {
+ find_files = {
+ -- `hidden = true` will still show the inside of `.git/` as it's not `.gitignore`d.
+ find_command = {
+ "rg";
+ "--files";
+ "--hidden";
+ "--glob";
+ "!**/.git/*";
+ "--trim";
+ };
+ };
+ live_grep = {
+ -- `hidden = true` will still show the inside of `.git/` as it's not `.gitignore`d.
+ find_command = {
+ "rg";
+ "--files";
+ "--hidden";
+ "--glob";
+ "!**/.git/*";
+ "--trim";
+ };
+ path_display = { "smart" };
+ only_sort_text = true;
+ word_match = "-w";
+ search = "";
+ };
+ };
+ })
end
local function clone_paq()