nvim: add project
This commit is contained in:
parent
79229e5cad
commit
bb1319078c
@ -78,3 +78,8 @@ require('gitsigns').setup({
|
||||
'Show blame for current line', bufnr)
|
||||
end
|
||||
})
|
||||
|
||||
require("project_nvim").setup({
|
||||
patterns = require('my.functions').project_root_markers,
|
||||
show_hidden = true
|
||||
})
|
||||
|
@ -67,17 +67,20 @@ end
|
||||
|
||||
vim.api.nvim_create_user_command('ModelineInsert', M.insert_modeline, {})
|
||||
|
||||
-- Files that could indicate the project's root directory
|
||||
M.project_root_markers = {
|
||||
'.git', '.hg', '.svn', '.bzr', '_darcs',
|
||||
'.projectile', '.clang-format', '.luarc.json', '.editorconfig',
|
||||
'Makefile', 'CMakeLists.txt', 'package.json'
|
||||
}
|
||||
|
||||
function M.get_project_root()
|
||||
local path = vim.api.nvim_buf_get_name(0)
|
||||
local root_markers = {
|
||||
'.git', '.hg', '.svn', '.bzr', '_darcs',
|
||||
'.projectile', '.clang-format', '.luarc.json', '.editorconfig'
|
||||
}
|
||||
local sep = '/'
|
||||
|
||||
repeat
|
||||
path = path:gsub(string.format('%s[^%s]*$', sep, sep), '')
|
||||
for _, marker in ipairs(root_markers) do
|
||||
for _, marker in ipairs(M.project_root_markers) do
|
||||
if io.open(path .. sep .. marker) then
|
||||
return path
|
||||
end
|
||||
|
@ -120,6 +120,7 @@ require('packer').startup(function(use)
|
||||
'https://github.com/lewis6991/gitsigns.nvim',
|
||||
tag = '*'
|
||||
}
|
||||
use { 'https://github.com/ahmedkhalf/project.nvim' }
|
||||
|
||||
-- net
|
||||
use { -- embed nvim in browsers
|
||||
|
@ -4,6 +4,7 @@ local map = require('my.functions').map
|
||||
local telescope = require('telescope')
|
||||
local actions = require('telescope.actions')
|
||||
telescope.load_extension('media_files') -- FIXME: does not work
|
||||
telescope.load_extension('projects')
|
||||
|
||||
require('telescope').setup {
|
||||
mappings = {
|
||||
@ -34,10 +35,11 @@ map('n', '<Leader>tg', function()
|
||||
end, 'Live-grep')
|
||||
map('n', '<Leader>tm', t_builtin.man_pages, 'Man pages')
|
||||
map('n', '<Leader>tr', t_builtin.registers, 'Registers')
|
||||
map('n', '<Leader>tp', telescope.extensions.projects.projects, 'Projects')
|
||||
|
||||
require("nvim-tree").setup({
|
||||
filters = {
|
||||
dotfiles = true
|
||||
dotfiles = false
|
||||
},
|
||||
renderer = {
|
||||
icons = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user