aboutsummaryrefslogtreecommitdiff
path: root/config/nvim
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2024-02-27 09:01:40 +0100
committerKarel Kočí <cynerd@email.cz>2024-02-27 09:01:40 +0100
commite7f3a7bec28f86d362c418c12658d672903223a7 (patch)
tree7696eaa72a408dcb660c43c750059d4164fca6e6 /config/nvim
parent1970054228b3a9a3a8fc99af723ee13c147e7747 (diff)
downloadmyconfigs-e7f3a7bec28f86d362c418c12658d672903223a7.tar.gz
myconfigs-e7f3a7bec28f86d362c418c12658d672903223a7.tar.bz2
myconfigs-e7f3a7bec28f86d362c418c12658d672903223a7.zip
Few more nvim updates
Diffstat (limited to 'config/nvim')
-rw-r--r--config/nvim/init.vim11
-rw-r--r--config/nvim/lua/plugins.lua97
2 files changed, 59 insertions, 49 deletions
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 <leader>f <Plug>(ale_fix)
" Telescope
nnoremap <c-c><c-c> :Telescope buffers<cr>
-nnoremap <expr> <c-p> ":lua require'telescope.builtin'.git_files{}<cr>".expand('%:h')."/"
+nnoremap <expr> <c-p> ":call TelescopeFiles()<cr>".expand('%:h')."/"
nnoremap <c-s-p> :Telescope lsp_document_symbols<cr>
nmap <leader>] :Telescope lsp_definitions<cr>
nmap <leader><leader>] :Telescope lsp_type_definitions<cr>
nmap <leader>[ :Telescope lsp_implementations<cr>
nmap <leader><leader>[ :Telescope lsp_references<cr>
+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)