diff --git a/dotfiles/neovim/lua/my/keymaps.lua b/dotfiles/neovim/lua/my/keymaps.lua index 369163b..6b8c483 100644 --- a/dotfiles/neovim/lua/my/keymaps.lua +++ b/dotfiles/neovim/lua/my/keymaps.lua @@ -6,6 +6,12 @@ function M.map(mode, lhs, rhs, opts) vim.api.nvim_set_keymap(mode, lhs, rhs, options) end +function M.mapSilent(mode, lhs, rhs, opts) + local options = {silent = true} + if opts then options = vim.tbl_extend('force', options, opts) end + M.map(mode, lhs, rhs, opts) +end + function M.setup() M.map("i", "jj", "") -- Remap Esc to end diff --git a/dotfiles/neovim/lua/my/plugins/fzf-lua.lua b/dotfiles/neovim/lua/my/plugins/fzf-lua.lua new file mode 100644 index 0000000..d9d154c --- /dev/null +++ b/dotfiles/neovim/lua/my/plugins/fzf-lua.lua @@ -0,0 +1,10 @@ +local mapSilent = require("my.keymaps").mapSilent + +local M = {} + +function M.setup() + -- Open files with control + P + mapSilent('n', '', "lua require('fzf-lua').files()") +end + +return M \ No newline at end of file diff --git a/dotfiles/neovim/lua/my/plugins/init.lua b/dotfiles/neovim/lua/my/plugins/init.lua index afe5da6..f4b2c0f 100644 --- a/dotfiles/neovim/lua/my/plugins/init.lua +++ b/dotfiles/neovim/lua/my/plugins/init.lua @@ -2,6 +2,7 @@ local M = {} function M.setup() require("my.plugins.lspconfig").setup() + require("my.plugins.fzf-lua").setup() -- Other unconfigured plugins require('nvim-autopairs').setup() diff --git a/dotfiles/neovim/lua/my/plugins/lspconfig.lua b/dotfiles/neovim/lua/my/plugins/lspconfig.lua index 6bb1e76..27151f1 100644 --- a/dotfiles/neovim/lua/my/plugins/lspconfig.lua +++ b/dotfiles/neovim/lua/my/plugins/lspconfig.lua @@ -2,7 +2,7 @@ local M = {} -- Use a loop to conveniently call 'setup' on multiple servers and -- map buffer local keybindings when the language server attaches -local servers = { "tsserver" "purescriptls" } +local servers = { "tsserver", "purescriptls" } function M.map(buf, mode, lhs, rhs, opts) local options = { noremap=true, silent=true } diff --git a/modules/applications/neovim.nix b/modules/applications/neovim.nix index 0c07242..db35181 100644 --- a/modules/applications/neovim.nix +++ b/modules/applications/neovim.nix @@ -15,8 +15,12 @@ in { ''; extraPackages = [ + pkgs.fzf # Required by lua-fzf + + # Language servers pkgs.nodePackages.typescript pkgs.easy-purescript-nix.purescript-language-server + ]; plugins = with pkgs.vimPlugins; @@ -25,6 +29,7 @@ in { github-nvim-theme # github theme for neovim nvim-lspconfig # configures lsps for me nvim-autopairs # close pairs for me + fzf-lua # fuzzy search for say opening files ]; }; }