From 0b81a1e8b25a370ced289cb6ad492e7f17e4b174 Mon Sep 17 00:00:00 2001 From: Fabian Becker Date: Fri, 21 May 2021 09:33:15 +0200 Subject: [PATCH] Convert keymappings to which-key --- .config/nvim/lua/functions.lua | 19 +++++ .config/nvim/lua/keymappings.lua | 69 ++++--------------- .config/nvim/lua/lsp/julia-ls.lua | 4 +- .../nvim/lua/plugins/telescope-project.lua | 4 ++ 4 files changed, 38 insertions(+), 58 deletions(-) create mode 100644 .config/nvim/lua/functions.lua create mode 100644 .config/nvim/lua/plugins/telescope-project.lua diff --git a/.config/nvim/lua/functions.lua b/.config/nvim/lua/functions.lua new file mode 100644 index 0000000..4339bb8 --- /dev/null +++ b/.config/nvim/lua/functions.lua @@ -0,0 +1,19 @@ +-- functions + +local M = {} + +function M.edit_dotfiles() + require'telescope.builtin'.git_files { + shorten_path = false, + cwd = "~/.dotfiles", + prompt = "~ dotfiles ~", + height = 10, + + layout_strategy = 'horizontal', + layout_options = { + preview_width = 0.75, + }, + } +end + +return M diff --git a/.config/nvim/lua/keymappings.lua b/.config/nvim/lua/keymappings.lua index 6223e12..71c2524 100644 --- a/.config/nvim/lua/keymappings.lua +++ b/.config/nvim/lua/keymappings.lua @@ -71,15 +71,6 @@ vim.cmd([[ vnoremap :FloatermSend ]]) --- Telescope -vim.cmd([[ - nnoremap ff Telescope find_files - nnoremap fg Telescope live_grep - - nnoremap Telescope buffers - nnoremap fb Telescope buffers - nnoremap fh Telescope help_tags -]]) -- better indenting vim.api.nvim_set_keymap('v', '<', 'gv-gv', {noremap = true, silen vim.api.nvim_set_keymap('x', 'J', ':move \'>+1gv-gv', {noremap = true, silent = true}) -vim.cmd([[ - if !exists('g:vscode') - " Let quit work as expected if after entering :q the only window left open is NERD Tree itself - autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif +-- vim.cmd([[ +-- if !exists('g:vscode') +-- " Automatic formatting for Julia files +-- autocmd FileType julia nnoremap :JuliaFormatterFormat - " Toggle NERDTree - " Can't get by itself to work, so this works as Ctrl - space - space - " https://github.com/neovim/neovim/issues/3101 - " http://stackoverflow.com/questions/7722177/how-do-i-map-ctrl-x-ctrl-o-to-ctrl-space-in-terminal-vim#answer-24550772 - "nnoremap :NERDTreeToggle - "nmap - "nnoremap :NERDTreeToggle +-- " Maps quit +-- noremap q :q - " toggle tagbar - nnoremap tb :TagbarToggle +-- " Maps quit all +-- noremap :qa - " toggle line wrap - nnoremap w :set wrap! wrap? - - " toggle buffer (switch between current and last buffer) - nnoremap bb - - " close buffer - nnoremap bd :bd - - " kill buffer - nnoremap bk :bd! - - " list buffers - nnoremap bl :ls - " list and select buffer - nnoremap bg :ls:buffer - - - - " Telescope project - nnoremap fp :Telescope project - - " Automatic formatting for Julia files - autocmd FileType julia nnoremap :JuliaFormatterFormat - - " Maps quit - noremap q :q - - " Maps quit all - noremap :qa - - " Maps write - nnoremap w :w - end -]]) +-- " Maps write +-- nnoremap w :w +-- end +-- ]]) diff --git a/.config/nvim/lua/lsp/julia-ls.lua b/.config/nvim/lua/lsp/julia-ls.lua index 06d1764..e759382 100644 --- a/.config/nvim/lua/lsp/julia-ls.lua +++ b/.config/nvim/lua/lsp/julia-ls.lua @@ -1 +1,3 @@ -require'lspconfig'.julials.setup{} +require'lspconfig'.julials.setup{ + on_attach = require'lsp'.common_on_attach +} diff --git a/.config/nvim/lua/plugins/telescope-project.lua b/.config/nvim/lua/plugins/telescope-project.lua new file mode 100644 index 0000000..64e0837 --- /dev/null +++ b/.config/nvim/lua/plugins/telescope-project.lua @@ -0,0 +1,4 @@ +-- Global remapping +------------------------------ +-- '--color=never', +require'telescope'.load_extension('project')