5 Achegas 96b795e82d ... 5481a146e5

Autor SHA1 Mensaxe Data
  Nikita Chursin 5481a146e5 remove autoinstall for treesitter hai 6 meses
  Nikita Chursin 8c2ca67be1 removed old file tree, fixes for neotre hai 6 meses
  Nikita Chursin 9a974457bb custom for ncvim hai 6 meses
  Nikita Chursin dd53887083 tabline fixes hai 6 meses
  Nikita Chursin ac6c0a6bca set title for tab hai 6 meses

+ 0 - 0
lua/ncvim/core_plugins/filetree/init.lua

@@ -1,4 +1,3 @@
 require('ncvim.core_plugins.filetree.neotree')
 
 require('ncvim.core_plugins.filetree.mappings')

+ 5 - 0
lua/ncvim/core_plugins/filetree/neotree.lua

@@ -28,6 +28,11 @@ ncvim.plugin {
   config = function()
     require('neo-tree').setup({
 
+      source_selector = {
+        winbar = true,
+        statusline = false
+      },
+
       filesystem = {
         filtered_items = {
           hide_dotfiles = false,

+ 0 - 30
lua/ncvim/core_plugins/filetree/nerdtree.lua

@@ -1,30 +0,0 @@
-local silent_noremap = { noremap = true, silent = true }
-
-ncvim.plugin({
-  'preservim/nerdtree',
-  requires = {
-    'ryanoasis/vim-devicons',
-    'PhilRunninger/nerdtree-visual-selection'
-  },
-  config = function()
-    vim.g.NERDTreeShowHidden = 1
-  end
-})
-
-ncvim.filetree = {
-  toggle = function()
-    vim.cmd 'NERDTreeToggle'
-  end,
-
-  focus = function()
-    vim.cmd 'NERDTreeFocus'
-  end,
-
-  current_file = function()
-    vim.cmd 'NERDTreeFind'
-  end,
-
-  restart = function()
-    vim.cmd 'NERDTree'
-  end,
-}

+ 1 - 1
lua/ncvim/core_plugins/highlight/treesitter/config.lua

@@ -8,7 +8,7 @@ return function()
     sync_install = false,
 
     -- Automatically install missing parsers when entering buffer
-    auto_install = true,
+    auto_install = false,
 
     ---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
     -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!

+ 2 - 0
lua/ncvim/mission_control.lua

@@ -258,6 +258,8 @@ ncvim = {
     end
   },
   autocmds = {},
+
+  custom = {},
 }
 
 require('ncvim.utils')

+ 1 - 0
lua/ncvim/ui/init.lua

@@ -37,6 +37,7 @@ require('ncvim.ui.statusline')
 require('ncvim.ui.tabline')
 require('ncvim.ui.cursorline')
 require('ncvim.ui.welcome_screen')
+require('ncvim.ui.tab_title')
 
 local function dumpTable(table, depth)
   if depth == nil then

+ 8 - 4
lua/ncvim/ui/statusline.lua

@@ -7,19 +7,23 @@ ncvim.plugin({
     }
   },
   config = function()
-    function basename(str)
+    local function basename(str)
       local name = string.gsub(str, "(.*/)(.*)", "%2")
       return name
     end
 
-    function get_cwd_basename()
-      return '󰙅 ' .. basename(vim.fn.getcwd())
+    local function get_cwd_basename()
+      return basename(vim.fn.getcwd())
+    end
+
+    function get_decorated_cwd_basename()
+      return '󰙅 ' .. get_cwd_basename()
     end
 
     require('lualine').setup({
       sections = {
         lualine_a = { 'mode' },
-        lualine_b = { get_cwd_basename, 'branch', 'diff', 'diagnostics' },
+        lualine_b = { get_decorated_cwd_basename, 'branch', 'diff', 'diagnostics' },
         lualine_c = { 'filename' },
         lualine_x = { 'encoding', 'fileformat', 'filetype' },
         lualine_y = { 'progress' },

+ 37 - 0
lua/ncvim/ui/tab_title.lua

@@ -0,0 +1,37 @@
+-- local set_option = vim.api.nvim_set_option
+
+local function basename(str)
+  local name = string.gsub(str, "(.*/)(.*)", "%2")
+  return name
+end
+
+local function get_cwd_basename()
+  return basename(vim.fn.getcwd())
+end
+
+ncvim.set_title = function()
+  vim.cmd("set title")
+  local cwd_name = get_cwd_basename()
+  vim.opt.titlestring = cwd_name
+end
+
+
+ncvim.add_autocmd(
+  {
+    'DirChanged',
+    'VimEnter',
+  },
+  {
+    callback = ncvim.set_title,
+  }
+)
+
+ncvim.add_autocmd(
+  {
+    'User'
+  },
+  {
+    pattern = 'SessionLoadPost',
+    callback = ncvim.set_title,
+  }
+)

+ 28 - 16
lua/ncvim/ui/tabline.lua

@@ -44,6 +44,7 @@ ncvim.plugin {
 
     local get_tabpage_head_buffer = function(tabpage)
       tabs.fetch_tabs()
+      buffersApi.
       tabpage = tabs.get_tabpage(tabpage.number)
       if tabpage == nil then
         return nil
@@ -55,11 +56,18 @@ ncvim.plugin {
 
       local success, buff_nr = pcall(vim.api.nvim_win_get_buf, tabpage.focused.number)
       if success == false then
-        -- print("tab err: " .. buff_nr)
         return nil
       end
       local buf = buffersApi.get_buffer(buff_nr)
 
+      if buf == nil then
+        if tabpage.last_focused ~= nil then
+          return tabpage.last_focused
+        end
+        return nil
+      end
+      tabpage.last_focused = buf
+
       return buf
     end
 
@@ -109,7 +117,6 @@ ncvim.plugin {
     local get_window_buffer = function(window)
       local success, buff_nr = pcall(vim.api.nvim_win_get_buf, window.number)
       if success == false then
-        -- print("tab err: " .. buff_nr)
         return nil
       end
       return buffersApi.get_buffer(buff_nr)
@@ -164,6 +171,10 @@ ncvim.plugin {
       return 0 < tab_errors_num(tabpage)
     end
 
+    local function is_empty_str(s)
+      return s == nil or s == ''
+    end
+
     require('cokeline').setup({
       show_if_buffers_are_at_least = 2,
 
@@ -199,20 +210,18 @@ ncvim.plugin {
       },
 
       sidebar = {
+        filetype = { 'neo-tree' },
+        components = {
+          {
+            text = function(buf)
+              return buf.filetype
+            end,
+            -- fg = highlight.inactive.fg,
+            -- bg = function() return get_hex('NvimTreeNormal', 'bg') end,
+            -- bold = true,
+          },
+        }
       },
-      -- sidebar = {
-      --   filetype = { 'NvimTree', 'neo-tree' },
-      --   components = {
-      --     {
-      --       text = function(buf)
-      --         return "Files"
-      --       end,
-      --       fg = highlight.inactive.fg,
-      --       bg = function() return get_hex('NvimTreeNormal', 'bg') end,
-      --       bold = true,
-      --     },
-      --   }
-      -- },
 
       tabs = {
         placement = "left",
@@ -268,7 +277,10 @@ ncvim.plugin {
             text = function(tabpage)
               local buffer = get_tabpage_head_buffer(tabpage)
               if buffer == nil then
-                return ''
+                return 'No Buffer'
+              end
+              if is_empty_str(buffer.filename) then
+                return "No Name"
               end
               return buffer.filename .. ' '
             end,