Updated: 01 March 2025
Working directory of current window
:lua print(vim.fn.getcwd(0, 0))
Get current window number
:lua print(vim.api.nvim_get_current_win())
Get current tabpage number
:lua print(vim.api.nvim_get_current_tabpage())
This might be how it works:
- Neovim (has own working_directory)
- Tabpage num 1 (has own working_directory)
- Window num 1010 (has own working_directory)
- Window num 1011 (has own working_directory)
- Tabpage num 2 (has own working_directory)
- Window num 1012 (has own working_directory)
- Window num 1013 (has own working_directory)