From e7f3a7bec28f86d362c418c12658d672903223a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Tue, 27 Feb 2024 09:01:40 +0100 Subject: Few more nvim updates --- config/nvim/init.vim | 11 ++++- config/nvim/lua/plugins.lua | 97 +++++++++++++++++++++++---------------------- 2 files changed, 59 insertions(+), 49 deletions(-) (limited to 'config') diff --git a/config/nvim/init.vim b/config/nvim/init.vim index b538453..1d0e6c6 100644 --- a/config/nvim/init.vim +++ b/config/nvim/init.vim @@ -24,8 +24,8 @@ set wildmenu set modeline set encoding=utf-8 - set backspace=indent,eol,start +set completeopt=menu,menuone,preview,noselect,noinsert colorscheme nord let g:lightline = { 'colorscheme': 'nord' } @@ -117,12 +117,19 @@ nmap f (ale_fix) " Telescope nnoremap :Telescope buffers -nnoremap ":lua require'telescope.builtin'.git_files{}".expand('%:h')."/" +nnoremap ":call TelescopeFiles()".expand('%:h')."/" nnoremap :Telescope lsp_document_symbols nmap ] :Telescope lsp_definitions nmap ] :Telescope lsp_type_definitions nmap [ :Telescope lsp_implementations nmap [ :Telescope lsp_references +function TelescopeFiles() + if stridx(system('git rev-parse --is-inside-work-tree 2>/dev/null || true'), 'true') != -1 + lua require('telescope.builtin').git_files{use_file_path=true,git_command={"sh","-c","git ls-files -c --recurse-submodules && git ls-files -o --exclude-standard"}} + else + lua require('telescope.builtin').find_files{} + endif +endfunction " Copy line location " TODO this should work but it doesn't for some reason diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index b60f913..fa736e3 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -45,53 +45,56 @@ require("packer").startup(function(use) use("tpope/vim-repeat") use("dhruvasagar/vim-table-mode") --- Indent blanklike character specificaiton -local highlight = { "CursorColumn", "Whitespace" } -require("ibl").setup({ - indent = { highlight = highlight, char = "" }, - whitespace = { - highlight = highlight, - remove_blankline_trail = false, - }, - scope = { enabled = false }, -}) --- Treesitter -require("nvim-treesitter.configs").setup({ - ensure_installed = { - "c", - "lua", - "kconfig", - "make", - "markdown", - "meson", - "ninja", - "ini", - "gitcommit", - "git_rebase", - "git_config", - "nix", - "python", - "toml", - "vim", - "vimdoc", - "yaml", - }, - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, -}) + -- Indent blanklike character specificaiton + local highlight = { "CursorColumn", "Whitespace" } + require("ibl").setup({ + indent = { highlight = highlight, char = "" }, + whitespace = { + highlight = highlight, + remove_blankline_trail = false, + }, + scope = { enabled = false }, + }) + -- Treesitter + require("nvim-treesitter.configs").setup({ + ensure_installed = { + "c", + "lua", + "kconfig", + "make", + "markdown", + "markdown_inline", + "meson", + "ninja", + "ini", + "gitcommit", + "git_rebase", + "git_config", + "nix", + "python", + "toml", + "vim", + "vimdoc", + "yaml", + }, + highlight = { + enable = true, + -- TODO why we must set this to true? + additional_vim_regex_highlighting = true, + }, + }) --- LSP -local lspconfig = require("lspconfig") -lspconfig.clangd.setup({}) -lspconfig.rnix.setup({}) -lspconfig.pylsp.setup({}) -lspconfig.bashls.setup({}) + -- LSP + local lspconfig = require("lspconfig") + lspconfig.clangd.setup({}) + lspconfig.rnix.setup({}) + lspconfig.pylsp.setup({}) + lspconfig.bashls.setup({}) --- Telescope -require('mytelescope') + -- Telescope + require("mytelescope") --- Gitlab -require("diffview").setup() -require("gitlab").setup() + -- Gitlab + require("diffview").setup() + require("gitlab").setup() +end) -- cgit v1.2.3