Created
          February 13, 2023 20:00 
        
      - 
      
- 
        Save destinio/7ccc80d6d60424f8ed8348d54a5cf27b to your computer and use it in GitHub Desktop. 
    Open notes in floating window
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | local api = vim.api | |
| local h = api.nvim_list_uis()[1].height | |
| local w = api.nvim_list_uis()[1].width | |
| local width = math.floor(api.nvim_win_get_width(0) / 2) | |
| local height = math.floor(api.nvim_win_get_height(0) / 2) | |
| local buf = api.nvim_create_buf(false, true) | |
| api.nvim_open_win(buf, true, { | |
| relative = "editor", | |
| width = width, | |
| height = height, | |
| row = (h - height) * 0.5, | |
| col = (w - width) * 0.5, | |
| }) | |
| vim.cmd(":edit ~/NOTES/random.md") | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment