Skip to content

Commit

Permalink
Begin configuring fzf
Browse files Browse the repository at this point in the history
  • Loading branch information
rootmos committed Mar 8, 2023
1 parent b3c0ced commit f25ff00
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .config/nvim/init.lua
Expand Up @@ -22,10 +22,10 @@ vim.api.nvim_set_keymap("n", "Q", "<NOP>", { noremap = true })
vim.g.mapleader = ","
vim.g.maplocalleader = '-'

require('plugins')
require("plugins")
require("fzf")

vim.api.nvim_command("colorscheme solarized")

vim.api.nvim_set_var("airline_solarized_bg", "dark")
vim.api.nvim_set_var("airline_theme", "solarized")

Expand All @@ -45,7 +45,11 @@ require('nvim-treesitter.configs').setup {
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
require('tabs-vs-spaces.config').default = 4
require('tabs-vs-spaces.config'){
default = 4,
make = -1,
yaml = 2,
}

vim.g.do_filetype_lua = 1
vim.filetype.add {
Expand Down
20 changes: 20 additions & 0 deletions .config/nvim/lua/fzf.lua
@@ -0,0 +1,20 @@
local function root()
return require("git").toplevel(vim.fn.expand("%:p:h"))
end

local function fzf_files()
vim.fn["fzf#vim#files"](root())
end

local function fzf_buffers()
vim.fn["fzf#vim#buffers"]()
end

local function fzf_ag()
vim.fn["fzf#vim#ag"](root())
end

vim.keymap.set("n", "<leader>f", function() vim.fn["fzf#vim#files"](root()) end)
vim.keymap.set("n", "<leader>t", function() vim.fn["fzf#vim#gitfiles"](root()) end)
vim.keymap.set("n", "<leader>a", function() vim.fn["fzf#vim#ag"](root()) end)
vim.keymap.set("n", "<leader>b", function() vim.fn["fzf#vim#buffers"]() end)
19 changes: 19 additions & 0 deletions .config/nvim/lua/git.lua
@@ -0,0 +1,19 @@
local M = {
_git = nil,
}

function M.git()
if M._git == nil then
M._git = io.popen("which git 2>/dev/null"):read("l")
if M._git == nil then
M._git = false
end
end
return M._git
end

function M.toplevel(path)
return io.popen(string.format("env -C '%s' '%s' rev-parse --show-toplevel 2>/dev/null", path or ".", M.git())):read("l")
end

return M
3 changes: 3 additions & 0 deletions .config/nvim/lua/plugins.lua
Expand Up @@ -2,6 +2,7 @@ return require('packer').startup(function()
use 'wbthomason/packer.nvim'

use 'altercation/vim-colors-solarized'
use 'overcache/NeoSolarized'

use 'nvim-treesitter/nvim-treesitter'
use 'nvim-treesitter/playground'
Expand All @@ -22,5 +23,7 @@ return require('packer').startup(function()
use 'https://github.com/hrsh7th/cmp-path'

use 'https://github.com/scrooloose/nerdcommenter'

use 'https://github.com/junegunn/fzf'
use 'https://github.com/junegunn/fzf.vim'
end)

0 comments on commit f25ff00

Please sign in to comment.